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; int docid = 0;
if (System.IO.File.Exists(fname)) if (System.IO.File.Exists(fname))
@ -111,7 +111,7 @@ namespace DataLoader
string s = myWordDoc.Save(temppath); string s = myWordDoc.Save(temppath);
myWordDoc.Close(); myWordDoc.Close();
WaitMS(wms); WaitMS(wms);
docid = SaveDoc(temppath, title, ci, ascii); docid = SaveDoc(temppath, title, ci, ascii, dtsutc);
DeleteFile(temppath); DeleteFile(temppath);
DeleteFile(tmpName); DeleteFile(tmpName);
keepTrying = false; keepTrying = false;
@ -164,7 +164,7 @@ namespace DataLoader
TryToShowMSWord(myWordDoc); TryToShowMSWord(myWordDoc);
CloseMSWord(myWordDoc); CloseMSWord(myWordDoc);
} }
docid = SaveDoc(fname, title, ci, ""); // Save the original file docid = SaveDoc(fname, title, ci, "",dtsutc); // Save the original file
keepTrying = false; keepTrying = false;
DeleteFile(temppath); DeleteFile(temppath);
DeleteFile(tmpName); DeleteFile(tmpName);
@ -178,7 +178,7 @@ namespace DataLoader
else else
{ {
if (frmMain.MySettings.ConvertTo == AccPageConversion.RichTextFormat) 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 else
@ -273,9 +273,10 @@ namespace DataLoader
{ {
ConfigInfo ci = new ConfigInfo(null); ConfigInfo ci = new ConfigInfo(null);
ci.AddItem("Edit", "Initialized", "true"); 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 try
{ {
@ -285,7 +286,7 @@ namespace DataLoader
int nBytesRead = fs.Read(ByteArray, 0, (int)len); int nBytesRead = fs.Read(ByteArray, 0, (int)len);
fs.Close(); fs.Close();
string t1 = (title == null || title == "") ? null : title; 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); FileInfo tmpFile = new FileInfo(temppath);
string docfile = temppath.Substring(0, temppath.LastIndexOf(".")) + @".doc"; string docfile = temppath.Substring(0, temppath.LastIndexOf(".")) + @".doc";
if (File.Exists(docfile)) File.Delete(docfile); 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 done = 0;
int ntry = 0; int ntry = 0;
while (done == 0 && ntry < 4) while (done == 0 && ntry < 4)
{ {
ntry++; ntry++;
done = SaveTheDoc(temppath, title, ci, ascii); done = SaveTheDoc(temppath, title, ci, ascii, dtsutc);
} }
return done; return done;
} }

View File

@ -26,8 +26,8 @@ namespace DataLoader
{ {
public partial class Loader public partial class Loader
{ {
public string _FmtAllPath; //public string _FmtAllPath;
public string _GenmacAllPath; //public string _GenmacAllPath;
//private FormatInfoList _AllFormats; //private FormatInfoList _AllFormats;
//public FormatInfoList AllFormats //public FormatInfoList AllFormats

View File

@ -69,10 +69,10 @@ namespace DataLoader
{ {
ConfigInfo ci = new ConfigInfo(null); ConfigInfo ci = new ConfigInfo(null);
string title = null; // for docname, remove the '.lib', i.e. substring(0,8) string title = null; // for docname, remove the '.lib', i.e. substring(0,8)
DateTime dts = DateTime.Now;
ci.AddItem("Edit", "Initialized", "true"); ci.AddItem("Edit", "Initialized", "true");
ci.AddItem("History", "OriginalFileName", fi.Name);
string tmpRtfFileName = GetLibDocData(fi, ci, ref title); string tmpRtfFileName = GetLibDocData(fi, ci, ref title);
int Docid = SaveWordDoc(tmpRtfFileName, title, null, ci, string.Empty); int Docid = SaveWordDoc(tmpRtfFileName, title, null, ci, string.Empty,fi.LastWriteTimeUtc);
File.Delete(tmpRtfFileName); File.Delete(tmpRtfFileName);
return Docid; return Docid;
} }

View File

@ -82,8 +82,8 @@ namespace DataLoader
{ {
try try
{ {
_FmtAllPath = frmMain.MySettings.FormatFolder; //_FmtAllPath = frmMain.MySettings.FormatFolder;
_GenmacAllPath = frmMain.MySettings.GenMacFolder; //_GenmacAllPath = frmMain.MySettings.GenMacFolder;
frmMain.Status = "Make Connection"; frmMain.Status = "Make Connection";
// make the initial database connection record, annotation types & top // make the initial database connection record, annotation types & top
// system folder. // system folder.
@ -105,7 +105,8 @@ namespace DataLoader
frmMain.Status = "Load All Formats"; frmMain.Status = "Load All Formats";
//LoadAllFormats(); //LoadAllFormats();
Format.UpdateFormats(_FmtAllPath, _GenmacAllPath); //Format.UpdateFormats(_FmtAllPath, _GenmacAllPath);
Format.UpdateFormats(frmMain.MySettings.FormatFolder, frmMain.MySettings.GenMacFolder);
Format baseFormat = Format.Get(1); Format baseFormat = Format.Get(1);
sysFolder = Folder.MakeFolder(null, dbConn, "VEPROMS", "VEPROMS", "VEPROMS", baseFormat, d.InnerXml, DateTime.Now, "Migration"); sysFolder = Folder.MakeFolder(null, dbConn, "VEPROMS", "VEPROMS", "VEPROMS", baseFormat, d.InnerXml, DateTime.Now, "Migration");

View File

@ -294,10 +294,11 @@ namespace DataLoader
if (FormatsOnly) if (FormatsOnly)
{ {
// ASSUMES No Formats/genmacs exist in database. // ASSUMES No Formats/genmacs exist in database.
MessageBox.Show(@"Format files are taken from c:\development\fmtall"); //MessageBox.Show(@"Format files are taken from c:\development\fmtall");
ldr._FmtAllPath = @"c:\development\fmtall"; //ldr._FmtAllPath = @"c:\development\fmtall";
ldr._GenmacAllPath = @"c:\development\genmacall"; //ldr._GenmacAllPath = @"c:\development\genmacall";
Format.UpdateFormats(@"c:\development\fmtall",@"c:\development\genmacall"); //ldr.LoadAllFormats(); Format.UpdateFormats(MySettings.FormatFolder, MySettings.GenMacFolder);
//Format.UpdateFormats(@"c:\development\fmtall",@"c:\development\genmacall"); //ldr.LoadAllFormats();
MessageBox.Show("Formats Loaded"); MessageBox.Show("Formats Loaded");
return; return;
} }
@ -579,6 +580,11 @@ namespace DataLoader
LoadSettings(); LoadSettings();
_Loading = false; _Loading = false;
MSWordToPDF.CloseWordWhenDone = false; MSWordToPDF.CloseWordWhenDone = false;
Format.FormatLoaded += new FormatEvent(Format_FormatLoaded);
}
void Format_FormatLoaded(object sender, FormatEventArgs args)
{
MyInfo = args.Status;
} }
private void btnFixTransitions_Click(object sender, EventArgs e) private void btnFixTransitions_Click(object sender, EventArgs e)
{ {
@ -708,7 +714,6 @@ namespace DataLoader
btnFixTransitions_Click(this, new System.EventArgs()); btnFixTransitions_Click(this, new System.EventArgs());
mb.Append("Fix Transtions Complete"); mb.Append("Fix Transtions Complete");
Status = "Backing up Phase 2 Data"; Status = "Backing up Phase 2 Data";
mb.Append("dBase Conversion Complete");
Backup("_" + MySettings.Phase2Suffix); Backup("_" + MySettings.Phase2Suffix);
mb.Append("Phase 2 Backup Complete"); mb.Append("Phase 2 Backup Complete");
// Phase 3 - Convert to Change Manager Version // Phase 3 - Convert to Change Manager Version

View File

@ -85,6 +85,21 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Edit_Initialized"); OnPropertyChanged("Edit_Initialized");
} }
} }
[Category("History")]
[DisplayName("Original File Name")]
[Description("File Name from 16-Bit Data")]
public string History_OriginalFileName
{
get
{
return _Xp["History", "OriginalFileName"];
}
set
{
_Xp["History", "OriginalFileName"] = value;
OnPropertyChanged("History_OriginalFileName");
}
}
// RHM 20110415 - These are now stored in the PDF table. // RHM 20110415 - These are now stored in the PDF table.
//[Category("Printing")] //[Category("Printing")]
//[DisplayName("Length")] //[DisplayName("Length")]

View File

@ -33,7 +33,6 @@ namespace VEPROMS.CSLA.Library
public class FormatEventArgs public class FormatEventArgs
{ {
private string _Status; private string _Status;
public string Status public string Status
{ {
get { return _Status; } get { return _Status; }
@ -110,7 +109,8 @@ namespace VEPROMS.CSLA.Library
foreach (FileInfo sfi in sfis) foreach (FileInfo sfi in sfis)
{ {
string nm = sfi.Name.Substring(0, sfi.Name.Length - 7); string nm = sfi.Name.Substring(0, sfi.Name.Length - 7);
Console.WriteLine("Processing {0}", sfi.Name); OnFormatLoaded(null, new FormatEventArgs("Loading Format " + sfi.Name));
//Console.WriteLine("Processing {0}", sfi.Name);
//frmMain.Status = string.Format("Processing Format {0}", sfi.Name); //frmMain.Status = string.Format("Processing Format {0}", sfi.Name);
try try
{ {
@ -159,7 +159,7 @@ namespace VEPROMS.CSLA.Library
string genmacdata = null; string genmacdata = null;
XmlDocument xd = null; XmlDocument xd = null;
OnFormatLoaded(null, new FormatEventArgs("Loading "+format)); OnFormatLoaded(null, new FormatEventArgs("Loading Format "+format));
//string path = "c:\\development\\fmtall\\" + format + "all.xml"; //string path = "c:\\development\\fmtall\\" + format + "all.xml";
string path = fmtPath + "\\" + format + "all.xml"; string path = fmtPath + "\\" + format + "all.xml";
if (File.Exists(path)) if (File.Exists(path))

View File

@ -377,7 +377,7 @@ namespace VEPROMS.CSLA.Library
// roid's are stored in database as 16 characters long in the rousages table. They may be stored // roid's are stored in database as 16 characters long in the rousages table. They may be stored
// as 12 characters in the ro.fst. // as 12 characters in the ro.fst.
string padroid = chg.Length <= 12 ? chg + "0000" : chg; string padroid = chg.Length <= 12 ? chg + "0000" : chg;
using (DROUsageInfoList affected = DROUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroid, desc, "Changed")) using (DROUsageInfoList affected = DROUsageInfoList.GetAffected(origROFstInfo.MyRODb.RODbID, padroid.Substring(0,12), desc, "Changed"))
{ {
foreach (DROUsageInfo droUsg in affected) foreach (DROUsageInfo droUsg in affected)
{ {