diff --git a/PROMS/Volian.Controls.Library/EditItem.cs b/PROMS/Volian.Controls.Library/EditItem.cs index 23a748af..eda53404 100644 --- a/PROMS/Volian.Controls.Library/EditItem.cs +++ b/PROMS/Volian.Controls.Library/EditItem.cs @@ -1023,11 +1023,6 @@ namespace Volian.Controls.Library //private void HandleSqlExceptionOnDelete(System.Data.SqlClient.SqlException ex) private void HandleSqlExceptionOnDelete(Exception ex) { - this.MyStepRTB.InsertSymbol(@"\u160?"); // since text was deleted, insert a hard space to prevent a looping effect B2016-082 - using (Item itm = MyStepRTB.MyItemInfo.Get()) - { - Annotation x = Annotation.MakeAnnotation(itm, AnnotationType.GetByName("Verification Required"), null, "A Hard Space was put in to keep the Transitions referencing here valid. \nPlease remove or re-assign these transitions before deleting this step.", null); - } if (ex.Message.Contains("has External Transitions and has no next step")) { using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitions(MyID)) @@ -1039,6 +1034,14 @@ namespace Volian.Controls.Library "Cannot Delete This Step", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (ans == DialogResult.Yes) { + if (MyStepRTB.Text == "") + { + this.MyStepRTB.InsertSymbol(@"\u160?"); // since text was deleted, insert a hard space to prevent a looping effect B2016-082 + using (Item itm = MyStepRTB.MyItemInfo.Get()) + { + Annotation x = Annotation.MakeAnnotation(itm, AnnotationType.GetByName("Verification Required"), null, "A Hard Space was put in to keep the Transitions referencing here valid. \nPlease remove or re-assign these transitions before deleting this step.", null); + } + } MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(exTrans[0].MyContent.ContentItems[0]); } else @@ -1056,6 +1059,14 @@ namespace Volian.Controls.Library "Cannot Delete This Procedure", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (ans == DialogResult.Yes) { + if (MyStepRTB.Text == "") + { + this.MyStepRTB.InsertSymbol(@"\u160?"); // since text was deleted, insert a hard space to prevent a looping effect B2016-082 + using (Item itm = MyStepRTB.MyItemInfo.Get()) + { + Annotation x = Annotation.MakeAnnotation(itm, AnnotationType.GetByName("Verification Required"), null, "A Hard Space was put in to keep the Transitions referencing here valid. \nPlease remove or re-assign these transitions before deleting this step.", null); + } + } MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(exTrans[0].MyContent.ContentItems[0]); } @@ -1074,8 +1085,20 @@ namespace Volian.Controls.Library "Cannot Delete This Step", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (ans == DialogResult.Yes) { + // B2017-182: The following code was moved from top of this method to here (and to each if/else case and only done if the text was removed, + // not when the step was deleted) + if (MyStepRTB.Text == "") + { + this.MyStepRTB.InsertSymbol(@"\u160?"); // since text was deleted, insert a hard space to prevent a looping effect B2016-082 + using (Item itm = MyStepRTB.MyItemInfo.Get()) + { + Annotation x = Annotation.MakeAnnotation(itm, AnnotationType.GetByName("Verification Required"), null, "A Hard Space was put in to keep the Transitions referencing here valid. \nPlease remove or re-assign these transitions before deleting this step.", null); + } + } MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(exTrans[0].MyContent.ContentItems[0]); } + else + SetFocus(); } } else