Updated code that tracks and displays Transition Refresh Statistics

Added Statistic tracking for invalid transitions converted to text
This commit is contained in:
Rich 2018-01-18 15:06:09 +00:00
parent 32d6728744
commit 88db9605ed

View File

@ -254,11 +254,21 @@ namespace VEPROMS
} }
this.Cursor = Cursors.Default; this.Cursor = Cursors.Default;
} }
// B2018-002 - Invalid Transitions - Define Transition Refresh Statistics
private int numTransProcessed = 0;
private int numTransFixed = 0;
private int numTransConverted = 0;
// B2018-002 - Invalid Transitions - Initialize Transition Refresh Statistics
private void ResetTransNumbers()
{
numTransProcessed = 0;
numTransFixed = 0;
numTransConverted = 0;
}
private void RefreshTransitions() private void RefreshTransitions()
{ {
int numTransProcessed = 0; // B2018-002 - Invalid Transitions - Initialize Transition Refresh Statistics
int numTransFixed = 0; ResetTransNumbers();
this.Cursor = Cursors.WaitCursor; this.Cursor = Cursors.WaitCursor;
List<ProcedureInfo> pil = new List<ProcedureInfo>(); List<ProcedureInfo> pil = new List<ProcedureInfo>();
foreach (TreeNode tn in myProcedures.Keys) foreach (TreeNode tn in myProcedures.Keys)
@ -296,16 +306,16 @@ namespace VEPROMS
else else
{ {
myFixes = new StringBuilder(); myFixes = new StringBuilder();
myFixesCount = 0;
int lastFixedCount = myFixesCount;
RefreshProcedureTransitions(pq); RefreshProcedureTransitions(pq);
// B2018-002 - Invalid Transitions - Update Transition Refresh Statistics
numTransConverted += ProcedureInfo.TranConvertCount;
numTransProcessed += ProcedureInfo.TranCheckCount; numTransProcessed += ProcedureInfo.TranCheckCount;
numTransFixed += ProcedureInfo.TranFixCount = myFixesCount - lastFixedCount; numTransFixed += ProcedureInfo.TranFixCount;
pbProcess.PerformStep(); pbProcess.PerformStep();
Application.DoEvents(); Application.DoEvents();
} }
} }
if (numTransFixed == 0) if (numTransFixed == 0 && numTransConverted ==0)
{ {
txtResults.AppendText("No Transitions Needed Updated."); txtResults.AppendText("No Transitions Needed Updated.");
txtResults.AppendText(Environment.NewLine); txtResults.AppendText(Environment.NewLine);
@ -316,7 +326,12 @@ namespace VEPROMS
txtProcess.AppendText(Environment.NewLine); txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(string.Format("Transitions Checked: {0}",numTransProcessed)); txtProcess.AppendText(string.Format("Transitions Checked: {0}",numTransProcessed));
txtProcess.AppendText(Environment.NewLine); txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(string.Format("Transitions Fixed: {0}",numTransFixed)); // B2018-002 - Invalid Transitions - Display Transition Refresh Statistics
txtProcess.AppendText(string.Format("Transitions Correct As Is: {0}",numTransProcessed - (numTransConverted + numTransFixed)));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(string.Format("Transitions Modified: {0}", numTransFixed));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(string.Format("Transitions Converted to text: {0}", numTransConverted));
Application.DoEvents(); Application.DoEvents();
if (pil.Count > 0) if (pil.Count > 0)
{ {
@ -340,10 +355,11 @@ namespace VEPROMS
} }
} }
this.Cursor = Cursors.Default; this.Cursor = Cursors.Default;
if (numTransFixed == 0) // B2018-002 - Invalid Transitions - Display Transition Refresh Statisitic
MessageBox.Show(string.Format("{0} Transitions Checked.\n\nNo Transitions needed fixed.",numTransProcessed), "Refresh Transitions Completed"); if (numTransFixed == 0 && numTransConverted ==0)
MessageBox.Show(string.Format("{0} Transitions Checked.\n\nNo Transitions Modified.",numTransProcessed), "Refresh Transitions Completed");
else else
MessageBox.Show(string.Format("{0} Transitions Checked.\n\n {1} Transitions needed fixed.", numTransProcessed, numTransFixed), "Refresh Transitions Completed"); MessageBox.Show(string.Format("{0} Transitions Checked.\n\n {1} Correct as is.\n\n {2} Transitions modified.\n\n {3} Transitions converted to text.", numTransProcessed, numTransProcessed - (numTransFixed + numTransConverted),numTransFixed, numTransConverted), "Refresh Transitions Completed");
} }
// C2017-030 - new Admin Tools user interface // C2017-030 - new Admin Tools user interface
@ -760,11 +776,12 @@ namespace VEPROMS
private void RefreshProcedureTransitions(ProcedureInfo pq) private void RefreshProcedureTransitions(ProcedureInfo pq)
{ {
DateTime start = DateTime.Now; DateTime start = DateTime.Now;
int lastFixesCount = myFixesCount;
ProcedureInfo.ResetTranCounters(); ProcedureInfo.ResetTranCounters();
ProcedureInfo.RefreshTransitions(pq);//, transitionsToDisconnected, transitionsToNonEditable); ProcedureInfo.RefreshTransitions(pq);//, transitionsToDisconnected, transitionsToNonEditable);
TimeSpan ts = DateTime.Now - start; TimeSpan ts = DateTime.Now - start;
txtProcess.AppendText(string.Format("Procedure: {1}{0}Checked {2} Transitions{0}Fixed {3} Transitions{0}Elapsed Seconds:{4}{0}{0}", Environment.NewLine, pq.DisplayNumber, ProcedureInfo.TranCheckCount,myFixesCount - lastFixesCount, ts.TotalSeconds)); // B2018-002 - Invalid Transitions - Display Transition Refresh Statistics
txtProcess.AppendText(string.Format("Procedure: {1}{0}Checked {2} Transitions{0}Fixed {3} Transitions{0}Converted to Text {4} Transitions{0}Elapsed Seconds:{5}{0}{0}", Environment.NewLine, pq.DisplayNumber, ProcedureInfo.TranCheckCount, ProcedureInfo.TranFixCount, ProcedureInfo.TranConvertCount, ts.TotalSeconds));
//Console.WriteLine("\"{0}\"\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}", pq.DisplayNumber, ProcedureInfo.TranCheckCount, ProcedureInfo.TranFixCount, ProcedureInfo.TranConvertCount, ts.TotalSeconds, numTransProcessed, numTransFixed, numTransConverted);
if (myFixes.Length > 0) if (myFixes.Length > 0)
{ {
txtResults.AppendText(myFixes.ToString()); txtResults.AppendText(myFixes.ToString());
@ -814,9 +831,11 @@ namespace VEPROMS
StringBuilder myFixes; StringBuilder myFixes;
int myFixesCount = 0; int myFixesCount = 0;
int myConvertCount = 0;
// show the changes made in the Results pannel, include the ItemId of the step element // show the changes made in the Results pannel, include the ItemId of the step element
void ContentInfo_StaticContentInfoChange(object sender, StaticContentInfoEventArgs args) void ContentInfo_StaticContentInfoChange(object sender, StaticContentInfoEventArgs args)
{ {
if (args.Type == "TX") if (args.Type == "TX")
{ {
myFixesCount++; myFixesCount++;
@ -827,10 +846,14 @@ namespace VEPROMS
} }
else if (args.Type == "RO") else if (args.Type == "RO")
{ {
txtResults.AppendText(string.Format("Fixed Referenced Object for {1}({4}){0}Old Text: {2}{0}New Text: {3}{0}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue,(sender as ItemInfo).ItemID)); txtResults.AppendText(string.Format("Fixed Referenced Object for {1}({4}){0}Old Text: {2}{0}New Text: {3}{0}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue, (sender as ItemInfo).ItemID));
Application.DoEvents(); Application.DoEvents();
//myFixes.AppendLine(string.Format("Fixed Referenced Object for {1}{0}Old Text: {2}{0}New Text: {3}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue)); //myFixes.AppendLine(string.Format("Fixed Referenced Object for {1}{0}Old Text: {2}{0}New Text: {3}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue));
} }
else // B2018-002 - Invalid Transitions - Display Transition Cconversion Statistics
{
myFixes.AppendLine(string.Format("Converted Transition to text for {0}({1})", (sender as ItemInfo).ShortPath, (sender as ItemInfo).ItemID));
}
} }
private void btnClear_Click(object sender, EventArgs e) private void btnClear_Click(object sender, EventArgs e)