C2020-018 made a more accurate description of the message for transitions when deleting a Procedure, Section, or Step

This commit is contained in:
2020-07-06 13:46:06 +00:00
parent 4e7d93aab5
commit 82124d1299
3 changed files with 41 additions and 17 deletions

View File

@@ -36,15 +36,18 @@ namespace VEPROMS.CSLA.Library
{
public ItemInfo HandleSqlExceptionOnDelete(Exception ex)
{
string itemDesc = this.GetTypeDescription(); // C2020-018 made the message more accurate when deleting a Procedure, Section, or Step
if (ex.Message.Contains("has External Transitions and has no next step"))
{
using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(ItemID))
{
DialogResult ans = FlexibleMessageBox.Show("Transitions exist to 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\nSubsteps with Problem Transitions" +
//C2020-018 build the message based on the type description
string msg1 = string.Format("Transitions exist to this {0} and cannot be adjusted automatically.", itemDesc);
DialogResult ans = FlexibleMessageBox.Show(msg1 +
"\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);
"Cannot Delete This " + itemDesc, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans == DialogResult.Yes)
{
return exTrans[0].MyContent.ContentItems[0];
@@ -56,8 +59,8 @@ namespace VEPROMS.CSLA.Library
using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(ItemID))
{
DialogResult ans = FlexibleMessageBox.Show("Transitions exist to this procedure 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\nSubsteps with Problem Transitions" +
"\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)
@@ -70,11 +73,13 @@ namespace VEPROMS.CSLA.Library
{
using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(ItemID))
{
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\nSubsteps with Problem Transitions:" +
//C2020-018 build the message based on the type description
string msg1 = string.Format("Transitions exist to {0} this {1} and cannot be adjusted automatically.", (this.IsSection) ? "steps in" : "children of", itemDesc);
DialogResult ans = FlexibleMessageBox.Show(msg1 +
"\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);
"Cannot Delete This "+itemDesc, MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (ans == DialogResult.No) return this;// If answer "NO" then return self
if (ans == DialogResult.Yes)
{