Save File Last Write UTC as Document.DTS

Eliminate unused variables
Use settings for Format Load
Output status of Formats being loaded
Save File Last Write UTC as Document.DTS
added History_OriginalFileName to DocumentConfig
Use settings rather than local variables
Only use the first 12 characters of a ROID for DROUsage Lookup
This commit is contained in:
Rich
2012-01-24 19:57:09 +00:00
parent 83f9e1cc75
commit 3ba7971ece
8 changed files with 47 additions and 25 deletions

View File

@@ -46,7 +46,7 @@ namespace DataLoader
}
}
private int SaveWordDoc(string fname, string title, string stype, ConfigInfo ci, string sectName)
private int SaveWordDoc(string fname, string title, string stype, ConfigInfo ci, string sectName, DateTime dtsutc)
{
int docid = 0;
if (System.IO.File.Exists(fname))
@@ -111,7 +111,7 @@ namespace DataLoader
string s = myWordDoc.Save(temppath);
myWordDoc.Close();
WaitMS(wms);
docid = SaveDoc(temppath, title, ci, ascii);
docid = SaveDoc(temppath, title, ci, ascii, dtsutc);
DeleteFile(temppath);
DeleteFile(tmpName);
keepTrying = false;
@@ -164,7 +164,7 @@ namespace DataLoader
TryToShowMSWord(myWordDoc);
CloseMSWord(myWordDoc);
}
docid = SaveDoc(fname, title, ci, ""); // Save the original file
docid = SaveDoc(fname, title, ci, "",dtsutc); // Save the original file
keepTrying = false;
DeleteFile(temppath);
DeleteFile(tmpName);
@@ -178,7 +178,7 @@ namespace DataLoader
else
{
if (frmMain.MySettings.ConvertTo == AccPageConversion.RichTextFormat)
docid = SaveDoc(fname, title, ci,""); // Need to get Ascii Text from RTF
docid = SaveDoc(fname, title, ci,"",dtsutc); // Need to get Ascii Text from RTF
}
}
else
@@ -273,9 +273,10 @@ namespace DataLoader
{
ConfigInfo ci = new ConfigInfo(null);
ci.AddItem("Edit", "Initialized", "true");
return SaveWordDoc(temppath, String.Empty, stype, ci, sectName);
FileInfo myFile = new FileInfo(temppath);
return SaveWordDoc(temppath, String.Empty, stype, ci, sectName, myFile.LastWriteTimeUtc);
}
private int SaveTheDoc(string temppath, string title, ConfigInfo ci, string ascii)
private int SaveTheDoc(string temppath, string title, ConfigInfo ci, string ascii, DateTime dtsutc)
{
try
{
@@ -285,7 +286,7 @@ namespace DataLoader
int nBytesRead = fs.Read(ByteArray, 0, (int)len);
fs.Close();
string t1 = (title == null || title == "") ? null : title;
Document doc = Document.MakeDocument(t1, ByteArray, null, ci == null ? null : ci.ToString(), DateTime.Now, "Migration", ".Doc");
Document doc = Document.MakeDocument(t1, ByteArray, null, ci == null ? null : ci.ToString(), dtsutc, "Migration", ".Doc");
FileInfo tmpFile = new FileInfo(temppath);
string docfile = temppath.Substring(0, temppath.LastIndexOf(".")) + @".doc";
if (File.Exists(docfile)) File.Delete(docfile);
@@ -312,14 +313,14 @@ namespace DataLoader
}
}
private int SaveDoc(string temppath, string title, ConfigInfo ci, string ascii)
private int SaveDoc(string temppath, string title, ConfigInfo ci, string ascii, DateTime dtsutc)
{
int done = 0;
int ntry = 0;
while (done == 0 && ntry < 4)
{
ntry++;
done = SaveTheDoc(temppath, title, ci, ascii);
done = SaveTheDoc(temppath, title, ci, ascii, dtsutc);
}
return done;
}