From b1fa1603b28dea6164787123cd838ca2e5403323 Mon Sep 17 00:00:00 2001 From: Rich Date: Fri, 19 Jan 2018 19:21:42 +0000 Subject: [PATCH] Revert to previous version --- .../VEPROMS User Interface/frmBatchRefresh.cs | 51 ++++--------- .../Extension/ContentExt.cs | 30 ++------ .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 76 +++++-------------- .../Extension/TransitionExt.cs | 2 + .../DisplayTransition.cs | 44 ++--------- PROMS/Volian.Controls.Library/StepPanel.cs | 3 +- PROMS/Volian.Controls.Library/StepTabPanel.cs | 6 -- .../Volian.Controls.Library/StepTabRibbon.cs | 4 +- 8 files changed, 49 insertions(+), 167 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs index 18616153..2821582c 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs +++ b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs @@ -254,21 +254,11 @@ namespace VEPROMS } 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() { - // B2018-002 - Invalid Transitions - Initialize Transition Refresh Statistics - ResetTransNumbers(); + int numTransProcessed = 0; + int numTransFixed = 0; this.Cursor = Cursors.WaitCursor; List pil = new List(); foreach (TreeNode tn in myProcedures.Keys) @@ -306,16 +296,16 @@ namespace VEPROMS else { myFixes = new StringBuilder(); + myFixesCount = 0; + int lastFixedCount = myFixesCount; RefreshProcedureTransitions(pq); - // B2018-002 - Invalid Transitions - Update Transition Refresh Statistics - numTransConverted += ProcedureInfo.TranConvertCount; numTransProcessed += ProcedureInfo.TranCheckCount; - numTransFixed += ProcedureInfo.TranFixCount; + numTransFixed += ProcedureInfo.TranFixCount = myFixesCount - lastFixedCount; pbProcess.PerformStep(); Application.DoEvents(); } } - if (numTransFixed == 0 && numTransConverted ==0) + if (numTransFixed == 0) { txtResults.AppendText("No Transitions Needed Updated."); txtResults.AppendText(Environment.NewLine); @@ -326,12 +316,7 @@ namespace VEPROMS txtProcess.AppendText(Environment.NewLine); txtProcess.AppendText(string.Format("Transitions Checked: {0}",numTransProcessed)); txtProcess.AppendText(Environment.NewLine); - // 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)); + txtProcess.AppendText(string.Format("Transitions Fixed: {0}",numTransFixed)); Application.DoEvents(); if (pil.Count > 0) { @@ -355,11 +340,10 @@ namespace VEPROMS } } this.Cursor = Cursors.Default; - // B2018-002 - Invalid Transitions - Display Transition Refresh Statisitic - if (numTransFixed == 0 && numTransConverted ==0) - MessageBox.Show(string.Format("{0} Transitions Checked.\n\nNo Transitions Modified.",numTransProcessed), "Refresh Transitions Completed"); + if (numTransFixed == 0) + MessageBox.Show(string.Format("{0} Transitions Checked.\n\nNo Transitions needed fixed.",numTransProcessed), "Refresh Transitions Completed"); else - 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"); + MessageBox.Show(string.Format("{0} Transitions Checked.\n\n {1} Transitions needed fixed.", numTransProcessed, numTransFixed), "Refresh Transitions Completed"); } // C2017-030 - new Admin Tools user interface @@ -776,12 +760,11 @@ namespace VEPROMS private void RefreshProcedureTransitions(ProcedureInfo pq) { DateTime start = DateTime.Now; + int lastFixesCount = myFixesCount; ProcedureInfo.ResetTranCounters(); ProcedureInfo.RefreshTransitions(pq);//, transitionsToDisconnected, transitionsToNonEditable); TimeSpan ts = DateTime.Now - start; - // 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); + 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()); @@ -831,11 +814,9 @@ namespace VEPROMS StringBuilder myFixes; int myFixesCount = 0; - int myConvertCount = 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++; @@ -846,14 +827,10 @@ namespace VEPROMS } 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(); //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) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs index 2d50e0af..4d6e61c8 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs @@ -46,11 +46,7 @@ namespace VEPROMS.CSLA.Library string lookFor; if (tran == null) { - // B2018-002 - Invalid Transitions - Handle Range Transitions - int loc1 = Text.IndexOf("#Link:Transition:", 0); - if(loc1 > 0) loc1+=("#Link:Transition:").Length; - else - loc1 = Text.IndexOf("#Link:TransitionRange:", 0)+ ("#Link:TransitionRange:").Length;; + int loc1 = Text.IndexOf("#Link:Transition:", 0) + ("#Link:Transition:").Length; int loc2 = Text.IndexOf(" ", loc1); string trantype = Text.Substring(loc1, loc2 - loc1); loc1 = loc2 + 1; @@ -81,12 +77,8 @@ namespace VEPROMS.CSLA.Library using (Item myitem = this.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153 { myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060 - // B2016-225 (follow through) added more descriptive Annotation Type when transition is converted to text] - //Check for validity - // B2018-002 - Invalid Transitions - Add a prefix of invalid if the transition record is missing - string prefix = ""; - if (tran == null) prefix = "Invalid "; - Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", prefix + string.Format("Transition ({0}) converted to text", ItemInfo.ConvertToDisplayText(gg)), null); + // B2016-225 (follow through) added more descriptive Annotation Type when transition is converted to text + Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", string.Format("Transition ({0}) converted to text", ItemInfo.ConvertToDisplayText(gg)), null); } if(tran != null) Transition.Delete(tran.TransitionID); @@ -182,12 +174,7 @@ namespace VEPROMS.CSLA.Library string lookFor; if (tran == null) { - // B2018-002 - Invalid Transitions - Added code to support range transitions - int loc1 = MyGrid.Data.IndexOf("#Link:Transition:", 0); - if (loc1 > 0) loc1 += ("#Link:Transition:").Length; - else - loc1 = MyGrid.Data.IndexOf("#Link:TransitionRange:", 0) + ("#Link:TransitionRange:").Length; ; - //int loc1 = MyGrid.Data.IndexOf("#Link:Transition:", 0) + ("#Link:Transition:").Length; + int loc1 = MyGrid.Data.IndexOf("#Link:Transition:", 0) + ("#Link:Transition:").Length; int loc2 = MyGrid.Data.IndexOf(" ", loc1); string trantype = MyGrid.Data.Substring(loc1, loc2 - loc1); loc1 = loc2 + 1; @@ -241,11 +228,7 @@ namespace VEPROMS.CSLA.Library string lookFor; if (tran == null) { - // B2018-002 - Invalid Transitions - Added code to support range transitions - int loc1 = Text.IndexOf("#Link:Transition:", 0); - if (loc1 > 0) loc1 += ("#Link:Transition:").Length; - else - loc1 = Text.IndexOf("#Link:TransitionRange:", 0) + ("#Link:TransitionRange:").Length; ; + int loc1 = Text.IndexOf("#Link:Transition:", 0) + ("#Link:Transition:").Length; int loc2 = Text.IndexOf(" ", loc1); string trantype = Text.Substring(loc1, loc2 - loc1); loc1 = loc2 + 1; @@ -775,8 +758,7 @@ namespace VEPROMS.CSLA.Library return _CacheByPrimaryKey.ContainsKey(contentID.ToString()); } public static event StaticContentInfoEvent StaticContentInfoChange; - // B2018-002 - Invalid Transitions - Changed to Public - public static void OnStaticContentInfoChange(object sender, StaticContentInfoEventArgs args) + private static void OnStaticContentInfoChange(object sender, StaticContentInfoEventArgs args) { if (StaticContentInfoChange != null) StaticContentInfoChange(sender, args); diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index bdd9066d..fee4492c 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -590,11 +590,9 @@ namespace VEPROMS.CSLA.Library { TranCheckCount = 0; TranFixCount = 0; - TranConvertCount = 0;// B2018-002 - Invalid Transitions - Initialize Transition Conversion Count } public static int TranCheckCount = 0; public static int TranFixCount = 0; - public static int TranConvertCount = 0;// B2018-002 - Invalid Transitions - Declare Transition Conversion Count internal static TransitionInfoList TransitionsToDisconnected; internal static TransitionInfoList TransitionsToNonEditable; internal static void MyRefreshTransitions(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup) @@ -623,9 +621,7 @@ namespace VEPROMS.CSLA.Library //foreach (ItemInfo ii in myItems) MyRefreshTransitions(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo, tranLookup); } - // B2018-002 - Invalid Transitions - Convert Invalid Transitions to Text - // An invalid transition is a transition embedded in the content text that does not match the transition table record. - if(ConvertInvalidTransitionsToText(itemInfo)) + if (itemInfo.MyContent.ContentTransitionCount > 0) { itemInfo.ResetOrdinal(); foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions) @@ -665,14 +661,14 @@ namespace VEPROMS.CSLA.Library if (itemInfo.MyProcedure.ItemID != traninfo.MyItemToID.MyProcedure.ItemID) //different proc if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("Proc")) //internal format if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("other proc")) //B2017-068 paste with transition fix - { - forceConvertToText = true; - TranFixCount++; - itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, "Reason for Change: Transition to External Procedure using Internal Format"); - Content content = Content.Get(itemInfo.MyContent.ContentID); - content.FixTransitionText(traninfo, true); - content.Save(); - } + { + forceConvertToText = true; + TranFixCount++; + itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, "Reason for Change: Transition to External Procedure using Internal Format"); + Content content = Content.Get(itemInfo.MyContent.ContentID); + content.FixTransitionText(traninfo, true); + content.Save(); + } } if (!forceConvertToText) { @@ -680,14 +676,14 @@ namespace VEPROMS.CSLA.Library { if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("Proc")) //internal format if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("other proc")) //B2017-068 paste with transition fix - { - forceConvertToText = true; - TranFixCount++; - itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, "Reason for Change: Transition to Outside Procedure using Internal Format"); - Content content = Content.Get(itemInfo.MyContent.ContentID); - content.FixTransitionText(traninfo, true); - content.Save(); - } + { + forceConvertToText = true; + TranFixCount++; + itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, "Reason for Change: Transition to Outside Procedure using Internal Format"); + Content content = Content.Get(itemInfo.MyContent.ContentID); + content.FixTransitionText(traninfo, true); + content.Save(); + } } } if (!forceConvertToText) @@ -697,7 +693,7 @@ namespace VEPROMS.CSLA.Library string newText = itemInfo.MyContent.Text; // 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 == "?") + if (newText != oldText|| newValue == "?") { TranFixCount++; Content content = Content.Get(itemInfo.MyContent.ContentID); @@ -708,42 +704,6 @@ namespace VEPROMS.CSLA.Library } } } - // // B2018-002 - Invalid Transitions - Method to check for invalid transitions and convert them to text - public static bool ConvertInvalidTransitionsToText(ItemInfo itemInfo) - { - bool retval = true; - MatchCollection mc = Regex.Matches(itemInfo.MyContent.Text, @"\#Link\:Transition"); - if (itemInfo.MyContent.ContentTransitionCount <= 0 || mc.Count > itemInfo.MyContent.ContentTransitionCount) - { - retval = false; - if (itemInfo.MyContent.Text.Contains("Link:Transition")) - { - //Console.WriteLine("\"TranCount\"\t\"{0}\"\t{1}\t{2}\t{3}", itemInfo.ShortPath, itemInfo.ItemID, mc.Count, itemInfo.MyContent.ContentTransitionCount); - Content content = Content.Get(itemInfo.MyContent.ContentID); - //if (itemInfo.InList(616031, 615898, 5516866)) - // Console.WriteLine("here"); - if (itemInfo.MyContent.ContentTransitions != null) - foreach (TransitionInfo ct in itemInfo.MyContent.ContentTransitions) - Transition.Delete(ct.TransitionID); - itemInfo.MyContent.RefreshContentTransitions(); - //if (content.Text.Contains("Link:TransitionRange")) - // Console.WriteLine("Here"); - while (content.Text.Contains("Link:Transition")) - { - TranCheckCount++; - TranConvertCount++; - if (content.FixTransitionText(null, true)) - { - ContentInfo.OnStaticContentInfoChange(itemInfo, new StaticContentInfoEventArgs("", "", "")); - if (itemInfo.MyContent.MyGrid != null) - content.ConvertTransitionToTextInGrid(null, null); - content.Save(); - } - } - } - } - return retval; - } //private static bool IsTransitionToDisconnected(TransitionInfo ti) //{ // foreach (TransitionInfo til in TransitionsToDisconnected) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs index 05035602..db212531 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs @@ -1456,6 +1456,8 @@ namespace VEPROMS.CSLA.Library string str = BuildSectionPath(ToSections); str = Regex.Replace(str, @"\", tb._ToItem.MyDocVersion.DocVersionConfig.Unit_Number, RegexOptions.IgnoreCase); str = Regex.Replace(str, @"\", tb._ToItem.MyDocVersion.DocVersionConfig.Unit_ID, RegexOptions.IgnoreCase); + if(str != str1) + Console.WriteLine("Difference In Strings: {0}\r\n{1}",str,str1); //if (!str.EndsWith(".") && tb._ToItem.ItemID != tb._ToItem.ActiveSection.ItemID) tb.StepPrefix = "."; tb.SectionNumberLength = str.Length; diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.cs b/PROMS/Volian.Controls.Library/DisplayTransition.cs index c95e62b9..7a463fc5 100644 --- a/PROMS/Volian.Controls.Library/DisplayTransition.cs +++ b/PROMS/Volian.Controls.Library/DisplayTransition.cs @@ -162,8 +162,7 @@ namespace Volian.Controls.Library _OrigGroupPanelProcs = groupPanelTransitionProcs.Style.BackColor; _OrigGroupPanelSects = groupPanelTransitionSect.Style.BackColor; _OrigGroupPanelSteps = groupPanelTranstionSteps.Style.BackColor; - // B2018-002 - Invalid Transitions - Get default section - side effect sets HasDefault - if (_CurItemFrom != null) FindSectionStart(_CurItemFrom.MyProcedure); + ListBoxTranFmtFillIn(); // if new, use _CurItemFrom to setup the initial selections in the controls, @@ -215,7 +214,6 @@ namespace Volian.Controls.Library E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; if ((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault) { - NeedsDefault = true; // B2018-002 - Invalid Transitions - if (SectDefault set in TransFormat set NeedsDefault to true secStartId = FindSectionStart(_CurrentProcedure); if (secStartId > -1) { @@ -225,10 +223,6 @@ namespace Volian.Controls.Library else btnTranSave.Enabled = false; // if there is an invalid section start - don't allow save. } - else - { - NeedsDefault = false;// B2018-002 - Invalid Transitions - if (SectDefault not set in TransFormat set NeedsDefault to false - } cbTranSectsFillIn(secitm, secitm == null ? -1 : secStartId, true); // Fill step items, passing in the active step to the selected item, or the first // step if the selection was not at the step level. @@ -254,7 +248,6 @@ namespace Volian.Controls.Library tvTran.Nodes.Clear(); } SetControlsEnabling(); - SaveCancelEnabling();// B2018-002 - Invalid Transitions - Set button enabled or disabled } private void tvInitHiliteRange() //bool rangeSameLevel, ItemInfo stpitm, ItemInfo rngitm, int uplevel) { @@ -481,12 +474,9 @@ namespace Volian.Controls.Library listBoxTranFmt.Items.Add(new TransItem(ttl[i].TransMenu.Replace("?.",""),ttl[i].TransFormat.Replace("?.",""))); //listBoxTranFmt.Items.Add(ttl[i].TransFormat.Replace("?.","")); listBoxTranFmt.SelectedIndex = _TranFmtIndx; + groupPanelTranFmt.Style.BackColor = (_CurTrans == null && _TranFmtIndx==0) ? Color.Yellow : Color.Orange; E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; _DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast; - // B2018-002 - Invalid Transitions - Determine if a default section is required for this format - NeedsDefault = ((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault); - // B2018-002 - Invalid Transitions - Set backcolor to red if it doesn't have a default section and it Needs a Default Section - groupPanelTranFmt.Style.BackColor = !HasDefault && NeedsDefault ? Color.Red : Color.Orange; } private void tvTranFillIn(ItemInfo startitm) { @@ -605,8 +595,6 @@ namespace Volian.Controls.Library } // Do section combo, in 16-bit system it was types 0, 3, 4, 5 - // B2018-002 - Invalid Transitions - Determine if a default section is required for this format - NeedsDefault = (etm & E_TransUI.SectDefault) == E_TransUI.SectDefault; if (cbTranSects.Items.Count > 0 && ( (((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault && _CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.DoSectionTransitions) || @@ -812,15 +800,11 @@ namespace Volian.Controls.Library IList chldrn = _CurrentProcedure.GetChildren(); int secIdForCbSect = secitm == null ? sectstartid : secitm.ItemID; // if this transition format requires the default section, use it: - if ((etmnew & E_TransUI.SectDefault) == E_TransUI.SectDefault) - secIdForCbSect = sectstartid; + if ((etmnew & E_TransUI.SectDefault) == E_TransUI.SectDefault) secIdForCbSect = sectstartid; if (chldrn != null && chldrn.Count > 0) cbTranSectsFillIn((ItemInfo)chldrn[0], secIdForCbSect, true); //sectstartid); } - // B2018-002 - Invalid Transitions - Determine if Default Section is required - NeedsDefault = ((etmnew & E_TransUI.SectDefault) == E_TransUI.SectDefault); _TranFmtIndx = listBoxTranFmt.SelectedIndex; - // B2018-002 - Invalid Transitions - Set the backcolor to red if it doesn't have a default section and it needs one - groupPanelTranFmt.Style.BackColor = !HasDefault && NeedsDefault ? Color.Red : Color.Orange; + groupPanelTranFmt.Style.BackColor = (_CurTrans == null && _TranFmtIndx == 0) ? Color.Yellow : Color.Orange; E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; _DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast; // get section selected and if it's a step section, fill in the treeview of steps @@ -899,12 +883,8 @@ namespace Volian.Controls.Library SaveCancelEnabling(); } } - // B2018-002 - Invalid Transitions - Declare Default Section variables - private bool NeedsDefault; - private bool HasDefault; private int FindSectionStart(ItemInfo prcitm) { - HasDefault = true;// B2018-002 - Invalid Transitions - Initialize Has Default to true // Steps to get the section start. continue down list until finding a valid id. If none is found // put up a message dialog - and if returns a result of -1, caller should disable the 'ok' button // so that a transition cannot be entered until the default section is defined: @@ -979,8 +959,7 @@ namespace Volian.Controls.Library } } // 5) Display messagebox to tell user to specify which section should be used as the 'default section'. - //MessageBox.Show("No default step section was found. Set the appropriate Step Section as the default by using the Section Property Page, Format Tab.", "Transition using Default Step Section in Format", MessageBoxButtons.OK,MessageBoxIcon.Error); - HasDefault = false;// B2018-002 - Invalid Transitions - Set Has default to false + MessageBox.Show("No default step section was found. Set the appropriate Step Section as the default by using the Section Property Page, Format Tab.", "Transition using Default Step Section in Format", MessageBoxButtons.OK,MessageBoxIcon.Error); return -1; } private void cbTranProcs_SelectedIndexChanged(object sender, EventArgs e) @@ -1053,19 +1032,8 @@ namespace Volian.Controls.Library // || ( selii != null && _CurTrans.ToID != selii.ItemID); bool hasChanged = SettingsChanged; bool isenh = MyRTB != null && MyRTB.MyItemInfo != null && MyRTB.MyItemInfo.IsEnhancedStep; - // B2018-002 - Invalid Transitions - Set button enabled if it has a default section or it doesn't need a default - btnTranSave.Enabled = (HasDefault || !NeedsDefault) && !isenh && hasChanged && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons + btnTranSave.Enabled = !isenh && hasChanged && UserInfo.CanEdit(MyUserInfo, Mydvi); //Can Insert Transitons btnTranCancel.Enabled = _CurTrans != null && hasChanged; - groupPanelTranFmt.Text = !HasDefault && NeedsDefault ? "Requires Default" : "Select Format"; - // B2018-002 - Invalid Transitions - Set tool tip based upon HasDefault and NeedsDefault - if (!HasDefault || NeedsDefault) - this.superToolTipDispTran.SetSuperTooltip(this.listBoxTranFmt, - new DevComponents.DotNetBar.SuperTooltipInfo("Requires Default", "", - "The selected Transition Format requires a Default Section.\r\n" + - "This can be set on the format tab of the section property window.", null, null, DevComponents.DotNetBar.eTooltipColor.Yellow)); - else - this.superToolTipDispTran.SetSuperTooltip(this.listBoxTranFmt, new DevComponents.DotNetBar.SuperTooltipInfo("", "", "This is where transition types are selected. This also defines how the transitio" + - "n will look in the text.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); //btnTranSave.Enabled = allowSave; //if (CurTrans != null && selii != null) //{ diff --git a/PROMS/Volian.Controls.Library/StepPanel.cs b/PROMS/Volian.Controls.Library/StepPanel.cs index 445366b8..0474bd38 100644 --- a/PROMS/Volian.Controls.Library/StepPanel.cs +++ b/PROMS/Volian.Controls.Library/StepPanel.cs @@ -445,8 +445,7 @@ namespace Volian.Controls.Library EditItem lastEI = _SelectedEditItem; if (value != null) value.SetActive(); // Set the active color if (lastEI == value) return; // Same - No Change - // B2018-002 - Invalid Transitions - If the current step contains an invalid transition convert it to text - if(value != null) ItemInfo.ConvertInvalidTransitionsToText(value.MyItemInfo); + if (lastEI != null && lastEI.BeingDisposed == false) { bool shouldDelete = !lastEI.BeingRemoved && lastEI.Empty && (lastEI.MyItemInfo.MyContent.ContentEntryCount <= 0); diff --git a/PROMS/Volian.Controls.Library/StepTabPanel.cs b/PROMS/Volian.Controls.Library/StepTabPanel.cs index 8d3cdeee..2e837321 100644 --- a/PROMS/Volian.Controls.Library/StepTabPanel.cs +++ b/PROMS/Volian.Controls.Library/StepTabPanel.cs @@ -281,12 +281,6 @@ namespace Volian.Controls.Library { if (args.MyLinkText.LinkInfoText.IndexOf("Transition") > -1) { - // B2018-002 - Invalid Transitions - Don't fail on invalid transition - if(args.MyLinkText.MyTransitionInfo == null) - { - MessageBox.Show("This transition is invalid\r\n\r\nDelete it and replace it with \r\na valid transition", "Invalid Transition", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; // Not a valid transition - } ItemInfo item = args.MyLinkText.MyTranToItemInfo; if (item == null || item.MyDocVersion == null || (item.PreviousID == null && item.ItemPartCount == 0 && item.ItemDocVersionCount == 0)) { diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index 38a4236e..1a74b713 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -3312,10 +3312,10 @@ namespace Volian.Controls.Library private void btnTranRefresh_Click(object sender, System.EventArgs e) { this.Cursor = Cursors.WaitCursor; + ProcedureInfo.ResetTranCounters(); ProcedureInfo.RefreshTransitions(MyItemInfo.MyProcedure as ProcedureInfo); this.Cursor = Cursors.Default; - // B2018-002 - Invalid Transitions - Display Transition Refresh Statistics - MessageBox.Show(this, string.Format("Checked {0} transitions, modified {1} transitions, converted to text {2} transitions", ProcedureInfo.TranCheckCount, ProcedureInfo.TranFixCount, ProcedureInfo.TranConvertCount), "Results of Refresh Transitions", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show(this, string.Format("Checked {0} transitions, fixed {1} transitions", ProcedureInfo.TranCheckCount, ProcedureInfo.TranFixCount), "Results of Refresh Transitions", MessageBoxButtons.OK, MessageBoxIcon.Information); } private void btnRefObjRefresh_Click(object sender, System.EventArgs e) {