B2017-182: deleting a step with transitions, selecting ‘No’ on dialog that asks user to be placed on 1st substep caused hardspace & annotation on step.

This commit is contained in:
Kathy Ruffing 2017-08-29 13:11:08 +00:00
parent 27ef564484
commit e1bdda3722

View File

@ -1023,11 +1023,6 @@ namespace Volian.Controls.Library
//private void HandleSqlExceptionOnDelete(System.Data.SqlClient.SqlException ex) //private void HandleSqlExceptionOnDelete(System.Data.SqlClient.SqlException ex)
private void HandleSqlExceptionOnDelete(Exception 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")) if (ex.Message.Contains("has External Transitions and has no next step"))
{ {
using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitions(MyID)) using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitions(MyID))
@ -1039,6 +1034,14 @@ namespace Volian.Controls.Library
"Cannot Delete This Step", MessageBoxButtons.YesNo, MessageBoxIcon.Question); "Cannot Delete This Step", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans == DialogResult.Yes) 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]); MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(exTrans[0].MyContent.ContentItems[0]);
} }
else else
@ -1056,6 +1059,14 @@ namespace Volian.Controls.Library
"Cannot Delete This Procedure", MessageBoxButtons.YesNo, MessageBoxIcon.Question); "Cannot Delete This Procedure", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans == DialogResult.Yes) 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]); 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); "Cannot Delete This Step", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans == DialogResult.Yes) 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]); MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(exTrans[0].MyContent.ContentItems[0]);
} }
else
SetFocus();
} }
} }
else else