C2020-036 Added list of duplicate procedure numbers to warning message box when doing approvals

This commit is contained in:
2020-08-25 20:04:51 +00:00
parent d8f41f3dcb
commit 7ca3f6ae0a
2 changed files with 88 additions and 28 deletions

View File

@@ -19,6 +19,7 @@ using Volian.Controls.Library;
using DescriptiveEnum;
using Volian.Base.Library;
using Volian.Print.Library;
using JR.Utils.GUI.Forms;
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
@@ -728,10 +729,30 @@ namespace VEPROMS
rpt.BuildAllReport(dvi);
this.Cursor = Cursors.Default;
}
//C2020-036 returns a string of duplicate procedure numbers separated by newlines for use in FlexibleMessageBox
private string dupProcList
{
get
{
string rtn = "";
if (dpl.Count > 0)
{
foreach (string pn in dpl)
rtn += pn + "\n";
rtn = rtn.TrimEnd('\n');
}
return rtn;
}
}
private List<string> dpl = new List<string>(); //C2020-036 used to create list duplicate procedure numbers
// B2017-242 added check for duplicate procedure numbers in a procedure set
// This is called before doing any of the approval
// C2020-036 return a string containing a list of duplicate procedure numbers
// this will be used in a FlexibleMessageBox when trying to run Approval
private bool DuplicateProcedureNumbers(DocVersionInfo dvi, ProcedureInfo pinfo)
{
dpl.Clear();
List<string> pnList = new List<string>();
foreach (ProcedureInfo pi in dvi.Procedures)
{
@@ -740,12 +761,22 @@ namespace VEPROMS
else if (pinfo != null)
{
if (pinfo.DisplayNumber == pi.DisplayNumber)
return true;
{
// In this case, we selected to approve a specific procedure from the tree view.
// Clear the list of found duplicate proc numbers thus far and add just this one - for use in messagebox
dpl.Clear();
dpl.Add(pi.DisplayNumber);
break; // C2020-036 break out of loop and return just the specific duplicate procedure number
}
}
else
return true;
{
// C2020-036 Append to the list of duplicate procedure numbers
// In this case we are approving All or Some procedures from tree view
if (!dpl.Contains(pi.DisplayNumber)) dpl.Add(pi.DisplayNumber);
}
}
return false;
return dpl.Count > 0;
}
void tv_ApproveSomeProcedures(object sender, vlnTreeEventArgs args)
{
@@ -754,8 +785,10 @@ namespace VEPROMS
// B2017-242 added check for duplicate procedure numbers in a procedure set
if (DuplicateProcedureNumbers(dvi, null))
{
MessageBox.Show("This procedure set has two or more procedures with the same procedure number.\n\n" +
"Please make each procedure number unique before approving.", "Approve Some Procedures");
// C2020-036 display list of duplicate procedure numbers
FlexibleMessageBox.Show("This procedure set has two or more procedures with the same procedure number.\n\n" +
"Please make each procedure number unique before approving.\n\n"+
"Below is a list of the dupicate procedure numbers:\n\n" +dupProcList, "Approve Some Procedures", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
tc.SaveCurrentEditItem();
@@ -782,8 +815,10 @@ namespace VEPROMS
// B2017-242 added check for duplicate procedure numbers in a procedure set
if (DuplicateProcedureNumbers(dvi, null))
{
MessageBox.Show("This procedure set has two or more procedures with the same procedure number.\n\n" +
"Please make each procedure number unique before approving.", "Approve All Procedures");
// C2020-036 display list of duplicate procedure numbers
FlexibleMessageBox.Show("This procedure set has two or more procedures with the same procedure number.\n\n" +
"Please make each procedure number unique before approving.\n\n"+
"Below is a list of the dupicate procedure numbers:\n\n" + dupProcList, "Approve All Procedures", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
tc.SaveCurrentEditItem();
@@ -866,8 +901,9 @@ namespace VEPROMS
// B2017-242 added check for duplicate procedure numbers in a procedure set
if (DuplicateProcedureNumbers(pi.MyDocVersion, pi))
{
MessageBox.Show("There is another procedure in this set with the same procedure number.\n\n" +
"Please make each procedure number unique before approving.", "Approve Procedure");
// C2020-036 display list of duplicate procedure numbers
FlexibleMessageBox.Show("Procedure number " + dupProcList + " is used by two or more procedures within this procedure set.\n\n" +
"Please make each procedure number unique before approving.", "Approve Procedure", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
tc.SaveCurrentEditItem(pi);
@@ -2212,7 +2248,7 @@ namespace VEPROMS
- Harrys PC- Harry-7100
- Caitlin- Caitlin-PC
*/
if ("|VOLIAN0|JCB2-HP|BODINE-64|WINDOWS7-RHM|PAUL-PC|MICHELLE-PC|WIN-O4QLPEH7JKH|HARRY-7100|CAITLIN-PC|".Contains("|" + Environment.UserDomainName.ToUpper() + "|"))
if ("|VLN|VOLIAN0|JCB2-HP|BODINE-64|WINDOWS7-RHM|PAUL-PC|MICHELLE-PC|WIN-O4QLPEH7JKH|HARRY-7100|CAITLIN-PC|".Contains("|" + Environment.UserDomainName.ToUpper() + "|"))
{
Random rnd = new Random(DateTime.Now.Year + DateTime.Now.DayOfYear * 1000);
MessageBox.Show(this, GetSecurityKey(), "Today's Security Key");