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

@@ -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()
{