C2025-023 - Electronic Procedures - Modifications to PROMS

Small change to handle removed items that were selected.
This commit is contained in:
Matthew Schill 2025-05-13 07:48:50 -04:00
parent 637cbd9954
commit 3e53ec9191

View File

@ -183,7 +183,7 @@ namespace Volian.Controls.Library
foreach (KeyValuePair<string, ComboBox> pair in _DicSingleRO)
{
string val = MyConfig.GetValue("EP", pair.Key);
if (val != null && val != "")
if (!string.IsNullOrEmpty(val) && pair.Value.Items.OfType<ROListItem>().Any(x=> x.Value == val))
pair.Value.SelectedValue = val;
else
pair.Value.SelectedValue = "";
@ -199,8 +199,8 @@ namespace Volian.Controls.Library
var selectedvalues = val.Split(multiseparator.ToCharArray());
foreach (string item in selectedvalues)
{
string text = ((List<ROListItem>)pair.Value.DataSource).First(x => x.Value == item).Text;
pair.Value.SetSelected(pair.Value.FindString(text), true);
string text = ((List<ROListItem>)pair.Value.DataSource).Find(x => x.Value == item)?.Text;
if (!string.IsNullOrEmpty(text)) pair.Value.SetSelected(pair.Value.FindString(text), true);
}
}