From 21184ba3663cf2d9ab11df8636d26d0692456e71 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 8 Aug 2017 19:51:20 +0000 Subject: [PATCH] Cleaned up status messages and results message when refreshing transitions B2017-165 convert ? transition from 16-bit to 32-bit conversion to text --- .../VEPROMS User Interface/frmBatchRefresh.cs | 29 ++++++++++++------- .../Extension/ContentExt.cs | 7 +++-- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 5 +++- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs index 31d0e4f2..f1057ec5 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs +++ b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs @@ -264,6 +264,8 @@ namespace VEPROMS txtProcess.AppendText(Environment.NewLine); txtProcess.AppendText(string.Format("Started: {0}",pStart.ToString("MM/dd/yyyy @ HH:mm"))); txtProcess.AppendText(Environment.NewLine); + txtResults.AppendText("Refresh Transitions"); + txtResults.AppendText(Environment.NewLine); Application.DoEvents(); pbProcess.Minimum = 0; pbProcess.Maximum = pil.Count; @@ -287,18 +289,28 @@ namespace VEPROMS } else { - txtResults.AppendText(string.Format("Processing {0} {1}", pq.DisplayNumber, pq.DisplayText)); - txtResults.AppendText(Environment.NewLine); + myFixes = new StringBuilder(); + myFixesCount = 0; + int lastFixedCount = myFixesCount; RefreshProcedureTransitions(pq); numTransProcessed += ProcedureInfo.TranCheckCount; - numTransFixed += ProcedureInfo.TranFixCount; + numTransFixed += ProcedureInfo.TranFixCount = myFixesCount - lastFixedCount; pbProcess.PerformStep(); Application.DoEvents(); } } + if (numTransFixed == 0) + { + txtResults.AppendText("No Transitions Needed Updated."); + txtResults.AppendText(Environment.NewLine); + } ContentInfo.StaticContentInfoChange -= new StaticContentInfoEvent(ContentInfo_StaticContentInfoChange); DateTime pEnd = DateTime.Now; txtProcess.AppendText(string.Format("Completed: {0}",pEnd.ToString("MM/dd/yyyy @ HH:mm"))); + txtProcess.AppendText(Environment.NewLine); + txtProcess.AppendText(string.Format("Transitions Checked: {0}",numTransProcessed)); + txtProcess.AppendText(Environment.NewLine); + txtProcess.AppendText(string.Format("Transitions Fixed: {0}",numTransFixed)); Application.DoEvents(); if (pil.Count > 0) { @@ -742,21 +754,16 @@ namespace VEPROMS private void RefreshProcedureTransitions(ProcedureInfo pq) { DateTime start = DateTime.Now; - myFixes = new StringBuilder(); + int lastFixesCount = myFixesCount; ProcedureInfo.ResetTranCounters(); ProcedureInfo.RefreshTransitions(pq);//, transitionsToDisconnected, transitionsToNonEditable); 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, ProcedureInfo.TranFixCount, ts.TotalSeconds)); + 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)); if (myFixes.Length > 0) { txtResults.AppendText(myFixes.ToString()); txtResults.AppendText(Environment.NewLine); } - else - { - txtResults.AppendText("No Transitions needed fixed"); - txtResults.AppendText(Environment.NewLine); - } } public List roFstInfo_ROTableUpdate(object sender, ROFstInfoROTableUpdateEventArgs args) @@ -800,11 +807,13 @@ namespace VEPROMS } StringBuilder myFixes; + int myFixesCount = 0; // show the changes made in the Results pannel, include the ItemId of the step element void ContentInfo_StaticContentInfoChange(object sender, StaticContentInfoEventArgs args) { if (args.Type == "TX") { + myFixesCount++; if (args.NewValue.StartsWith("Reason for Change:")) myFixes.AppendLine(string.Format("Fixed Transition for {1}({4}){0}Old Text: {2}{0}{3}{0}", Environment.NewLine, (sender as ItemInfo).ShortPath, args.OldValue, args.NewValue, (sender as ItemInfo).ItemID)); else diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs index b20386fd..824f009a 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs @@ -69,7 +69,7 @@ namespace VEPROMS.CSLA.Library } string gg = Text.Substring(myIndex, myLength); newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}"); - if (gg != newvalue && newvalue == "?") + if (newvalue == "?") // B2017-165 used to also check if gg and newvalue were different AND newvalue = '?'. Had case where gg also was = '?' (from 16-bit conversion) { string rv = ConvertTransitionToText(tran, newvalue); //Text = Text.Substring(0, myIndex - 14) + gg + Text.Substring(myIndex + myLength); @@ -809,13 +809,14 @@ namespace VEPROMS.CSLA.Library string gg = Text.Substring(myIndex, myLength); MyContentMessage = string.Format("ContentExt.ContentInfo:Content:{0}, {1}, {2}", this.ContentID, tran.TransitionID, gg); newvalue = newvalue.Replace("{", @"\{").Replace("}", @"\}"); - //if ((gg.Contains("\\u8209?") ? gg.Replace("\\u8209?", "-") : gg) != (newvalue.Contains("\\u8209?") ? newvalue.Replace("\\u8209?", "-") : newvalue)) - if ((gg.Replace(@"\u8209?", "-").Replace(@"\u9586?",@"\\")) != (newvalue.Replace("\\u8209?", "-").Replace(@"\u9586?",@"\\"))) + if ((gg.Replace(@"\u8209?", "-").Replace(@"\u9586?",@"\\")) != (newvalue.Replace("\\u8209?", "-").Replace(@"\u9586?",@"\\")) || newvalue == "?") // B2017-165 added check of newvalue { _Text = Text.Substring(0, myIndex) + newvalue + Text.Substring(myIndex + myLength); if (newvalue == "?") { gg = ItemInfo.ConvertToDisplayText(gg); + if (gg == "?" && forceConvertToText == "") // B2017-165 existing transition is a question mark (left over from 16-bit data) + forceConvertToText = "Reason for Change: Transition Step does not Exist"; newvalue = forceConvertToText; OnStaticContentInfoChange(ii, new StaticContentInfoEventArgs(gg, newvalue, "TX")); break; diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index c593870f..3d56a5a1 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -611,6 +611,7 @@ namespace VEPROMS.CSLA.Library // content.Save(); // } //} + if (itemInfo == null) return; if (itemInfo.MyContent.ContentPartCount > 0) foreach (PartInfo pi in itemInfo.MyContent.ContentParts) { @@ -690,7 +691,9 @@ namespace VEPROMS.CSLA.Library string oldText = itemInfo.MyContent.Text; itemInfo.MyContent.FixTransitionText(traninfo, itemInfo); string newText = itemInfo.MyContent.Text; - if (newText != oldText) + // B2017-165 added check of newValue (special case for old 16-bit transition that was not fixed by the customer) + string newValue = traninfo.ResolvePathTo(itemInfo.ActiveFormat, itemInfo, traninfo.TranType, traninfo.MyItemToID, traninfo.MyItemRangeID); + if (newText != oldText|| newValue == "?") { TranFixCount++; Content content = Content.Get(itemInfo.MyContent.ContentID);