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/EPTST1all.xml b/PROMS/Formats/fmtall/EPTST1all.xml
index 0c355742..148469dd 100644
Binary files a/PROMS/Formats/fmtall/EPTST1all.xml and b/PROMS/Formats/fmtall/EPTST1all.xml differ
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/VEPROMS_UI.csproj b/PROMS/VEPROMS User Interface/VEPROMS_UI.csproj
index 34aae1a6..593c1005 100644
--- a/PROMS/VEPROMS User Interface/VEPROMS_UI.csproj
+++ b/PROMS/VEPROMS User Interface/VEPROMS_UI.csproj
@@ -175,6 +175,9 @@
dlgCheckedOutProcedure.cs
+
+ Form
+
Form
diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs
index 47b85a1b..df2e4acb 100644
--- a/PROMS/VEPROMS User Interface/dlgExportImport.cs
+++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
using System.Text;
using System.Windows.Forms;
using VEPROMS.CSLA.Library;
@@ -13,9 +10,12 @@ using System.IO;
using Ionic.Zip;
using System.Text.RegularExpressions;
using JR.Utils.GUI.Forms;
+using System.Linq;
namespace VEPROMS
{
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Major Code Smell", "S6580:Use a format provider when parsing date and time", Justification = "dts formatting may be different time per plant")]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Major Code Smell", "S6561:Avoid using \"DateTime.Now\" for benchmarking or timing operations", Justification = "Rough Time estimate on ProgressBars")]
public partial class dlgExportImport : Form
{
#region Log4Net
@@ -29,12 +29,17 @@ namespace VEPROMS
}
private bool _ConvertROsToTextDuringImport = false;
private bool _ConvertROsAndTransitionsToText = false; // set to true when Approval creates an Export file
+ protected bool _ExportBothConvertedandNot = false; // set to true when Electronic Procedure export
// B2016-225 notify user when Transitions and/or ROs are converted to text
private bool _DidConvertTransitionsToText = false;
private bool _DidConvertROsToText = false;
private bool _DidUCF = false;
+ //C2025-024 Proms EP XML Output
+ //this will hold if a specific unit was selected
+ readonly protected int _UnitIndex;
+
private ItemInfo _ExternalTransitionItem = null;
public ItemInfo ExternalTransitionItem
{
@@ -61,16 +66,16 @@ namespace VEPROMS
}
private string PEIPath;
private string _MyMode;
- private FolderInfo MyFolder = null;
- private DocVersionInfo MyDocVersion = null;
- private ProcedureInfo MyProcedure = null;
- private XmlAttribute AddAttribute(XmlDocument xd, string name, string value)
+ protected FolderInfo MyFolder = null;
+ protected DocVersionInfo MyDocVersion = null;
+ protected ProcedureInfo MyProcedure = null;
+ protected XmlAttribute AddAttribute(XmlDocument xd, string name, string value)
{
XmlAttribute xa = xd.CreateAttribute(name);
xa.InnerText = value;
return xa;
}
- public dlgExportImport(string mode, FolderInfo folderInfo, frmVEPROMS myFrmVEPROMS, E_UCFImportOptions frset)
+ public dlgExportImport(string mode, FolderInfo folderInfo, frmVEPROMS myFrmVEPROMS, E_UCFImportOptions frset, int unitIndex = 0)
{
UCFImportDefaultFromSettings = frset;
MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing
@@ -78,8 +83,21 @@ namespace VEPROMS
MyFolder = folderInfo;
InitializeComponent();
this.Text = mode + " Dialog for " + folderInfo.Name;
+ _UnitIndex = unitIndex;
+
+ if (_UnitIndex > 0)
+ {
+ foreach (DocVersionInfo docver in MyFolder.FolderDocVersions)
+ {
+ docver.DocVersionConfig.SelectedSlave = _UnitIndex;
+
+ foreach (ItemInfo proc in docver.Procedures)
+ proc.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = _UnitIndex;
+ }
+ FormClosed += RemoveUnit_OnClose;
+ }
}
- public dlgExportImport(string mode, DocVersionInfo docVersionInfo, frmVEPROMS myFrmVEPROMS, E_UCFImportOptions frset)
+ public dlgExportImport(string mode, DocVersionInfo docVersionInfo, frmVEPROMS myFrmVEPROMS, E_UCFImportOptions frset, int unitIndex = 0)
{
UCFImportDefaultFromSettings = frset;
MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing
@@ -90,8 +108,19 @@ namespace VEPROMS
this.Text = mode;
else
this.Text = mode + " Dialog for " + docVersionInfo.Name + " of " + docVersionInfo.MyFolder.Name;
+ _UnitIndex = unitIndex;
+
+ if (_UnitIndex > 0)
+ {
+ MyDocVersion.DocVersionConfig.SelectedSlave = _UnitIndex;
+
+ foreach (ItemInfo proc in MyDocVersion.Procedures)
+ proc.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = _UnitIndex;
+
+ FormClosed += RemoveUnit_OnClose;
+ }
}
- public dlgExportImport(string mode, ProcedureInfo procedureInfo, frmVEPROMS myFrmVEPROMS, E_UCFImportOptions frset)
+ public dlgExportImport(string mode, ProcedureInfo procedureInfo, frmVEPROMS myFrmVEPROMS, E_UCFImportOptions frset, int unitIndex = 0)
{
UCFImportDefaultFromSettings = frset;
MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing
@@ -99,6 +128,14 @@ namespace VEPROMS
MyProcedure = procedureInfo;
InitializeComponent();
this.Text = mode + " Dialog for " + procedureInfo.DisplayNumber;
+ _UnitIndex = unitIndex;
+
+ if (_UnitIndex > 0)
+ {
+ MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = _UnitIndex;
+ MyProcedure.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = _UnitIndex;
+ FormClosed += RemoveUnit_OnClose;
+ }
//Preset path for single procedures.
PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database;
@@ -109,15 +146,6 @@ namespace VEPROMS
PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database;
if (!Directory.Exists(PEIPath))
Directory.CreateDirectory(PEIPath);
- if (_MyMode == "Import")
- {
- //If you try to import a procedure into an empty PROMS folder, the code was deleting the File System Folder including the import file. This happened during D.C. Cook training (12/3/2015).
- //if (MyFolder != null && MyFolder.ChildFolderCount == 0 )
- //{
- // Directory.Delete(PEIPath, true);
- // Directory.CreateDirectory(PEIPath);
- //}
- }
pnlExport.Dock = DockStyle.Fill;
pnlImport.Dock = DockStyle.Fill;
int formsize = 2;
@@ -159,21 +187,16 @@ namespace VEPROMS
}
if (MyFolder != null)
{
- //Database.SelectedDatabase
- //sfd.FileName = string.Format("{0}.expx", MyFolder.Name);
sfd.FileName = string.Format("{0}-{1}.expx", Database.ActiveDatabase, MyFolder.Name);
- if (sfd.ShowDialog(this) == DialogResult.OK)
- {
- if (sfd.FileName != string.Empty)
- {
- txtExport.Text = sfd.FileName;
- if (File.Exists(txtExport.Text))
- File.Delete(txtExport.Text);
- MyExpxZipFile = new ZipFile(txtExport.Text, Encoding.UTF8);
- MyExpxZipFile.Save();
- }
- }
- }
+ if (sfd.ShowDialog(this) == DialogResult.OK && sfd.FileName != string.Empty)
+ {
+ txtExport.Text = sfd.FileName;
+ if (File.Exists(txtExport.Text))
+ File.Delete(txtExport.Text);
+ MyExpxZipFile = new ZipFile(txtExport.Text, Encoding.UTF8);
+ MyExpxZipFile.Save();
+ }
+ }
else if (MyProcedure != null)
{
txtExport.Enabled = true;
@@ -188,12 +211,12 @@ namespace VEPROMS
else
lblExportStatus.Text = "Awaiting Export File Name:";
}
- private XmlWriter MyWriter = null;
private ZipFile MyExpxZipFile = null;
private ZipFile MyImpxZipFile = null;
private DateTime MyStart;
private bool successfullExport = true;
- private void btnDoExport_Click(object sender, EventArgs e)
+
+ private void btnDoExport_Click(object sender, EventArgs e)
{
@@ -218,7 +241,6 @@ namespace VEPROMS
btnDoExport.Enabled = false;
lblExportStatus.Text = "Performing Export";
SaveExportData();
- //SaveExportDataWriter();
TimeSpan elapsed = DateTime.Now.Subtract(MyStart);
lblExportStatus.Text = "Export Completed in " + elapsed.ToString();
@@ -230,7 +252,7 @@ namespace VEPROMS
var fileLocation = txtExport.Text;
if (File.Exists(fileLocation))
{ // C2022-029 if an existing export of the same name is found, provide option to overwrite it
- DialogResult ovewriteEx = FlexibleMessageBox.ShowCustom(null, "There is already another export file with the same name. You can choose to either overwrite the existing file or have the existing file renamed with the original creation date appended.\r\n\r\nSelecting 'Cancel' will cancel the export.", "What would you like to do?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);// == DialogResult.Yes;
+ DialogResult ovewriteEx = FlexibleMessageBox.ShowCustom(null, "There is already another export file with the same name. You can choose to either overwrite the existing file or have the existing file renamed with the original creation date appended.\r\n\r\nSelecting 'Cancel' will cancel the export.", "What would you like to do?", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
// Extract directory, filename, and extension
string directory = Path.GetDirectoryName(fileLocation);
@@ -315,18 +337,6 @@ namespace VEPROMS
MyFrmVEPROMS.DisablePing = false;//B2018-030 turn on ping Export is done
}
- // appears to not be used -jsj 4-29-2016
- //private void SaveExportDataWriter()
- //{
- // XmlWriterSettings ws = new XmlWriterSettings();
- // ws.Indent = true;
- // ws.NewLineHandling = NewLineHandling.Entitize;
- // ws.CheckCharacters = false;
- // MyWriter = XmlWriter.Create(txtExport.Text, ws);
- // ExportFolder(MyFolder, "folder");
- // MyWriter.Close();
- //}
-
private void btnDoImport_Click(object sender, EventArgs e)
{
bool isImported = false;
@@ -340,7 +350,6 @@ namespace VEPROMS
_DidConvertROsToText = false;
_DidProcessTransitions = false; // B2017-076 to know if we processed any transition (used in status message at the end of importing)
_DidProcessROs = false; // B2017-076 to know if we processed any transition (used in status message at the end of importing)
- //LoadImportDataReader();
if (_MyMode.ToUpper().Contains("FORMAT"))
{
TurnChangeManagerOff.Execute();
@@ -423,7 +432,6 @@ namespace VEPROMS
}
// B2016-225 added more information to the finish import message to tell the user when ROs or Transitions are converted to text.
MessageBox.Show(msg, "Import Completed", MessageBoxButtons.OK, MessageBoxIcon.Information); // C2020-042 changed mesage box title
- //MessageBox.Show(string.Format("Finished Importing:\n\n{0}", txtImport.Text.Substring(txtImport.Text.LastIndexOf("\\") + 1)), "Import", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
if (canceledPressed || !isImported)
{
@@ -432,7 +440,7 @@ namespace VEPROMS
}
}
- private bool TryToImportUCFs(ref bool isImported, ref bool canceledPressed)
+ private bool TryToImportUCFs(ref bool isImported, ref bool canceledPressed)
{
try
{
@@ -629,7 +637,7 @@ namespace VEPROMS
fstInfo = tmp;
using (DocVersion dv = MyDocVersion.Get())
{
- using (ROFst fst = fstInfo.Get())
+ using (ROFst fst = fstInfo?.Get())
{
dv.DocVersionAssociations.Add(fst);
dv.Save();
@@ -659,7 +667,7 @@ namespace VEPROMS
// use resolvedProcNum to determine if procedure is 'unique', i.e. if the procedure number exists
// and user does not overwrite or copy, then the procedure should NOT be imported. Fix for B2016-045
bool resolvedProcNum = true;
- foreach (ProcedureInfo pi in MyDocVersion.Procedures)
+ foreach (ProcedureInfo pi in MyDocVersion.Procedures.OfType())
{
// procedure numbers that contain a hyphen may have the hyphen represented as the unicode character
// '\u8209?' or the '-' character. If proc number is same except for hyphen representation, they
@@ -676,7 +684,7 @@ namespace VEPROMS
if (hyphenNum == hyphenImpNum)
{
- string msg = string.Format("The procedure you are importing{0}already exists in this procedure set.\n\nDo you want to OVERWRITE the existing procedure?", !hyphenImpNum.Equals("") ? string.Format(" ({0}) ", hyphenImpNum) : " ");
+ string msg = string.Format("The procedure you are importing{0}already exists in this procedure set.\n\nDo you want to OVERWRITE the existing procedure?", !string.IsNullOrEmpty(hyphenImpNum) ? string.Format(" ({0}) ", hyphenImpNum) : " ");
DialogResult dr = MessageBox.Show(this, msg, "Overwrite Existing Procedure", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Stop);
if (dr == DialogResult.Yes)
{
@@ -692,7 +700,7 @@ namespace VEPROMS
}
if (dr == DialogResult.No)
{
- msg = string.Format("Do you want to import {0} as a COPY of the existing procedure?\n\nThis will prefix the procedure number with \"Copy of\"", !hyphenImpNum.Equals("") ? string.Format("({0})", hyphenImpNum) : "the procedure");
+ msg = string.Format("Do you want to import {0} as a COPY of the existing procedure?\n\nThis will prefix the procedure number with \"Copy of\"", !string.IsNullOrEmpty(hyphenImpNum) ? string.Format("({0})", hyphenImpNum) : "the procedure");
dr = MessageBox.Show(this, msg, "Create Copy Of Existing Procedure", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Stop);
if (dr == DialogResult.Yes)
{
@@ -776,14 +784,13 @@ namespace VEPROMS
string fn = PEIPath + @"\transitions.xml";
PendingTransitions.Save(fn);
ProcedureInfo lastProcedure = null;
- foreach (ProcedureInfo pi in MyDocVersion.Procedures)
+ foreach (ProcedureInfo pi in MyDocVersion.Procedures.OfType())
lastProcedure = pi;
_MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure);
//update transitions
AddTransitions(PendingTransitions);
PendingTransitions.Save(fn);
FixFloatingFoldouts();
- //File.Delete(fn);
}
private void ImportProcedureCopy(XmlDocument xd)
{
@@ -811,7 +818,7 @@ namespace VEPROMS
// kbr - could replace '-' with unicode in number, here.
int count = 0;
- foreach (ProcedureInfo pi in MyDocVersion.Procedures)
+ foreach (ProcedureInfo pi in MyDocVersion.Procedures.OfType())
{
lastProcedure = pi;
if (pi.MyContent.Number.EndsWith(number))
@@ -847,7 +854,7 @@ namespace VEPROMS
PendingTransitions.Save(fn);
ProcedureInfo lastProcedure = null;
//delete old procedure
- foreach (ProcedureInfo lp in MyDocVersion.Procedures)
+ foreach (ProcedureInfo lp in MyDocVersion.Procedures.OfType())
lastProcedure = lp;
//delete opi
try
@@ -864,7 +871,7 @@ namespace VEPROMS
{
using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(pi.ItemID))
{
- DialogResult ans = MessageBox.Show("Transitions exist to this procedure and cannot be adjusted automatically." +
+ MessageBox.Show("Transitions exist to this procedure and cannot be adjusted automatically." +
"\r\nSteps with Problem Transitions:" +
exTrans.Summarize(),
"Cannot Overwrite Procedure", MessageBoxButtons.OK, MessageBoxIcon.Question);
@@ -931,11 +938,6 @@ namespace VEPROMS
ff = AddFolder(Folder.Get(MyFolder.FolderID), xd, name);
}
- //else if (dr == System.Windows.Forms.DialogResult.Cancel)
- //{
- // //canceledPressed = true;
- // //resolvedProcNum = false;
- //}
else
return false;
}
@@ -1138,9 +1140,8 @@ namespace VEPROMS
// need to add this format - name must be unique so add 'COPY(x) of 'original name'' where x is unique number:
if (UCFImportCase == E_UCFImportOptions.LoadNotUsed || UCFImportCase == E_UCFImportOptions.LoadOnlyImported || UCFImportCase == E_UCFImportOptions.LoadForSetOnly)
{
- int count = 0;
- foreach (FormatInfo fi in fil) if (fi.Name.EndsWith(name)) count++;
- if (count > 0)
+ int count = (fil.Where(fi => fi.Name.EndsWith(name))).Count();
+ if (count > 0)
{
string origname = name;
name = string.Format("Copy {0} of {1}", count.ToString(), name);
@@ -1157,9 +1158,8 @@ namespace VEPROMS
if (UCFImportCase == E_UCFImportOptions.LoadUseAll)
{
string savname = name;
- int count = 0;
- foreach (FormatInfo fi in fil) if (fi.Name.EndsWith(name)) count++;
- if (count > 0)
+ int count = (fil.Where(fi => fi.Name.EndsWith(name))).Count();
+ if (count > 0)
{
name = string.Format("Old {0} of {1}", count.ToString(), name);
}
@@ -1239,239 +1239,14 @@ namespace VEPROMS
// See if there is an existing format file that was created as a copy. If so, check if the passed in format's
// config is the same as an existing 'Copy of' format - if so, use rather than importing the same format as
// defined by config.
- foreach (var existname in existingFormat)
+ foreach (string cpy in existingFormat.Select(existname => existname.Key).Where(existname => existname.Contains(name) && existname.StartsWith("Copy") && existname.Contains("of " + name)))
{
- if (existname.Key.Contains(name))
- {
- string cpy = existname.Key;
- if (cpy.StartsWith("Copy") && cpy.Contains("of " + name))
- {
- FormatInfo exFI = FormatInfo.Get(existingFormat[cpy]);
- if (exFI.Config == config) return cpy;
- }
- }
+ FormatInfo exFI = FormatInfo.Get(existingFormat[cpy]);
+ if (exFI.Config == config) return cpy;
}
return null;
}
- //jsj 4-29-2016 appears to not be used
- //Dictionary dicParentItem = null;
- //private void UpdateParentItem(int depth, ItemInfo ii)
- //{
- // if (dicParentItem == null) dicParentItem = new Dictionary();
- // if (!dicParentItem.ContainsKey(depth)) dicParentItem.Add(depth, null);
- // dicParentItem[depth] = ii;
- //}
-
- //jsj 4-29-2016 appears to not be used
- //Dictionary dicPreviousItem = null;
- //private void UpdatePreviousItem(int depth, ItemInfo ii)
- //{
- // if (dicPreviousItem == null) dicPreviousItem = new Dictionary();
- // if (!dicPreviousItem.ContainsKey(depth)) dicPreviousItem.Add(depth, null);
- // dicPreviousItem[depth] = ii;
- //}
-
- Dictionary dicItemDepth = null;
-
- // jsj 4-29-2016 appears to not be used
- //private void UpdateItemDepth(int depth, int id)
- //{
- // if (dicItemDepth == null) dicItemDepth = new Dictionary();
- // if (!dicItemDepth.ContainsKey(depth)) dicItemDepth.Add(depth, 0);
- // dicItemDepth[depth] = id;
- //}
- // jsj 2016Feb17 - this appears to not be used
- //private void LoadImportDataReader()
- //{
- // int pCount = 0;
- // int sCount = 0;
- // Folder folder = null;
- // DocVersion docversion = null;
- // Dictionary dicRofst = null;
- // Dictionary dicEntry = null;
- // ROFst rofst = null;
- // GetImportDataCounts();
- // pbImportProcedure.Maximum = MyCounts.Count;
- // pbImportProcedure.Value = 0;
- // Application.DoEvents();
- // FileStream fs = File.OpenRead(txtImport.Text);
- // XmlReaderSettings rs = new XmlReaderSettings();
- // rs.CheckCharacters = false;
- // XmlReader xr = XmlReader.Create(fs, rs);
- // while (xr.Read())
- // {
- // if (xr.IsStartElement())
- // {
- // switch (xr.Name)
- // {
- // case "annotation":
- // AddAnnotation(xr);
- // break;
- // //case "association":
- // // break;
- // case "content":
- // {
- // if (xr.Depth == 3) //content for procedure
- // {
- // ItemInfo ii = AddProcedure(xr, docversion, dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]);
- // UpdatePreviousItem(xr.Depth, ii);
- // UpdateParentItem(xr.Depth, ii);
- // }
- // else
- // {
-
- // int fromtype = dicItemDepth.ContainsKey(xr.Depth - 2) ? dicItemDepth[xr.Depth - 2] : 0;
- // switch (fromtype)
- // {
- // case 2:
- // { //sections
- // ItemInfo ii = AddSection(xr, dicParentItem[xr.Depth], dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]);
- // UpdatePreviousItem(xr.Depth, ii);
- // UpdateParentItem(xr.Depth, ii);
- // break;
- // }
- // case 3:
- // { //cautions
- // ItemInfo ii = AddCaution(xr, dicParentItem[xr.Depth], dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]);
- // UpdatePreviousItem(xr.Depth, ii);
- // UpdateParentItem(xr.Depth, ii);
- // break;
- // }
- // case 4:
- // { //notes
- // ItemInfo ii = AddNote(xr, dicParentItem[xr.Depth], dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]);
- // UpdatePreviousItem(xr.Depth, ii);
- // UpdateParentItem(xr.Depth, ii);
- // break;
- // }
- // case 5:
- // { //rnos
- // ItemInfo ii = AddRNO(xr, dicParentItem[xr.Depth], dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]);
- // UpdatePreviousItem(xr.Depth, ii);
- // UpdateParentItem(xr.Depth, ii);
- // break;
- // }
- // case 6:
- // { //steps
- // ItemInfo ii = AddStep(xr, dicParentItem[xr.Depth], dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]);
- // UpdatePreviousItem(xr.Depth, ii);
- // UpdateParentItem(xr.Depth, ii);
- // break;
- // }
- // case 7:
- // { //tables
- // ItemInfo ii = AddTable(xr, dicParentItem[xr.Depth], dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]);
- // UpdatePreviousItem(xr.Depth, ii);
- // UpdateParentItem(xr.Depth, ii);
- // break;
- // }
- // default:
- // break;
- // }
- // }
- // break;
- // }
- // case "document":
- // AddDocument(xr, dicEntry);
- // break;
- // case "docversion":
- // {
- // docversion = AddDocVersion(folder, xr);
- // UpdatePreviousItem(xr.Depth + 2, null);
- // break;
- // }
- // case "entry":
- // dicEntry = AddEntry(xr);
- // break;
- // case "folder":
- // folder = AddFolder(Folder.Get(MyFolder.FolderID), xr);
- // break;
- // case "grid":
- // AddGrid(xr);
- // break;
- // case "procedure":
- // {
- // UpdateItemDepth(xr.Depth + 1, int.Parse(xr.GetAttribute("itemid")));
- // pbImportProcedure.PerformStep();
- // lblImportProcedure.Text = string.Format("{0} of {1} Procedures", pbImportProcedure.Value.ToString(), pbImportProcedure.Maximum.ToString());
- // pCount++;
- // pbImportSection.Maximum = MyCounts[pCount].Count;
- // pbImportSection.Value = 0;
- // sCount = 0;
- // Application.DoEvents();
- // break;
- // }
- // case "section":
- // {
- // UpdateItemDepth(xr.Depth + 1, int.Parse(xr.GetAttribute("itemid")));
- // pbImportSection.PerformStep();
- // lblImportSection.Text = string.Format("{0} of {1} Sections", pbImportSection.Value.ToString(), pbImportSection.Maximum.ToString());
- // sCount++;
- // pbImportStep.Maximum = MyCounts[pCount][sCount];
- // pbImportStep.Value = 0;
- // Application.DoEvents();
- // break;
- // }
- // case "step":
- // {
- // UpdateItemDepth(xr.Depth + 1, int.Parse(xr.GetAttribute("itemid")));
- // if (xr.Depth == 8)
- // {
- // pbImportStep.PerformStep();
- // lblImportStep.Text = string.Format("{0} of {1} Steps", pbImportStep.Value.ToString(), pbImportStep.Maximum.ToString());
- // Application.DoEvents();
- // }
- // break;
- // }
- // case "caution":
- // case "note":
- // case "rno":
- // case "table":
- // UpdateItemDepth(xr.Depth + 1, int.Parse(xr.GetAttribute("itemid")));
- // break;
- // case "cautions":
- // case "notes":
- // case "rnos":
- // case "sections":
- // case "steps":
- // case "tables":
- // {
- // UpdateItemDepth(xr.Depth, int.Parse(xr.GetAttribute("fromtype")));
- // UpdatePreviousItem(xr.Depth + 2, null);
- // UpdateParentItem(xr.Depth + 2, dicParentItem[xr.Depth - 1]);
- // break;
- // }
- // case "rodb":
- // {
- // MyRODb = AddRODb(xr);
- // rofst = AddROFst(dicRofst);
- // docversion.DocVersionAssociations.Add(rofst);
- // docversion.Save();
- // break;
- // }
- // case "rofst":
- // dicRofst = GetROFstData(xr);
- // break;
- // case "rousage":
- // AddROUsage(xr);
- // break;
- // //case "transition":
- // // break;
- // default:
- // break;
- // }
- // Console.WriteLine("{0} - {1}", xr.Name, xr.Depth.ToString());
- // }
- // }
- // pbImportProcedure.PerformStep();
- // Application.DoEvents();
- // fs.Close();
- // FixImportDataTransitions();
- // StoreItemContentIDs();
- // ResolveExternalTransitions(folder);
- //}
-
// This is called only when we are importing an entire folder.
// if there is a .impx file (a zip file generated from the last folder export file and based on location -folder name- of the export file you are importing), then it updates it with new values,
// else it will create a .impx file, and saves the id information listed below.
@@ -1535,78 +1310,6 @@ namespace VEPROMS
MyImpxZipFile.Save();
File.Delete(fn);
}
- // appears to not be used - jsj 4-28-2016
- //private void StoreItemContentIDs()
- //{
- // XmlDocument xd = new XmlDocument();
- // string fn = PEIPath + @"\ExternalTransitions.xml";
- // xd.Load(fn);
- // XmlElement xe = (XmlElement)xd.SelectSingleNode("externaltransitions/oldtonewitem");
- // foreach (int key in Old2NewItem.Keys)
- // {
- // XmlElement xee = xd.CreateElement("item");
- // XmlAttribute xa = AddAttribute(xd, "old", key.ToString());
- // xee.Attributes.SetNamedItem(xa);
- // xa = AddAttribute(xd, "new", Old2NewItem[key].ToString());
- // xee.Attributes.SetNamedItem(xa);
- // xe.AppendChild(xee);
- // }
- // xd.Save(fn);
- // xe = (XmlElement)xd.SelectSingleNode("externaltransitions/oldtonewcontent");
- // foreach (int key in Old2NewContent.Keys)
- // {
- // XmlElement xee = xd.CreateElement("content");
- // XmlAttribute xa = AddAttribute(xd, "old", key.ToString());
- // xee.Attributes.SetNamedItem(xa);
- // xa = AddAttribute(xd, "new", Old2NewContent[key].ToString());
- // xee.Attributes.SetNamedItem(xa);
- // xe.AppendChild(xee);
- // }
- // xd.Save(fn);
- //}
- //private void ResolveExternalTransitions(Folder folder)
- //{
- // XmlDocument xd = new XmlDocument();
- // string fn = PEIPath + @"\ExternalTransitions.xml";
- // xd.Load(fn);
- // AddStoredItemContentIDs(xd);
- // XmlNodeList nl = xd.SelectNodes("//transition[@folder!='']");
- // foreach (XmlNode nd in nl)
- // {
- // int transitionid = int.Parse(nd.Attributes.GetNamedItem("transitionid").InnerText);
- // int fromid = int.Parse(nd.Attributes.GetNamedItem("fromid").InnerText);
- // int toid = int.Parse(nd.Attributes.GetNamedItem("toid").InnerText);
- // int rangeid = int.Parse(nd.Attributes.GetNamedItem("rangeid").InnerText);
- // if (Old2NewContent.ContainsKey(fromid) && Old2NewItem.ContainsKey(toid) && Old2NewItem.ContainsKey(rangeid))
- // {
- // int isrange = int.Parse(nd.Attributes.GetNamedItem("isrange").InnerText);
- // int trantype = int.Parse(nd.Attributes.GetNamedItem("trantype").InnerText);
- // string config = nd.Attributes.GetNamedItem("config").InnerText;
- // string userid = nd.Attributes.GetNamedItem("userid").InnerText;
- // DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
- // string lookfor;
- // if (isrange == 0)
- // lookfor = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid);
- // else
- // lookfor = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid);
- // fromid = Old2NewContent[fromid];
- // toid = Old2NewItem[toid];
- // rangeid = Old2NewItem[rangeid];
- // Content cc = Content.Get(fromid);
- // Transition tt = Transition.MakeTransition(cc, Item.Get(toid), Item.Get(rangeid), isrange, trantype, config, dts, userid);
- // transitionid = tt.TransitionID;
- // string replacewith;
- // if (isrange == 0)
- // replacewith = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid);
- // else
- // replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid);
- // cc.Text = cc.Text.Replace(lookfor, replacewith);
- // cc.Save();
- // nd.Attributes.GetNamedItem("folder").InnerText = "";
- // }
- // }
- // xd.Save(fn);
- //}
// This is called only when we are importing an entire folder and there is a .impx file (a zip file)
// the name of the .impx file is based on the folder name containing the export file being imported
@@ -1619,14 +1322,6 @@ namespace VEPROMS
XmlDocument xd = new XmlDocument();
xd.Load(fn);
// B2016-176, B2016-197 Transitions were no always properly resolved - don't load in the old item ids
- //XmlNodeList nl = xd.SelectNodes("//item");
- //foreach (XmlNode nd in nl)
- //{
- // int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText);
- // int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText);
- // //if (!Old2NewItem.ContainsKey(oldid))
- // Old2NewItem.Add(oldid, newid);
- //}
File.Delete(fn);
ze = MyImpxZipFile["contents.xml"];
ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently);
@@ -1634,14 +1329,6 @@ namespace VEPROMS
xd = new XmlDocument();
xd.Load(fn);
// B2016-176, B2016-197 Transitions were no always properly resolved - don't load in the old content ids
- //nl = xd.SelectNodes("//content");
- //foreach (XmlNode nd in nl)
- //{
- // int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText);
- // int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText);
- // //if (!Old2NewContent.ContainsKey(oldid))
- // Old2NewContent.Add(oldid, newid);
- //}
File.Delete(fn);
ze = MyImpxZipFile["libdocs.xml"];
ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently);
@@ -1649,7 +1336,6 @@ namespace VEPROMS
xd = new XmlDocument();
xd.Load(fn);
XmlNodeList nl = xd.SelectNodes("//libdoc");
- //nl = xd.SelectNodes("//libdoc");
foreach (XmlNode nd in nl)
{
int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText);
@@ -1664,133 +1350,6 @@ namespace VEPROMS
PendingTransitions.Load(fn);
File.Delete(fn);
}
- // appears not to be used - jsj 4-28-2016
- //private void AddStoredItemContentIDs(XmlDocument xd)
- //{
- // XmlNodeList nl = xd.SelectNodes("//item");
- // foreach (XmlNode nd in nl)
- // {
- // int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText);
- // int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText);
- // if (!Old2NewItem.ContainsKey(oldid))
- // Old2NewItem.Add(oldid, newid);
- // }
- // nl = xd.SelectNodes("//content");
- // foreach (XmlNode nd in nl)
- // {
- // int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText);
- // int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText);
- // if (!Old2NewContent.ContainsKey(oldid))
- // Old2NewContent.Add(oldid, newid);
- // }
- //}
-
- // appears not to be used - jsj 4-28-2016
- //private void FixImportDataTransitions()
- //{
- // XmlDocument xd = new XmlDocument();
- // string fn = PEIPath + @"\ExternalTransitions.xml";
- // if (!File.Exists(fn))
- // {
- // XmlElement xe = xd.CreateElement("externaltransitions");
- // XmlElement xee = xd.CreateElement("oldtonewitem");
- // xe.AppendChild(xee);
- // xee = xd.CreateElement("oldtonewcontent");
- // xe.AppendChild(xee);
- // xee = xd.CreateElement("transitions");
- // xe.AppendChild(xee);
- // xd.AppendChild(xe);
- // xd.Save(fn);
- // }
- // else
- // {
- // xd.Load(fn);
- // }
- // FileStream fs = File.OpenRead(txtImport.Text);
- // XmlReaderSettings rs = new XmlReaderSettings();
- // rs.CheckCharacters = false;
- // XmlReader xr = XmlReader.Create(fs, rs);
- // while (xr.Read())
- // {
- // if (xr.IsStartElement())
- // {
- // switch (xr.Name)
- // {
- // case "transition":
- // AddTransitions(xr);
- // break;
- // case "externaltransition":
- // {
- // AddExternalTransition(xr, xd);
- // break;
- // }
- // default:
- // break;
- // }
- // }
- // }
- // fs.Close();
- // xd.Save(fn);
- //}
-
- // jsj 4-29-2016 appears to not be used
- //private Dictionary> MyCounts = null;
- //private Dictionary MySubCounts = null;
- //private void GetImportDataCounts()
- //{
- // int pCount = 0;
- // int sCount = 0;
- // int tCount = 0;
- // MyCounts = new Dictionary>();
- // MySubCounts = new Dictionary();
- // FileStream fs = File.OpenRead(txtImport.Text);
- // XmlReaderSettings rs = new XmlReaderSettings();
- // rs.CheckCharacters = false;
- // XmlReader xr = XmlReader.Create(fs, rs);
- // while (xr.Read())
- // {
- // if (xr.IsStartElement())
- // {
- // switch (xr.Name)
- // {
- // case "procedure":
- // {
- // if (pCount > 0)
- // {
- // MySubCounts.Add(sCount, tCount);
- // MyCounts.Add(pCount, MySubCounts);
- // sCount = 0;
- // tCount = 0;
- // MySubCounts = new Dictionary();
- // }
- // pCount++;
- // break;
- // }
- // case "section":
- // {
- // if (sCount > 0)
- // {
- // MySubCounts.Add(sCount, tCount);
- // tCount = 0;
- // }
- // sCount++;
- // break;
- // }
- // case "step":
- // {
- // if (xr.Depth == 8)
- // tCount++;
- // break;
- // }
- // default:
- // break;
- // }
- // }
- // }
- // MySubCounts.Add(sCount, tCount);
- // MyCounts.Add(pCount, MySubCounts);
- // fs.Close();
- //}
private void btnImport_Click(object sender, EventArgs e)
{
@@ -1801,76 +1360,70 @@ namespace VEPROMS
txtImport.Text = ofd.FileName;
return;
}
- if (MyFolder != null)
- {
- if (ofd.ShowDialog(this) == DialogResult.OK)
- {
- if (ofd.FileName != string.Empty)
- {
- Old2NewItem = new Dictionary();
- Old2NewContent = new Dictionary();
- Old2NewLibDoc = new Dictionary();
- GetExistingLibDocsList(); // B2019-035 better memory management
- PendingTransitions = new XmlDocument();
- FileInfo fi = new FileInfo(ofd.FileName);
- string dn;
- if (fi.Name.IndexOf("-") > 0)
- dn = fi.Name.Substring(0, fi.Name.IndexOf("-"));
- else
- dn = fi.Name.Substring(0, fi.Name.IndexOf("."));
- txtImport.Text = ofd.FileName;
- ReadOptions ro = new ReadOptions();
- ro.Encoding = Encoding.UTF8;
- MyExpxZipFile = ZipFile.Read(txtImport.Text, ro);
- string fn = string.Format(@"{0}\{1}.impx", PEIPath, dn);
- if (File.Exists(fn))
- {
- MyImpxZipFile = ZipFile.Read(fn, ro);
- ReadTransitionAndItemContentIDs();
- }
- else
- {
- MyImpxZipFile = new ZipFile(fn, Encoding.UTF8);
- //transitions
- XmlElement xe = PendingTransitions.CreateElement("transitions");
- PendingTransitions.AppendChild(xe);
- fn = PEIPath + @"\transitions.xml";
- PendingTransitions.Save(fn);
- MyImpxZipFile.AddFile(fn, "");
- MyImpxZipFile.Save();
- File.Delete(fn);
- //itemids
- XmlDocument xd = new XmlDocument();
- xe = xd.CreateElement("items");
- xd.AppendChild(xe);
- fn = PEIPath + @"\items.xml";
- xd.Save(fn);
- MyImpxZipFile.AddFile(fn, "");
- MyImpxZipFile.Save();
- File.Delete(fn);
- //contentids
- xd = new XmlDocument();
- xe = xd.CreateElement("contents");
- xd.AppendChild(xe);
- fn = PEIPath + @"\contents.xml";
- xd.Save(fn);
- MyImpxZipFile.AddFile(fn, "");
- MyImpxZipFile.Save();
- File.Delete(fn);
- //libdocids
- xd = new XmlDocument();
- xe = xd.CreateElement("libdocs");
- xd.AppendChild(xe);
- fn = PEIPath + @"\libdocs.xml";
- xd.Save(fn);
- MyImpxZipFile.AddFile(fn, "");
- MyImpxZipFile.Save();
- File.Delete(fn);
- }
- }
- }
- }
- if (MyDocVersion != null)
+ if (MyFolder != null && ofd.ShowDialog(this) == DialogResult.OK && ofd.FileName != string.Empty)
+ {
+ Old2NewItem = new Dictionary();
+ Old2NewContent = new Dictionary();
+ Old2NewLibDoc = new Dictionary();
+ GetExistingLibDocsList(); // B2019-035 better memory management
+ PendingTransitions = new XmlDocument();
+ FileInfo fi = new FileInfo(ofd.FileName);
+ string dn;
+ if (fi.Name.IndexOf("-") > 0)
+ dn = fi.Name.Substring(0, fi.Name.IndexOf("-"));
+ else
+ dn = fi.Name.Substring(0, fi.Name.IndexOf("."));
+ txtImport.Text = ofd.FileName;
+ ReadOptions ro = new ReadOptions();
+ ro.Encoding = Encoding.UTF8;
+ MyExpxZipFile = ZipFile.Read(txtImport.Text, ro);
+ string fn = string.Format(@"{0}\{1}.impx", PEIPath, dn);
+ if (File.Exists(fn))
+ {
+ MyImpxZipFile = ZipFile.Read(fn, ro);
+ ReadTransitionAndItemContentIDs();
+ }
+ else
+ {
+ MyImpxZipFile = new ZipFile(fn, Encoding.UTF8);
+ //transitions
+ XmlElement xe = PendingTransitions.CreateElement("transitions");
+ PendingTransitions.AppendChild(xe);
+ fn = PEIPath + @"\transitions.xml";
+ PendingTransitions.Save(fn);
+ MyImpxZipFile.AddFile(fn, "");
+ MyImpxZipFile.Save();
+ File.Delete(fn);
+ //itemids
+ XmlDocument xd = new XmlDocument();
+ xe = xd.CreateElement("items");
+ xd.AppendChild(xe);
+ fn = PEIPath + @"\items.xml";
+ xd.Save(fn);
+ MyImpxZipFile.AddFile(fn, "");
+ MyImpxZipFile.Save();
+ File.Delete(fn);
+ //contentids
+ xd = new XmlDocument();
+ xe = xd.CreateElement("contents");
+ xd.AppendChild(xe);
+ fn = PEIPath + @"\contents.xml";
+ xd.Save(fn);
+ MyImpxZipFile.AddFile(fn, "");
+ MyImpxZipFile.Save();
+ File.Delete(fn);
+ //libdocids
+ xd = new XmlDocument();
+ xe = xd.CreateElement("libdocs");
+ xd.AppendChild(xe);
+ fn = PEIPath + @"\libdocs.xml";
+ xd.Save(fn);
+ MyImpxZipFile.AddFile(fn, "");
+ MyImpxZipFile.Save();
+ File.Delete(fn);
+ }
+ }
+ if (MyDocVersion != null)
{
ofd.Filter = "PROMS Procedure Export Files|*.pxml";
if (ofd.ShowDialog(this) == DialogResult.OK)
@@ -1980,46 +1533,6 @@ namespace VEPROMS
xn.AppendChild(xe);
}
- // jsj 4-29-2016 appears to not be used
- //private void ExportFolder(FolderInfo fi, string nodename)
- //{
- // /*
- // FolderID
- // ParentID
- // DBID
- // Name
- // Title
- // ShortName
- // FormatID
- // ManualOrder
- // Config
- // DTS
- // UsrID
- // */
- // string formatFileName = (fi.MyFormat != null) ? fi.MyFormat.Name : "";
- // FromFolderName = fi.Name;
- // MyWriter.WriteStartDocument();
- // MyWriter.WriteStartElement(nodename);
- // MyWriter.WriteAttributeString("folderid", fi.FolderID.ToString());
- // MyWriter.WriteAttributeString("parentid", fi.ParentID.ToString());
- // MyWriter.WriteAttributeString("dbid", fi.DBID.ToString());
- // MyWriter.WriteAttributeString("name", fi.Name);
- // MyWriter.WriteAttributeString("title", fi.Title);
- // MyWriter.WriteAttributeString("shortname", fi.ShortName);
- // MyWriter.WriteAttributeString("formatid", fi.FormatID.ToString());
- // MyWriter.WriteAttributeString("manualorder", fi.ManualOrder.ToString());
- // MyWriter.WriteAttributeString("config", fi.Config);
- // MyWriter.WriteAttributeString("dts", fi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- // MyWriter.WriteAttributeString("usrid", fi.UsrID.ToString());
- // MyWriter.WriteAttributeString("formatfilename", formatFileName);
-
- // if (fi.FolderDocVersionCount > 0)
- // foreach (DocVersionInfo dvi in fi.FolderDocVersions)
- // ExportDocVersion(dvi, "docversion");
- // MyWriter.WriteEndElement();
- // MyWriter.WriteEndDocument();
- //}
-
// bug fix: B2017-082 don't export if no RO Path - display an message to the user to assign a RO Path
private bool ValidDocVersionAssociation(DocVersionInfo dvi)
{
@@ -2069,7 +1582,7 @@ namespace VEPROMS
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "name", dvi.Name));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "title", dvi.Title));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "itemid", dvi.ItemID.ToString()));
- xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "formatid", tmpFormatID.ToString()));//dvi.FormatID.ToString()));
+ xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "formatid", tmpFormatID.ToString()));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", dvi.Config));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", dvi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", dvi.UserID.ToString()));
@@ -2106,48 +1619,6 @@ namespace VEPROMS
}
}
}
- private void ExportDocVersion(DocVersionInfo dvi, string nodename)
- {
- /*
- VersionID
- FolderID
- VersionType
- Name
- Title
- ItemID
- FormatID
- Config
- DTS
- UserID
- */
- string formatFileName = (dvi.MyFormat != null) ? dvi.MyFormat.Name : "";
- MyWriter.WriteStartElement(nodename);
- MyWriter.WriteAttributeString("versionid", dvi.VersionID.ToString());
- MyWriter.WriteAttributeString("folderid", dvi.FolderID.ToString());
- MyWriter.WriteAttributeString("versiontype", dvi.VersionType.ToString());
- MyWriter.WriteAttributeString("name", dvi.Name);
- MyWriter.WriteAttributeString("title", dvi.Title);
- MyWriter.WriteAttributeString("itemid", dvi.ItemID.ToString());
- MyWriter.WriteAttributeString("formatid", dvi.FormatID.ToString());
- MyWriter.WriteAttributeString("config", dvi.Config);
- MyWriter.WriteAttributeString("dts", dvi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- MyWriter.WriteAttributeString("userid", dvi.UserID.ToString());
- MyWriter.WriteAttributeString("formatfilename", formatFileName);
- if (dvi.DocVersionAssociationCount > 0)
- foreach (AssociationInfo ai in dvi.DocVersionAssociations)
- ExportAssociation(ai, "association");
- if (dvi.Procedures.Count > 0)
- {
- pbExportProcedure.Value = 0;
- pbExportProcedure.Maximum = dvi.Procedures.Count;
- lblExportProcedure.Text = pbExportProcedure.Maximum.ToString() + " Procedures";
- foreach (ItemInfo ii in dvi.Procedures)
- {
- ExportItem(ii, "procedure");
- }
- }
- MyWriter.WriteEndElement();
- }
private void ExportAssociation(XmlElement xn, AssociationInfo ai, string nodename)
{
/*
@@ -2170,27 +1641,6 @@ namespace VEPROMS
xn.AppendChild(xe);
ExportROFst(xe, ai.MyROFst, "rofst");
}
- private void ExportAssociation(AssociationInfo ai, string nodename)
- {
- /*
- AssociationID
- VersionID
- ROFstID
- Config
- DTS
- UserID
- */
- MyWriter.WriteStartElement(nodename);
- MyWriter.WriteAttributeString("associationid", ai.AssociationID.ToString());
- MyWriter.WriteAttributeString("versionid", ai.VersionID.ToString());
- MyWriter.WriteAttributeString("rofstid", ai.ROFstID.ToString());
- MyWriter.WriteAttributeString("config", ai.Config);
- MyWriter.WriteAttributeString("dts", ai.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- MyWriter.WriteAttributeString("userid", ai.UserID.ToString());
- ExportROFst(ai.MyROFst, "rofst");
- MyWriter.WriteEndElement();
- }
-
private void ExportROFst(XmlElement xn, ROFstInfo fst, string nodename)
{
/*
@@ -2217,28 +1667,6 @@ namespace VEPROMS
ExportRODb(xe, fst.MyRODb, "rodb");
}
- private void ExportROFst(ROFstInfo fst, string nodename)
- {
- /*
- ROFstID
- RODbID
- ROLookup
- Config
- DTS
- UserID
- */
- MyWriter.WriteStartElement(nodename);
- MyWriter.WriteAttributeString("rofstid", fst.ROFstID.ToString());
- MyWriter.WriteAttributeString("rodbid", fst.RODbID.ToString());
- MyWriter.WriteAttributeString("rolookup", Convert.ToBase64String(ROFSTLookup.GetRofstLookupBytes(fst.ROFstID))); // B2022-026 RO Memory reduction - new calls
- MyWriter.WriteAttributeString("config", fst.Config);
- MyWriter.WriteAttributeString("dts", fst.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- MyWriter.WriteAttributeString("userid", fst.UserID.ToString());
-
- ExportRODb(fst.MyRODb, "rodb");
- MyWriter.WriteEndElement();
- }
-
private void ExportFigures(XmlElement xn, ROFstInfo fst)
{
if (fst.ROFstFigureCount > 0)
@@ -2305,28 +1733,6 @@ namespace VEPROMS
xn.AppendChild(xe);
}
- private void ExportRODb(RODbInfo db, string nodename)
- {
- /*
- RODbID
- ROName
- FolderPath
- DBConnectionString
- Config
- DTS
- UserID
- */
- MyWriter.WriteStartElement(nodename);
- MyWriter.WriteAttributeString("rodbid", db.RODbID.ToString());
- MyWriter.WriteAttributeString("roname", db.ROName);
- MyWriter.WriteAttributeString("folderpath", db.FolderPath);
- MyWriter.WriteAttributeString("dbconnectionstring", db.DBConnectionString);
- MyWriter.WriteAttributeString("config", db.Config);
- MyWriter.WriteAttributeString("dts", db.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- MyWriter.WriteAttributeString("userid", db.UserID.ToString());
- MyWriter.WriteEndElement();
- }
-
public void ExportItem(XmlDocument xd, ItemInfo ii, string nodename)
{
XmlElement xe = xd.CreateElement(nodename);
@@ -2418,11 +1824,48 @@ 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)
ExportAnnotation(xe, ai, "annotation");
+
+ ExportEPAnnotationInfo(xe, ii);
+ }
+
+ protected virtual void ExportEPAnnotationInfo(XmlElement xe, ItemInfo ii)
+ {
+ //do nothing - this will be for Electronic procedures only
+ //and handled/overridden in dlgExportEP.cs
+ }
+
+ protected virtual void SetROLocation(ref XmlElement xindivid, ROFSTLookup.rochild roc, RODbInfo rodb, bool isMulti)
+ {
+ //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
+ protected void SetROLocation(ref XmlElement xindivid, string roid, int rodbid)
+ {
+ if (MyProcedure?.MyDocVersion != null)
+ {
+ ROFSTLookup lookup = MyProcedure.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyProcedure.MyDocVersion);
+
+ using (RODbInfo myRODB = RODbInfoList.Get().FirstOrDefault(x => x.RODbID == rodbid))
+ {
+ roid = ROFSTLookup.FormatRoidKey(roid, true);
+ ROFSTLookup.rochild roc = lookup.GetRoChild(roid);
+ if (Enumerable.Range(8, 15).Contains(roc.type))
+ SetROLocation(ref xindivid, roc, myRODB, roc.type != 8);
+ }
+ }
}
private void ExportItemAudits(XmlElement xn, ItemInfo ii)
@@ -2470,78 +1913,9 @@ namespace VEPROMS
}
}
- private void ExportItem(ItemInfo ii, string nodename)
- {
- /*
- ItemID
- PreviousID
- ContentID
- DTS
- */
- if (ii.IsProcedure)
- {
- pbExportProcedure.PerformStep();
- lblExportProcedure.Text = string.Format("{0} of {1} Procedures", pbExportProcedure.Value.ToString(), pbExportProcedure.Maximum.ToString());
- Application.DoEvents();
-
- pbExportSection.Value = 0;
- pbExportStep.Value = 0;
- pbExportSection.Maximum = ii.Sections.Count;
-
- if (ii.Sections != null)
- pbExportSection.Maximum = ii.Sections.Count;
- else
- {
- pbExportSection.Maximum = 1;
- pbExportSection.PerformStep();
- pbExportStep.Maximum = 1;
- pbExportStep.PerformStep();
- lblExportSection.Text = "Sections";
- lblExportStep.Text = "Steps";
- Application.DoEvents();
- }
- }
-
- if (ii.IsSection)
- {
- pbExportSection.PerformStep();
- lblExportSection.Text = string.Format("{0} of {1} Sections", pbExportSection.Value.ToString(), pbExportSection.Maximum.ToString());
- Application.DoEvents();
- pbExportStep.Value = 0;
- if (ii.Steps != null)
- pbExportStep.Maximum = ii.Steps.Count;
- else
- {
- pbExportStep.Maximum = 1;
- pbExportStep.PerformStep();
- lblExportStep.Text = "Word Section Data";
- Application.DoEvents();
- }
- }
-
- if (ii.IsStep)
- {
- pbExportStep.PerformStep();
- lblExportStep.Text = string.Format("{0} of {1} Steps", pbExportStep.Value.ToString(), pbExportStep.Maximum.ToString());
- Application.DoEvents();
- }
-
- MyWriter.WriteStartElement(nodename);
- MyWriter.WriteAttributeString("itemid", ii.ItemID.ToString());
- MyWriter.WriteAttributeString("previousid", ii.PreviousID.ToString());
- MyWriter.WriteAttributeString("contentid", ii.ContentID.ToString());
- MyWriter.WriteAttributeString("dts", ii.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
-
- ExportContent(ii.MyContent, "content");
- if (ii.ItemAnnotationCount > 0)
- foreach (AnnotationInfo ai in ii.ItemAnnotations)
- ExportAnnotation(ai, "annotation");
-
- MyWriter.WriteEndElement();
- }
-
- private void ExportContent(XmlElement xn, ContentInfo ci, string nodename)
+ private void ExportContent(XmlElement xn, ItemInfo ii, string nodename)
{
+ ContentInfo ci = ii.MyContent;
/*
ContentID
Number
@@ -2553,8 +1927,13 @@ namespace VEPROMS
UserID
*/
XmlElement xe = xn.OwnerDocument.CreateElement(nodename);
- // strip the link information if we are convertingthe RO and Transitions to text
- string ciText = (_ConvertROsAndTransitionsToText) ? ItemInfo.StripLinks(ci.Text) : ci.Text;
+
+ //C2025-024 PROMS EP XML output
+ //if multiunit with ROs, need to actually resolve those / not just strip links
+ string ciText = ResolveMultiUnitROs(ci);
+
+ // strip the link information if we are converting the RO and Transitions to text
+ ciText = _ConvertROsAndTransitionsToText ? ItemInfo.StripLinks(ciText) : ciText;
string formatFileName = (ci.MyFormat != null) ? ci.MyFormat.Name : "";
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "contentid", ci.ContentID.ToString()));
@@ -2566,6 +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));
+ SetEPEnhancedDocLinks(ref xe, ii);
+ }
//content audits
ExportContentAudits(xe, ci);
@@ -2577,7 +1961,7 @@ namespace VEPROMS
if (ci.ContentRoUsageCount > 0)
foreach (RoUsageInfo ri in ci.ContentRoUsages)
- ExportROUsage(xe, ri, "rousage");
+ ExportROUsage(xe, ri, "rousage");
if (ci.ContentEntryCount > 0)
ExportEntry(xe, ci.MyEntry, "entry");
@@ -2593,7 +1977,61 @@ namespace VEPROMS
ExportPart(xe, pi, ((E_FromTypes)pi.FromType).ToString().ToLower());
}
- private void ExportContentAudits(XmlElement xn, ContentInfo ci)
+ //C2025-024 PROMS Electronic Procedure XML output
+ //if multi unit with ROs, need to actually resolve those / not just strip links
+ private string ResolveMultiUnitROs(ContentInfo ci)
+ {
+ string ciText = ci.Text;
+ DocVersionInfo docver = null;
+ if (MyProcedure?.MyDocVersion != null)
+ {
+ docver = MyProcedure.MyDocVersion;
+ }
+ else if (MyDocVersion != null)
+ {
+ docver = MyDocVersion;
+ }
+ else if (MyFolder.FolderDocVersions != null && MyFolder.FolderDocVersions.Count > 0)
+ {
+ docver = MyFolder.FolderDocVersions[0];
+ }
+
+
+ if (_UnitIndex != 0 && docver != null)
+ {
+ docver.DocVersionConfig.SelectedSlave = _UnitIndex;
+ ciText = DisplayText.ResolveUnitSpecific(docver, ciText);
+
+ if (ci.ContentRoUsageCount > 0)
+ {
+ ROFSTLookup lookup = docver.DocVersionAssociations[0].MyROFst.GetROFSTLookup(docver);
+
+ if (lookup != null)
+ {
+ foreach (var RO in ci.ContentRoUsages)
+ {
+ string roid = ROFSTLookup.FormatRoidKey(RO.ROID, true);
+ ROFSTLookup.rochild roc = lookup.GetRoChild(roid);
+ //need to search / replace in content info
+ string lookFor = string.Format(@"(?<=(()", RO.ROUsageID);
+ Match m = Regex.Match(ciText, lookFor, RegexOptions.Singleline);
+ if (m != null && m.Groups.Count > 1)
+ {
+ ciText = ciText.Replace($"{m.Groups[1].Value}{m.Groups[6].Value}{m.Groups[7].Value}", $"{m.Groups[1].Value}{roc.value}{m.Groups[7].Value}");
+ }
+ }
+ }
+
+ }
+
+ docver.DocVersionConfig.SelectedSlave = 0;
+ }
+
+
+ return ciText;
+ }
+
+ private void ExportContentAudits(XmlElement xn, ContentInfo ci)
{
if (cbxExportAudits.Checked)
{
@@ -2626,57 +2064,6 @@ namespace VEPROMS
}
}
- private void ExportContent(ContentInfo ci, string nodename)
- {
- /*
- ContentID
- Number
- Text
- Type
- FormatID
- Config
- DTS
- UserID
- */
- // strip the link information if we are convertinga the ROs and Transitions to text
- string ciText = (_ConvertROsAndTransitionsToText) ? ItemInfo.StripLinks(ci.Text) : ci.Text;
- string formatFileName = (ci.MyFormat != null) ? ci.MyFormat.Name : "";
-
- MyWriter.WriteStartElement(nodename);
- MyWriter.WriteAttributeString("contentid", ci.ContentID.ToString());
- MyWriter.WriteAttributeString("number", ci.Number);
- MyWriter.WriteAttributeString("text", ciText);
- MyWriter.WriteAttributeString("type", ci.Type.ToString());
- MyWriter.WriteAttributeString("formatid", ci.FormatID.ToString());
- MyWriter.WriteAttributeString("config", ci.Config);
- MyWriter.WriteAttributeString("dts", ci.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- MyWriter.WriteAttributeString("userid", ci.UserID.ToString());
- MyWriter.WriteAttributeString("formatfilename", formatFileName);
-
- if (ci.ContentTransitionCount > 0)
- foreach (TransitionInfo ti in ci.ContentTransitions)
- ExportTransition(ti, "transition");
-
- if (ci.ContentRoUsageCount > 0)
- foreach (RoUsageInfo ri in ci.ContentRoUsages)
- ExportROUsage(ri, "rousage");
-
- if (ci.ContentEntryCount > 0)
- ExportEntry(ci.MyEntry, "entry");
-
- if (ci.ContentGridCount > 0)
- ExportGrid(ci.MyGrid, "grid");
-
- if (ci.ContentImageCount > 0)
- ExportImage(ci.MyImage, "image");
-
- if (ci.ContentPartCount > 0)
- foreach (PartInfo pi in ci.ContentParts)
- ExportPart(pi, ((E_FromTypes)pi.FromType).ToString().ToLower());
-
- MyWriter.WriteEndElement();
- }
-
private void ExportGrid(XmlElement xn, GridInfo gi, string nodename)
{
/*
@@ -2699,7 +2086,8 @@ namespace VEPROMS
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", gi.Config));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", gi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", gi.UserID.ToString()));
-
+ if (_ExportBothConvertedandNot) xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "datawithlinks", gi.Data));
+
//grid audits
ExportGridAudits(xe, gi);
xn.AppendChild(xe);
@@ -2736,31 +2124,6 @@ namespace VEPROMS
}
}
- private void ExportGrid(GridInfo gi, string nodename)
- {
- /*
- ContentID
- Data
- Config
- DTS
- UserID
- */
- string giData = gi.Data;
- if (_ConvertROsAndTransitionsToText)
- {
- giData = giData.Replace("IsRoTable>True", "IsRoTable>False"); // converts a RO table to regular table
- giData = ItemInfo.StripLinks(giData); // converts ROs and Transitions to text
- }
-
- MyWriter.WriteStartElement(nodename);
- MyWriter.WriteAttributeString("contentid", gi.ContentID.ToString());
- MyWriter.WriteAttributeString("data", giData);
- MyWriter.WriteAttributeString("config", gi.Config);
- MyWriter.WriteAttributeString("dts", gi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- MyWriter.WriteAttributeString("userid", gi.UserID.ToString());
- MyWriter.WriteEndElement();
- }
-
private void ExportEntry(XmlElement xn, EntryInfo ei, string nodename)
{
/*
@@ -2809,23 +2172,6 @@ namespace VEPROMS
}
}
- private void ExportEntry(EntryInfo ei, string nodename)
- {
- /*
- ContentID
- DocID
- DTS
- UserID
- */
- MyWriter.WriteStartElement(nodename);
- MyWriter.WriteAttributeString("contentid", ei.ContentID.ToString());
- MyWriter.WriteAttributeString("docid", ei.DocID.ToString());
- MyWriter.WriteAttributeString("dts", ei.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- MyWriter.WriteAttributeString("userid", ei.UserID.ToString());
- ExportDocument(ei.MyDocument, "document");
- MyWriter.WriteEndElement();
- }
-
private void ExportImage(XmlElement xn, ImageInfo ii, string nodename)
{
/*
@@ -2881,28 +2227,6 @@ namespace VEPROMS
}
}
- private void ExportImage(ImageInfo ii, string nodename)
- {
- /*
- ContentID
- ImageType
- FileName
- Data
- Config
- DTS
- UserID
- */
- MyWriter.WriteStartElement(nodename);
- MyWriter.WriteAttributeString("contentid", ii.ContentID.ToString());
- MyWriter.WriteAttributeString("imagetype", ii.ImageType.ToString());
- MyWriter.WriteAttributeString("filename", ii.FileName);
- MyWriter.WriteAttributeString("data", Convert.ToBase64String(ii.Data));
- MyWriter.WriteAttributeString("config", ii.Config);
- MyWriter.WriteAttributeString("dts", ii.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- MyWriter.WriteAttributeString("userid", ii.UserID.ToString());
- MyWriter.WriteEndElement();
- }
-
private void ExportDocument(XmlElement xn, DocumentInfo di, string nodename)
{
/*
@@ -2925,14 +2249,15 @@ namespace VEPROMS
XmlElement xe = xn.OwnerDocument.CreateElement(nodename);
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "docid", di.DocID.ToString()));
- xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "libtitle", libDocTitle)); // di.LibTitle));
+ xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "libtitle", libDocTitle));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "doccontent", Convert.ToBase64String(buf)));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "docascii", di.DocAscii));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", di.Config));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", di.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", di.UserID.ToString()));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "fileextension", di.FileExtension));
-
+ if (_ExportBothConvertedandNot) xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "doccontentwithlinks", Convert.ToBase64String(di.DocContent)));
+
//document audits
ExportDocumentAudits(xe, di);
xn.AppendChild(xe);
@@ -2969,37 +2294,6 @@ namespace VEPROMS
}
}
}
- private void ExportDocument(DocumentInfo di, string nodename)
- {
- /*
- DocID
- LibTitle
- DocContent
- DocAscii
- Config
- DTS
- UserID
- FileExtension
- */
- byte[] buf = di.DocContent;
- string libDocTitle = di.LibTitle;
- if (DocReplace != null && DocReplace.ContainsKey(di.DocID) && _ConvertROsAndTransitionsToText)
- {
- buf = DocReplace[di.DocID];
- libDocTitle = null; // unlink the word section from the library document
- }
-
- MyWriter.WriteStartElement(nodename);
- MyWriter.WriteAttributeString("docid", di.DocID.ToString());
- MyWriter.WriteAttributeString("libtitle", libDocTitle);// di.LibTitle);
- MyWriter.WriteAttributeString("doccontent", Convert.ToBase64String(buf));
- MyWriter.WriteAttributeString("docascii", di.DocAscii);
- MyWriter.WriteAttributeString("config", di.Config);
- MyWriter.WriteAttributeString("dts", di.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- MyWriter.WriteAttributeString("userid", di.UserID.ToString());
- MyWriter.WriteAttributeString("fileextension", di.FileExtension);
- MyWriter.WriteEndElement();
- }
private void ExportROUsage(XmlElement xn, RoUsageInfo ri, string nodename)
{
@@ -3020,39 +2314,11 @@ namespace VEPROMS
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ri.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ri.UserID.ToString()));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rodbid", ri.RODbID.ToString()));
-
- //rousage audits
- ExportROUsageAudits(xe, ri);
+ if (_ExportBothConvertedandNot) SetROLocation(ref xe, ri.ROID, ri.RODbID);
+
xn.AppendChild(xe);
}
- private void ExportROUsageAudits(XmlElement xe, RoUsageInfo ri)
- {
- if (cbxExportAudits.Checked) { };
- }
-
- private void ExportROUsage(RoUsageInfo ri, string nodename)
- {
- /*
- ROUsageID
- ContentID
- ROID
- Config
- DTS
- UserID
- RODbID
- */
- MyWriter.WriteStartElement(nodename);
- MyWriter.WriteAttributeString("rousageid", ri.ROUsageID.ToString());
- MyWriter.WriteAttributeString("contentid", ri.ContentID.ToString());
- MyWriter.WriteAttributeString("roid", ri.ROID);
- MyWriter.WriteAttributeString("config", ri.Config);
- MyWriter.WriteAttributeString("dts", ri.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- MyWriter.WriteAttributeString("userid", ri.UserID.ToString());
- MyWriter.WriteAttributeString("rodbid", ri.RODbID.ToString());
- MyWriter.WriteEndElement();
- }
-
private void ExportPart(XmlElement xn, PartInfo pi, string nodename)
{
/*
@@ -3105,26 +2371,6 @@ namespace VEPROMS
}
}
- private void ExportPart(PartInfo pi, string nodename)
- {
- /*
- ContentID
- FromType
- ItemID
- DTS
- UserID
- */
- MyWriter.WriteStartElement(nodename);
- MyWriter.WriteAttributeString("contentid", pi.ContentID.ToString());
- MyWriter.WriteAttributeString("fromtype", pi.FromType.ToString());
- MyWriter.WriteAttributeString("itemid", pi.ItemID.ToString());
- MyWriter.WriteAttributeString("dts", pi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- MyWriter.WriteAttributeString("userid", pi.UserID.ToString());
- foreach (ItemInfo ii in pi.MyItems)
- ExportItem(ii, pi.PartType.ToString().ToLower());
- MyWriter.WriteEndElement();
- }
-
private void ExportTransition(XmlElement xn, TransitionInfo ti, string nodename)
{
/*
@@ -3149,58 +2395,9 @@ namespace VEPROMS
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ti.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ti.UserID.ToString()));
- //transition audits
- ExportTransitionAudits(xe, ti);
xn.AppendChild(xe);
}
- private void ExportTransitionAudits(XmlElement xe, TransitionInfo ti)
- {
- if (cbxExportAudits.Checked) { };
- }
-
- private void ExportTransition(TransitionInfo ti, string nodename)
- {
- /*
- TransitionID
- FromID
- ToID
- RangeID
- IsRange
- TranType
- Config
- DTS
- UserID
- */
- string folder = string.Empty;
- if (ti.MyItemToID.MyDocVersion != null && ti.MyItemToID.MyDocVersion.MyFolder.Name != MyFolder.Name)
- {
- nodename = "external" + nodename;
- folder = ti.MyItemToID.MyDocVersion.MyFolder.Name;
- }
- else
- {
- nodename = "external" + nodename;
- folder = "UNKNOWN";
- }
-
- MyWriter.WriteStartElement(nodename);
-
- if (folder != string.Empty)
- MyWriter.WriteAttributeString("folder", folder);
-
- MyWriter.WriteAttributeString("transitionid", ti.TransitionID.ToString());
- MyWriter.WriteAttributeString("fromid", ti.FromID.ToString());
- MyWriter.WriteAttributeString("toid", ti.ToID.ToString());
- MyWriter.WriteAttributeString("rangeid", ti.RangeID.ToString());
- MyWriter.WriteAttributeString("isrange", ti.IsRange.ToString());
- MyWriter.WriteAttributeString("trantype", ti.TranType.ToString());
- MyWriter.WriteAttributeString("config", ti.Config);
- MyWriter.WriteAttributeString("dts", ti.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- MyWriter.WriteAttributeString("userid", ti.UserID.ToString());
- MyWriter.WriteEndElement();
- }
-
private void ExportAnnotation(XmlElement xn, AnnotationInfo ai, string nodename)
{
/*
@@ -3217,7 +2414,6 @@ namespace VEPROMS
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "annotationid", ai.AnnotationID.ToString()));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "itemid", ai.ItemID.ToString()));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "typeid", ai.TypeID.ToString()));
- //if(ai.TypeID > 6)
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "typename", ai.MyAnnotationType.Name));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rtftext", ai.RtfText));
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "searchtext", ai.SearchText));
@@ -3263,93 +2459,10 @@ namespace VEPROMS
}
}
- private void ExportAnnotation(AnnotationInfo ai, string nodename)
- {
- /*
- AnnotationID
- ItemID
- TypeID
- RtfText
- SearchText
- Config
- DTS
- UserID
- */
- MyWriter.WriteStartElement(nodename);
- MyWriter.WriteAttributeString("annotationid", ai.AnnotationID.ToString());
- MyWriter.WriteAttributeString("itemid", ai.ItemID.ToString());
- MyWriter.WriteAttributeString("typeid", ai.TypeID.ToString());
- MyWriter.WriteAttributeString("rtftext", ai.RtfText);
- MyWriter.WriteAttributeString("searchtext", ai.SearchText);
- MyWriter.WriteAttributeString("config", ai.Config);
- MyWriter.WriteAttributeString("dts", ai.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
- MyWriter.WriteAttributeString("userid", ai.UserID.ToString());
- MyWriter.WriteEndElement();
- }
-
#endregion
#region Import for Merge
- // jsj 4-29-2016 appears to not be used
- //private void AddExternalTransition(XmlReader xr, XmlDocument xd)
- //{
- // XmlElement xe = xd.CreateElement("transition");
- // XmlAttribute xa = AddAttribute(xd, "folder", xr.GetAttribute("folder"));
- // xe.Attributes.SetNamedItem(xa);
- // xa = AddAttribute(xd, "transitionid", xr.GetAttribute("transitionid"));
- // xe.Attributes.SetNamedItem(xa);
- // xa = AddAttribute(xd, "fromid", xr.GetAttribute("fromid"));
- // xe.Attributes.SetNamedItem(xa);
- // xa = AddAttribute(xd, "toid", xr.GetAttribute("toid"));
- // xe.Attributes.SetNamedItem(xa);
- // xa = AddAttribute(xd, "rangeid", xr.GetAttribute("rangeid"));
- // xe.Attributes.SetNamedItem(xa);
- // xa = AddAttribute(xd, "isrange", xr.GetAttribute("isrange"));
- // xe.Attributes.SetNamedItem(xa);
- // xa = AddAttribute(xd, "trantype", xr.GetAttribute("trantype"));
- // xe.Attributes.SetNamedItem(xa);
- // xa = AddAttribute(xd, "config", xr.GetAttribute("config"));
- // xe.Attributes.SetNamedItem(xa);
- // xa = AddAttribute(xd, "userid", xr.GetAttribute("userid"));
- // xe.Attributes.SetNamedItem(xa);
- // xa = AddAttribute(xd, "dts", xr.GetAttribute("dts"));
- // xe.Attributes.SetNamedItem(xa);
- // xd.SelectSingleNode("externaltransitions/transitions").AppendChild(xe);
- //}
-
- // jsj 4-29-2016 appears to not be used
- //private void AddTransitions(XmlReader xr)
- //{
- // int transitionid = int.Parse(xr.GetAttribute("transitionid"));
- // int fromid = int.Parse(xr.GetAttribute("fromid"));
- // int toid = int.Parse(xr.GetAttribute("toid"));
- // int rangeid = int.Parse(xr.GetAttribute("rangeid"));
- // int isrange = int.Parse(xr.GetAttribute("isrange"));
- // int trantype = int.Parse(xr.GetAttribute("trantype"));
- // string config = xr.GetAttribute("config");
- // string userid = xr.GetAttribute("userid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // string lookfor;
- // if (isrange == 0)
- // lookfor = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid);
- // else
- // lookfor = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid);
- // fromid = Old2NewContent[fromid];
- // toid = Old2NewItem[toid];
- // rangeid = Old2NewItem[rangeid];
- // Content cc = Content.Get(fromid);
- // Transition tt = Transition.MakeTransition(cc, Item.Get(toid), Item.Get(rangeid), isrange, trantype, config, dts, userid);
- // transitionid = tt.TransitionID;
- // string replacewith;
- // if (isrange == 0)
- // replacewith = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid);
- // else
- // replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid);
- // cc.Text = cc.Text.Replace(lookfor, replacewith);
- // cc.Save();
- //}
-
private bool _DidProcessTransitions = false; // B2017-076 keep track whether we procrocessed Transitions
private void AddTransitions(Content content, XmlNode xn)
@@ -3393,7 +2506,6 @@ namespace VEPROMS
else
lookfor = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid);
- //fromid = content.ContentID;
toid = Old2NewItem[toid];
rangeid = Old2NewItem[rangeid];
Transition tt = Transition.MakeTransition(content, Item.Get(toid), Item.Get(rangeid), isrange, trantype, config, dts, userid);
@@ -3559,24 +2671,6 @@ namespace VEPROMS
// B2016-176, B2016-197 - external transitions should be converted to text
forceConvertToText = true;
- //if (TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection != null)
- //{
- // SectionConfig sc = TransitionInfo.Get(tt.TransitionID).MyItemToID.ActiveSection.MyConfig as SectionConfig;
- // forceConvertToText = (sc.SubSection_Edit == "N");
- //}
- //if (!forceConvertToText) //check to see if external with internal format
- //{
- // TransitionInfo tran = TransitionInfo.Get(transitionid);
- // if (tran.MyContent.ContentItems[0].MyProcedure.ItemID != tran.MyItemToID.MyProcedure.ItemID)
- // if (!tran.MyContent.ContentItems[0].ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[tran.TranType].TransMenu.Contains("Proc"))
- // forceConvertToText = true;
- //}
- //if (!forceConvertToText) //check to see if external to different doc version
- //{
- // TransitionInfo tran = TransitionInfo.Get(transitionid);
- // if (tran.MyContent.ContentItems[0].MyDocVersion.VersionID != tran.MyItemToID.MyDocVersion.VersionID)
- // forceConvertToText = true;
- //}
_DidProcessTransitions |= cc.FixTransitionText(TransitionInfo.Get(tt.TransitionID), forceConvertToText); // B2017-076 FixTransitionText will tell us if transitions were processed/changed
// B2017=003 make sure any grid changes are saved.
// done here because FixTransitionText() could update the transitions in the grid
@@ -3598,32 +2692,12 @@ namespace VEPROMS
private XmlDocument PendingTransitions;
private RODb MyRODb = null;
- // jsj 4-29-2016 appears to not be used
- //private Folder AddFolder(Folder folder, XmlReader xr)
- //{
- // Old2NewItem = new Dictionary();
- // Old2NewContent = new Dictionary();
- // Old2NewLibDoc = new Dictionary();
- // string title = xr.GetAttribute("title");
- // string name = xr.GetAttribute("name");
- // string shortname = xr.GetAttribute("shortname");
- // string usrid = xr.GetAttribute("usrid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // string formatid = xr.GetAttribute("formatid");
- // string formatfilename = xr.GetAttribute("formatfilename"); //Bug fix B2016-103 the formatid in an Export file may not match the formatid where you are importing to
- // Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid),formatfilename);
- // folder = Folder.MakeFolder(folder, folder.MyConnection, name, title, shortname, format, null, dts, usrid);
- // //f.Save();
- // return folder;
- //}
-
private Folder AddFolder(Folder p, XmlDocument xd, string name)
{
lblImportStatus.Text = "Creating Folder...";
Application.DoEvents();
string title = xd.DocumentElement.Attributes.GetNamedItem("title").InnerText;
- //string name = xd.DocumentElement.Attributes.GetNamedItem("name").InnerText;
string shortname = xd.DocumentElement.Attributes.GetNamedItem("shortname").InnerText;
string usrid = xd.DocumentElement.Attributes.GetNamedItem("usrid").InnerText;
DateTime dts = DateTime.Parse(xd.DocumentElement.Attributes.GetNamedItem("dts").InnerText);
@@ -3662,22 +2736,6 @@ namespace VEPROMS
}
}
- private DocVersion AddDocVersion(Folder f, XmlReader xr)
- {
- int versiontype = int.Parse(xr.GetAttribute("versiontype"));
- string name = xr.GetAttribute("name");
- string config = xr.GetAttribute("config");
- string userid = xr.GetAttribute("userid");
- DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- string formatid = xr.GetAttribute("formatid");
- string formatfilename = xr.GetAttribute("formatfilename"); //Bug fix B2016-103 the formatid in an Export file may not match the formatid where you are importing to
- Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid), formatfilename);
-
- DocVersion dv = DocVersion.MakeDocVersion(f, versiontype, name, null, null, format, config, dts, userid);
-
- return dv;
- }
-
private void AddAnnotationTypes(XmlDocument xd)
{
XmlNodeList nl = xd.SelectNodes("folder/annotationtypes/annotationtype");
@@ -3724,31 +2782,6 @@ namespace VEPROMS
return DocVersionInfo.Get(dv.VersionID);
}
- // jsj 4-29-2016 appears to not be used
- //private Dictionary GetROFstData(XmlReader xr)
- //{
- // Dictionary rv = new Dictionary();
- // rv.Add("rolookup", xr.GetAttribute("rolookup"));
- // rv.Add("config", xr.GetAttribute("config"));
- // rv.Add("userid", xr.GetAttribute("userid"));
- // rv.Add("dts", xr.GetAttribute("dts"));
- // return rv;
- //}
-
- // jsj 4-29-2016 appears to not be used
- //private ROFst AddROFst(Dictionary dic)
- //{
- // byte[] rolookup = Convert.FromBase64String(dic["rolookup"]);
- // string config = dic["config"];
- // string userid = dic["userid"];
- // DateTime dts = DateTime.Parse(dic["dts"]);
- // ROFst rv = null;
- // rv = ROFst.GetByRODbID_DTS(MyRODb.RODbID, dts); //MyRODb.DTS);
- // if (rv == null)
- // rv = ROFst.MakeROFst(MyRODb, rolookup, config, dts, userid);
- // return rv;
- //}
-
private ROFst AddROFst(XmlNode xrofst)
{
lblImportStatus.Text = "Creating ROFst...";
@@ -3840,24 +2873,6 @@ namespace VEPROMS
}
}
- // jsj 4-29-2016 appears to not be used
- //private RODb AddRODb(XmlReader xr)
- //{
- // oldRODbID = int.Parse(xr.GetAttribute("rodbid"));
- // string roname = xr.GetAttribute("roname");
- // string folderpath = xr.GetAttribute("folderpath");
- // string dbconnectionstring = xr.GetAttribute("dbconnectionstring");
- // string config = xr.GetAttribute("config");
- // string userid = xr.GetAttribute("userid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // RODb rv = null;
- // rv = RODb.GetByFolderPath(folderpath);
- // if (rv == null)
- // rv = RODb.MakeRODb(roname, folderpath, dbconnectionstring, config, dts, userid);
- // newRODbID = rv.RODbID;
- // return rv;
- //}
-
private RODb AddRODb(XmlNode xrodb)
{
lblImportStatus.Text = "Creating RODb...";
@@ -3877,15 +2892,11 @@ namespace VEPROMS
{
// create a list of the RO databases currently in the database
List roDbNameList = new List();
- RODbInfoList rolist = RODbInfoList.Get();
+ using (RODbInfoList rolist = RODbInfoList.Get())
+ {
+ roDbNameList.AddRange(rolist.Where(rodbinfo => !roDbNameList.Contains(rodbinfo.ROName)).Select(rodbinfo => rodbinfo.ROName));
+ }
- foreach (RODbInfo rodbinfo in rolist)
- {
- if (!roDbNameList.Contains(rodbinfo.ROName))
- roDbNameList.Add(rodbinfo.ROName);
- }
-
- rolist.Dispose();
int cnt = 0;
string roNameNew = roname;
@@ -3903,38 +2914,6 @@ namespace VEPROMS
return rv;
}
- // jsj 4-29-2016 appears to not be used
- //private int GetProcedureData(XmlReader xr)
- //{
- // return int.Parse(xr.GetAttribute("itemid"));
- //}
-
- // jsj 4-29-2016 appears to not be used
- //private ItemInfo AddProcedure(XmlReader xr, DocVersion dv, ItemInfo procInfo, int oldid)
- //{
- // DocVersionInfo dvInfo = DocVersionInfo.Get(dv.VersionID);
- // string number = xr.GetAttribute("number");
- // string text = xr.GetAttribute("text");
- // int proctype = int.Parse(xr.GetAttribute("type"));
- // string formatid = xr.GetAttribute("formatid");
- // string config = xr.GetAttribute("config");
- // string userid = xr.GetAttribute("userid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // Procedure p = Procedure.MakeProcedure(dvInfo, procInfo, number, text, proctype);
- // p.DTS = dts;
- // p.UserID = userid;
- // string formatfilename = xr.GetAttribute("formatfilename"); //Bug fix B2016-103 the formatid in an Export file may not match the formatid where you are importing to
- // if (formatid != string.Empty)
- // p.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid),formatfilename);
- // p.MyContent.Config = config;
- // p.MyContent.DTS = dts;
- // p.MyContent.UserID = userid;
- // p.Save();
- // Old2NewItem.Add(oldid, p.ItemID);
- // Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), p.MyContent.ContentID);
- // procInfo = ProcedureInfo.Get(p.ItemID);
- // return procInfo;
- //}
private ProcedureInfo AddProcedure(XmlNode xn, DocVersionInfo dvInfo, ProcedureInfo procInfo)
{
pbImportProcedure.PerformStep();
@@ -4000,27 +2979,6 @@ namespace VEPROMS
return procInfo;
}
- // jsj 2016Feb16 - This appears to not be used
- //private void AddROUsage(XmlReader xr)
- //{
- // int contentid = int.Parse(xr.GetAttribute("contentid"));
- // contentid = Old2NewContent[contentid];
- // Content content = Content.Get(contentid);
- // string rousageid = xr.GetAttribute("rousageid");
- // string roid = xr.GetAttribute("roid");
- // string config = xr.GetAttribute("config");
- // string userid = xr.GetAttribute("userid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // RoUsage rou = RoUsage.MakeRoUsage(content, roid, config, dts, userid, MyRODb);
- // rou.Save();
- // string lookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString());
- // string replaceWith = (cbxCvrtROsToText.Checked) ? "" : string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString());
- // if (lookFor != replaceWith)
- // {
- // content.Text = content.Text.Replace(lookFor, replaceWith);
- // content.Save();
- // }
- //}
private string GetMyPrefix(string text, int start, int lastIndex)
{
string defPrefix = text.Substring(start - 3, 3);
@@ -4143,10 +3101,7 @@ namespace VEPROMS
txtRO = txtRO.Replace(@"\u8595?", "\x19"); // Down Arrow - changes to \xd6
Item myitem = content.ContentItems[0].MyItem; // The Using statement caused the content.text to disappear
- //using (Item myitem = content.ContentItems[0].MyItem) // so that myitem does not stay in cache
- //{
Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", string.Format("RO value ({0}) converted to text", txtRO), null);
- //}
_DidConvertROsToText |= true;
}
@@ -4193,7 +3148,7 @@ namespace VEPROMS
if (roval == "?")
{
RoUsageInfo roui = RoUsageInfo.Get(int.Parse(rousageid));
- content.FixContentText(roui, roval, 0, MyDocVersion.DocVersionAssociations[0].MyROFst, null, rousageid); // + " " + roid);
+ content.FixContentText(roui, roval, 0, MyDocVersion.DocVersionAssociations[0].MyROFst, null, rousageid);
_DidConvertROsToText |= true; // B2016-225 (follow through) add annotation when RO is converted to text
_DidProcessROs = true; // B2017-076 flag that ROs where processed
}
@@ -4226,7 +3181,7 @@ namespace VEPROMS
bool hasNewROID = (content.MyGrid.Data.Contains(glookFor));
if (hasNewROID)
content.MyGrid.Data = content.MyGrid.Data.Replace(glookFor, greplaceWith);
- else if (!hasNewROID && glookFor.Contains("0041") && glookFor.Contains("FFFF"))
+ else if (glookFor.Contains("0041") && glookFor.Contains("FFFF"))
{
string newGlookFor = glookFor;
newGlookFor = newGlookFor.Replace("0041", "0000");
@@ -4247,20 +3202,6 @@ namespace VEPROMS
}
}
- // jsj 4-29-2016 appears to not be used
- //private void AddAnnotation(XmlReader xr)
- //{
- // int itemid = int.Parse(xr.GetAttribute("itemid"));
- // itemid = Old2NewItem[itemid];
- // Item itm = Item.Get(itemid);
- // int typeid = int.Parse(xr.GetAttribute("typeid"));
- // string rtftext = xr.GetAttribute("rtftext");
- // string searchtext = xr.GetAttribute("searchtext");
- // string config = xr.GetAttribute("config");
- // string userid = xr.GetAttribute("userid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // Annotation ann = Annotation.MakeAnnotation(itm, AnnotationType.Get(typeid), rtftext, searchtext, config, dts, userid);
- //}
private void AddImage(Content content, XmlNode xc)
{
XmlNode xn = xc.SelectSingleNode("image");
@@ -4353,30 +3294,6 @@ namespace VEPROMS
prevInfo = AddTable(nd, parentInfo, prevInfo);
}
- // jsj 2016Feb16 - This appears to not be used
- //private ItemInfo AddTable(XmlReader xr, ItemInfo parentInfo, ItemInfo prevInfo, int oldid)
- //{
- // string number = xr.GetAttribute("number");
- // string text = xr.GetAttribute("text");
- // int steptype = int.Parse(xr.GetAttribute("type"));
- // string formatid = xr.GetAttribute("formatid");
- // string config = xr.GetAttribute("config");
- // string userid = xr.GetAttribute("userid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // Step step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Table);
- // step.DTS = dts;
- // step.UserID = userid;
- // if (formatid != string.Empty)
- // step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid));
- // step.MyContent.Config = config;
- // step.MyContent.DTS = dts;
- // step.MyContent.UserID = userid;
- // step.Save();
- // Old2NewItem.Add(oldid, step.ItemID);
- // Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), step.MyContent.ContentID);
- // prevInfo = StepInfo.Get(step.ItemID);
- // return prevInfo;
- //}
private ItemInfo AddTable(XmlNode xn, ItemInfo parentInfo, ItemInfo prevInfo)
{
pbImportStep.PerformStep();
@@ -4465,31 +3382,6 @@ namespace VEPROMS
prevInfo = AddStep(nd, parentInfo, prevInfo);
}
- // jsj 4-29-2016 appears to not be used
- //private ItemInfo AddStep(XmlReader xr, ItemInfo parentInfo, ItemInfo prevInfo, int oldid)
- //{
- // string number = xr.GetAttribute("number");
- // string text = xr.GetAttribute("text");
- // int steptype = int.Parse(xr.GetAttribute("type"));
- // string formatid = xr.GetAttribute("formatid");
- // string config = xr.GetAttribute("config");
- // string userid = xr.GetAttribute("userid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // Step step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Step);
- // step.DTS = dts;
- // step.UserID = userid;
- // string formatfilename = xr.GetAttribute("formatfilename"); //Bug fix B2016-103 the formatid in an Export file may not match the formatid where you are importing to
- // if (formatid != string.Empty)
- // step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid),formatfilename);
- // step.MyContent.Config = config;
- // step.MyContent.DTS = dts;
- // step.MyContent.UserID = userid;
- // step.Save();
- // Old2NewItem.Add(oldid, step.ItemID);
- // Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), step.MyContent.ContentID);
- // prevInfo = StepInfo.Get(step.ItemID);
- // return prevInfo;
- //}
private ItemInfo AddStep(XmlNode xn, ItemInfo parentInfo, ItemInfo prevInfo)
{
pbImportStep.PerformStep();
@@ -4590,32 +3482,6 @@ namespace VEPROMS
prevInfo = AddSupInfo(nd, parentInfo, prevInfo);
}
- // jsj 4-29-2016 appears to not be used
- //private ItemInfo AddRNO(XmlReader xr, ItemInfo parentInfo, ItemInfo prevInfo, int oldid)
- //{
- // string number = xr.GetAttribute("number");
- // string text = xr.GetAttribute("text");
- // int steptype = int.Parse(xr.GetAttribute("type"));
- // string formatid = xr.GetAttribute("formatid");
- // string config = xr.GetAttribute("config");
- // string userid = xr.GetAttribute("userid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // Step step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.RNO);
- // step.DTS = dts;
- // step.UserID = userid;
- // string formatfilename = xr.GetAttribute("formatfilename"); //Bug fix B2016-103 the formatid in an Export file may not match the formatid where you are importing to
- // if (formatid != string.Empty)
- // step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename);
- // step.MyContent.Config = config;
- // step.MyContent.DTS = dts;
- // step.MyContent.UserID = userid;
- // step.Save();
- // Old2NewItem.Add(oldid, step.ItemID);
- // Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), step.MyContent.ContentID);
- // prevInfo = StepInfo.Get(step.ItemID);
- // return prevInfo;
- //}
-
private ItemInfo AddRNO(XmlNode xn, ItemInfo parentInfo, ItemInfo prevInfo)
{
pbImportStep.PerformStep();
@@ -4730,32 +3596,6 @@ namespace VEPROMS
prevInfo = AddNote(nd, parentInfo, prevInfo);
}
- // jsj 4-29-2016 appears to not be used
- //private ItemInfo AddNote(XmlReader xr, ItemInfo parentInfo, ItemInfo prevInfo, int oldid)
- //{
- // string number = xr.GetAttribute("number");
- // string text = xr.GetAttribute("text");
- // int steptype = int.Parse(xr.GetAttribute("type"));
- // string formatid = xr.GetAttribute("formatid");
- // string config = xr.GetAttribute("config");
- // string userid = xr.GetAttribute("userid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // Step step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Note);
- // step.DTS = dts;
- // step.UserID = userid;
- // string formatfilename = xr.GetAttribute("formatfilename"); //Bug fix B2016-103 the formatid in an Export file may not match the formatid where you are importing to
- // if (formatid != string.Empty)
- // step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename);
- // step.MyContent.Config = config;
- // step.MyContent.DTS = dts;
- // step.MyContent.UserID = userid;
- // step.Save();
- // Old2NewItem.Add(oldid, step.ItemID);
- // Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), step.MyContent.ContentID);
- // prevInfo = StepInfo.Get(step.ItemID);
- // return prevInfo;
- //}
-
private ItemInfo AddNote(XmlNode xn, ItemInfo parentInfo, ItemInfo prevInfo)
{
pbImportStep.PerformStep();
@@ -4824,32 +3664,6 @@ namespace VEPROMS
prevInfo = AddCaution(nd, parentInfo, prevInfo);
}
- // jsj 4-29-2016 appears to not be used
- //private ItemInfo AddCaution(XmlReader xr, ItemInfo parentInfo, ItemInfo prevInfo, int oldid)
- //{
- // string number = xr.GetAttribute("number");
- // string text = xr.GetAttribute("text");
- // int steptype = int.Parse(xr.GetAttribute("type"));
- // string formatid = xr.GetAttribute("formatid");
- // string config = xr.GetAttribute("config");
- // string userid = xr.GetAttribute("userid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // Step step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Caution);
- // step.DTS = dts;
- // step.UserID = userid;
- // string formatfilename = xr.GetAttribute("formatfilename"); //Bug fix B2016-103 the formatid in an Export file may not match the formatid where you are importing to
- // if (formatid != string.Empty)
- // step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename);
- // step.MyContent.Config = config;
- // step.MyContent.DTS = dts;
- // step.MyContent.UserID = userid;
- // step.Save();
- // Old2NewItem.Add(oldid, step.ItemID);
- // Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), step.MyContent.ContentID);
- // prevInfo = StepInfo.Get(step.ItemID);
- // return prevInfo;
- //}
-
private ItemInfo AddCaution(XmlNode xn, ItemInfo parentInfo, ItemInfo prevInfo)
{
pbImportStep.PerformStep();
@@ -4918,39 +3732,6 @@ namespace VEPROMS
prevInfo = AddSection(nd, parentInfo, prevInfo);
}
- private Dictionary GetSectionData(XmlReader xr)
- {
- Dictionary rv = new Dictionary();
- rv.Add("itemid", xr.GetAttribute("itemid"));
- return rv;
- }
-
- // js j4-29-2016 appears to not be used
- //private ItemInfo AddSection(XmlReader xr, ItemInfo parentInfo, ItemInfo prevInfo, int oldid)
- //{
- // string number = xr.GetAttribute("number");
- // string text = xr.GetAttribute("text");
- // int sectiontype = int.Parse(xr.GetAttribute("type"));
- // string formatid = xr.GetAttribute("formatid");
- // string config = xr.GetAttribute("config");
- // string userid = xr.GetAttribute("userid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // Section sect = Section.MakeSection(parentInfo, prevInfo, number, text, sectiontype);
- // sect.DTS = dts;
- // sect.UserID = userid;
- // string formatfilename = xr.GetAttribute("formatfilename"); //Bug fix B2016-103 the formatid in an Export file may not match the formatid where you are importing to
- // if (formatid != string.Empty)
- // sect.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid), formatfilename);
- // sect.MyContent.Config = config;
- // sect.MyContent.DTS = dts;
- // sect.MyContent.UserID = userid;
- // sect.Save();
- // Old2NewItem.Add(oldid, sect.ItemID);
- // Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), sect.MyContent.ContentID);
- // prevInfo = SectionInfo.Get(sect.ItemID);
- // return prevInfo;
- //}
-
private ItemInfo AddSection(XmlNode xn, ItemInfo parentInfo, ItemInfo prevInfo)
{
pbImportSection.PerformStep();
@@ -5034,19 +3815,6 @@ namespace VEPROMS
}
}
- // jsj 2016Feb16 - This appears to not be used
- //private void AddGrid(XmlReader xr)
- //{
- // int contentid = int.Parse(xr.GetAttribute("contentid"));
- // contentid = Old2NewContent[contentid];
- // Content content = Content.Get(contentid);
- // string data = xr.GetAttribute("data");
- // string config = xr.GetAttribute("config");
- // string userid = xr.GetAttribute("userid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // Grid gg = Grid.MakeGrid(content, data, config, dts, userid);
- //}
-
private void AddGrid(Content content, XmlNode xc)
{
XmlNode nd = xc.SelectSingleNode("grid");
@@ -5078,14 +3846,13 @@ namespace VEPROMS
string newvalue = "";
// if it's an ro within a table, need to process into an flex grid to save the grid data:
string findLinkXml = @"<START\].*?\[END>";
- //string lookForXml = string.Format(@"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}} \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:{0} .*?\[END>$", rousageid);
string lookForXml = @"^<START\](\\[^v \\]+)*\\v0(\\[^v '?{{}}\\]+)*( |\\u[0-9]{{1,4}}?|\\'[0-9a-fA-F]{{2}}|\\[{{}}~])(.*?)(\\[^v'?{{}} \\]+)*\\v(\\[^v \\]+)* #Link:ReferencedObject:.*?\[END>$";
MatchCollection msg = Regex.Matches(data, findLinkXml);
int nmsg = msg.Count;
for (int i = nmsg - 1; i >= 0; i--)
{
Match mmg = msg[i];
- Match mg = Regex.Match(mmg.Value, lookForXml);// Regex.Match(MyGrid.Data, lookForXml);
+ Match mg = Regex.Match(mmg.Value, lookForXml);
if (mg != null && mg.Groups.Count > 1)
{
int myIndex = mg.Groups[4].Index + mmg.Index;
@@ -5130,17 +3897,6 @@ namespace VEPROMS
content.MyGrid = gg;
}
-
- // jsj 4-29-2016 appears to not be used
- //private Dictionary AddEntry(XmlReader xr)
- //{
- // Dictionary dic = new Dictionary();
- // dic.Add("contentid", xr.GetAttribute("contentid"));
- // dic.Add("dts", xr.GetAttribute("dts"));
- // dic.Add("userid", xr.GetAttribute("userid"));
- // return dic;
- //}
-
private void AddEntry(Content content, XmlNode xc)
{
XmlNode nd = xc.SelectSingleNode("entry");
@@ -5152,25 +3908,7 @@ namespace VEPROMS
ee.Save();
}
}
- // jsj 2016Feb16 - This appears to not be used
- //private void AddDocument(XmlReader xr, Dictionary dic)
- //{
- // string libtitle = xr.GetAttribute("libtitle");
- // byte[] doccontent = Convert.FromBase64String(xr.GetAttribute("doccontent"));
- // string docascii = xr.GetAttribute("docascii");
- // string config = xr.GetAttribute("config");
- // string userid = xr.GetAttribute("userid");
- // DateTime dts = DateTime.Parse(xr.GetAttribute("dts"));
- // string fileextension = xr.GetAttribute("fileextension");
- // Document dd = Document.MakeDocument(libtitle, doccontent, docascii, config, dts, userid, fileextension);
- // int contentid = int.Parse(dic["contentid"]);
- // contentid = Old2NewContent[contentid];
- // Content content = Content.Get(contentid);
- // dts = DateTime.Parse(dic["dts"]);
- // userid = dic["userid"];
- // Entry ee = Entry.MakeEntry(content, dd, dts, userid);
- //}
-
+
// B2019-035 This is called only once to get the existing library document info.
// when it was in the AddDocument() logic, it would use up (and not free up) memory each time
// a Word section was added during the import
@@ -5252,5 +3990,32 @@ namespace VEPROMS
{
this.Close();
}
+
+ //unset the unit (SelectedSlave)
+ private void RemoveUnit_OnClose(object sender, EventArgs e)
+ {
+ if (MyProcedure != null)
+ {
+ MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
+ MyProcedure.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
+ }
+ if (MyDocVersion != null)
+ {
+ MyDocVersion.DocVersionConfig.SelectedSlave = 0;
+
+ foreach (ItemInfo proc in MyDocVersion.Procedures)
+ proc.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = _UnitIndex;
+ }
+ if (MyFolder != null)
+ {
+ foreach (DocVersionInfo docver in MyFolder.FolderDocVersions)
+ {
+ docver.DocVersionConfig.SelectedSlave = _UnitIndex;
+
+ foreach (ItemInfo proc in docver.Procedures)
+ proc.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = _UnitIndex;
+ }
+ }
+ }
}
}
diff --git a/PROMS/VEPROMS User Interface/dlgExportImportEP.cs b/PROMS/VEPROMS User Interface/dlgExportImportEP.cs
new file mode 100644
index 00000000..07151940
--- /dev/null
+++ b/PROMS/VEPROMS User Interface/dlgExportImportEP.cs
@@ -0,0 +1,347 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Xml;
+using VEPROMS.CSLA.Library;
+
+namespace VEPROMS
+{
+ //C2025-024 Electronic Procedures - Phase 2 (PROMS XML output)
+ //class inherits from normal import/export form
+ //then adds additional functionality
+#pragma warning disable S101 // Types should be named in PascalCase
+ public partial class dlgExportImportEP : dlgExportImport
+#pragma warning restore S101 // Types should be named in PascalCase
+ {
+ private readonly AnnotationTypeInfo _AnnotationType;
+ private readonly string multiseparator = ",";
+
+ private static Regex _ROAccPageTokenPattern = new Regex("[<][^<>-]+-[^<>]+[>]");
+
+ public dlgExportImportEP(string mode, FolderInfo folderInfo, frmVEPROMS myFrmVEPROMS, int annotationTypeId, int unitIndex = 0) : base(mode, folderInfo, myFrmVEPROMS, (E_UCFImportOptions)0, unitIndex)
+ {
+ _AnnotationType = AnnotationTypeInfo.Get(annotationTypeId);
+ _ExportBothConvertedandNot = true;
+ DocReplace = new Dictionary();
+ FormClosed += OnClose;
+ Text = $"{mode} Electronic Procedure ({_AnnotationType.Name}) Dialog for {folderInfo.Name}";
+ }
+ public dlgExportImportEP(string mode, DocVersionInfo docVersionInfo, frmVEPROMS myFrmVEPROMS, int annotationTypeId, int unitIndex = 0) : base(mode, docVersionInfo, myFrmVEPROMS, (E_UCFImportOptions)0, unitIndex)
+ {
+ _AnnotationType = AnnotationTypeInfo.Get(annotationTypeId);
+ _ExportBothConvertedandNot = true;
+ DocReplace = new Dictionary();
+ FormClosed += OnClose;
+ Text = $"{mode} Electronic Procedure ({_AnnotationType.Name}) Dialog for {docVersionInfo.Name} of {docVersionInfo.MyFolder.Name}";
+ }
+ public dlgExportImportEP(string mode, ProcedureInfo procedureInfo, frmVEPROMS myFrmVEPROMS, int annotationTypeId, int unitIndex = 0) : base(mode, procedureInfo, myFrmVEPROMS, (E_UCFImportOptions)0, unitIndex)
+ {
+ _AnnotationType = AnnotationTypeInfo.Get(annotationTypeId);
+ _ExportBothConvertedandNot = true;
+ DocReplace = new Dictionary();
+ FormClosed += OnClose;
+ Text = $"{mode} Electronic Procedure ({_AnnotationType.Name}) Dialog for {procedureInfo.DisplayNumber}";
+ }
+
+ //Overridden function to handle export of EP data
+ protected override void ExportEPAnnotationInfo(XmlElement xe, ItemInfo ii)
+ {
+ if (_UnitIndex > 0)
+ {
+ ii.MyDocVersion.DocVersionConfig.SelectedSlave = _UnitIndex;
+ ii.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = _UnitIndex;
+ }
+
+ //switch to handle customizations for different formats
+ switch (ii.ActiveFormat.PlantFormat.EPFormatFiles.Find(x => x.AnnotationTypeID == _AnnotationType.TypeID)?.Name)
+ {
+ default:
+ ExportEPAnnotationInfo_Default(xe, ii);
+ break;
+ }
+
+ ii.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
+ ii.MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
+
+ }
+
+ //default export of EP Data
+ private void ExportEPAnnotationInfo_Default(XmlElement xe, ItemInfo ii)
+ {
+ //Add tab text to item
+ string steptab = Volian.Print.Library.PDFReport.BuildStepTab(ii);
+ xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "StepTab", steptab));
+
+ //Add db sequence to item
+ string dbsequence = dbSeq(ii);
+ xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dbsequence", dbsequence));
+
+ //get first transition in item and add it as an xml element
+ if (ii.MyContent.ContentTransitionCount > 0)
+ {
+ TransitionInfo ct = ii.MyContent.ContentTransitions[0];
+ xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "TransitionToItemID", ct.ToID.ToString()));
+ xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "TransitionTodbsequence", dbSeq(ct.ToID)));
+ }
+
+ //export EP annotation details under an EPInfo node
+ if (ii.ItemAnnotations != null)
+ {
+ XmlElement xepinfo = xe.OwnerDocument.CreateElement("EPInfo");
+
+ EPFields myEPFields = ii.GetValidEPFields(_AnnotationType.TypeID);
+ ROFSTLookup lookup = ii.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(ii.MyDocVersion);
+ bool epexportblank = ii.EPexportblank(_AnnotationType.TypeID); //should blank xml elements export?
+
+ //grab the current RO db so will know location of RO files and default graphics ext.
+ using (RODbInfo myRODB = (RODbInfoList.Get()).FirstOrDefault(x => x.RODbID == ii.MyDocVersion.DocVersionAssociations[0].MyROFst.RODbID))
+ {
+ //For each annotation in the item that is of the current EP Annotation type
+ foreach (var EPAnnotation in ii.ItemAnnotations.Where(x => x.TypeID == _AnnotationType.TypeID))
+ {
+ var EPAnnotationConfig = new AnnotationConfig(EPAnnotation.Config);
+
+ XmlElement xepdetails = xe.OwnerDocument.CreateElement("Details");
+ //include the annotation ID for reference
+ xepdetails.Attributes.SetNamedItem(AddAttribute(xepdetails.OwnerDocument, "AnnotationID", EPAnnotation.AnnotationID.ToString()));
+
+ //loop through each EP Field - name the xml elements the EP.name
+ foreach (EPField EP in myEPFields)
+ {
+ string val = EPAnnotationConfig.GetValue("EP", EP.name);
+
+ if (epexportblank || !string.IsNullOrEmpty(val))
+ {
+
+ if (_UnitIndex != 0)
+ {
+ val = DisplayText.ResolveUnitSpecific(ii.MyDocVersion, val);
+ }
+
+ XmlElement xindivid = xe.OwnerDocument.CreateElement(EP.name);
+
+ //need to resolve ROs ROSingle, ROMulti, in text
+ //get values
+ switch (EP.type.ToLower())
+ {
+ case "text":
+
+ //for text, check if any embedded ROs
+ //if none, set the xml element to the text
+ //otherwise resolve the ROs
+ MatchCollection matches = _ROAccPageTokenPattern.Matches(val);
+ if (matches.Count == 0)
+ {
+ xindivid.InnerText = val;
+ }
+ else
+ {
+ //resolve ROs
+ //text ROs will replace the AccID key in the text
+ //for binary objects like images,
+ //we will keep the AccID in the text and output the binary as a separate child
+ //XML element with the same xml name as the AccID
+ foreach (Match m in matches)
+ {
+ ROFSTLookup.rochild roc = lookup.GetROChildByAccPageID(m.Groups[0].Value);
+
+ // Exclude replacing Images since are binary - for those, add a sub item
+ if (Enumerable.Range(8, 15).Contains(roc.type))
+ {
+ xindivid.InnerText = val;
+
+ XmlElement xroid = AddGraphic(xindivid, m.Groups[0].Value, roc, myRODB, roc.type != 8);
+
+ xindivid.AppendChild(xroid);
+ }
+ else if (!string.IsNullOrEmpty(roc.value))
+ {
+ bool convertCaretToDeltaSymbol = (ii.ActiveSection != null) && ii.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta;
+
+ string rocvalue = roc.value.Replace("`", "\xB0");
+ rocvalue = rocvalue.Replace("\xF8", "\xB0");
+ rocvalue = rocvalue.Replace("\x7F", "\x394"); //delta
+ if (convertCaretToDeltaSymbol) rocvalue = rocvalue.Replace("^", "\x394"); // delta
+ val = val.Replace($"{m.Groups[0].Value}", rocvalue);
+ xindivid.InnerText = val;
+ }
+ }
+ }
+ break;
+ case "rosingle":
+ //Get the output columns from the EPFormatFile
+ //set the "Item" nodes value = to those resolved items
+ //separated by multiseparator
+ XmlElement xindivid_rosingle = xindivid.OwnerDocument.CreateElement("Item");
+ xindivid_rosingle.Attributes.SetNamedItem(AddAttribute(xindivid_rosingle.OwnerDocument, "ROID", val));
+
+ //add values specified in EP input list
+ List ro_single_tmp = EP.getROValuesList(EPAnnotation, val);
+ xindivid_rosingle.InnerText = String.Join(multiseparator, ro_single_tmp.ToArray());
+
+ //if image, add location and binary of image
+ // - images are type 8
+ // but if multiple return values could combine
+ // for example an text (1) + image (8) would be 9
+ ROFSTLookup.rochild roc_single = lookup.GetRoChild(val);
+ if (Enumerable.Range(8, 15).Contains(roc_single.type))
+ {
+ XmlElement xroid = AddGraphic(xindivid, val, roc_single, myRODB, roc_single.type != 8);
+ xindivid_rosingle.AppendChild(xroid);
+ }
+
+ xindivid.AppendChild(xindivid_rosingle);
+ break;
+ case "romulti":
+ //Get the output columns from the EPFormatFile
+ //create an "Item" subnode for each selected RO
+ //set the nodes value = to those resolved items
+ //separated by multiseparator
+ foreach (string ival in val.Split(multiseparator.ToCharArray()))
+ {
+ XmlElement xindivid_romulti = xindivid.OwnerDocument.CreateElement("Item");
+ xindivid_romulti.Attributes.SetNamedItem(AddAttribute(xindivid_romulti.OwnerDocument, "ROID", ival));
+
+ //add values specified in EP input list
+ List ro_multi_tmp = EP.getROValuesList(EPAnnotation, ival);
+ xindivid_romulti.InnerText = String.Join(multiseparator, ro_multi_tmp.ToArray());
+
+ //if image, add location and binary of image
+ // - images are type 8
+ // but if multiple return values could combine
+ // for example an text (1) + image (8) would be 9
+ ROFSTLookup.rochild roc_multi = lookup.GetRoChild(ival);
+ if (Enumerable.Range(8, 15).Contains(roc_multi.type))
+ {
+ XmlElement xroid = AddGraphic(xindivid, ival, roc_multi, myRODB, roc_multi.type != 8);
+ xindivid_romulti.AppendChild(xroid);
+ }
+
+ xindivid.AppendChild(xindivid_romulti);
+ }
+ break;
+ case "tableinput":
+ xindivid.InnerText = val;
+ break;
+ default:
+ xindivid.InnerText = val;
+ break;
+ }
+ xepdetails.AppendChild(xindivid);
+ }
+ }
+ xepinfo.AppendChild(xepdetails);
+ }
+
+ }
+
+ xe.AppendChild(xepinfo);
+ }
+
+ }
+
+ //return a db sequence string from an Item ID
+ private string dbSeq(int itemID)
+ {
+ using (ItemInfo ii = ItemInfo.Get(itemID))
+ {
+ return dbSeq(ii);
+ }
+ }
+
+ //return a db sequence string from an ItemInfo
+ private string dbSeq(ItemInfo ii) => $"{((FolderInfo)ii.MyDocVersion.ActiveParent).Name}:{ii.MyProcedure.DisplayNumber} {ii.MyProcedure.DisplayText}:{ii.DBSequence}";
+
+ //For Exporting an RO that is an image
+ //returns the Location and FileName of the RO Image
+ private string GetROImageFileLocation(ROFSTLookup.rochild roc, RODbInfo rodb, bool isMulti)
+ {
+ string rodbpath = rodb.FolderPath;
+
+ string rocval = roc.value;
+ if (rocval == null) rocval = Array.Find(roc.children, x => x.value.Contains('.')).value;
+
+ if (rocval == null) return "";
+ string imgname;
+ if (isMulti)
+ {
+ imgname = rocval.Substring(rocval.IndexOf(' ') + 1, rocval.IndexOf("\r\n") - rocval.IndexOf(' ') - 1);
+ }
+ else
+ {
+ imgname = rocval.Substring(0, rocval.IndexOf('\n'));
+ }
+ int thedot = imgname.LastIndexOf('.');
+ string fname = imgname;
+ if (thedot == -1 || (thedot != (imgname.Length - 4)))
+ {
+ RODbConfig roDbCfg = new RODbConfig(rodb.Config);
+ fname += string.Format(".{0}", roDbCfg.GetDefaultGraphicExtension());
+ }
+
+ string imgfile = Path.Combine(rodbpath, fname);
+ return imgfile;
+ }
+
+ //For Exporting an RO that is an image
+ //returns an xmlElement
+ // - that is a child to xindivid
+ // - that has a name of Name
+ // - that has a value of the binary representation of the image
+ // - that has an attribute designating the location of the image file
+ private XmlElement AddGraphic(XmlElement xindivid, string Name, ROFSTLookup.rochild roc, RODbInfo rodb, bool isMulti)
+ {
+ Name = Name.Replace("<", "").Replace(">", "");
+
+ XmlElement xroid = xindivid.OwnerDocument.CreateElement(Name);
+
+ string imgfile = GetROImageFileLocation(roc, rodb, isMulti);
+ if (string.IsNullOrEmpty(imgfile)) return xroid;
+ xroid.Attributes.SetNamedItem(AddAttribute(xroid.OwnerDocument, "Location", imgfile));
+
+ if (File.Exists(imgfile))
+ {
+ using (FileStream fsIn = new FileStream(imgfile, FileMode.Open, FileAccess.Read, FileShare.Read))
+ {
+ // Create an instance of StreamReader that can read characters from the FileStream.
+ using (BinaryReader r = new BinaryReader(fsIn))
+ xroid.InnerText = Encoding.Default.GetString(r.ReadBytes((int)fsIn.Length));
+ }
+ }
+
+ return xroid;
+ }
+
+ //overridden - used to set the RO location for RO Images that are not in annotations
+ protected override void SetROLocation(ref XmlElement xindivid, ROFSTLookup.rochild roc, RODbInfo rodb, bool isMulti)
+ {
+ string imgfile = GetROImageFileLocation(roc, rodb, isMulti);
+ 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)
+ {
+ DocReplace.Clear();
+ DocReplace = null;
+ }
+
+
+ }
+}
diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs
index a53cd0d5..2a28917c 100644
--- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs
+++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs
@@ -707,15 +707,32 @@ namespace VEPROMS
else
{
int ownerid = MySessionInfo.CheckOutItem(fi.FolderID, CheckOutType.Session);
-
- dlgExportImport dlg = new dlgExportImport(args.Index == 0 ? "Export" : "Import", fi, this, (E_UCFImportOptions)Properties.Settings.Default.UCFImportOpt);//Added frmVEPROMS Parameter
- dlg.ShowDialog(this);
- MySessionInfo.CheckInItem(ownerid);
-
- if (args.Index == 1 && dlg.MyNewFolder != null)
+ //C2025-024 Electronic Procedures - Phase 2 (PROMS XML output)
+ //form for exporting Electronic Procedures from FolderInfo
+ if (args.AnnotationTypeId > 0)
{
- tv.AddNewNode(dlg.MyNewFolder);
+ dlgExportImportEP dlg = new dlgExportImportEP(args.Index == 0 ? "Export" : "Import", fi, this, args.AnnotationTypeId, args.UnitIndex);
+ dlg.ShowDialog(this);
+
+ MySessionInfo.CheckInItem(ownerid);
+
+ if (args.Index == 1 && dlg.MyNewFolder != null)
+ {
+ tv.AddNewNode(dlg.MyNewFolder);
+ }
+ }
+ else
+ {
+ dlgExportImport dlg = new dlgExportImport(args.Index == 0 ? "Export" : "Import", fi, this, (E_UCFImportOptions)Properties.Settings.Default.UCFImportOpt);//Added frmVEPROMS Parameter
+ dlg.ShowDialog(this);
+
+ MySessionInfo.CheckInItem(ownerid);
+
+ if (args.Index == 1 && dlg.MyNewFolder != null)
+ {
+ tv.AddNewNode(dlg.MyNewFolder);
+ }
}
}
}
@@ -741,18 +758,40 @@ namespace VEPROMS
int ownerid = MySessionInfo.CheckOutItem(dvi.VersionID, CheckOutType.DocVersion);
- dlgExportImport dlg = new dlgExportImport("Import", dvi, this, (E_UCFImportOptions)Properties.Settings.Default.UCFImportOpt);//Added frmVEPROMS Parameter
- dlg.MyNewProcedure = null;
- dlg.ExternalTransitionItem = null;
- dlg.ShowDialog(this);
+ //C2025-024 Electronic Procedures - Phase 2 (PROMS XML output)
+ //form for exporting Electronic Procedures from DocVersionInfo
+ if (args.AnnotationTypeId > 0)
+ {
+ dlgExportImportEP dlg = new dlgExportImportEP(args.Index == 0 ? "Export" : "Import", dvi, this, args.AnnotationTypeId, args.UnitIndex);
+ dlg.MyNewProcedure = null;
+ dlg.ExternalTransitionItem = null;
+ dlg.ShowDialog(this);
- MySessionInfo.CheckInItem(ownerid);
+ MySessionInfo.CheckInItem(ownerid);
- if (dlg.MyNewProcedure != null)
- tv.AddNewNode(dlg.MyNewProcedure);
+ if (dlg.MyNewProcedure != null)
+ tv.AddNewNode(dlg.MyNewProcedure);
+
+ if (dlg.ExternalTransitionItem != null)
+ tc.OpenItem(dlg.ExternalTransitionItem);
+ }
+ else
+ {
+
+ dlgExportImport dlg = new dlgExportImport("Import", dvi, this, (E_UCFImportOptions)Properties.Settings.Default.UCFImportOpt);//Added frmVEPROMS Parameter
+ dlg.MyNewProcedure = null;
+ dlg.ExternalTransitionItem = null;
+ dlg.ShowDialog(this);
+
+ MySessionInfo.CheckInItem(ownerid);
+
+ if (dlg.MyNewProcedure != null)
+ tv.AddNewNode(dlg.MyNewProcedure);
+
+ if (dlg.ExternalTransitionItem != null)
+ tc.OpenItem(dlg.ExternalTransitionItem);
+ }
- if (dlg.ExternalTransitionItem != null)
- tc.OpenItem(dlg.ExternalTransitionItem);
}
}
@@ -768,10 +807,24 @@ namespace VEPROMS
else
{
int ownerid = MySessionInfo.CheckOutItem(pi.ItemID, CheckOutType.Procedure);
- dlgExportImport dlg = new dlgExportImport("Export", pi, this, (E_UCFImportOptions)0);//Added frmVEPROMS Parameter
- dlg.ShowDialog(this);
- MySessionInfo.CheckInItem(ownerid);
+ //C2025-024 Electronic Procedures - Phase 2 (PROMS XML output)
+ //form for exporting Electronic Procedures from ProcedureInfo
+ if (args.AnnotationTypeId > 0)
+ {
+ dlgExportImportEP dlg = new dlgExportImportEP("Export", pi, this, args.AnnotationTypeId, args.UnitIndex);
+ dlg.ShowDialog(this);
+
+ MySessionInfo.CheckInItem(ownerid);
+ }
+ else
+ {
+
+ dlgExportImport dlg = new dlgExportImport("Export", pi, this, (E_UCFImportOptions)0);//Added frmVEPROMS Parameter
+ dlg.ShowDialog(this);
+
+ MySessionInfo.CheckInItem(ownerid);
+ }
}
}
}
@@ -1215,7 +1268,7 @@ namespace VEPROMS
//Print Section
//C2025-028 Add a Quick Print Section option
-
+
void tv_PrintSection(object sender, vlnTreeEventArgs args)
{
PrintSection(sender, args, false);
@@ -1225,7 +1278,7 @@ namespace VEPROMS
PrintSection(sender, args, true);
}
- void PrintSection(object sender, vlnTreeEventArgs args, bool quickprint)
+ void PrintSection(object sender, vlnTreeEventArgs args, bool quickprint)
{
try
{
@@ -2203,7 +2256,7 @@ namespace VEPROMS
this.superTooltip1.SetSuperTooltip(btnResetSecurity, new SuperTooltipInfo("Reset Security", "", "WARNING this will \nREMOVE ALL PROMS USERS and Reset to the\nOriginal Volian Defaults", null, null, eTooltipColor.Gray));
this.superTooltip1.SetSuperTooltip(btnAdministrativeTools, new SuperTooltipInfo("Administrative Tools", "", "Open the PROMS Adminstration Tools Window", null, null, eTooltipColor.Gray));
this.superTooltip1.SetSuperTooltip(btnUpdateFormats, new SuperTooltipInfo("Update Formats", "", "Install New Formats \n or Re-Install Formats", null, null, eTooltipColor.Gray));
-
+
try
{
MyUserInfo = UserInfo.GetByUserID(VlnSettings.UserID);
diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs
index 2ddb1b73..9caea004 100644
--- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs
@@ -346,21 +346,21 @@ namespace VEPROMS.CSLA.Library
{
var ii = _CacheByPrimaryKey.FirstOrDefault();
- while (ii.Value.Count > 0)
- {
- if (ii.Value[0]?.MyContent?.ContentParts != null)
- { foreach (PartInfo pi in ii.Value[0]?.MyContent?.ContentParts) pi.Dispose(); }
- ii.Value[0].Dispose();
- }
+ while (ii.Value.Count > 0)
+ {
+ if (ii.Value[0]?.MyContent?.ContentParts != null)
+ { foreach (PartInfo pi in ii.Value[0]?.MyContent?.ContentParts) pi.Dispose(); }
+ ii.Value[0].Dispose();
+ }
_CacheByPrimaryKey.Remove(ii.Key);
}
while (_CacheList.Count > 0)
- {
- if (_CacheList[0]?.MyContent?.ContentParts != null)
- {foreach (PartInfo pi in _CacheList[0]?.MyContent?.ContentParts) pi.Dispose(); }
- _CacheList[0].Dispose();
- }
+ {
+ if (_CacheList[0]?.MyContent?.ContentParts != null)
+ {foreach (PartInfo pi in _CacheList[0]?.MyContent?.ContentParts) pi.Dispose(); }
+ _CacheList[0].Dispose();
+ }
}
private bool _PrintAllAtOnce = false;
@@ -450,86 +450,86 @@ namespace VEPROMS.CSLA.Library
StringBuilder sret = new StringBuilder();
ItemInfo pitem = this;
while (!pitem.IsSection && !pitem.IsHigh)
- {
+ {
using (StepInfo stpinfo = StepInfo.Get(pitem.ItemID))
- {
- string thisTab = stpinfo.MyTab.CleanText;
+ {
+ string thisTab = stpinfo.MyTab.CleanText;
- string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;
+ string typeName = stpinfo.FormatStepData.StepEditData.TypeMenu.MenuItem;
- if (!string.IsNullOrEmpty(thisTab))
- {
- thisTab = thisTab.Trim();
- }
+ if (!string.IsNullOrEmpty(thisTab))
+ {
+ thisTab = thisTab.Trim();
+ }
- // if the tab is null or
- // if the the tab is not a letter or number OR
- // the tab is an AND or OR type and is the letter "o"
- // then reset the tab an empty string so that the type name along with the count of that type
- // (ex. "AND 2", "OR 3")
- if (string.IsNullOrEmpty(thisTab) || (thisTab != string.Empty && (!(char.IsLetterOrDigit(thisTab[0])) || ((pitem.IsAnd || pitem.IsOr || pitem.IsCaution || pitem.IsNote) && thisTab.Contains("o")))))
- {
- thisTab = string.Empty;
- }
+ // if the tab is null or
+ // if the the tab is not a letter or number OR
+ // the tab is an AND or OR type and is the letter "o"
+ // then reset the tab an empty string so that the type name along with the count of that type
+ // (ex. "AND 2", "OR 3")
+ if (string.IsNullOrEmpty(thisTab) || (thisTab != string.Empty && (!(char.IsLetterOrDigit(thisTab[0])) || ((pitem.IsAnd || pitem.IsOr || pitem.IsCaution || pitem.IsNote) && thisTab.Contains("o")))))
+ {
+ thisTab = string.Empty;
+ }
- if (pitem.IsRNOPart)
- {
- if (string.IsNullOrEmpty(thisTab))
- {
- sret.Insert(0, "RNO.");
- }
- else
- {
- thisTab = thisTab.Trim();
+ if (pitem.IsRNOPart)
+ {
+ if (string.IsNullOrEmpty(thisTab))
+ {
+ sret.Insert(0, "RNO.");
+ }
+ else
+ {
+ thisTab = thisTab.Trim();
- if (!thisTab.EndsWith(".") && !thisTab.EndsWith(")"))
- {
- thisTab += ".";
- }
+ if (!thisTab.EndsWith(".") && !thisTab.EndsWith(")"))
+ {
+ thisTab += ".";
+ }
- sret.Insert(0, "RNO." + thisTab);
- }
- }
- else if (pitem.IsCaution || pitem.IsNote)
- {
- // add the Caution or Note count to the tab (ex "Caution 1", "Note 2")
- if (string.IsNullOrEmpty(thisTab))
- {
- sret.Append("{" + typeName + " " + pitem.Ordinal.ToString() + "}");
- }
- else
- {
- thisTab = thisTab.Trim(" ".ToCharArray());
- sret.Append(thisTab + " " + pitem.Ordinal.ToString() + sret);
- }
- }
- else
- {
- if (!string.IsNullOrEmpty(thisTab))
- {
- thisTab = thisTab.Trim(" ".ToCharArray());
+ sret.Insert(0, "RNO." + thisTab);
+ }
+ }
+ else if (pitem.IsCaution || pitem.IsNote)
+ {
+ // add the Caution or Note count to the tab (ex "Caution 1", "Note 2")
+ if (string.IsNullOrEmpty(thisTab))
+ {
+ sret.Append("{" + typeName + " " + pitem.Ordinal.ToString() + "}");
+ }
+ else
+ {
+ thisTab = thisTab.Trim(" ".ToCharArray());
+ sret.Append(thisTab + " " + pitem.Ordinal.ToString() + sret);
+ }
+ }
+ else
+ {
+ if (!string.IsNullOrEmpty(thisTab))
+ {
+ thisTab = thisTab.Trim(" ".ToCharArray());
- if (!thisTab.EndsWith(".") && !thisTab.EndsWith(")"))
- {
- thisTab += ".";
- }
- }
- else
- {
- thisTab = "{" + typeName + " " + pitem.Ordinal.ToString() + "}.";
- }
+ if (!thisTab.EndsWith(".") && !thisTab.EndsWith(")"))
+ {
+ thisTab += ".";
+ }
+ }
+ else
+ {
+ thisTab = "{" + typeName + " " + pitem.Ordinal.ToString() + "}.";
+ }
- sret.Insert(0, thisTab);
- }
- }
+ sret.Insert(0, thisTab);
+ }
+ }
- pitem = pitem.ActiveParent as ItemInfo;
+ pitem = pitem.ActiveParent as ItemInfo;
- if (pitem == null)
- break;
- }
+ if (pitem == null)
+ break;
+ }
- return sret.ToString().Trim(" .)".ToCharArray());
+ return sret.ToString().Trim(" .)".ToCharArray());
}
public void SetHeader(VE_Font myFont, string myText)
@@ -574,11 +574,11 @@ namespace VEPROMS.CSLA.Library
}
_MyPrevious = null; // Reset list so that the next line gets a new list
if (MyPrevious != null) MyPrevious.RefreshNextItems(); // Update List for new value
- //if (_ContentID != tmp.ContentID)
- //{
+ //if (_ContentID != tmp.ContentID)
+ //{
if (MyContent != null) MyContent.RefreshContentItems(); // Update List for old value
_ContentID = tmp.ContentID; // Update the value
- //}
+ //}
_MyContent = null; // Reset list so that the next line gets a new list
if (MyContent != null) MyContent.RefreshContentItems(); // Update List for new value
_DTS = tmp.DTS;
@@ -674,12 +674,12 @@ namespace VEPROMS.CSLA.Library
}
}
}
-
+
internal static void SetParentSectionAndDocVersion(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, bool isAutomatic = false)
{
// B2022-107: Display Progress Bar Messages/Statuses when a new ROFST binary file is loaded into the database
// Added Optional Parameter "bool isAutomatic = false" to disable the RofstLoadingStatus pop-up screen when printing baselines
-
+
if (itemInfo == null) return;
itemInfo.LoadAllAtOnce = true;
itemInfo.ActiveParent = itemParent;
@@ -721,7 +721,7 @@ namespace VEPROMS.CSLA.Library
}
}
}
-
+
///
/// The following method is used only in print because the 'printed' data is loaded into
/// memory before printing. Find the next item from memory (do not go out to database).
@@ -784,7 +784,7 @@ namespace VEPROMS.CSLA.Library
{
bool forceConvertToText = false;
TranCheckCount++;
-
+
if (!forceConvertToText)
{
if (traninfo.MyItemToID.ActiveSection != null)
@@ -802,7 +802,7 @@ namespace VEPROMS.CSLA.Library
content.FixTransitionText(traninfo, true);
content.Save();
}
- }
+ }
}
// B2025-020 Null Reference fix. Added check for valid index into the TransitionTypeList
if (!forceConvertToText)
@@ -812,7 +812,7 @@ namespace VEPROMS.CSLA.Library
forceConvertToText = true;
TranFixCount++;
itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, "Reason for Change: Transition type is not available");
- using (Content content = Content.Get(itemInfo.MyContent.ContentID))
+ using (Content content = Content.Get(itemInfo.MyContent.ContentID))
{
content.FixTransitionText(traninfo, true);
content.Save();
@@ -835,14 +835,14 @@ namespace VEPROMS.CSLA.Library
content.FixTransitionText(traninfo, true);
content.Save();
}
- }
+ }
}
}
}
if (!forceConvertToText)
{
- if (itemInfo.MyDocVersion != null && traninfo.MyItemToID.MyDocVersion != null && itemInfo.MyDocVersion.VersionID != traninfo.MyItemToID.MyDocVersion.VersionID) //different doc version
+ if (itemInfo.MyDocVersion != null && traninfo.MyItemToID.MyDocVersion != null && itemInfo.MyDocVersion.VersionID != traninfo.MyItemToID.MyDocVersion.VersionID) //different doc version
{
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("Proc")) //internal format
{
@@ -903,7 +903,7 @@ namespace VEPROMS.CSLA.Library
if (itemInfo.MyContent.Text.Contains("Link:Transition"))
{
Content content = Content.Get(itemInfo.MyContent.ContentID);
-
+
if (itemInfo.MyContent.ContentTransitions != null)
{
foreach (TransitionInfo ct in itemInfo.MyContent.ContentTransitions)
@@ -913,7 +913,7 @@ namespace VEPROMS.CSLA.Library
}
itemInfo.MyContent.RefreshContentTransitions();
-
+
while (content.Text.Contains("Link:Transition"))
{
TranCheckCount++;
@@ -931,7 +931,7 @@ namespace VEPROMS.CSLA.Library
else // B2018-043 Eliminate infinite loop for invalid transition structure
{
// Add annotation for Invalid Transition
- AddInvalidTransitionAnnotation(itemInfo,"Invalid Transition Format");
+ AddInvalidTransitionAnnotation(itemInfo, "Invalid Transition Format");
break;
}
}
@@ -984,16 +984,16 @@ namespace VEPROMS.CSLA.Library
ContentInfo myContent = itemInfo.MyContent;
string txt = myContent.Text;
string regDelete = @"(\\v |)\(\\v0 |)";
- string txt2=txt;
+ string txt2 = txt;
- do{
+ do {
txt = txt2;
txt2 = Regex.Replace(txt, regDelete, "");
- } while(txt2 != txt);
+ } while (txt2 != txt);
- if(txt2 != myContent.Text)
+ if (txt2 != myContent.Text)
{
- using(Content tmp = myContent.Get())
+ using (Content tmp = myContent.Get())
{
tmp.Text = txt2;
tmp.Save();
@@ -1001,7 +1001,7 @@ namespace VEPROMS.CSLA.Library
AddInvalidTransitionAnnotation(itemInfo, "Removed Empty Transition Text");
}
}
-
+
private static bool IsTransitionToNonEditable(TransitionInfo ti)
{
foreach (TransitionInfo til in TransitionsToNonEditable)
@@ -1032,7 +1032,7 @@ namespace VEPROMS.CSLA.Library
public static int ROCheckCount = 0;
public static int ROFixCount = 0;
private static AnnotationType _VolianCommentType = null; // Using this to flag ro value issues with byron to braidwood
-
+
public static AnnotationType VolianCommentType
{
get
@@ -1065,7 +1065,7 @@ namespace VEPROMS.CSLA.Library
string roval = lookup.GetTranslatedRoValue(rousage.ROID, this.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, this.ActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, false, this);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
-
+
this.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, this);
string newText = this.MyContent.Text;
@@ -1263,7 +1263,7 @@ namespace VEPROMS.CSLA.Library
}
}
}
-
+
public static string GetCombinedTab(ItemInfo itemInfo, string parTab)
{
string pTab = parTab == null ? "" : parTab;
@@ -1276,7 +1276,7 @@ namespace VEPROMS.CSLA.Library
// for supplemental information, bulleted tabs need to be included in the tab. The 'isletterordigit' should not occur for supinfo items -
// and this includes the parent of the supinfo since that is the tab used for supinfo concatenated with its parent. (B2017-120)
// // B2020-154: Added check for the tab to start with '(', tabs that started with this were not included in the combined tab
- if (thisTab != null && thisTab != "" && (!char.IsLetterOrDigit(thisTab[0]) && thisTab[0] != '(') && !vcbHeaderCheck && !itemInfo.IsInSupInfo && (itemInfo.SupInfos == null || itemInfo.SupInfos.Count <= 0 )) return pTab;
+ if (thisTab != null && thisTab != "" && (!char.IsLetterOrDigit(thisTab[0]) && thisTab[0] != '(') && !vcbHeaderCheck && !itemInfo.IsInSupInfo && (itemInfo.SupInfos == null || itemInfo.SupInfos.Count <= 0)) return pTab;
if (itemInfo.FormatStepData.NumberWithLevel) pTab = itemInfo.MyHLS.MyTab.CleanText.Trim();
// if the parent tab ends with a alphanumeric and this tab is alphanumeric, add a '.' to separate them
// also, include use the separator for bullets if doing the supplemental information tab (B2017-120)
@@ -1285,7 +1285,7 @@ namespace VEPROMS.CSLA.Library
if (ms && mn) pTab = pTab.TrimEnd() + ".";
// remove ending '.' (if this is a hls, don't remove the '.')
if (!itemInfo.IsHigh && thisTab.EndsWith(".")) thisTab = thisTab.Substring(0, thisTab.Length - 1);
- if (itemInfo.HasParentTab) return thisTab.Trim(); // F2020-023: if tab includes parent tab already, don't concatenate it
+ if (itemInfo.HasParentTab) return thisTab.Trim(); // F2020-023: if tab includes parent tab already, don't concatenate it
return pTab + thisTab.Trim();
}
@@ -1341,8 +1341,8 @@ namespace VEPROMS.CSLA.Library
// B2023-037: loading print text, resolve the RO symbols
bool GTLT = !itemInfo.IsTable && sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertGTELTEPMinROValue;
- bool GLTArrows = !itemInfo.IsTable && sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseDashGreaterLessThenForArrowsInROValue;
- string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, GTLT || GLTArrows, itemInfo);
+ bool GLTArrows = !itemInfo.IsTable && sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseDashGreaterLessThenForArrowsInROValue;
+ string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues, GTLT || GLTArrows, itemInfo);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo);
}
@@ -1367,7 +1367,7 @@ namespace VEPROMS.CSLA.Library
}
}
}
-
+
if (itemInfo.MyContent.ContentTransitionCount > 0)
{
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
@@ -1440,14 +1440,14 @@ namespace VEPROMS.CSLA.Library
private float _MSWordPageCount = 0;
public float MSWordPageCount
{
- get {
+ get {
if (_MSWordPageCount == 0) // C2018-011 Get the proper word page count from the saved pdf attachment
if (MyContent.MyEntry != null && MyContent.MyEntry.MyDocument != null)
{
PdfInfo pi = PdfInfo.Get(this, false);
- if(pi != null) _MSWordPageCount = (float)pi.PageCount;// B2018-071 Don't crash on invalid MS Word section
+ if (pi != null) _MSWordPageCount = (float)pi.PageCount;// B2018-071 Don't crash on invalid MS Word section
}
- return _MSWordPageCount;
+ return _MSWordPageCount;
}
set { _MSWordPageCount = value; }
}
@@ -1649,7 +1649,7 @@ namespace VEPROMS.CSLA.Library
// the addition of the parent.IsNote, the note was breaking between 2 ANDs (the 1st AND was a
// steplevel of 5, but the 2nd was a steplevel of 4). If something similar is seen with Cautions,
// that check could be added.
- if (!item.IsRNOPart && !item.IsHigh && (item.MyPrevious == null || (((item.ActiveFormat.PlantFormat.FormatData.PurchaseOptions & E_PurchaseOptions.EnhancedBackgrounds) != E_PurchaseOptions.EnhancedBackgrounds)
+ if (!item.IsRNOPart && !item.IsHigh && (item.MyPrevious == null || (((item.ActiveFormat.PlantFormat.FormatData.PurchaseOptions & E_PurchaseOptions.EnhancedBackgrounds) != E_PurchaseOptions.EnhancedBackgrounds)
&& item.MyParent != null && item.MyParent.IsNote)))
level += firstInc;
else
@@ -1716,7 +1716,7 @@ namespace VEPROMS.CSLA.Library
}
return maxRNOLevel;
}
-
+
}
private bool ParentAndOr
{
@@ -1767,7 +1767,7 @@ namespace VEPROMS.CSLA.Library
RemoveEnhancedFromConfig(false);
}
- public void RemoveEnhancedFromConfig(bool doOneStepOnly)
+ public void RemoveEnhancedFromConfig(bool doOneStepOnly)
{
XmlDocument xd = new XmlDocument();
if (this.MyContent.Config == null || this.MyContent.Config == "") return; // B2017-164 & B2017-172 check for null or empty config
@@ -1782,7 +1782,7 @@ namespace VEPROMS.CSLA.Library
ctmp.Config = config;
ctmp.Save();
ContentInfo.Refresh(ctmp);
- _MyConfig = null; // refresh the memory value
+ _MyConfig = null; // refresh the memory value
}
}
if (doOneStepOnly) return;
@@ -2071,7 +2071,7 @@ namespace VEPROMS.CSLA.Library
{
bool rval = false;
ItemInfo itm = this;
- while (itm != null &&!itm.IsHigh && !rval)
+ while (itm != null && !itm.IsHigh && !rval)
{
rval = itm.IsCautionOrNotePart;
if (!rval) itm = itm.MyParent;
@@ -2111,6 +2111,16 @@ namespace VEPROMS.CSLA.Library
return (sd.Type == type);
}
+ // C2025-024 - Electronic Procedures - Export
+ //return if should export blanks
+ public bool EPexportblank(int AnnTypeID)
+ {
+ if (ActiveFormat.PlantFormat.EPFormatFiles.Count == 0 || !ActiveFormat.PlantFormat.EPFormatFiles.Exists(x => x.AnnotationTypeID == AnnTypeID))
+ return true;
+ else
+ return ActiveFormat.PlantFormat.EPFormatFiles.Find(x => x.AnnotationTypeID == AnnTypeID).exportblank;
+ }
+
// C2025-023 - Electronic Procedures - Modifications to PROMS
//return EPFields that match this step type or a parent step type
public EPFields GetValidEPFields(int AnnTypeID)
diff --git a/PROMS/VEPROMS.CSLA.Library/Format/EPFormatFile.cs b/PROMS/VEPROMS.CSLA.Library/Format/EPFormatFile.cs
index 0d2253d2..1d75f875 100644
--- a/PROMS/VEPROMS.CSLA.Library/Format/EPFormatFile.cs
+++ b/PROMS/VEPROMS.CSLA.Library/Format/EPFormatFile.cs
@@ -11,138 +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");
- }
- }
- // 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)
+ //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;
+ }
+
+ //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
@@ -153,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 mylist;
+ }
+ else
+ {
+ return new List
+ {
+ 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();
+ }
+ catch
+ {
+ throw new ArgumentException($"Error in rosource for EP file, field: {name}");
+ }
+ }
- List values = new List();
- DocVersionInfo MyDocVersion = currAnn.MyItem.MyDocVersion;
- ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
- rochild ro = lookup.GetRoChild(roid);
+ //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();
- List rtncols = returncols();
+ List values = new List();
+ DocVersionInfo MyDocVersion = currAnn.MyItem.MyDocVersion;
+ ROFSTLookup lookup = MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(MyDocVersion);
+ rochild ro = lookup.GetRoChild(roid);
- 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 rtncols = returncols();
- return values;
+ 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);
diff --git a/PROMS/Volian.Controls.Library/vlnTreeView.cs b/PROMS/Volian.Controls.Library/vlnTreeView.cs
index 82dc5a98..8fc87d14 100644
--- a/PROMS/Volian.Controls.Library/vlnTreeView.cs
+++ b/PROMS/Volian.Controls.Library/vlnTreeView.cs
@@ -152,6 +152,15 @@ namespace Volian.Controls.Library
get { return _Index; }
set { _Index = value; }
}
+
+ //C2025-024 Electronic Procedures - Phase 2 (PROMS XML output)
+ //AnnotationType that would be doing an export for
+ private int _AnnotationTypeId = -1;
+ public int AnnotationTypeId
+ {
+ get { return _AnnotationTypeId; }
+ set { _AnnotationTypeId = value; }
+ }
//jcb multiunit
private string _Unit;
public string Unit
@@ -179,6 +188,13 @@ namespace Volian.Controls.Library
_Destination = destination;
_Index = index;
}
+ public vlnTreeEventArgs(TreeNode node, TreeNode destination, int index, int annTypeId)
+ {
+ _Node = node;
+ _Destination = destination;
+ _Index = index;
+ _AnnotationTypeId = annTypeId;
+ }
//jcb multiunit
public vlnTreeEventArgs(TreeNode node, TreeNode destination, int index, string unit, int unitIndex)
{
@@ -188,6 +204,15 @@ namespace Volian.Controls.Library
_Unit = unit;
_UnitIndex = unitIndex;
}
+ public vlnTreeEventArgs(TreeNode node, TreeNode destination, int index, string unit, int unitIndex, int annTypeId)
+ {
+ _Node = node;
+ _Destination = destination;
+ _Index = index;
+ _Unit = unit;
+ _UnitIndex = unitIndex;
+ _AnnotationTypeId = annTypeId;
+ }
//end jcb multiunit
#endregion
public override string ToString()
@@ -706,7 +731,10 @@ namespace Volian.Controls.Library
if (ui.IsAdministrator() || ui.IsSetAdministrator(fi))// && fi.MyParent == null) //VEPROMS level
{
if (fi.HasWorkingDraft)
+ {
cm.MenuItems.Add("Export Procedure Set", new EventHandler(mi_Click));
+ //AddEPExport(cm.MenuItems, 0, null);
+ }
else
cm.MenuItems.Add("Import Procedure Set", new EventHandler(mi_Click));
if (DoSpecificInfo)
@@ -842,6 +870,9 @@ namespace Volian.Controls.Library
if (ui.IsAdministrator() || ui.IsSetAdministrator(pri.MyDocVersion))
{
cm.MenuItems.Add("Export Procedure", mi_Click);
+ //C2025-024 Proms XML Output - if have any EP Format files, add dropdown menu for exporting EP formats
+ if (pri.ActiveFormat.PlantFormat.EPFormatFiles.Count > 0)
+ AddEPExport(cm.MenuItems, pri.MyDocVersion.MultiUnitCount, pri.MyDocVersion.UnitNames, pri.ActiveFormat.PlantFormat.EPFormatFiles);
}
if (ui.IsAdministrator() || ui.IsSetAdministrator(pri.MyDocVersion) || ui.IsWriter(pri.MyDocVersion))
{
@@ -1355,6 +1386,43 @@ namespace Volian.Controls.Library
}
}
+ //C2025-024 Electronic Procedures - Phase 2 (PROMS XML output)
+ // Add context menu for exporting Electronic Procedures
+ // if has an Electronic procedure
+ // then loop through and add an Export for each EP Viewer
+ private void AddEPExport(Menu.MenuItemCollection menuItems, int MultiUnitCount, string[] UnitNames, EPFormatFiles EPFiles)
+ {
+ //add outer menu
+ MenuItem mi = menuItems.Add("Electronic Procedure Viewer Export");
+ foreach (EPFormatFile epAnnType in EPFiles)
+ {
+
+ //Add item for each individual EP Viewer
+ MenuItem mv = mi.MenuItems.Add(epAnnType.AnnotationName());
+
+ //tag will be of format:
+ //{EP Annotation Type ID},{Unit}
+ //if not multi-unit, unit will be zero.
+ if (MultiUnitCount > 1)
+ {
+ //if multi-unit, add menu item for each unit
+ int k = 0;
+ foreach (string s in UnitNames)
+ {
+ k++;
+ MenuItem multiunit_mv = mv.MenuItems.Add(s);
+ multiunit_mv.Tag = $"{epAnnType.AnnotationTypeID},{k}";
+ multiunit_mv.Click += new EventHandler(miEP_Click);
+ }
+ }
+ else
+ {
+ mv.Tag = $"{epAnnType.AnnotationTypeID},0";
+ mv.Click += new EventHandler(miEP_Click);
+ }
+ }
+ }
+
private void AddApprovedRevisionsMultiUnit(Menu.MenuItemCollection menuItemCollection, ProcedureInfo pri)
{
_currentPri = pri;
@@ -2251,6 +2319,23 @@ namespace Volian.Controls.Library
break;
}
}
+
+ //C2025-024 Electronic Procedures - Phase 2 (PROMS XML output)
+ // Handles clicking of items in the context menu
+ // for exporting Electronic Procedures
+ // tag will be of format:
+ // {EP Annotation Type ID},{Unit}
+ // if not multi-unit, unit will be zero.
+ void miEP_Click(object sender, EventArgs e)
+ {
+ MenuItem mi = sender as MenuItem;
+ int annTypeid = int.Parse(((string)mi.Tag).Split(',')[0]);
+ int unit = int.Parse(((string)mi.Tag).Split(',')[1]);
+ if (unit == 0)
+ OnExportImportProcedureSets(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, annTypeid));
+ else
+ OnExportImportProcedureSets(this, new vlnTreeEventArgs(SelectedNode as VETreeNode, null, 0, "", unit, annTypeid));
+ }
private bool _doingCollapseNode = false; // B2016-058 when collapse is done, it always calls the drag node event which doesn't appear to be needed
private void CollapseProcedures()
{
diff --git a/PROMS/Volian.Print.Library/PDFReport.cs b/PROMS/Volian.Print.Library/PDFReport.cs
index 39bf29f8..e660630e 100644
--- a/PROMS/Volian.Print.Library/PDFReport.cs
+++ b/PROMS/Volian.Print.Library/PDFReport.cs
@@ -1688,7 +1688,7 @@ namespace Volian.Print.Library
System.Windows.Forms.MessageBox.Show(msg.ToString(), "Error during PDF creation for search:", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Exclamation);
}
- private static string BuildStepTab(ItemInfo item)
+ public static string BuildStepTab(ItemInfo item)
{
if (item == null)
return string.Empty;