diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs index 9366dde0..897908d5 100644 --- a/PROMS/VEPROMS User Interface/dlgExportImport.cs +++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs @@ -223,6 +223,8 @@ namespace VEPROMS lblImportStatus.Text = "Performing Import"; _DidConvertTransitionsToText = false; _DidConvertROsToText = false; + _DidProcessTransitions = false; // B2017-076 to know if we processed any transition (used in status message at the end of importing) + _DidProcessROs = false; // B2017-076 to know if we processed any transition (used in status message at the end of importing) //LoadImportDataReader(); if (MyFolder != null) // import a folder - a .expx file { @@ -271,6 +273,10 @@ namespace VEPROMS string msg1 = (_DidConvertTransitionsToText && _DidConvertROsToText)?"Transitions and Referenced Objects":(_DidConvertTransitionsToText)?"Transitions":"Referenced Objects"; msg += string.Format("\n\n{0} converted to text.\n\nThe locations can be found by doing a Global Search for the \"Link Converted To Text\" annotation type",msg1); } + else if (!_DidProcessTransitions && !_DidProcessROs) // B2017-076 Approved import file does not have ROs nor Transitions + { + msg += "\n\nAll Transition and Referenced Object values are text.\n\nThere either were none or you had imported an Approved procedure."; + } // B2016-225 added more information to the finish import message to tell the user when ROs or Transitions are converted to text. MessageBox.Show(msg, "Import", MessageBoxButtons.OK, MessageBoxIcon.Information); //MessageBox.Show(string.Format("Finished Importing:\n\n{0}", txtImport.Text.Substring(txtImport.Text.LastIndexOf("\\") + 1)), "Import", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -2640,6 +2646,8 @@ namespace VEPROMS // cc.Save(); //} + private bool _DidProcessTransitions = false; // B2017-076 keep track whether we procrocessed Transitions + private void AddTransitions(Content content, XmlNode xn) { /* @@ -2690,7 +2698,7 @@ namespace VEPROMS content.Text = content.Text.Replace(lookfor, replacewith); if (content.MyGrid != null && content.MyGrid.Data != "") content.MyGrid.Data = content.MyGrid.Data.Replace(lookfor, replacewith); - content.FixTransitionText(TransitionInfo.Get(tt.TransitionID)); + _DidProcessTransitions |= content.FixTransitionText(TransitionInfo.Get(tt.TransitionID)); // B2017-076 FixTransitionText will tell us if transitions were processed/changed // B2017=003 make sure any grid changes are saved. // done here because FixTransitionText() could update the transitions in the grid if (content.MyGrid != null && content.MyGrid.Data != "") @@ -2708,6 +2716,7 @@ namespace VEPROMS { AddTransitions(PendingTransitions); } + private void AddTransitions(XmlDocument xd) { /* @@ -2769,7 +2778,7 @@ namespace VEPROMS SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig; forceConvertToText = (sc.SubSection_Edit == "N"); } - cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); + _DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed // B2017=003 make sure any grid changes are saved. // done here because FixTransitionText() could update the transitions in the grid if (cc.MyGrid != null && cc.MyGrid.Data != "") @@ -2796,7 +2805,7 @@ namespace VEPROMS if (tt.TransitionID < 0) { forceConvertToText = true; - cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); + _DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed cc.Save(); nd.InnerText = "done"; } @@ -2831,14 +2840,14 @@ namespace VEPROMS // if (tran.MyContent.ContentItems[0].MyDocVersion.VersionID != tran.MyItemToID.MyDocVersion.VersionID) // forceConvertToText = true; //} - cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); + _DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed // B2017=003 make sure any grid changes are saved. // done here because FixTransitionText() could update the transitions in the grid if (cc.MyGrid != null && cc.MyGrid.Data != "") cc.MyGrid.Save(); cc.Save(); nd.InnerText = "done"; - _DidConvertTransitionsToText |= forceConvertToText; // B2016-225 - notify user when transitions are converted to text + _DidConvertTransitionsToText |= (forceConvertToText && _DidProcessTransitions); // B2016-225 - notify user when transitions are converted to text } } } @@ -3286,6 +3295,7 @@ namespace VEPROMS part3 = suffix.Replace(@"\v0", "") + part3.Substring(suffix.Length); content.Text = part1 + part2 + part3; ROToTextAnnotation(content, part2); // B2016-225 (follow through) add annotation when RO is converted to text + _DidProcessROs = true; // B2017-076 flag that ROs where processed } lastIndex = mm.Index + mm.Length; } @@ -3332,6 +3342,7 @@ namespace VEPROMS //} _DidConvertROsToText |= true; } + private bool _DidProcessROs = false; // B2017-076 flag that ROs where processed private void AddROUsages(Content content, XmlNode xn) { AddROUsages(content, xn, false); @@ -3339,6 +3350,7 @@ namespace VEPROMS // part of bug fix B2017-060 added the isGrid parameter private void AddROUsages(Content content, XmlNode xn, bool isGrid) { + _DidProcessROs = false; if (_ConvertROsToTextDuringImport) ConvertImportProcedureROsToText(content, xn); else @@ -3359,6 +3371,7 @@ namespace VEPROMS RoUsageInfo roui = RoUsageInfo.Get(int.Parse(rousageid)); content.FixContentText(roui, roval, 0, MyDocVersion.DocVersionAssociations[0].MyROFst, null, rousageid); // + " " + roid); _DidConvertROsToText |= true; // B2016-225 (follow through) add annotation when RO is converted to text + _DidProcessROs = true; // B2017-076 flag that ROs where processed } else { @@ -3367,6 +3380,7 @@ namespace VEPROMS RoUsageInfo roui = RoUsageInfo.Get(rou.ROUsageID); string lookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString()); string replaceWith = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString()); + _DidProcessROs = content.Text.Contains(lookFor); // B2017-076 RO link in the text so we will be processing it if (lookFor != replaceWith) { content.Text = content.Text.Replace(lookFor, replaceWith); diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs index 824f009a..4d6e61c8 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs @@ -20,12 +20,13 @@ namespace VEPROMS.CSLA.Library { return string.Format("{0} {1}", Number, Text); } - public void FixTransitionText(TransitionInfo tran) + public bool FixTransitionText(TransitionInfo tran) // B2017-076 return whether Transitions were processed (used when importing a procedure) { - FixTransitionText(tran, false); + return FixTransitionText(tran, false); } - public void FixTransitionText(TransitionInfo tran, bool forceConvertToText) + public bool FixTransitionText(TransitionInfo tran, bool forceConvertToText) { + bool didFixATransition = false; // B2017-076 return whether Transitions were processed (used when importing a procedure) //string transText = tran.ResolvePathTo(); //string lookFor = string.Format(@"", tran.TranType, tran.TransitionID); ////string lookFor = string.Format(@"", tran.TranType, tran.TransitionID); @@ -81,12 +82,14 @@ namespace VEPROMS.CSLA.Library } if(tran != null) Transition.Delete(tran.TransitionID); + didFixATransition = true; // B2017-076 return Transitions were processed (used when importing a procedure) break; } //else if ((gg.Contains("\\u8209?") ? gg.Replace("\\u8209?", "-") : gg) != (newvalue.Contains("\\u8209?") ? newvalue.Replace("\\u8209?", "-") : newvalue)) else if ((gg.Replace(@"\u8209?", "-").Replace(@"\u9568?", @"\\")) != (newvalue.Replace(@"\u8209?", "-").Replace(@"\u9568?", @"\\"))) { Text = Text.Substring(0, myIndex) + newvalue + Text.Substring(myIndex + myLength); + didFixATransition = true; // B2017-076 return Transitions were processed (used when importing a procedure) break; // Text has been processed } } @@ -125,16 +128,18 @@ namespace VEPROMS.CSLA.Library newvalue = ProcessSpecChar(gg, newvalue, @"\u8593?","^"); if (newvalue.Contains(@"\u9586?")) // process backslash newvalue = ProcessSpecChar(gg, newvalue, @"\u9586?",@"\\"); - if (gg != newvalue) - { + if (gg != newvalue) + { if (newvalue == "?") ConvertTransitionToTextInGrid(tran, newvalue); else - MyGrid.Data = MyGrid.Data.Substring(0, myIndex) + newvalue + MyGrid.Data.Substring(myIndex + myLength); - } + MyGrid.Data = MyGrid.Data.Substring(0, myIndex) + newvalue + MyGrid.Data.Substring(myIndex + myLength); + didFixATransition = true; // B2017-076 return Transitions were processed (used when importing a procedure) + } } } } + return didFixATransition; } private string ProcessSpecChar(string orgText, string newValue, string specChar, string kbChar)