From e1bdda37229952f435fa7963e5c4d29f138ea0c0 Mon Sep 17 00:00:00 2001 From: Kathy Date: Tue, 29 Aug 2017 13:11:08 +0000 Subject: [PATCH] =?UTF-8?q?B2017-182:=20deleting=20a=20step=20with=20trans?= =?UTF-8?q?itions,=20selecting=20=E2=80=98No=E2=80=99=20on=20dialog=20that?= =?UTF-8?q?=20asks=20user=20to=20be=20placed=20on=201st=20substep=20caused?= =?UTF-8?q?=20hardspace=20&=20annotation=20on=20step.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PROMS/Volian.Controls.Library/EditItem.cs | 33 +++++++++++++++++++---- 1 file changed, 28 insertions(+), 5 deletions(-) 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