Upped revision number to 1.8

C2020-033: 2021 UPGRADE Handling of incoming transitions on delete or review
This commit is contained in:
2021-01-06 15:07:57 +00:00
parent ba2e72baeb
commit fdd59a5d6b
18 changed files with 1564 additions and 1005 deletions

View File

@@ -1030,114 +1030,51 @@ namespace Volian.Controls.Library
private void HandleSqlExceptionOnDelete(Exception ex)
{
// C2020-018 made the messaging consistent in the message boxes
// C2020-033: Expand/fill in the Search/Incoming Transition panel. Also, the dialog message was changed
// to give message to view panel and eliminate list in the dialog. This is done for each of cases.
if (ex.Message.Contains("has External Transitions and has no next step"))
{
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnSearchIncTrans(this, new vlnTreeItemInfoEventArgs(MyStepRTB.MyItemInfo));
using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(MyID)) // B2020-109: look at substeps too
{
DialogResult ans = FlexibleMessageBox.Show("Transitions exist to this step and cannot be adjusted automatically." +
"\r\n\r\nDo you want to be placed at the " + (exTrans.Count > 1 ? "first " : "") + "location with the problem Transition?" +
"\r\n\r\nLocations with Problem Transitions" +
exTrans.Summarize(),
"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
SetFocus();
"\r\n\r\nThe list of all locations are shown in the Tools/Search/Incoming Transitions tab.",
"Cannot Delete This Step", MessageBoxButtons.OK, MessageBoxIcon.Information);
SetFocus();
}
}
else if (ex.Message.Contains("has External Transitions to Procedure"))
{
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnSearchIncTrans(this, new vlnTreeItemInfoEventArgs(MyStepRTB.MyItemInfo));
using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(MyID))
{
DialogResult ans = FlexibleMessageBox.Show("Transitions exist to this procedure." +
"\r\n\r\nDo you want to be placed at the " + (exTrans.Count > 1 ? "first " : "") + "location with the problem Transition?" +
"\r\n\r\nLocations with Problem Transitions" +
exTrans.Summarize(),
"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]);
}
else
SetFocus();
"\r\n\r\nThe list of all locations are shown in the Tools/Search/Incoming Transitions tab.",
"Cannot Delete This Procedure", MessageBoxButtons.OK, MessageBoxIcon.Information);
SetFocus();
}
}
// B2020-097: If deleting a section that has transitions pointing to it, show list:
// B2020-098: If deleting a section that has transitions & select to remove 1st transition, crash on trying to delete section again
else if (ex.Message.Contains("has External Transitions to Section"))
{
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnSearchIncTrans(this, new vlnTreeItemInfoEventArgs(MyStepRTB.MyItemInfo));
using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(MyID))
{
DialogResult ans = FlexibleMessageBox.Show("Transitions exist to this section and cannot be adjusted automatically." +
"\r\n\r\nDo you want to be placed at the " + (exTrans.Count > 1 ? "first " : "") + "location with the problem Transition?" +
"\r\n\r\nLocations with Problem Transitions" +
exTrans.Summarize(),
"Cannot Delete This Section", 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.SelectedEditItem = this;
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OpenItem(exTrans[0].MyContent.ContentItems[0]);
}
else
MyStepPanel.SelectedEditItem = this;
"\r\n\r\nThe list of all locations are shown in the Tools/Search/Incoming Transitions tab.",
"Cannot Delete This Section", MessageBoxButtons.OK, MessageBoxIcon.Information);
MyStepPanel.SelectedEditItem = this;
}
}
else if (ex.Message.Contains("has External Transitions to it's children"))
{
MyStepPanel.MyStepTabPanel.MyDisplayTabControl.OnSearchIncTrans(this, new vlnTreeItemInfoEventArgs(MyStepRTB.MyItemInfo));
using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(MyID))
{
//DialogResult ans = FlexibleMessageBox.Show("Transitions exist to substeps of this step and cannot be adjusted automatically." +
// "\r\n\r\nDo you want to be placed on the " + (exTrans.Count > 1 ? "first " : "") + "substep with the problem Transition?" +
// "\r\n\r\nLocations with Problem Transitions:" +
// exTrans.Summarize(),
// "Cannot Delete This Step", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
DialogResult ans = FlexibleMessageBox.Show("Transitions exist to the substeps of this step and cannot be adjusted automatically." +
"\r\n\r\nDo you want to be placed at the " + (exTrans.Count > 1 ? "first " : "") + "location with the problem Transition?" +
"\r\n\r\nLocations with Problem Transitions:" +
exTrans.Summarize(),
"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
"\r\n\r\nThe list of all locations are shown in the Tools/Search/Incoming Transitions tab.",
"Cannot Delete This Step", MessageBoxButtons.OK, MessageBoxIcon.Information);
SetFocus();
}
}