B2019-048: fixed crashes on approval dialog

This commit is contained in:
Kathy Ruffing 2019-04-01 13:22:19 +00:00
parent 5d6bfe1c45
commit abb89cc757

View File

@ -11,6 +11,7 @@ using Volian.Print.Library;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using DevComponents.DotNetBar; using DevComponents.DotNetBar;
using JR.Utils.GUI.Forms;
namespace VEPROMS namespace VEPROMS
{ {
@ -219,6 +220,10 @@ namespace VEPROMS
{ {
if (key.Contains(" Checked out to ")) if (key.Contains(" Checked out to "))
key = key.Substring(0, key.IndexOf(" Checked out to ")); key = key.Substring(0, key.IndexOf(" Checked out to "));
// B2019-048: after running consistency check - inconsistency text was added to string in dialog. Remove that text
// if in key so that it can be used to find procedure in procedure list (was crashing):
if (key.Contains(" - ("))
key = key.Substring(0, key.LastIndexOf(" - ("));
if (tmpProcedures.ContainsKey(key)) if (tmpProcedures.ContainsKey(key))
return tmpProcedures[key]; return tmpProcedures[key];
else else
@ -402,6 +407,12 @@ namespace VEPROMS
for (int i = 0; i < clbMore.Items.Count; i++) for (int i = 0; i < clbMore.Items.Count; i++)
if (clbMore.GetItemChecked(i)) if (clbMore.GetItemChecked(i))
myProcs.Add(GetProcedureInfoByKey(clbMore.Items[i].ToString())); myProcs.Add(GetProcedureInfoByKey(clbMore.Items[i].ToString()));
// B2019-048: if no procedures are checked in procedure list dialog, just tell user - don't crash:
if (myProcs.Count == 0)
{
FlexibleMessageBox.Show("No procedures are selected, you must select at least one procedure.", "No Procedures Selected", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
pbMore.Maximum = myProcs.Count; pbMore.Maximum = myProcs.Count;
_MyItemInfoList = ItemInfoList.GetMoreProcedures(myProcs); _MyItemInfoList = ItemInfoList.GetMoreProcedures(myProcs);
ItemInfoList.ConsistencyCheckUpdated -= new ItemInfoListCCEvent(ItemInfoList_ConsistencyCheckUpdated); ItemInfoList.ConsistencyCheckUpdated -= new ItemInfoListCCEvent(ItemInfoList_ConsistencyCheckUpdated);