DataLoader changes during development
This commit is contained in:
@@ -26,28 +26,9 @@ using Org.Mentalis.Files;
|
||||
|
||||
namespace DataLoader
|
||||
{
|
||||
public partial class frmLoader : Form
|
||||
public partial class Loader
|
||||
{
|
||||
private void UpdateLabelsLibDocs(int incLib, int incUsages)
|
||||
{
|
||||
if (incLib == 0 && incUsages == 0)//Reset
|
||||
{
|
||||
lblTime.Tag = DateTime.Now;
|
||||
pbProc.Value = 0;
|
||||
pbSect.Value = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
pbProc.Value += incLib;
|
||||
pbSect.Value += incUsages;
|
||||
}
|
||||
lblProc.Text = string.Format("{0} Lib Docs", pbProc.Value);
|
||||
lblSection.Text = string.Format("{0} Usages", pbSect.Value);
|
||||
lblStep.Text = "";
|
||||
TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - ((DateTime)lblTime.Tag).Ticks);
|
||||
lblTime.Text = string.Format("{0:D2}:{1:D2}:{2:D2} Elapsed", ts.Hours, ts.Minutes, ts.Seconds);
|
||||
Application.DoEvents();
|
||||
}
|
||||
|
||||
private void MigrateLibDocs(OleDbConnection cn, string pth)
|
||||
{
|
||||
// Get all of the library documents - the first list has the entire list of files
|
||||
@@ -56,15 +37,15 @@ namespace DataLoader
|
||||
// will be migrated. After that, any remaining library documents will be added to
|
||||
// the section table without a reference from the structuretbl.
|
||||
Dictionary<string, int> dicLibDocSect = new Dictionary<string, int>();
|
||||
UpdateLabelsLibDocs(0, 0);
|
||||
frmMain.UpdateLabelsLibDocs(0, 0);
|
||||
if (Directory.Exists(pth + "\\rtffiles"))
|
||||
{
|
||||
DirectoryInfo di = new DirectoryInfo(pth + "\\RTFFILES");
|
||||
FileInfo[] fis = di.GetFiles("DOC_*.LIB");
|
||||
pbProc.Maximum = fis.Length;
|
||||
frmMain.UpdateLabelsSetProc(fis.Length);
|
||||
foreach (FileInfo fi in fis)
|
||||
{
|
||||
UpdateLabelsLibDocs(1, 0);
|
||||
frmMain.UpdateLabelsLibDocs(1, 0);
|
||||
dicLibDocSect[fi.Name.Substring(0, 8).ToUpper()] = MigrateLibDoc(fi);
|
||||
}
|
||||
}
|
||||
@@ -72,10 +53,10 @@ namespace DataLoader
|
||||
OleDbDataAdapter da_doc = new OleDbDataAdapter("select [FROMNUMBER], [FROMSEQUEN], [TONUMBER] from [tran] where [TONUMBER] LIKE 'doc_%' or [TONUMBER] like 'DOC_%'", cn);
|
||||
DataSet ds_doc = new DataSet();
|
||||
da_doc.Fill(ds_doc);
|
||||
pbSect.Maximum = ds_doc.Tables[0].Rows.Count;
|
||||
frmMain.UpdateLabelsSetSect(ds_doc.Tables[0].Rows.Count);
|
||||
foreach (DataRow dr_doc in ds_doc.Tables[0].Rows)
|
||||
{
|
||||
UpdateLabelsLibDocs(0, 1);
|
||||
frmMain.UpdateLabelsLibDocs(0, 1);
|
||||
string key = dr_doc["FROMNUMBER"].ToString().PadRight(20) + dr_doc["FROMSEQUEN"].ToString().PadRight(10);
|
||||
if (!dicLibDocSect.ContainsKey(dr_doc["TONUMBER"].ToString().ToUpper()))
|
||||
log.ErrorFormat("Error setting library document references: {0}", dr_doc["TONUMBER"].ToString().ToUpper());
|
||||
@@ -150,4 +131,5 @@ namespace DataLoader
|
||||
return tmpRtfFileName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user