diff --git a/PROMS/Formats/Formats.csproj b/PROMS/Formats/Formats.csproj
index e950a1ee..c1ca80da 100644
--- a/PROMS/Formats/Formats.csproj
+++ b/PROMS/Formats/Formats.csproj
@@ -180,6 +180,7 @@
+
diff --git a/PROMS/Formats/fmtall/EPTSTBCK1all.xml b/PROMS/Formats/fmtall/EPTSTBCK1all.xml
new file mode 100644
index 00000000..4fd3f7b2
Binary files /dev/null and b/PROMS/Formats/fmtall/EPTSTBCK1all.xml differ
diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs
index 93ad460c..5e56d913 100644
--- a/PROMS/VEPROMS User Interface/dlgExportImport.cs
+++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs
@@ -1824,7 +1824,7 @@ namespace VEPROMS
//item audits
ExportItemAudits(xe, ii);
- ExportContent(xe, ii.MyContent, "content");
+ ExportContent(xe, ii, "content");
if (ii.ItemAnnotationCount > 0)
foreach (AnnotationInfo ai in ii.ItemAnnotations)
@@ -1844,6 +1844,11 @@ namespace VEPROMS
//do nothing - this will be for Electronic procedures only
//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
//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
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, "userid", ci.UserID.ToString()));
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
ExportContentAudits(xe, ci);
diff --git a/PROMS/VEPROMS User Interface/dlgExportImportEP.cs b/PROMS/VEPROMS User Interface/dlgExportImportEP.cs
index a310e864..07151940 100644
--- a/PROMS/VEPROMS User Interface/dlgExportImportEP.cs
+++ b/PROMS/VEPROMS User Interface/dlgExportImportEP.cs
@@ -322,6 +322,19 @@ namespace VEPROMS
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
private void OnClose(object sender, EventArgs e)
{
diff --git a/PROMS/VEPROMS.CSLA.Library/Format/EPFormatFile.cs b/PROMS/VEPROMS.CSLA.Library/Format/EPFormatFile.cs
index 9bdb1720..1d75f875 100644
--- a/PROMS/VEPROMS.CSLA.Library/Format/EPFormatFile.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Format/EPFormatFile.cs
@@ -11,157 +11,157 @@ using static VEPROMS.CSLA.Library.ROFSTLookup;
namespace VEPROMS.CSLA.Library
{
- //C2025-023 - Electronic Procedures - Modifications to PROMS
- // class to handle storage and access of EPFormatFile and EPFormatFile details
- #region EPFormatFiles
- [TypeConverter(typeof(vlnListConverter))]
- public class EPFormatFiles : vlnFormatList
- {
- public EPFormatFiles(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
- }
- #endregion
- #region EPFormatFile
- public class EPFormatFile : vlnFormatItem
- {
- #region Constructor
- public EPFormatFile(XmlNode xmlNode) : base(xmlNode) { }
- public EPFormatFile() : base() { }
- #endregion
- #region Business Fields
- // Name of the EP Viewer Format File
- private LazyLoad _Name;
- [DisplayName("Name")]
- [Description("EP Viewer File Name")]
- public string Name
- {
- get
- {
- return LazyLoad(ref _Name, "@Name");
- }
- }
- // Name of the EP Viewer Format File
- private LazyLoad _Description;
- [DisplayName("Description")]
- [Description("EP Viewer Description")]
- public string Description
- {
- get
- {
- return LazyLoad(ref _Description, "@Description");
- }
- }
- // Id of Annotation Type Associated with this file
- private LazyLoad _AnnotationTypeID;
- [DisplayName("AnnotationTypeID")]
- [Description("Id of Annotation Type Associated with this file")]
- public int? AnnotationTypeID
- {
- get
- {
- return LazyLoad(ref _AnnotationTypeID, "@AnnotationTypeID");
- }
- }
+ //C2025-023 - Electronic Procedures - Modifications to PROMS
+ // class to handle storage and access of EPFormatFile and EPFormatFile details
+ #region EPFormatFiles
+ [TypeConverter(typeof(vlnListConverter))]
+ public class EPFormatFiles : vlnFormatList
+ {
+ public EPFormatFiles(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
+ }
+ #endregion
+ #region EPFormatFile
+ public class EPFormatFile : vlnFormatItem
+ {
+ #region Constructor
+ public EPFormatFile(XmlNode xmlNode) : base(xmlNode) { }
+ public EPFormatFile() : base() { }
+ #endregion
+ #region Business Fields
+ // Name of the EP Viewer Format File
+ private LazyLoad _Name;
+ [DisplayName("Name")]
+ [Description("EP Viewer File Name")]
+ public string Name
+ {
+ get
+ {
+ return LazyLoad(ref _Name, "@Name");
+ }
+ }
+ // Name of the EP Viewer Format File
+ private LazyLoad _Description;
+ [DisplayName("Description")]
+ [Description("EP Viewer Description")]
+ public string Description
+ {
+ get
+ {
+ return LazyLoad(ref _Description, "@Description");
+ }
+ }
+ // Id of Annotation Type Associated with this file
+ private LazyLoad _AnnotationTypeID;
+ [DisplayName("AnnotationTypeID")]
+ [Description("Id of Annotation Type Associated with this file")]
+ public int? AnnotationTypeID
+ {
+ get
+ {
+ return LazyLoad(ref _AnnotationTypeID, "@AnnotationTypeID");
+ }
+ }
- // Return Name of Annotation that EP Format File is Attached to
- public string AnnotationName()
- {
- return AnnotationTypeInfo.Get((int) AnnotationTypeID).Name;
- }
+ // Return Name of Annotation that EP Format File is Attached to
+ public string AnnotationName()
+ {
+ return AnnotationTypeInfo.Get((int) AnnotationTypeID).Name;
+ }
- //if xml value is blank, should element export?
- //defaults to true
- private LazyLoad _exportblank;
- [DisplayName("exportblank")]
- [Description("if xml value is blank, should element export?")]
- public bool exportblank
- {
- get
- {
- return LazyLoad(ref _exportblank, "@exportblank");
- }
- }
- // returns a list of fields that are defined in the EP format's structure
- private EPFields _FieldList;
- public EPFields FieldList
- {
- get
- {
- XmlDocument xd = GetEPFormatData(Name);
- return _FieldList == null ? _FieldList = new EPFields(xd.SelectNodes("/EPFormat/EPField")) : _FieldList;
- }
- }
- #endregion
- #region Business Methods
- // update all in-use annotation types that have Electronic Procedures
- public static void UpdateAllInUseEPAnnotationTypes()
- {
- foreach (int formatid in GetAllInUseFormats())
- {
- PlantFormat frmt = FormatInfo.Get(formatid).PlantFormat;
- foreach (EPFormatFile EP in frmt.EPFormatFiles)
+ //if xml value is blank, should element export?
+ //defaults to true
+ private LazyLoad _exportblank;
+ [DisplayName("exportblank")]
+ [Description("if xml value is blank, should element export?")]
+ public bool exportblank
+ {
+ get
+ {
+ return LazyLoad(ref _exportblank, "@exportblank");
+ }
+ }
+ // returns a list of fields that are defined in the EP format's structure
+ private EPFields _FieldList;
+ public EPFields FieldList
+ {
+ get
+ {
+ XmlDocument xd = GetEPFormatData(Name);
+ return _FieldList ?? (_FieldList = new EPFields(xd.SelectNodes("/EPFormat/EPField")));
+ }
+ }
+ #endregion
+ #region Business Methods
+ // update all in-use annotation types that have Electronic Procedures
+ public static void UpdateAllInUseEPAnnotationTypes()
+ {
+ foreach (int formatid in GetAllInUseFormats())
+ {
+ PlantFormat frmt = FormatInfo.Get(formatid).PlantFormat;
+ foreach (EPFormatFile EP in frmt.EPFormatFiles)
{
- UpdateAnnotationTypeAsEP((int) EP.AnnotationTypeID);
- }
- }
- }
- #endregion
- #region Data Access
- // static - Load EP Format details - save to db (insert/update)
- public static void UpdateEPFormat(string name, string data, string userID)
- {
- using (SqlConnection cn = Database.VEPROMS_SqlConnection)
- {
- using (SqlCommand cm = cn.CreateCommand())
- {
- cm.CommandType = CommandType.StoredProcedure;
- cm.CommandText = "vesp_UpdateEPFormat";
- cm.Parameters.AddWithValue("@name", name);
- cm.Parameters.AddWithValue("@data", data);
- cm.Parameters.AddWithValue("@userID", userID);
- cm.CommandTimeout = Database.DefaultTimeout;
- cm.ExecuteNonQuery();
- }
- }
- }
+ UpdateAnnotationTypeAsEP((int) EP.AnnotationTypeID);
+ }
+ }
+ }
+ #endregion
+ #region Data Access
+ // static - Load EP Format details - save to db (insert/update)
+ public static void UpdateEPFormat(string name, string data, string userID)
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.StoredProcedure;
+ cm.CommandText = "vesp_UpdateEPFormat";
+ cm.Parameters.AddWithValue("@name", name);
+ cm.Parameters.AddWithValue("@data", data);
+ cm.Parameters.AddWithValue("@userID", userID);
+ cm.CommandTimeout = Database.DefaultTimeout;
+ cm.ExecuteNonQuery();
+ }
+ }
+ }
- // load data for getting fieldlist for this EPFormat
- public static XmlDocument GetEPFormatData(string name)
- {
- name = name.Replace(".xml", "");
+ // load data for getting fieldlist for this EPFormat
+ public static XmlDocument GetEPFormatData(string name)
+ {
+ name = name.Replace(".xml", "");
- using (SqlConnection cn = Database.VEPROMS_SqlConnection)
- {
- using (SqlCommand cm = cn.CreateCommand())
- {
- cm.CommandType = CommandType.Text;
- cm.CommandText = "Select Data FROM EPFormats where Name = @Name";
- cm.Parameters.AddWithValue("@Name", name);
- cm.CommandTimeout = Database.DefaultTimeout;
- using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
- {
- if (dr.Read())
- {
- XmlDocument xd = new XmlDocument();
- xd.XmlResolver = null;
- xd.LoadXml(dr.GetString("Data"));
- return xd;
- }
- }
- }
- }
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.Text;
+ cm.CommandText = "Select Data FROM EPFormats where Name = @Name";
+ cm.Parameters.AddWithValue("@Name", name);
+ cm.CommandTimeout = Database.DefaultTimeout;
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ if (dr.Read())
+ {
+ XmlDocument xd = new XmlDocument();
+ xd.XmlResolver = null;
+ xd.LoadXml(dr.GetString("Data"));
+ return xd;
+ }
+ }
+ }
+ }
- return null;
- }
+ return null;
+ }
- // Get all in-use formats
- public static List GetAllInUseFormats()
- {
- using (SqlConnection cn = Database.VEPROMS_SqlConnection)
- {
- using (SqlCommand cm = cn.CreateCommand())
- {
- cm.CommandType = CommandType.Text;
- cm.CommandText = @"SELECT Distinct Formats.[FormatID]
+ // Get all in-use formats
+ public static List GetAllInUseFormats()
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.Text;
+ cm.CommandText = @"SELECT Distinct Formats.[FormatID]
FROM
(
SELECT FormatID FROM Contents
@@ -172,260 +172,272 @@ namespace VEPROMS.CSLA.Library
) inuse
inner join Formats
on inuse.FormatID = Formats.FormatID";
- cm.CommandTimeout = Database.DefaultTimeout;
+ cm.CommandTimeout = Database.DefaultTimeout;
- using (DataTable dt = new DataTable())
- {
- using (SqlDataAdapter da = new SqlDataAdapter(cm))
- {
- da.Fill(dt);
- return dt.AsEnumerable().Select(x => x.Field("FormatID")).ToList();
- }
- }
+ using (DataTable dt = new DataTable())
+ {
+ using (SqlDataAdapter da = new SqlDataAdapter(cm))
+ {
+ da.Fill(dt);
+ return dt.AsEnumerable().Select(x => x.Field("FormatID")).ToList();
+ }
+ }
- }
- }
- }
+ }
+ }
+ }
- // update an annotation type as an Electronic Procedure Annotation Type
- public static void UpdateAnnotationTypeAsEP(int typeID)
- {
- using (SqlConnection cn = Database.VEPROMS_SqlConnection)
- {
- using (SqlCommand cm = cn.CreateCommand())
- {
- cm.CommandType = CommandType.Text;
- cm.CommandText = @"Update AnnotationTypes
+ // update an annotation type as an Electronic Procedure Annotation Type
+ public static void UpdateAnnotationTypeAsEP(int typeID)
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.Text;
+ cm.CommandText = @"Update AnnotationTypes
SET IsEPAnnotationType = 1
WHERE TypeID = @typeID";
- cm.Parameters.AddWithValue("@typeID", typeID);
- cm.CommandTimeout = Database.DefaultTimeout;
- cm.ExecuteNonQuery();
- }
- }
- }
+ cm.Parameters.AddWithValue("@typeID", typeID);
+ cm.CommandTimeout = Database.DefaultTimeout;
+ cm.ExecuteNonQuery();
+ }
+ }
+ }
- // Returns true if there are any EP Annotation Types
- public static bool IsEPAnnotationType()
- {
- try
- {
- using (SqlConnection cn = Database.VEPROMS_SqlConnection)
- {
- using (SqlCommand cm = cn.CreateCommand())
- {
- cm.CommandType = CommandType.Text;
- cm.CommandText = @"SELECT RESULT = CASE WHEN
+ // Returns true if there are any EP Annotation Types
+ public static bool IsEPAnnotationType()
+ {
+ try
+ {
+ using (SqlConnection cn = Database.VEPROMS_SqlConnection)
+ {
+ using (SqlCommand cm = cn.CreateCommand())
+ {
+ cm.CommandType = CommandType.Text;
+ cm.CommandText = @"SELECT RESULT = CASE WHEN
EXISTS(SELECT 1 FROM AnnotationTypes where IsEPAnnotationType = 1)
THEN 1 ELSE 0 END";
- cm.CommandTimeout = Database.DefaultTimeout;
- using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
- {
- if (dr.Read() && dr.GetInt32("RESULT") == 1)
- return true;
- }
- }
- }
- }
- catch
- {
- // EP Support has not yet been added for this DB
- // IsEPAnnotationType does not exist
- // need to run PROMS Fixes
- // until then will ignore EP code
- // instead of crashing for a field not found
- }
+ cm.CommandTimeout = Database.DefaultTimeout;
+ using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader()))
+ {
+ if (dr.Read() && dr.GetInt32("RESULT") == 1)
+ return true;
+ }
+ }
+ }
+ }
+ catch
+ {
+ // EP Support has not yet been added for this DB
+ // IsEPAnnotationType does not exist
+ // need to run PROMS Fixes
+ // until then will ignore EP code
+ // instead of crashing for a field not found
+ }
- return false;
- }
- #endregion
- }
+ return false;
+ }
+ #endregion
+ }
- public class EPFields : vlnFormatList
- {
+ public class EPFields : vlnFormatList
+ {
public EPFields()
{
}
public EPFields(XmlNodeList xmlNodeList) : base(xmlNodeList) { }
- }
- // EP field class
- public class EPField : vlnFormatItem
- {
- public EPField(XmlNode xmlNode) : base(xmlNode) { }
- public EPField() : base() { }
- private LazyLoad _name;
- public string name
- {
- get
- {
- return LazyLoad(ref _name, "@name");
- }
- }
- private LazyLoad _type;
- public string type
- {
- get
- {
- return LazyLoad(ref _type, "@type");
- }
- }
- private LazyLoad _label;
- public string label
- {
- get
- {
- string tmp = LazyLoad(ref _label, "@label");
+ }
+ // EP field class
+ public class EPField : vlnFormatItem
+ {
+ public EPField(XmlNode xmlNode) : base(xmlNode) { }
+ public EPField() : base() { }
+ private LazyLoad _name;
+ public string name
+ {
+ get
+ {
+ return LazyLoad(ref _name, "@name");
+ }
+ }
+ private LazyLoad _type;
+ public string type
+ {
+ get
+ {
+ return LazyLoad(ref _type, "@type");
+ }
+ }
+ private LazyLoad _label;
+ public string label
+ {
+ get
+ {
+ string tmp = LazyLoad(ref _label, "@label");
- if (string.IsNullOrEmpty(tmp))
- return LazyLoad(ref _name, "@name");
- else
- return tmp;
- }
- }
- private LazyLoad _text;
- public string text
- {
- get
- {
- 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
- private LazyLoad _rosource;
- public string rosource
- {
- get
- {
- return LazyLoad(ref _rosource, "@rosource");
- }
- }
- //the columns in the RO that will be included in the exports
- private LazyLoad _returncols;
- public List returncols()
- {
- try
- {
- string tmp = LazyLoad(ref _returncols, "@returncols");
+ if (string.IsNullOrEmpty(tmp))
+ return LazyLoad(ref _name, "@name");
+ else
+ return tmp;
+ }
+ }
+ private LazyLoad _text;
+ public string text
+ {
+ get
+ {
+ 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
+ private LazyLoad _rosource;
+ public string rosource
+ {
+ get
+ {
+ return LazyLoad(ref _rosource, "@rosource");
+ }
+ }
+ //the columns in the RO that will be included in the exports
+ private LazyLoad _returncols;
+ public List returncols()
+ {
+ try
+ {
+ string tmp = LazyLoad(ref _returncols, "@returncols");
- if (string.IsNullOrEmpty(tmp))
- return new List();
- else
- return tmp.Split(',').Select(p => p.Trim()).ToList();
- }
- catch
- {
- throw new ArgumentException($"Error in returncols for EP file: {((EPFormatFile)MyParentFormat).Name}.xml, field: {name}");
- }
- }
+ if (string.IsNullOrEmpty(tmp))
+ return new List();
+ else
+ return tmp.Split(',').Select(p => p.Trim()).ToList();
+ }
+ catch
+ {
+ throw new ArgumentException($"Error in returncols for EP file, field: {name}");
+ }
+ }
- //number of lines for a multi-line text box to span
- private LazyLoad _numlines;
- public int numlines
- {
- get
- {
- int? tmp = LazyLoad(ref _numlines, "@numlines");
+ //number of lines for a multi-line text box to span
+ private LazyLoad _numlines;
+ public int numlines
+ {
+ get
+ {
+ int? tmp = LazyLoad(ref _numlines, "@numlines");
- if (tmp == null)
- return 1;
+ if (tmp == null)
+ return 1;
- return (int) tmp;
- }
- }
- //step types that the EPForma Item is valid for (as a list of types)
- private LazyLoad _validforsteptypes;
+ return (int) tmp;
+ }
+ }
+ //step types that the EPForma Item is valid for (as a list of types)
+ private LazyLoad _validforsteptypes;
public List validforsteptypes()
- {
- try
- {
- string tmp = LazyLoad(ref _validforsteptypes, "@validforsteptypes");
- return tmp.Split(',').Select(p => p.Trim()).ToList();
- }
- catch
- {
- throw new ArgumentException($"Error in validforsteptypes for EP file: {((EPFormatFile) MyParentFormat).Name}.xml, field: {name}");
- }
- }
- public bool IsValidForStepType(string StepType)
- {
- List tmp = validforsteptypes();
- return tmp.Contains(StepType);
- }
+ {
+ try
+ {
+ string tmp = LazyLoad(ref _validforsteptypes, "@validforsteptypes");
+ return tmp.Split(',').Select(p => p.Trim()).ToList();
+ }
+ catch
+ {
+ throw new ArgumentException($"Error in validforsteptypes for EP file, field: {name}");
+ }
+ }
+ public bool IsValidForStepType(string StepType)
+ {
+ List tmp = validforsteptypes();
+ return tmp.Contains(StepType);
+ }
- //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
- public List getROList(AnnotationInfo currAnn, bool includeblank)
- {
- if (string.IsNullOrEmpty(rosource))
- return new List();
+ //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
+ public List getROList(AnnotationInfo currAnn, bool includeblank)
+ {
+ if (string.IsNullOrEmpty(rosource))
+ return new List();
- try
- {
- DocVersionInfo MyDocVersion = currAnn.MyItem.MyDocVersion;
- ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
+ try
+ {
+ DocVersionInfo MyDocVersion = currAnn.MyItem.MyDocVersion;
- string roid = FormatRoidKey(rosource, false);
- rochild[] children = lookup.GetRoChildrenByRoid(roid);
+ if (MyDocVersion.DocVersionAssociations != null && MyDocVersion.DocVersionAssociations.Any())
+ {
+ ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
- List mylist = children.Select(x => new ROListItem(x.title, x.roid.Substring(0, 12))).ToList();
- if (includeblank)
- mylist.Insert(0, new ROListItem("", ""));
+ string roid = FormatRoidKey(rosource, false);
+ rochild[] children = lookup.GetRoChildrenByRoid(roid);
- return mylist;
- }
- catch (Exception Ex)
- {
- throw new ArgumentException($"Error in rosource for EP file: {((EPFormatFile)MyParentFormat).Name}.xml, field: {name}");
- }
- }
+ List mylist = children.Select(x => new ROListItem(x.title, x.roid.Substring(0, 12))).ToList();
+ if (includeblank)
+ mylist.Insert(0, new ROListItem("", ""));
- //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 getROValuesList(AnnotationInfo currAnn, string roid)
- {
- if (string.IsNullOrEmpty(roid))
- return new List();
+ return mylist;
+ }
+ else
+ {
+ return new List
+ {
+ new ROListItem("", "")
+ };
+ }
- List values = new List();
- DocVersionInfo MyDocVersion = currAnn.MyItem.MyDocVersion;
- ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
- rochild ro = lookup.GetRoChild(roid);
+ }
+ catch
+ {
+ throw new ArgumentException($"Error in rosource for EP file, field: {name}");
+ }
+ }
- List 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 getROValuesList(AnnotationInfo currAnn, string roid)
+ {
+ if (string.IsNullOrEmpty(roid))
+ return new List();
- 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);
- }
- }
+ List values = new List();
+ DocVersionInfo MyDocVersion = currAnn.MyItem.MyDocVersion;
+ ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
+ rochild ro = lookup.GetRoChild(roid);
- return values;
+ List 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
- //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 string Value { get; private set; }
- public ROListItem(string _text, string _value)
- {
- Text = _text; Value = _value;
- }
- }
- #endregion
+ return values;
+
+ }
+ }
+
+ #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 string Value { get; private set; }
+ public ROListItem(string _text, string _value)
+ {
+ Text = _text; Value = _value;
+ }
+ }
+ #endregion
}
diff --git a/PROMS/Volian.Controls.Library/frmEPAnnotationDetails.cs b/PROMS/Volian.Controls.Library/frmEPAnnotationDetails.cs
index a641fd1c..518e63c7 100644
--- a/PROMS/Volian.Controls.Library/frmEPAnnotationDetails.cs
+++ b/PROMS/Volian.Controls.Library/frmEPAnnotationDetails.cs
@@ -120,7 +120,7 @@ namespace Volian.Controls.Library
foreach (string t in tmps) cmb.Items.Add(t.Trim());
string val = MyConfig.GetValue("EP", EP.name);
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;
_DicComboBox.Add(EP.name, cmb);
panelEP.Controls.Add(cmb, 1, panelEP.RowCount - 1);
@@ -135,7 +135,7 @@ namespace Volian.Controls.Library
cmb.ValueMember = "Value";
cmb.DataSource = tmps;
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;
_DicSingleRO.Add(EP.name, cmb);
@@ -148,7 +148,7 @@ namespace Volian.Controls.Library
List 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.Width = TextRenderer.MeasureText(tmps.OrderByDescending(x => x.Text.Length).FirstOrDefault()?.Text, lb.Font).Width + SystemInformation.VerticalScrollBarWidth;
lb.DataSource = tmps;
_DicMultiRO.Add(EP.name, lb);