C2025-024 Electronic Procedures Phase 2 - XML Export

Enhanced Doc Links
This commit is contained in:
2025-08-01 13:53:08 -04:00
parent 44025c3978
commit 28c681a562
6 changed files with 408 additions and 372 deletions

View File

@@ -180,6 +180,7 @@
<Content Include="fmtall\CPL_03all.xml" /> <Content Include="fmtall\CPL_03all.xml" />
<Content Include="fmtall\CPSAMGDataall.xml" /> <Content Include="fmtall\CPSAMGDataall.xml" />
<Content Include="fmtall\CPSAMGDEVall.xml" /> <Content Include="fmtall\CPSAMGDEVall.xml" />
<Content Include="fmtall\EPTSTBCK1all.xml" />
<Content Include="fmtall\EPTST1all.xml" /> <Content Include="fmtall\EPTST1all.xml" />
<Content Include="fmtall\CWEall.xml" /> <Content Include="fmtall\CWEall.xml" />
<Content Include="fmtall\CWEDEVall.xml" /> <Content Include="fmtall\CWEDEVall.xml" />

Binary file not shown.

View File

@@ -1824,7 +1824,7 @@ namespace VEPROMS
//item audits //item audits
ExportItemAudits(xe, ii); ExportItemAudits(xe, ii);
ExportContent(xe, ii.MyContent, "content"); ExportContent(xe, ii, "content");
if (ii.ItemAnnotationCount > 0) if (ii.ItemAnnotationCount > 0)
foreach (AnnotationInfo ai in ii.ItemAnnotations) foreach (AnnotationInfo ai in ii.ItemAnnotations)
@@ -1844,6 +1844,11 @@ namespace VEPROMS
//do nothing - this will be for Electronic procedures only //do nothing - this will be for Electronic procedures only
//and handled/overridden in dlgExportEP.cs //and handled/overridden in dlgExportEP.cs
} }
protected virtual void SetEPEnhancedDocLinks(ref XmlElement xe, ItemInfo ii)
{
//do nothing - this will be for Electronic procedures only
//and handled/overridden in dlgExportEP.cs
}
//C2025-024 Electronic Procedures Phase 2 - XML Export //C2025-024 Electronic Procedures Phase 2 - XML Export
//use overridden method to set the location for ROs //use overridden method to set the location for ROs
@@ -1908,8 +1913,9 @@ namespace VEPROMS
} }
} }
private void ExportContent(XmlElement xn, ContentInfo ci, string nodename) private void ExportContent(XmlElement xn, ItemInfo ii, string nodename)
{ {
ContentInfo ci = ii.MyContent;
/* /*
ContentID ContentID
Number Number
@@ -1939,7 +1945,11 @@ namespace VEPROMS
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ci.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ci.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ci.UserID.ToString())); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ci.UserID.ToString()));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "formatfilename", formatFileName)); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "formatfilename", formatFileName));
if (_ExportBothConvertedandNot) xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "textwithlinks", ci.Text)); if (_ExportBothConvertedandNot)
{
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "textwithlinks", ci.Text));
SetEPEnhancedDocLinks(ref xe, ii);
}
//content audits //content audits
ExportContentAudits(xe, ci); ExportContentAudits(xe, ci);

View File

@@ -322,6 +322,19 @@ namespace VEPROMS
if (!string.IsNullOrEmpty(imgfile)) xindivid.Attributes.SetNamedItem(AddAttribute(xindivid.OwnerDocument, "Location", imgfile)); if (!string.IsNullOrEmpty(imgfile)) xindivid.Attributes.SetNamedItem(AddAttribute(xindivid.OwnerDocument, "Location", imgfile));
} }
//overridden - used to set specific enhanced doc info
protected override void SetEPEnhancedDocLinks(ref XmlElement xe, ItemInfo ii)
{
EnhancedDocuments eds = ii.GetMyEnhancedDocuments();
if (eds != null && eds.Count == 1)
{
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "EnhancedDocType", eds[0].Type.ToString()));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "EnhancedDocToItemID", eds[0].ItemID.ToString()));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "EnhancedDocToDbSeq", dbSeq(eds[0].ItemID)));
}
}
//clear objects to release memory //clear objects to release memory
private void OnClose(object sender, EventArgs e) private void OnClose(object sender, EventArgs e)
{ {

View File

@@ -11,157 +11,157 @@ using static VEPROMS.CSLA.Library.ROFSTLookup;
namespace VEPROMS.CSLA.Library namespace VEPROMS.CSLA.Library
{ {
//C2025-023 - Electronic Procedures - Modifications to PROMS //C2025-023 - Electronic Procedures - Modifications to PROMS
// class to handle storage and access of EPFormatFile and EPFormatFile details // class to handle storage and access of EPFormatFile and EPFormatFile details
#region EPFormatFiles #region EPFormatFiles
[TypeConverter(typeof(vlnListConverter<EPFormatFiles, EPFormatFile>))] [TypeConverter(typeof(vlnListConverter<EPFormatFiles, EPFormatFile>))]
public class EPFormatFiles : vlnFormatList<EPFormatFile> public class EPFormatFiles : vlnFormatList<EPFormatFile>
{ {
public EPFormatFiles(XmlNodeList xmlNodeList) : base(xmlNodeList) { } public EPFormatFiles(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
} }
#endregion #endregion
#region EPFormatFile #region EPFormatFile
public class EPFormatFile : vlnFormatItem public class EPFormatFile : vlnFormatItem
{ {
#region Constructor #region Constructor
public EPFormatFile(XmlNode xmlNode) : base(xmlNode) { } public EPFormatFile(XmlNode xmlNode) : base(xmlNode) { }
public EPFormatFile() : base() { } public EPFormatFile() : base() { }
#endregion #endregion
#region Business Fields #region Business Fields
// Name of the EP Viewer Format File // Name of the EP Viewer Format File
private LazyLoad<string> _Name; private LazyLoad<string> _Name;
[DisplayName("Name")] [DisplayName("Name")]
[Description("EP Viewer File Name")] [Description("EP Viewer File Name")]
public string Name public string Name
{ {
get get
{ {
return LazyLoad(ref _Name, "@Name"); return LazyLoad(ref _Name, "@Name");
} }
} }
// Name of the EP Viewer Format File // Name of the EP Viewer Format File
private LazyLoad<string> _Description; private LazyLoad<string> _Description;
[DisplayName("Description")] [DisplayName("Description")]
[Description("EP Viewer Description")] [Description("EP Viewer Description")]
public string Description public string Description
{ {
get get
{ {
return LazyLoad(ref _Description, "@Description"); return LazyLoad(ref _Description, "@Description");
} }
} }
// Id of Annotation Type Associated with this file // Id of Annotation Type Associated with this file
private LazyLoad<int?> _AnnotationTypeID; private LazyLoad<int?> _AnnotationTypeID;
[DisplayName("AnnotationTypeID")] [DisplayName("AnnotationTypeID")]
[Description("Id of Annotation Type Associated with this file")] [Description("Id of Annotation Type Associated with this file")]
public int? AnnotationTypeID public int? AnnotationTypeID
{ {
get get
{ {
return LazyLoad(ref _AnnotationTypeID, "@AnnotationTypeID"); return LazyLoad(ref _AnnotationTypeID, "@AnnotationTypeID");
} }
} }
// Return Name of Annotation that EP Format File is Attached to // Return Name of Annotation that EP Format File is Attached to
public string AnnotationName() public string AnnotationName()
{ {
return AnnotationTypeInfo.Get((int) AnnotationTypeID).Name; return AnnotationTypeInfo.Get((int) AnnotationTypeID).Name;
} }
//if xml value is blank, should element export? //if xml value is blank, should element export?
//defaults to true //defaults to true
private LazyLoad<bool> _exportblank; private LazyLoad<bool> _exportblank;
[DisplayName("exportblank")] [DisplayName("exportblank")]
[Description("if xml value is blank, should element export?")] [Description("if xml value is blank, should element export?")]
public bool exportblank public bool exportblank
{ {
get get
{ {
return LazyLoad(ref _exportblank, "@exportblank"); return LazyLoad(ref _exportblank, "@exportblank");
} }
} }
// returns a list of fields that are defined in the EP format's structure // returns a list of fields that are defined in the EP format's structure
private EPFields _FieldList; private EPFields _FieldList;
public EPFields FieldList public EPFields FieldList
{ {
get get
{ {
XmlDocument xd = GetEPFormatData(Name); XmlDocument xd = GetEPFormatData(Name);
return _FieldList == null ? _FieldList = new EPFields(xd.SelectNodes("/EPFormat/EPField")) : _FieldList; return _FieldList ?? (_FieldList = new EPFields(xd.SelectNodes("/EPFormat/EPField")));
} }
} }
#endregion #endregion
#region Business Methods #region Business Methods
// update all in-use annotation types that have Electronic Procedures // update all in-use annotation types that have Electronic Procedures
public static void UpdateAllInUseEPAnnotationTypes() public static void UpdateAllInUseEPAnnotationTypes()
{ {
foreach (int formatid in GetAllInUseFormats()) foreach (int formatid in GetAllInUseFormats())
{ {
PlantFormat frmt = FormatInfo.Get(formatid).PlantFormat; PlantFormat frmt = FormatInfo.Get(formatid).PlantFormat;
foreach (EPFormatFile EP in frmt.EPFormatFiles) foreach (EPFormatFile EP in frmt.EPFormatFiles)
{ {
UpdateAnnotationTypeAsEP((int) EP.AnnotationTypeID); UpdateAnnotationTypeAsEP((int) EP.AnnotationTypeID);
} }
} }
} }
#endregion #endregion
#region Data Access #region Data Access
// static - Load EP Format details - save to db (insert/update) // static - Load EP Format details - save to db (insert/update)
public static void UpdateEPFormat(string name, string data, string userID) public static void UpdateEPFormat(string name, string data, string userID)
{ {
using (SqlConnection cn = Database.VEPROMS_SqlConnection) using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{ {
using (SqlCommand cm = cn.CreateCommand()) using (SqlCommand cm = cn.CreateCommand())
{ {
cm.CommandType = CommandType.StoredProcedure; cm.CommandType = CommandType.StoredProcedure;
cm.CommandText = "vesp_UpdateEPFormat"; cm.CommandText = "vesp_UpdateEPFormat";
cm.Parameters.AddWithValue("@name", name); cm.Parameters.AddWithValue("@name", name);
cm.Parameters.AddWithValue("@data", data); cm.Parameters.AddWithValue("@data", data);
cm.Parameters.AddWithValue("@userID", userID); cm.Parameters.AddWithValue("@userID", userID);
cm.CommandTimeout = Database.DefaultTimeout; cm.CommandTimeout = Database.DefaultTimeout;
cm.ExecuteNonQuery(); cm.ExecuteNonQuery();
} }
} }
} }
// load data for getting fieldlist for this EPFormat // load data for getting fieldlist for this EPFormat
public static XmlDocument GetEPFormatData(string name) public static XmlDocument GetEPFormatData(string name)
{ {
name = name.Replace(".xml", ""); name = name.Replace(".xml", "");
using (SqlConnection cn = Database.VEPROMS_SqlConnection) using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{ {
using (SqlCommand cm = cn.CreateCommand()) using (SqlCommand cm = cn.CreateCommand())
{ {
cm.CommandType = CommandType.Text; cm.CommandType = CommandType.Text;
cm.CommandText = "Select Data FROM EPFormats where Name = @Name"; cm.CommandText = "Select Data FROM EPFormats where Name = @Name";
cm.Parameters.AddWithValue("@Name", name); cm.Parameters.AddWithValue("@Name", name);
cm.CommandTimeout = Database.DefaultTimeout; cm.CommandTimeout = Database.DefaultTimeout;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{ {
if (dr.Read()) if (dr.Read())
{ {
XmlDocument xd = new XmlDocument(); XmlDocument xd = new XmlDocument();
xd.XmlResolver = null; xd.XmlResolver = null;
xd.LoadXml(dr.GetString("Data")); xd.LoadXml(dr.GetString("Data"));
return xd; return xd;
} }
} }
} }
} }
return null; return null;
} }
// Get all in-use formats // Get all in-use formats
public static List<int> GetAllInUseFormats() public static List<int> GetAllInUseFormats()
{ {
using (SqlConnection cn = Database.VEPROMS_SqlConnection) using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{ {
using (SqlCommand cm = cn.CreateCommand()) using (SqlCommand cm = cn.CreateCommand())
{ {
cm.CommandType = CommandType.Text; cm.CommandType = CommandType.Text;
cm.CommandText = @"SELECT Distinct Formats.[FormatID] cm.CommandText = @"SELECT Distinct Formats.[FormatID]
FROM FROM
( (
SELECT FormatID FROM Contents SELECT FormatID FROM Contents
@@ -172,260 +172,272 @@ namespace VEPROMS.CSLA.Library
) inuse ) inuse
inner join Formats inner join Formats
on inuse.FormatID = Formats.FormatID"; on inuse.FormatID = Formats.FormatID";
cm.CommandTimeout = Database.DefaultTimeout; cm.CommandTimeout = Database.DefaultTimeout;
using (DataTable dt = new DataTable()) using (DataTable dt = new DataTable())
{ {
using (SqlDataAdapter da = new SqlDataAdapter(cm)) using (SqlDataAdapter da = new SqlDataAdapter(cm))
{ {
da.Fill(dt); da.Fill(dt);
return dt.AsEnumerable().Select(x => x.Field<int>("FormatID")).ToList(); return dt.AsEnumerable().Select(x => x.Field<int>("FormatID")).ToList();
} }
} }
} }
} }
} }
// update an annotation type as an Electronic Procedure Annotation Type // update an annotation type as an Electronic Procedure Annotation Type
public static void UpdateAnnotationTypeAsEP(int typeID) public static void UpdateAnnotationTypeAsEP(int typeID)
{ {
using (SqlConnection cn = Database.VEPROMS_SqlConnection) using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{ {
using (SqlCommand cm = cn.CreateCommand()) using (SqlCommand cm = cn.CreateCommand())
{ {
cm.CommandType = CommandType.Text; cm.CommandType = CommandType.Text;
cm.CommandText = @"Update AnnotationTypes cm.CommandText = @"Update AnnotationTypes
SET IsEPAnnotationType = 1 SET IsEPAnnotationType = 1
WHERE TypeID = @typeID"; WHERE TypeID = @typeID";
cm.Parameters.AddWithValue("@typeID", typeID); cm.Parameters.AddWithValue("@typeID", typeID);
cm.CommandTimeout = Database.DefaultTimeout; cm.CommandTimeout = Database.DefaultTimeout;
cm.ExecuteNonQuery(); cm.ExecuteNonQuery();
} }
} }
} }
// Returns true if there are any EP Annotation Types // Returns true if there are any EP Annotation Types
public static bool IsEPAnnotationType() public static bool IsEPAnnotationType()
{ {
try try
{ {
using (SqlConnection cn = Database.VEPROMS_SqlConnection) using (SqlConnection cn = Database.VEPROMS_SqlConnection)
{ {
using (SqlCommand cm = cn.CreateCommand()) using (SqlCommand cm = cn.CreateCommand())
{ {
cm.CommandType = CommandType.Text; cm.CommandType = CommandType.Text;
cm.CommandText = @"SELECT RESULT = CASE WHEN cm.CommandText = @"SELECT RESULT = CASE WHEN
EXISTS(SELECT 1 FROM AnnotationTypes where IsEPAnnotationType = 1) EXISTS(SELECT 1 FROM AnnotationTypes where IsEPAnnotationType = 1)
THEN 1 ELSE 0 END"; THEN 1 ELSE 0 END";
cm.CommandTimeout = Database.DefaultTimeout; cm.CommandTimeout = Database.DefaultTimeout;
using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
{ {
if (dr.Read() && dr.GetInt32("RESULT") == 1) if (dr.Read() && dr.GetInt32("RESULT") == 1)
return true; return true;
} }
} }
} }
} }
catch catch
{ {
// EP Support has not yet been added for this DB // EP Support has not yet been added for this DB
// IsEPAnnotationType does not exist // IsEPAnnotationType does not exist
// need to run PROMS Fixes // need to run PROMS Fixes
// until then will ignore EP code // until then will ignore EP code
// instead of crashing for a field not found // instead of crashing for a field not found
} }
return false; return false;
} }
#endregion #endregion
} }
public class EPFields : vlnFormatList<EPField> public class EPFields : vlnFormatList<EPField>
{ {
public EPFields() public EPFields()
{ {
} }
public EPFields(XmlNodeList xmlNodeList) : base(xmlNodeList) { } public EPFields(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
} }
// EP field class // EP field class
public class EPField : vlnFormatItem public class EPField : vlnFormatItem
{ {
public EPField(XmlNode xmlNode) : base(xmlNode) { } public EPField(XmlNode xmlNode) : base(xmlNode) { }
public EPField() : base() { } public EPField() : base() { }
private LazyLoad<string> _name; private LazyLoad<string> _name;
public string name public string name
{ {
get get
{ {
return LazyLoad(ref _name, "@name"); return LazyLoad(ref _name, "@name");
} }
} }
private LazyLoad<string> _type; private LazyLoad<string> _type;
public string type public string type
{ {
get get
{ {
return LazyLoad(ref _type, "@type"); return LazyLoad(ref _type, "@type");
} }
} }
private LazyLoad<string> _label; private LazyLoad<string> _label;
public string label public string label
{ {
get get
{ {
string tmp = LazyLoad(ref _label, "@label"); string tmp = LazyLoad(ref _label, "@label");
if (string.IsNullOrEmpty(tmp)) if (string.IsNullOrEmpty(tmp))
return LazyLoad(ref _name, "@name"); return LazyLoad(ref _name, "@name");
else else
return tmp; return tmp;
} }
} }
private LazyLoad<string> _text; private LazyLoad<string> _text;
public string text public string text
{ {
get get
{ {
return LazyLoad(ref _text, "@text"); return LazyLoad(ref _text, "@text");
} }
} }
//roid of group item that individual sub-items will be the choices for the list/combobox for ROSINGLE and ROMULTI //roid of group item that individual sub-items will be the choices for the list/combobox for ROSINGLE and ROMULTI
private LazyLoad<string> _rosource; private LazyLoad<string> _rosource;
public string rosource public string rosource
{ {
get get
{ {
return LazyLoad(ref _rosource, "@rosource"); return LazyLoad(ref _rosource, "@rosource");
} }
} }
//the columns in the RO that will be included in the exports //the columns in the RO that will be included in the exports
private LazyLoad<string> _returncols; private LazyLoad<string> _returncols;
public List<string> returncols() public List<string> returncols()
{ {
try try
{ {
string tmp = LazyLoad(ref _returncols, "@returncols"); string tmp = LazyLoad(ref _returncols, "@returncols");
if (string.IsNullOrEmpty(tmp)) if (string.IsNullOrEmpty(tmp))
return new List<string>(); return new List<string>();
else else
return tmp.Split(',').Select(p => p.Trim()).ToList(); return tmp.Split(',').Select(p => p.Trim()).ToList();
} }
catch catch
{ {
throw new ArgumentException($"Error in returncols for EP file: {((EPFormatFile)MyParentFormat).Name}.xml, field: {name}"); throw new ArgumentException($"Error in returncols for EP file, field: {name}");
} }
} }
//number of lines for a multi-line text box to span //number of lines for a multi-line text box to span
private LazyLoad<int?> _numlines; private LazyLoad<int?> _numlines;
public int numlines public int numlines
{ {
get get
{ {
int? tmp = LazyLoad(ref _numlines, "@numlines"); int? tmp = LazyLoad(ref _numlines, "@numlines");
if (tmp == null) if (tmp == null)
return 1; return 1;
return (int) tmp; return (int) tmp;
} }
} }
//step types that the EPForma Item is valid for (as a list of types) //step types that the EPForma Item is valid for (as a list of types)
private LazyLoad<string> _validforsteptypes; private LazyLoad<string> _validforsteptypes;
public List<string> validforsteptypes() public List<string> validforsteptypes()
{ {
try try
{ {
string tmp = LazyLoad(ref _validforsteptypes, "@validforsteptypes"); string tmp = LazyLoad(ref _validforsteptypes, "@validforsteptypes");
return tmp.Split(',').Select(p => p.Trim()).ToList(); return tmp.Split(',').Select(p => p.Trim()).ToList();
} }
catch catch
{ {
throw new ArgumentException($"Error in validforsteptypes for EP file: {((EPFormatFile) MyParentFormat).Name}.xml, field: {name}"); throw new ArgumentException($"Error in validforsteptypes for EP file, field: {name}");
} }
} }
public bool IsValidForStepType(string StepType) public bool IsValidForStepType(string StepType)
{ {
List<string> tmp = validforsteptypes(); List<string> tmp = validforsteptypes();
return tmp.Contains(StepType); return tmp.Contains(StepType);
} }
//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
//will return all RO items under the Group that's roid = the rosource //will return all RO items under the Group that's roid = the rosource
public List<ROListItem> getROList(AnnotationInfo currAnn, bool includeblank) public List<ROListItem> getROList(AnnotationInfo currAnn, bool includeblank)
{ {
if (string.IsNullOrEmpty(rosource)) if (string.IsNullOrEmpty(rosource))
return new List<ROListItem>(); return new List<ROListItem>();
try try
{ {
DocVersionInfo MyDocVersion = currAnn.MyItem.MyDocVersion; DocVersionInfo MyDocVersion = currAnn.MyItem.MyDocVersion;
ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
string roid = FormatRoidKey(rosource, false); if (MyDocVersion.DocVersionAssociations != null && MyDocVersion.DocVersionAssociations.Any())
rochild[] children = lookup.GetRoChildrenByRoid(roid); {
ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
List<ROListItem> mylist = children.Select(x => new ROListItem(x.title, x.roid.Substring(0, 12))).ToList(); string roid = FormatRoidKey(rosource, false);
if (includeblank) rochild[] children = lookup.GetRoChildrenByRoid(roid);
mylist.Insert(0, new ROListItem("", ""));
return mylist; List<ROListItem> mylist = children.Select(x => new ROListItem(x.title, x.roid.Substring(0, 12))).ToList();
} if (includeblank)
catch (Exception Ex) mylist.Insert(0, new ROListItem("", ""));
{
throw new ArgumentException($"Error in rosource for EP file: {((EPFormatFile)MyParentFormat).Name}.xml, field: {name}");
}
}
//return a list of values for the specified ROID return mylist;
//given the EP items return columns }
//will return all RO items under the Group that's roid = the rosource else
public List<string> getROValuesList(AnnotationInfo currAnn, string roid) {
{ return new List<ROListItem>
if (string.IsNullOrEmpty(roid)) {
return new List<string>(); new ROListItem("", "")
};
}
List<string> values = new List<string>(); }
DocVersionInfo MyDocVersion = currAnn.MyItem.MyDocVersion; catch
ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion); {
rochild ro = lookup.GetRoChild(roid); throw new ArgumentException($"Error in rosource for EP file, field: {name}");
}
}
List<string> rtncols = returncols(); //return a list of values for the specified ROID
//given the EP items return columns
//will return all RO items under the Group that's roid = the rosource
public List<string> getROValuesList(AnnotationInfo currAnn, string roid)
{
if (string.IsNullOrEmpty(roid))
return new List<string>();
if (rtncols.Count == 0) List<string> values = new List<string>();
{ DocVersionInfo MyDocVersion = currAnn.MyItem.MyDocVersion;
values.Add(ro.value); ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
} rochild ro = lookup.GetRoChild(roid);
else
{
foreach (string rcol in rtncols)
{
rochild ro_indiv = Array.Find(ro.children, x => x.appid.EndsWith($".{rcol}"));
if (ro_indiv.value != null) values.Add(ro_indiv.value);
}
}
return values; List<string> rtncols = returncols();
} if (rtncols.Count == 0)
} {
values.Add(ro.value);
}
else
{
foreach (string rcol in rtncols)
{
rochild ro_indiv = Array.Find(ro.children, x => x.appid.EndsWith($".{rcol}"));
if (ro_indiv.value != null) values.Add(ro_indiv.value);
}
}
#endregion return values;
//C2025-023 - Electronic Procedures - Modifications to PROMS
// class to handle return of RO Lists }
#region EPFormatFiles }
public class ROListItem
{ #endregion
public string Text { get; private set; } //C2025-023 - Electronic Procedures - Modifications to PROMS
public string Value { get; private set; } // class to handle return of RO Lists
public ROListItem(string _text, string _value) #region EPFormatFiles
{ public class ROListItem
Text = _text; Value = _value; {
} public string Text { get; private set; }
} public string Value { get; private set; }
#endregion public ROListItem(string _text, string _value)
{
Text = _text; Value = _value;
}
}
#endregion
} }

View File

@@ -120,7 +120,7 @@ namespace Volian.Controls.Library
foreach (string t in tmps) cmb.Items.Add(t.Trim()); 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.DropDownWidth = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Length).FirstOrDefault(), cmb.Font).Width + SystemInformation.VerticalScrollBarWidth;
cmb.Width = cmb.DropDownWidth; 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);
@@ -135,7 +135,7 @@ namespace Volian.Controls.Library
cmb.ValueMember = "Value"; cmb.ValueMember = "Value";
cmb.DataSource = tmps; cmb.DataSource = tmps;
cmb.DropDownStyle = ComboBoxStyle.DropDownList; cmb.DropDownStyle = ComboBoxStyle.DropDownList;
cmb.DropDownWidth = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Text.Length).First().Text, cmb.Font).Width + SystemInformation.VerticalScrollBarWidth; cmb.DropDownWidth = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Text.Length).FirstOrDefault()?.Text, cmb.Font).Width + SystemInformation.VerticalScrollBarWidth;
cmb.Width = cmb.DropDownWidth; cmb.Width = cmb.DropDownWidth;
_DicSingleRO.Add(EP.name, cmb); _DicSingleRO.Add(EP.name, cmb);
@@ -148,7 +148,7 @@ namespace Volian.Controls.Library
List<ROListItem> tmps = EP.getROList(currAnn, false); List<ROListItem> tmps = EP.getROList(currAnn, false);
lb.DisplayMember = "Text"; lb.DisplayMember = "Text";
lb.ValueMember = "Value"; lb.ValueMember = "Value";
lb.Width = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Text.Length).First().Text, lb.Font).Width + SystemInformation.VerticalScrollBarWidth; lb.Width = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Text.Length).FirstOrDefault()?.Text, lb.Font).Width + SystemInformation.VerticalScrollBarWidth;
lb.DataSource = tmps; lb.DataSource = tmps;
_DicMultiRO.Add(EP.name, lb); _DicMultiRO.Add(EP.name, lb);