C2020-026 – consistent messaging when deleting sections and steps

This commit is contained in:
2020-07-16 14:11:09 +00:00
parent b8d46d3768
commit 91958accaa
2 changed files with 25 additions and 8 deletions

View File

@@ -2964,24 +2964,38 @@ namespace Volian.Controls.Library
{
SetLastValues((VETreeNode)SelectedNode);
string message = string.Empty;
if(_LastStepInfo != null)
string typeDescription = "item";
if (_LastStepInfo != null)
{
if (!MySessionInfo.CanCheckOutItem(_LastStepInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
{
FlexibleMessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
//C2020-026 specific description of what user is trying to delete
typeDescription = "\"" + _LastStepInfo.FormatStepData.StepEditData.TypeMenu.MenuItem + "\"";
if (_LastStepInfo.HasChildren) typeDescription += " and its substeps";
}
if (_LastSectionInfo != null)
{
if (!MySessionInfo.CanCheckOutItem(_LastSectionInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
{
FlexibleMessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
//C2020-026 specific description of what user is trying to delete
typeDescription = "Section";
if (_LastSectionInfo.HasChildren) typeDescription += " and its steps";
}
if (_LastProcedureInfo != null)
{
if (!MySessionInfo.CanCheckOutItem(_LastProcedureInfo.ItemID, CheckOutType.Procedure, ref message))
{
FlexibleMessageBox.Show(this, message, "Item Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
typeDescription = "Procedure"; //C2020-026 specific description of what user is trying to delete
}
if (_LastDocVersionInfo != null)
{
StringBuilder sb = new StringBuilder();
@@ -2996,6 +3010,7 @@ namespace Volian.Controls.Library
FlexibleMessageBox.Show(this, sb.ToString(), "Items Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
typeDescription = "Procedure Set"; //C2020-026 specific description of what user is trying to delete
}
if (_LastFolderInfo != null)
{
@@ -3017,9 +3032,10 @@ namespace Volian.Controls.Library
FlexibleMessageBox.Show(this, sb.ToString(), "Items Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return false;
}
typeDescription = "Folder"; //C2020-026 specific description of what user is trying to delete
}
DialogResult result = FlexibleMessageBox.Show("Are you sure you want to delete " + SelectedNode.Text, "Verify Delete",
//C2020-026 added standardized wording when attempting to delete
DialogResult result = FlexibleMessageBox.Show("Are you sure you want to delete this " + typeDescription + "?", "Verify Delete",
MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{