From bcfd5578c1bee887e6ae5bd58a5cfb067d33b9cd Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 11 Feb 2015 20:32:43 +0000 Subject: [PATCH] Added how SubSection_Edit property value is determined Added code to delete ro usages and transitions that are converted to text. Added code to handle "dashes" and "unicode dashes" Added code to support converting to text transitions to external destinations with internal style transition Added wait cursor for log running processes so application shows it is busy and added code to to fix searches that should return results but are not returning results when doiing transitions searches. Added code to make Refresh Referenced Objects and Refresh Transitions button under Review tab of StepTabRibbon not visible --- .../Config/SectionConfig.cs | 14 +++- .../Extension/ContentExt.cs | 10 ++- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 75 +++++++++++++++---- .../Extension/ItemInsertExt.cs | 21 +++++- .../Volian.Controls.Library/DisplaySearch.cs | 6 +- .../Volian.Controls.Library/StepTabRibbon.cs | 2 + 6 files changed, 104 insertions(+), 24 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs index d7a39e73..e0bf0622 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/SectionConfig.cs @@ -771,7 +771,7 @@ namespace VEPROMS.CSLA.Library { // if null - return a "Y" string tmp = _Xp["SubSection", "Edit"]; - return tmp == null || tmp == "" ? "N" : tmp; + return tmp == null || tmp == "" ? DefaultSubSectionEdit : tmp; } set { @@ -779,7 +779,17 @@ namespace VEPROMS.CSLA.Library OnPropertyChanged("SubSection_Edit"); } } - + public string DefaultSubSectionEdit + { + get + { + if (_SectionInfo != null && _SectionInfo.Sections.Count > 0 && _SectionInfo.Steps.Count > 0) + return "N"; + //if (_Section != null && _Section.MyContent.cont .Sections.Count > 0 && _Section.Steps.Count > 0) + // return "N"; + return "Y"; + } + } [Category("SubSection")] //PROPGRID: Hide Subsection AutoIndent [Browsable(false)] diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs index f8e0426b..ff875044 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs @@ -58,9 +58,10 @@ namespace VEPROMS.CSLA.Library string rv = ConvertTransitionToText(tran, newvalue); //Text = Text.Substring(0, myIndex - 14) + gg + Text.Substring(myIndex + myLength); Annotation.MakeAnnotation(this.ContentItems[0].MyItem, ItemInfo.VolianCommentType, "", string.Format("Transition ({0}) converted to text", ItemInfo.ConvertToDisplayText(gg)), null); + Transition.Delete(tran.TransitionID); break; } - else if (gg != newvalue) + else if ((gg.Contains("\\u8209?") ? gg.Replace("\\u8209?", "-") : gg) != (newvalue.Contains("\\u8209?") ? newvalue.Replace("\\u8209?", "-") : newvalue)) { Text = Text.Substring(0, myIndex) + newvalue + Text.Substring(myIndex + myLength); break; // Text has been processed @@ -390,7 +391,7 @@ namespace VEPROMS.CSLA.Library } } } - return retval; + return retval == null ? "" : retval; } public string FixContentText(RoUsageInfo rousg, string value, int rotype, ROFstInfo origROFstInfo) // string newvalue) { @@ -402,7 +403,9 @@ namespace VEPROMS.CSLA.Library if (value == "?") { retval = this.ConvertROToText(rousg, value, rotype, origROFstInfo); + if (retval == null) Console.WriteLine("null"); Annotation.MakeAnnotation(this.ContentItems[0].MyItem, ItemInfo.VolianCommentType, "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(retval)), null); + RoUsage.Delete(rousg.ROUsageID); return retval; } string newvalue = value; @@ -558,7 +561,6 @@ namespace VEPROMS.CSLA.Library // _Text = Text.Substring(0, g.Index) + transText + Text.Substring(g.Index + g.Length); //} string newvalue; - //if (InList(78185)) Console.WriteLine("Here"); MyContentMessage = string.Empty; if (tranLookup == null) newvalue = tran.ResolvePathTo(); @@ -585,7 +587,7 @@ 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 != newvalue) + if ((gg.Contains("\\u8209?") ? gg.Replace("\\u8209?", "-") : gg) != (newvalue.Contains("\\u8209?") ? newvalue.Replace("\\u8209?", "-") : newvalue)) { _Text = Text.Substring(0, myIndex) + newvalue + Text.Substring(myIndex + myLength); OnStaticContentInfoChange(ii, new StaticContentInfoEventArgs(gg, newvalue,"TX")); diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 4cda69d0..76409c30 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -583,25 +583,70 @@ namespace VEPROMS.CSLA.Library itemInfo.ResetOrdinal(); foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions) { + bool forceConvertToText = false; TranCheckCount++; - if (IsTransitionToNonEditable(traninfo)) + if (TransitionsToNonEditable != null) { - TranFixCount++; - itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, true); - Content content = Content.Get(itemInfo.MyContent.ContentID); - content.FixTransitionText(traninfo, true); - content.Save(); - return; + if (IsTransitionToNonEditable(traninfo)) + { + forceConvertToText = true; + TranFixCount++; + itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, true); + Content content = Content.Get(itemInfo.MyContent.ContentID); + content.FixTransitionText(traninfo, true); + content.Save(); + } } - string oldText = itemInfo.MyContent.Text; - itemInfo.MyContent.FixTransitionText(traninfo, itemInfo); - string newText = itemInfo.MyContent.Text; - if (newText != oldText) + else { - TranFixCount++; - Content content = Content.Get(itemInfo.MyContent.ContentID); - content.FixTransitionText(traninfo); - content.Save(); + SectionConfig sc = traninfo.MyItemToID.ActiveSection.MyConfig as SectionConfig; + forceConvertToText = (sc.SubSection_Edit == "N"); + if (forceConvertToText) + { + TranFixCount++; + itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, true); + Content content = Content.Get(itemInfo.MyContent.ContentID); + content.FixTransitionText(traninfo, true); + content.Save(); + } + } + if (!forceConvertToText) + { + if (itemInfo.MyProcedure.ItemID != traninfo.MyItemToID.MyProcedure.ItemID) //different proc + if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("Proc")) //internal format + { + forceConvertToText = true; + TranFixCount++; + itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, true); + Content content = Content.Get(itemInfo.MyContent.ContentID); + content.FixTransitionText(traninfo, true); + content.Save(); + } + } + if (!forceConvertToText) + { + if (itemInfo.MyDocVersion.VersionID != traninfo.MyItemToID.MyDocVersion.VersionID) //different doc version + { + forceConvertToText = true; + TranFixCount++; + itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, true); + Content content = Content.Get(itemInfo.MyContent.ContentID); + content.FixTransitionText(traninfo, true); + content.Save(); + } + } + if (!forceConvertToText) + { + string oldText = itemInfo.MyContent.Text; + itemInfo.MyContent.FixTransitionText(traninfo, itemInfo); + string newText = itemInfo.MyContent.Text; + if (newText != oldText) + { + TranFixCount++; + Content content = Content.Get(itemInfo.MyContent.ContentID); + content.FixTransitionText(traninfo); + content.Save(); + } } } } diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs index b5603163..577227f3 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemInsertExt.cs @@ -680,10 +680,16 @@ namespace VEPROMS.CSLA.Library } if (oldContent == null) oldContent = content; //check to see if noneditable - bool forceConvertToText; + bool forceConvertToText = false; SectionConfig sc = tran.MyItemToID.ActiveSection.MyConfig as SectionConfig; //SectionConfig sc = new SectionConfig(tran.MyItemToID.ActiveSection.MyConfig.ToString()); forceConvertToText = (sc.SubSection_Edit == "N"); + if (!forceConvertToText) //check to see if external with internal format + { + if (tran.MyContent.ContentItems[0].MyProcedure.ItemID != tran.MyItemToID.MyProcedure.ItemID) + if (!tran.MyContent.ContentItems[0].ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[tran.TranType].TransMenu.Contains("Proc")) + forceConvertToText = true; + } oldContent.FixTransitionText(tran, forceConvertToText); //if (content.IsDirty) //{ @@ -720,10 +726,21 @@ namespace VEPROMS.CSLA.Library using (Content content = tran.MyContent.Get()) { //check to see if noneditable - bool forceConvertToText; + bool forceConvertToText = false; SectionConfig sc = tran.MyItemToID.ActiveSection.MyConfig as SectionConfig; //SectionConfig sc = new SectionConfig(tran.MyItemToID.ActiveSection.MyConfig.ToString()); forceConvertToText = (sc.SubSection_Edit == "N"); + if (!forceConvertToText) //check to see if external with internal format + { + if (tran.MyContent.ContentItems[0].MyProcedure.ItemID != tran.MyItemToID.MyProcedure.ItemID) + if (!tran.MyContent.ContentItems[0].ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[tran.TranType].TransMenu.Contains("Proc")) + forceConvertToText = true; + } + if (!forceConvertToText) + { + if (tran.MyContent.ContentItems[0].MyDocVersion.VersionID != tran.MyItemToID.MyDocVersion.VersionID) + forceConvertToText = true; + } content.FixTransitionText(tran, forceConvertToText); if (content.IsDirty) content.Save(); diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index aa0eabbc..65c20d32 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -151,6 +151,7 @@ namespace Volian.Controls.Library if (e.NewTab == tabTranSearch) { //setup transition format versions + this.Cursor = Cursors.WaitCursor; if (myFormatVersionList == null) { myFormatVersionList = FormatVersionList.GetFormatVersions(); @@ -167,6 +168,7 @@ namespace Volian.Controls.Library cbxTranVersion.SelectedIndexChanged += new EventHandler(cbxTranVersion_SelectedIndexChanged); cbxTranFormat.SelectedIndexChanged += new EventHandler(cbxTranFormat_SelectedIndexChanged); } + this.Cursor = Cursors.Default; } } @@ -238,6 +240,7 @@ namespace Volian.Controls.Library void cbxTranVersion_SelectedIndexChanged(object sender, EventArgs e) { + this.Cursor = Cursors.WaitCursor; string versionList = string.Empty; string sep = string.Empty; FormatVersion sfv = cbxTranVersion.SelectedItem as FormatVersion; @@ -267,6 +270,7 @@ namespace Volian.Controls.Library uncheckNodes.Remove(uncheckNodes[0]); } lstCheckedDocVersions.Clear(); + this.Cursor = Cursors.Default; } private DevComponents.AdvTree.Node NewAdvTreeNode(string nodetext, bool selectable, bool chxbxvisable) @@ -1240,7 +1244,7 @@ namespace Volian.Controls.Library sep = ","; } } - SearchResults = ItemInfoList.GetListFromTransitionSearch(docVersionList, cbxTranFormat.SelectedIndex - 1, cbxTranCategory.SelectedItem.ToString()); + SearchResults = ItemInfoList.GetListFromTransitionSearch(docVersionList, cbxTranFormat.SelectedIndex - 1, cbxTranCategory.SelectedItem.ToString() == "All" ? "" : cbxTranCategory.SelectedItem.ToString()); cmbResultsStyleIndex = 3; // display step text in results } AddMessageForEmptyAnnotations(); diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index ef3eabcf..2c6e7cd2 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -622,6 +622,8 @@ namespace Volian.Controls.Library _RibbonControl.Items[0].RaiseClick(); // initially default to HOME tab rbnBorderlistBox.Resize+=new EventHandler(rbnBorderlistBox_Resize); rbnBorderlistBox.SetupFontAndSize(6); // 6 Point Font + // added per Harry to hide refresh buttons + btnRefObjRefresh.Visible = btnTranRefresh.Visible = false; } void _RibbonControl_SizeChanged(object sender, EventArgs e)