Show processing time from beginning

Hide Section and Step Progress when just processing Procedures
Add a Progress Bar for Formats
Add backup after individual phases
Adjusted status labels to show processed/total counts
Adjusted size of labels to allow for processed/total counts
Use flag to control if Sections and Steps are shown in progress
Reset Step count when going to a new procedure
Eliminate reset of Step by Section
Add a total count to events to setup progress bar
This commit is contained in:
Rich 2012-07-16 17:34:32 +00:00
parent d13a0f0fb5
commit 872ce3286e
5 changed files with 120 additions and 24 deletions

View File

@ -375,6 +375,7 @@ namespace DataLoader
frmMain.UpdateLabels(0, 0, 0);
dicSetfileEntries = new Dictionary<string, string>(); // used to check for duplicate SET file info - jsj 2/11/10
int i = 0;
frmMain.ShowSections = convertProcedures;
foreach (DataRow dr in ds.Tables[0].Rows)
{
if (++i > frmMain.SkipProcedures)
@ -387,6 +388,7 @@ namespace DataLoader
List<int> cachePdfInfo = PdfInfo.CacheList;
List<int> cacheDocVersionInfo = DocVersionInfo.CacheList;
List<int> cachePartInfo = PartInfo.CacheList;
frmMain.pbStepValue = 0;//Reset Step Count
FrItm = MigrateProcedure(cn, dr, FrItm, pth, docver, convertProcedures, activeFormat);
if (FirstItm == null) FirstItm = FrItm;
//frmMain.MyInfo = string.Format("Before Restore {0}", GC.GetTotalMemory(true));

View File

@ -616,7 +616,6 @@ namespace DataLoader
DataView dv = new DataView(dt, sQry, "StepNo", DataViewRowState.CurrentRows);
Item FrItem = null;
frmMain.pbStepMaximum = dt.Rows.Count;
frmMain.pbStepValue = 0;
int type = 6;
foreach (DataRowView drv in dv)
{

View File

@ -138,31 +138,31 @@ namespace DataLoader
this.lblTime.Location = new System.Drawing.Point(7, 67);
this.lblTime.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblTime.Name = "lblTime";
this.lblTime.Size = new System.Drawing.Size(84, 20);
this.lblTime.Size = new System.Drawing.Size(142, 20);
this.lblTime.TabIndex = 58;
//
// pbStep
//
this.pbStep.Location = new System.Drawing.Point(96, 50);
this.pbStep.Location = new System.Drawing.Point(153, 50);
this.pbStep.Margin = new System.Windows.Forms.Padding(2);
this.pbStep.Name = "pbStep";
this.pbStep.Size = new System.Drawing.Size(557, 15);
this.pbStep.Size = new System.Drawing.Size(500, 15);
this.pbStep.TabIndex = 57;
//
// pbSect
//
this.pbSect.Location = new System.Drawing.Point(96, 30);
this.pbSect.Location = new System.Drawing.Point(153, 30);
this.pbSect.Margin = new System.Windows.Forms.Padding(2);
this.pbSect.Name = "pbSect";
this.pbSect.Size = new System.Drawing.Size(557, 15);
this.pbSect.Size = new System.Drawing.Size(500, 15);
this.pbSect.TabIndex = 56;
//
// pbProc
//
this.pbProc.Location = new System.Drawing.Point(96, 11);
this.pbProc.Location = new System.Drawing.Point(153, 11);
this.pbProc.Margin = new System.Windows.Forms.Padding(2);
this.pbProc.Name = "pbProc";
this.pbProc.Size = new System.Drawing.Size(557, 15);
this.pbProc.Size = new System.Drawing.Size(500, 15);
this.pbProc.TabIndex = 55;
//
// lblStep
@ -171,7 +171,7 @@ namespace DataLoader
this.lblStep.Location = new System.Drawing.Point(7, 47);
this.lblStep.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblStep.Name = "lblStep";
this.lblStep.Size = new System.Drawing.Size(84, 20);
this.lblStep.Size = new System.Drawing.Size(142, 20);
this.lblStep.TabIndex = 49;
//
// lblSection
@ -180,7 +180,7 @@ namespace DataLoader
this.lblSection.Location = new System.Drawing.Point(7, 28);
this.lblSection.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblSection.Name = "lblSection";
this.lblSection.Size = new System.Drawing.Size(84, 19);
this.lblSection.Size = new System.Drawing.Size(142, 19);
this.lblSection.TabIndex = 48;
//
// lblProc
@ -189,7 +189,7 @@ namespace DataLoader
this.lblProc.Location = new System.Drawing.Point(7, 9);
this.lblProc.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.lblProc.Name = "lblProc";
this.lblProc.Size = new System.Drawing.Size(84, 19);
this.lblProc.Size = new System.Drawing.Size(142, 19);
this.lblProc.TabIndex = 47;
//
// tv
@ -257,7 +257,7 @@ namespace DataLoader
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.exitToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//

View File

@ -381,11 +381,16 @@ namespace DataLoader
{
MyInfo = args.Message;
}
private bool _ShowSections = false;
public bool ShowSections
{
get { return _ShowSections; }
set { _ShowSections = value; }
}
public void UpdateLabels(int incPrc, int incSec, int incStp)
{
if (incPrc == 0 && incSec == 0 && incStp == 0)//Reset
{
lblTime.Tag = DateTime.Now;
pbProc.Value = 0;
pbSect.Value = 0;
pbStep.Value = 0;
@ -405,13 +410,21 @@ namespace DataLoader
}
}
//Database.LoggingInfo = (pbProc.Value > 153 && pbSect.Value > 11 && pbStep.Value > 61);
lblProc.Text = string.Format("{0} Procedures", pbProc.Value);
lblSection.Text = string.Format("{0} Sections", pbSect.Value);
lblStep.Text = string.Format("{0} Steps", pbStep.Value);
lblProc.Text = string.Format("{0}/{1} Procedures", pbProc.Value, pbProc.Maximum);
if (ShowSections)
{
lblSection.Text = string.Format("{0}/{1} Sections", pbSect.Value, pbSect.Maximum);
lblStep.Text = string.Format("{0}/{1} Steps", pbStep.Value, pbStep.Maximum);
}
else
{
lblSection.Text = "";
lblStep.Text = "";
}
//pbProc.Value = iPrc;
//pbSect.Value = iSec;
//pbStep.Value = iStp;
TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - ((DateTime)lblTime.Tag).Ticks);
TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - ProcessTime.Ticks);
lblTime.Text = string.Format("{0:D2}:{1:D2}:{2:D2} Elapsed", ts.Hours, ts.Minutes, ts.Seconds);
Application.DoEvents();
}
@ -462,7 +475,6 @@ namespace DataLoader
{
if (incLib == 0 && incUsages == 0)//Reset
{
lblTime.Tag = DateTime.Now;
pbProc.Value = 0;
pbSect.Value = 0;
}
@ -471,10 +483,36 @@ namespace DataLoader
pbProc.Value += incLib;
pbSect.Value += incUsages;
}
lblProc.Text = string.Format("{0} Lib Docs", pbProc.Value);
lblSection.Text = string.Format("{0} Usages", pbSect.Value);
lblProc.Text = string.Format("{0}/{1} Lib Docs", pbProc.Value,pbProc.Maximum);
lblSection.Text = string.Format("{0}/{1} Usages", pbSect.Value,pbSect.Maximum);
lblStep.Text = "";
TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - ((DateTime)lblTime.Tag).Ticks);
TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - ProcessTime.Ticks);
lblTime.Text = string.Format("{0:D2}:{1:D2}:{2:D2} Elapsed", ts.Hours, ts.Minutes, ts.Seconds);
Application.DoEvents();
}
public void UpdateLabelsImages(int incImages)
{
if (incImages == 0)//Reset
pbProc.Value = 0;
else
pbProc.Value += incImages;
lblProc.Text = string.Format("{0}/{1} Images", pbProc.Value, pbProc.Maximum);
lblSection.Text = "";
lblStep.Text = "";
TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - ProcessTime.Ticks);
lblTime.Text = string.Format("{0:D2}:{1:D2}:{2:D2} Elapsed", ts.Hours, ts.Minutes, ts.Seconds);
Application.DoEvents();
}
public void UpdateLabelsFormats(int incFormats)
{
if (incFormats == 0)//Reset
pbProc.Value = 0;
else
pbProc.Value += incFormats;
lblProc.Text = string.Format("{0}/{1} Formats", pbProc.Value, pbProc.Maximum);
lblSection.Text = "";
lblStep.Text = "";
TimeSpan ts = new TimeSpan(DateTime.Now.Ticks - ProcessTime.Ticks);
lblTime.Text = string.Format("{0:D2}:{1:D2}:{2:D2} Elapsed", ts.Hours, ts.Minutes, ts.Seconds);
Application.DoEvents();
}
@ -592,6 +630,13 @@ namespace DataLoader
}
void Format_FormatLoaded(object sender, FormatEventArgs args)
{
if (args.Status.StartsWith("Loading Format"))
UpdateLabelsFormats(1);
else if (!args.Status.StartsWith("Format") && !args.Status.StartsWith("Loading "))
{
pbProcMaximum = int.Parse(args.Status.Split(" ".ToCharArray())[0]);
UpdateLabelsFormats(0);
}
MyInfo = args.Status;
}
private void btnFixTransitions_Click(object sender, EventArgs e)
@ -609,7 +654,7 @@ namespace DataLoader
TimeSpan howlong = myFixer.Process(MySettings.CheckRTF);
string TransFixTime = string.Format("Fix Transitions completion time: {0:D2}:{1:D2}:{2:D2}.{3}", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds);
MyInfo = TransFixTime;
if (!ProcessComplete) MessageBox.Show(string.Format("{0}\r\n\n({1} Total Seconds)", TransFixTime, howlong.TotalSeconds));
//if (!ProcessComplete) MessageBox.Show(string.Format("{0}\r\n\n({1} Total Seconds)", TransFixTime, howlong.TotalSeconds));
//MessageBox.Show(string.Format("Fix Transitions completion time: {0:D2}:{1:D2}:{2:D2}.{3}\r\n\n({4} Total Seconds)", howlong.Hours, howlong.Minutes, howlong.Seconds, howlong.Milliseconds, howlong.TotalSeconds));
CreateBackupRestoreBatchFiles();
ItemInfo.RestoreCacheList(cacheItemInfo);
@ -763,30 +808,68 @@ namespace DataLoader
ProcessTime = DateTime.Now;
FormatsOnly = true;
btnConvert_Click(this, new System.EventArgs());
if (ProcessFailed) return;
MyInfo="Format Load Complete";
Status = "Backing up Format Change Data";
Backup("_" + "FormatChange");
MyInfo="Format Change Backup Complete";
Status = "Format Change Complete";
MessageBox.Show("Format Change Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void convertDBToolStripMenuItem_Click(object sender, EventArgs e)
{
ProcessTime = DateTime.Now;
btnConvert_Click(this, new System.EventArgs());
if (ProcessFailed) return;
MyInfo="dBase Conversion Complete";
Status = "Backing up Phase 1 Data";
Backup("_" + MySettings.Phase1Suffix);
MyInfo="Phase 1 Backup Complete";
Status = "dBase Conversion Complete";
MessageBox.Show("dBase Conversion Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void fixTransitionsToolStripMenuItem_Click(object sender, EventArgs e)
{
ProcessTime = DateTime.Now;
btnFixTransitions_Click(this, new System.EventArgs());
MyInfo="Fix Transtions Complete";
Status = "Backing up Phase 2 Data";
Backup("_" + MySettings.Phase2Suffix);
MyInfo="Phase 2 Backup Complete";
Status = "Fix Transtions Complete";
MessageBox.Show("Fix Transtions Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void convertToChangeManagerToolStripMenuItem_Click(object sender, EventArgs e)
{
ProcessTime = DateTime.Now;
ConvertToChangeManager();
MyInfo="Conversion to Change Manager Complete";
Status = "Backing up Phase 3 Data";
Backup("_" + MySettings.Phase3Suffix);
MyInfo="Phase 3 Backup Complete";
Status = "Conversion to Change Manager Complete";
MessageBox.Show("Conversion to Change Manager Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void convertToApprovalToolStripMenuItem_Click(object sender, EventArgs e)
{
ProcessTime = DateTime.Now;
ConvertToApproval();
MyInfo="Conversion to Approval Complete";
Status = "Backing up Phase 4 Data";
Backup("_" + MySettings.Phase4Suffix);
MyInfo="Phase 4 Backup Complete";
Status = "Conversion to Approval Complete";
MessageBox.Show("Conversion to Approval Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void load16BitApprovalToolStripMenuItem_Click(object sender, EventArgs e)
{
ProcessTime = DateTime.Now;
LoadApprovedData();
Status = "Backing up Data";
Backup("");
MyInfo="Backup Complete";
Status = "Loading 16 Bit Approval Data Complete";
MessageBox.Show("Loading 16 Bit Approval Data Complete", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void LoadApprovedData()
{
@ -794,10 +877,22 @@ namespace DataLoader
Database.VEPROMS_Connection = MySettings.ConnectionString.Replace("{DBName}", MySettings.DBName);
bool ok = ldr.BuildApprovedRevision();
Status = "Conversion " + (ok ? "Succeeded" : "Failed");
if (ok)
{
Status = "Backing up Data";
Backup("");
MyInfo="Backup Complete";
Status = "Processing Complete";
}
}
private void fixesToolStripMenuItem_Click(object sender, EventArgs e)
{
FixProceduresAndFunctions();
Status = "Backing up Data";
Backup("_Fixed");
MyInfo="Backup Complete";
Status = "Processing Complete";
MessageBox.Show("Fixed Stored Procedures", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void FixProceduresAndFunctions()
{

View File

@ -161,7 +161,7 @@ namespace VEPROMS.CSLA.Library
// (for example, AEP_00.xml) skip it in main loop, it's handled for each format.
DirectoryInfo di = new DirectoryInfo(fmtPath); //(@"c:\development\fmtall");
FileInfo[] fis = di.GetFiles("*.xml");
OnFormatLoaded(null, new FormatEventArgs(fis.Length.ToString() + " Formats to Load"));
foreach (FileInfo fi in fis)
{
//if (fi.Name.ToUpper() == "WCN2ALL.XML"|| fi.Name.ToUpper() == "OHLPALL.XML")
@ -183,7 +183,7 @@ namespace VEPROMS.CSLA.Library
foreach (FileInfo sfi in sfis)
{
string nm = sfi.Name.Substring(0, sfi.Name.Length - 7);
OnFormatLoaded(null, new FormatEventArgs("Loading Format " + sfi.Name));
OnFormatLoaded(null, new FormatEventArgs("Loading SubFormat " + sfi.Name));
//Console.WriteLine("Processing {0}", sfi.Name);
//frmMain.Status = string.Format("Processing Format {0}", sfi.Name);
try