C2025-023 - Electronic Procedures - Modifications to PROMS - checkin #2
This commit is contained in:
parent
6fd84e2f2a
commit
389b9e382b
@ -316,10 +316,10 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
|
|
||||||
//return a list of items based on the ROsource specified in the EPFormat File
|
//return a list of items based on the ROsource specified in the EPFormat File
|
||||||
public Dictionary<int, string> getROList(AnnotationInfo currAnn)
|
public List<ROListItem> getROList(AnnotationInfo currAnn, bool includeblank)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(rosource))
|
if (string.IsNullOrEmpty(rosource))
|
||||||
return new Dictionary<int, string>();
|
return new List<ROListItem>();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -329,8 +329,11 @@ namespace VEPROMS.CSLA.Library
|
|||||||
string roid = FormatRoidKey(rosource, false);
|
string roid = FormatRoidKey(rosource, false);
|
||||||
rochild[] children = lookup.GetRoChildrenByRoid(roid);
|
rochild[] children = lookup.GetRoChildrenByRoid(roid);
|
||||||
|
|
||||||
|
List<ROListItem> mylist = children.Select(x => new ROListItem(x.title, x.ID)).ToList();
|
||||||
return children.Select(x => new { x.ID, x.title }).ToDictionary(t => t.ID, t => t.title);
|
if (includeblank)
|
||||||
|
mylist.Insert(0, new ROListItem("", -1));
|
||||||
|
|
||||||
|
return mylist;
|
||||||
}
|
}
|
||||||
catch (Exception Ex)
|
catch (Exception Ex)
|
||||||
{
|
{
|
||||||
@ -339,5 +342,18 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
//C2025-023 - Electronic Procedures - Modifications to PROMS
|
||||||
|
// class to handle return of RO Lists
|
||||||
|
#region EPFormatFiles
|
||||||
|
public class ROListItem
|
||||||
|
{
|
||||||
|
public string Text { get; private set; }
|
||||||
|
public int Value { get; private set; }
|
||||||
|
public ROListItem(string _text, int _value)
|
||||||
|
{
|
||||||
|
Text = _text; Value = _value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,9 @@ namespace Volian.Controls.Library
|
|||||||
private Dictionary<string, CheckBox> _DicCheckBox;
|
private Dictionary<string, CheckBox> _DicCheckBox;
|
||||||
private Dictionary<string, ComboBox> _DicComboBox;
|
private Dictionary<string, ComboBox> _DicComboBox;
|
||||||
private Dictionary<string, ComboBox> _DicSingleRO;
|
private Dictionary<string, ComboBox> _DicSingleRO;
|
||||||
|
private Dictionary<string, ListBox> _DicMultiRO;
|
||||||
|
|
||||||
|
private string multiseparator = ",";
|
||||||
|
|
||||||
public frmEPAnnotationDetails(AnnotationInfo currAnn)
|
public frmEPAnnotationDetails(AnnotationInfo currAnn)
|
||||||
{
|
{
|
||||||
@ -32,6 +35,7 @@ namespace Volian.Controls.Library
|
|||||||
_DicCheckBox = new Dictionary<string, CheckBox>();
|
_DicCheckBox = new Dictionary<string, CheckBox>();
|
||||||
_DicComboBox = new Dictionary<string, ComboBox>();
|
_DicComboBox = new Dictionary<string, ComboBox>();
|
||||||
_DicSingleRO = new Dictionary<string, ComboBox>();
|
_DicSingleRO = new Dictionary<string, ComboBox>();
|
||||||
|
_DicMultiRO = new Dictionary<string, ListBox>();
|
||||||
InitializeSpecificControls(currAnn);
|
InitializeSpecificControls(currAnn);
|
||||||
_MyStepTabRibbon = new StepTabRibbon();
|
_MyStepTabRibbon = new StepTabRibbon();
|
||||||
}
|
}
|
||||||
@ -108,9 +112,11 @@ namespace Volian.Controls.Library
|
|||||||
cmb.Visible = true;
|
cmb.Visible = true;
|
||||||
string tmp = EP.text;
|
string tmp = EP.text;
|
||||||
string[] tmps = tmp.Split(",".ToCharArray());
|
string[] tmps = tmp.Split(",".ToCharArray());
|
||||||
foreach (string t in tmps) cmb.Items.Add(t);
|
foreach (string t in tmps) cmb.Items.Add(t.Trim());
|
||||||
string val = MyConfig.GetValue("EP", EP.name);
|
string val = MyConfig.GetValue("EP", EP.name);
|
||||||
if (val != null && val != "") cmb.SelectedItem = val;
|
if (val != null && val != "") cmb.SelectedItem = val;
|
||||||
|
cmb.DropDownWidth = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Length).First(), cmb.Font).Width + SystemInformation.VerticalScrollBarWidth;
|
||||||
|
cmb.Width = cmb.DropDownWidth;
|
||||||
_DicComboBox.Add(EP.name, cmb);
|
_DicComboBox.Add(EP.name, cmb);
|
||||||
panelEP.Controls.Add(cmb, 1, panelEP.RowCount - 1);
|
panelEP.Controls.Add(cmb, 1, panelEP.RowCount - 1);
|
||||||
}
|
}
|
||||||
@ -118,28 +124,70 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
ComboBox cmb = new ComboBox();
|
ComboBox cmb = new ComboBox();
|
||||||
cmb.Visible = true;
|
cmb.Visible = true;
|
||||||
cmb.DisplayMember = "Value";
|
|
||||||
cmb.ValueMember = "Key";
|
|
||||||
Dictionary<int, string> tmps = EP.getROList(currAnn);
|
|
||||||
//foreach (var t in tmps)
|
|
||||||
// cmb.Items.Add(t);
|
|
||||||
|
|
||||||
tmps.Add(-1, "");
|
List<ROListItem> tmps = EP.getROList(currAnn, true);
|
||||||
cmb.DataSource = new BindingSource(tmps, null);
|
cmb.DisplayMember = "Text";
|
||||||
string val = MyConfig.GetValue("EP", EP.name);
|
cmb.ValueMember = "Value";
|
||||||
if (val != null && val != "" && int.TryParse(val, out int n))
|
cmb.DataSource = tmps;
|
||||||
cmb.SelectedValue = n;
|
cmb.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
else
|
cmb.DropDownWidth = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Text.Length).First().Text, cmb.Font).Width + SystemInformation.VerticalScrollBarWidth;
|
||||||
cmb.SelectedValue = -1;
|
cmb.Width = cmb.DropDownWidth;
|
||||||
//cmb.SelectedItem = null;
|
|
||||||
|
|
||||||
_DicSingleRO.Add(EP.name, cmb);
|
_DicSingleRO.Add(EP.name, cmb);
|
||||||
panelEP.Controls.Add(cmb, 1, panelEP.RowCount - 1);
|
panelEP.Controls.Add(cmb, 1, panelEP.RowCount - 1);
|
||||||
}
|
}
|
||||||
|
if (EP.type.ToLower() == "romulti")
|
||||||
|
{
|
||||||
|
ListBox lb = new ListBox();
|
||||||
|
lb.Visible = true;
|
||||||
|
|
||||||
|
List<ROListItem> tmps = EP.getROList(currAnn, false);
|
||||||
|
lb.DisplayMember = "Text";
|
||||||
|
lb.ValueMember = "Value";
|
||||||
|
|
||||||
|
lb.Width = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Text.Length).First().Text, lb.Font).Width + SystemInformation.VerticalScrollBarWidth;
|
||||||
|
lb.SelectionMode = SelectionMode.MultiSimple;
|
||||||
|
//lb.IsSynchronizedWithCurrentItem = false;
|
||||||
|
|
||||||
|
lb.DataSource = tmps;
|
||||||
|
_DicMultiRO.Add(EP.name, lb);
|
||||||
|
panelEP.Controls.Add(lb, 1, panelEP.RowCount - 1);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Load += new EventHandler(Form1Load_setDefaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FieldStepRTB_Enter(object sender, EventArgs e)
|
void Form1Load_setDefaults(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
foreach (KeyValuePair<string, ComboBox> pair in _DicSingleRO)
|
||||||
|
{
|
||||||
|
string val = MyConfig.GetValue("EP", pair.Key);
|
||||||
|
if (val != null && val != "" && int.TryParse(val, out int n))
|
||||||
|
pair.Value.SelectedValue = n;
|
||||||
|
else
|
||||||
|
pair.Value.SelectedValue = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (KeyValuePair<string, ListBox> pair in _DicMultiRO)
|
||||||
|
{
|
||||||
|
pair.Value.ClearSelected();
|
||||||
|
string val = MyConfig.GetValue("EP", pair.Key);
|
||||||
|
if (val != null && val != "")
|
||||||
|
{
|
||||||
|
var selectedvalues = val.Split(multiseparator.ToCharArray());
|
||||||
|
foreach (string item in selectedvalues)
|
||||||
|
if (int.TryParse(item, out int n))
|
||||||
|
{
|
||||||
|
string text = ((List<ROListItem>)pair.Value.DataSource).First(x => x.Value == n).Text;
|
||||||
|
pair.Value.SetSelected(pair.Value.FindString(text), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FieldStepRTB_Enter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_MyStepTabRibbon.MyStepRTB = (StepRTB)sender;
|
_MyStepTabRibbon.MyStepRTB = (StepRTB)sender;
|
||||||
}
|
}
|
||||||
@ -154,8 +202,7 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
StepRTB cur = _DicStepRtb[EP.name];
|
StepRTB cur = _DicStepRtb[EP.name];
|
||||||
string rtf = cur.Rtf;
|
string rtf = cur.Rtf;
|
||||||
string newval = DisplayText.StaticStripRtfCommands(rtf, false); // C2020-001: added 'false'
|
string newval = DisplayText.StaticStripRtfCommands(rtf, false);
|
||||||
// compare to original and if different, save in proc config.
|
|
||||||
string oldval = MyConfig.GetValue("EP", EP.name);
|
string oldval = MyConfig.GetValue("EP", EP.name);
|
||||||
if (oldval != newval)
|
if (oldval != newval)
|
||||||
{
|
{
|
||||||
@ -190,12 +237,24 @@ namespace Volian.Controls.Library
|
|||||||
ComboBox cmbcur = _DicSingleRO[EP.name];
|
ComboBox cmbcur = _DicSingleRO[EP.name];
|
||||||
string newval = cmbcur.SelectedValue.ToString();
|
string newval = cmbcur.SelectedValue.ToString();
|
||||||
string oldval = MyConfig.GetValue("EP", EP.name);
|
string oldval = MyConfig.GetValue("EP", EP.name);
|
||||||
|
if (newval == "-1") newval = "";
|
||||||
if (newval != oldval)
|
if (newval != oldval)
|
||||||
{
|
{
|
||||||
isDirty = true;
|
isDirty = true;
|
||||||
MyConfig.SetValue("EP", EP.name, newval);
|
MyConfig.SetValue("EP", EP.name, newval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (EP.type.ToLower() == "romulti")
|
||||||
|
{
|
||||||
|
ListBox lbcur = _DicMultiRO[EP.name];
|
||||||
|
string newvalues = String.Join(multiseparator, lbcur.SelectedItems.OfType<ROListItem>().Select(item => item.Value));
|
||||||
|
string oldvalues = MyConfig.GetValue("EP", EP.name);
|
||||||
|
if (newvalues != oldvalues)
|
||||||
|
{
|
||||||
|
isDirty = true;
|
||||||
|
MyConfig.SetValue("EP", EP.name, newvalues);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isDirty)
|
if (isDirty)
|
||||||
{
|
{
|
||||||
@ -209,8 +268,6 @@ namespace Volian.Controls.Library
|
|||||||
annotation.Save();
|
annotation.Save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
Close();
|
Close();
|
||||||
@ -229,6 +286,8 @@ namespace Volian.Controls.Library
|
|||||||
{
|
{
|
||||||
tb.Enter -= FieldStepRTB_Enter;
|
tb.Enter -= FieldStepRTB_Enter;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
Load -= Form1Load_setDefaults;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user