From 6593bb58777d0bc818da347699ff1c52cf201f27 Mon Sep 17 00:00:00 2001 From: Kathy Date: Fri, 18 Jan 2019 14:53:46 +0000 Subject: [PATCH] Fixed indenting (tabs versus spaces). No code change - verified through ultra compare --- .../VEPROMS User Interface/dlgExportImport.cs | 3036 ++++++++--------- 1 file changed, 1518 insertions(+), 1518 deletions(-) diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs index 99b46d8b..20d5e45f 100644 --- a/PROMS/VEPROMS User Interface/dlgExportImport.cs +++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs @@ -16,17 +16,17 @@ using System.Text.RegularExpressions; namespace VEPROMS { public partial class dlgExportImport : Form -{ - #region Log4Net - private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - #endregion - frmVEPROMS _MyFrmVEPROMS = null;// Save frmVEPROMS for Import to shutoff SessionPing - public frmVEPROMS MyFrmVEPROMS { - get { return _MyFrmVEPROMS; } - set { _MyFrmVEPROMS = value; } - } - private bool _ConvertROsToTextDuringImport = false; + #region Log4Net + private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + #endregion + frmVEPROMS _MyFrmVEPROMS = null;// Save frmVEPROMS for Import to shutoff SessionPing + public frmVEPROMS MyFrmVEPROMS + { + get { return _MyFrmVEPROMS; } + set { _MyFrmVEPROMS = value; } + } + private bool _ConvertROsToTextDuringImport = false; private bool _ConvertROsAndTransitionsToText = false; // set to true when Approval creates an Export file // B2016-225 notify user when Transitions and/or ROs are converted to text @@ -39,36 +39,36 @@ namespace VEPROMS get { return _ExternalTransitionItem; } set { _ExternalTransitionItem = value; } } - private Dictionary floatFoldout; - private Dictionary importedFormat; - private Dictionary existingFormat; - private Dictionary renamedUCFFormatName; // if format is renamed, this is its new name so references to it can be made - private Dictionary renamedUCFFormatId; // if format is renamed, this is its old->new formatid - private int oldRODbID; - private int newRODbID; - private FolderInfo _MyNewFolder; - public FolderInfo MyNewFolder - { - get { return _MyNewFolder; } - } - private ProcedureInfo _MyNewProcedure; - public ProcedureInfo MyNewProcedure - { - get { return _MyNewProcedure; } + private Dictionary floatFoldout; + private Dictionary importedFormat; + private Dictionary existingFormat; + private Dictionary renamedUCFFormatName; // if format is renamed, this is its new name so references to it can be made + private Dictionary renamedUCFFormatId; // if format is renamed, this is its old->new formatid + private int oldRODbID; + private int newRODbID; + private FolderInfo _MyNewFolder; + public FolderInfo MyNewFolder + { + get { return _MyNewFolder; } + } + private ProcedureInfo _MyNewProcedure; + public ProcedureInfo MyNewProcedure + { + get { return _MyNewProcedure; } set { _MyNewProcedure = value; } - } - private string PEIPath; + } + 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) + private DocVersionInfo MyDocVersion = null; + private ProcedureInfo MyProcedure = null; + private 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) { UCFImportDefaultFromSettings = frset; MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing @@ -81,97 +81,97 @@ namespace VEPROMS { UCFImportDefaultFromSettings = frset; MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing - _MyMode = mode; - MyDocVersion = docVersionInfo; - InitializeComponent(); - if (mode.ToUpper().Contains("FORMAT")) - this.Text = mode; - else - this.Text = mode + " Dialog for " + docVersionInfo.Name + " of " + docVersionInfo.MyFolder.Name; - } + _MyMode = mode; + MyDocVersion = docVersionInfo; + InitializeComponent(); + if (mode.ToUpper().Contains("FORMAT")) + this.Text = mode; + else + this.Text = mode + " Dialog for " + docVersionInfo.Name + " of " + docVersionInfo.MyFolder.Name; + } public dlgExportImport(string mode, ProcedureInfo procedureInfo, frmVEPROMS myFrmVEPROMS, E_UCFImportOptions frset) { UCFImportDefaultFromSettings = frset; MyFrmVEPROMS = myFrmVEPROMS;// Save frmVEPROMS for Import to shutoff SessionPing - _MyMode = mode; - MyProcedure = procedureInfo; - InitializeComponent(); - this.Text = mode + " Dialog for " + procedureInfo.DisplayNumber; - } - private void dlgExportImport_Load(object sender, EventArgs e) + _MyMode = mode; + MyProcedure = procedureInfo; + InitializeComponent(); + this.Text = mode + " Dialog for " + procedureInfo.DisplayNumber; + } + private void dlgExportImport_Load(object sender, EventArgs e) { - PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database; - if (!Directory.Exists(PEIPath)) - Directory.CreateDirectory(PEIPath); - if (_MyMode == "Import") - { + 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; + } + pnlExport.Dock = DockStyle.Fill; pnlImport.Dock = DockStyle.Fill; - int formsize = 2; - if (_MyMode.ToLower().Contains("export")) - { - // if doing formats, make various controls invisible: - if (_MyMode.ToUpper().Contains("FORMAT")) - { - cbxExportAudits.Visible = false; - lblExportProcedure.Visible = lblExportSection.Visible = lblExportStep.Visible = false; - pbExportProcedure.Visible = pbExportSection.Visible = pbExportStep.Visible = false; - lblExportTime.Visible = false; - formsize = 4; - } - sfd.InitialDirectory = PEIPath; - pnlExport.BringToFront(); - } - else - { - if (_MyMode.ToUpper().Contains("FORMAT")) - { - cbxImportAudits.Visible = false; - lblImportProcedure.Visible = lblImportSection.Visible = lblImportStep.Visible = false; - pbImportProcedure.Visible = pbImportSection.Visible = pbImportStep.Visible = false; - lblExportTime.Visible = false; - formsize = 4; - } - ofd.InitialDirectory = PEIPath; - pnlImport.BringToFront(); - } - this.Height = this.Height / formsize; + int formsize = 2; + if (_MyMode.ToLower().Contains("export")) + { + // if doing formats, make various controls invisible: + if (_MyMode.ToUpper().Contains("FORMAT")) + { + cbxExportAudits.Visible = false; + lblExportProcedure.Visible = lblExportSection.Visible = lblExportStep.Visible = false; + pbExportProcedure.Visible = pbExportSection.Visible = pbExportStep.Visible = false; + lblExportTime.Visible = false; + formsize = 4; + } + sfd.InitialDirectory = PEIPath; + pnlExport.BringToFront(); + } + else + { + if (_MyMode.ToUpper().Contains("FORMAT")) + { + cbxImportAudits.Visible = false; + lblImportProcedure.Visible = lblImportSection.Visible = lblImportStep.Visible = false; + pbImportProcedure.Visible = pbImportSection.Visible = pbImportStep.Visible = false; + lblExportTime.Visible = false; + formsize = 4; + } + ofd.InitialDirectory = PEIPath; + pnlImport.BringToFront(); + } + this.Height = this.Height / formsize; } private void btnExport_Click(object sender, EventArgs e) { - if (_MyMode.ToUpper().Contains("FORMAT")) - { - txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, "UCF"); - return; - } - 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(); - } - } - } - else if (MyProcedure != null) - { - txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber.Replace("/", "_").Replace("\\","_")); - } + if (_MyMode.ToUpper().Contains("FORMAT")) + { + txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, "UCF"); + return; + } + 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(); + } + } + } + else if (MyProcedure != null) + { + txtExport.Text = string.Format(@"{0}\{1}.pxml", PEIPath, MyProcedure.DisplayNumber.Replace("/", "_").Replace("\\", "_")); + } } private void txtExport_TextChanged(object sender, EventArgs e) { @@ -182,93 +182,93 @@ namespace VEPROMS lblExportStatus.Text = "Awaiting Export File Name:"; } private XmlWriter MyWriter = null; - private ZipFile MyExpxZipFile = null; - private ZipFile MyImpxZipFile = null; - private DateTime MyStart; + 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) { - btnExport.Enabled = false; + btnExport.Enabled = false; string msg = "Finished Exporting:\n\n"; - if (_MyMode.ToUpper().Contains("FORMAT")) - { - this.Cursor = Cursors.WaitCursor; - MyStart = DateTime.Now; - btnDoExport.Enabled = false; - lblExportStatus.Text = "Performing Export of UC Formats"; - SaveExportUCF(); + if (_MyMode.ToUpper().Contains("FORMAT")) + { + this.Cursor = Cursors.WaitCursor; + MyStart = DateTime.Now; + btnDoExport.Enabled = false; + lblExportStatus.Text = "Performing Export of UC Formats"; + SaveExportUCF(); - TimeSpan elapsed = DateTime.Now.Subtract(MyStart); - lblExportStatus.Text = "Format Export Completed in " + elapsed.ToString(); - this.Cursor = Cursors.Default; - } - else if (MyFolder != null) - { - this.Cursor = Cursors.WaitCursor; - MyStart = DateTime.Now; - btnDoExport.Enabled = false; - lblExportStatus.Text = "Performing Export"; - SaveExportData(); - //SaveExportDataWriter(); + TimeSpan elapsed = DateTime.Now.Subtract(MyStart); + lblExportStatus.Text = "Format Export Completed in " + elapsed.ToString(); + this.Cursor = Cursors.Default; + } + else if (MyFolder != null) + { + this.Cursor = Cursors.WaitCursor; + MyStart = DateTime.Now; + btnDoExport.Enabled = false; + lblExportStatus.Text = "Performing Export"; + SaveExportData(); + //SaveExportDataWriter(); - TimeSpan elapsed = DateTime.Now.Subtract(MyStart); - lblExportStatus.Text = "Export Completed in " + elapsed.ToString(); - this.Cursor = Cursors.Default; + TimeSpan elapsed = DateTime.Now.Subtract(MyStart); + lblExportStatus.Text = "Export Completed in " + elapsed.ToString(); + this.Cursor = Cursors.Default; msg += MyFolder.Name; - } - else if (MyProcedure != null) - { - this.Cursor = Cursors.WaitCursor; - MyStart = DateTime.Now; - btnDoExport.Enabled = false; - lblExportStatus.Text = "Performing Export"; - pbExportProcedure.Maximum = 1; - XmlDocument xd = new XmlDocument(); - ExportItem(xd, MyProcedure, "procedure"); - XmlElement xe = xd.CreateElement("formats"); - xd.DocumentElement.AppendChild(xe); - ExportFormats(FormatInfoList.GetFormatInfoListUsed(), xe, "formats", false); - xd.Save(txtExport.Text); - TimeSpan elapsed = DateTime.Now.Subtract(MyStart); - lblExportStatus.Text = "Export Completed in " + elapsed.ToString(); - this.Cursor = Cursors.Default; - } + } + else if (MyProcedure != null) + { + this.Cursor = Cursors.WaitCursor; + MyStart = DateTime.Now; + btnDoExport.Enabled = false; + lblExportStatus.Text = "Performing Export"; + pbExportProcedure.Maximum = 1; + XmlDocument xd = new XmlDocument(); + ExportItem(xd, MyProcedure, "procedure"); + XmlElement xe = xd.CreateElement("formats"); + xd.DocumentElement.AppendChild(xe); + ExportFormats(FormatInfoList.GetFormatInfoListUsed(), xe, "formats", false); + xd.Save(txtExport.Text); + TimeSpan elapsed = DateTime.Now.Subtract(MyStart); + lblExportStatus.Text = "Export Completed in " + elapsed.ToString(); + this.Cursor = Cursors.Default; + } // added message to user when export of a procedure or procedure set has completed - if (successfullExport) - { + if (successfullExport) + { if (!_MyMode.ToUpper().Contains("FORMAT")) msg += MyProcedure; else msg += "Formats"; - } - else - msg = "Could not complete export"; + } + else + msg = "Could not complete export"; MessageBox.Show(msg, "Export", MessageBoxButtons.OK, MessageBoxIcon.Information); btnCloseExport.Enabled = true; - } + } - private void SaveExportUCF() - { - lblExportStatus.Text = "Exporting UC Formats..."; - Application.DoEvents(); - XmlDocument xd = new XmlDocument(); - XmlElement xe = xd.CreateElement("ucformats"); - xd.AppendChild(xe); - FormatInfoList fil = FormatInfoList.Get(); - foreach (FormatInfo fi in fil) - { - if (fi.Config != null && fi.Config != "") - ExportFormat(xe, fi, "ucformat"); - } - xd.Save(txtExport.Text); - } - private void SaveExportData() - { - XmlDocument xd = new XmlDocument(); + private void SaveExportUCF() + { + lblExportStatus.Text = "Exporting UC Formats..."; + Application.DoEvents(); + XmlDocument xd = new XmlDocument(); + XmlElement xe = xd.CreateElement("ucformats"); + xd.AppendChild(xe); + FormatInfoList fil = FormatInfoList.Get(); + foreach (FormatInfo fi in fil) + { + if (fi.Config != null && fi.Config != "") + ExportFormat(xe, fi, "ucformat"); + } + xd.Save(txtExport.Text); + } + private void SaveExportData() + { + XmlDocument xd = new XmlDocument(); MyFrmVEPROMS.DisablePing = true;//B2018-030 Shutoff ping when doing Export - ExportFolder(xd, MyFolder, "folder"); + ExportFolder(xd, MyFolder, "folder"); MyFrmVEPROMS.DisablePing = false;//B2018-030 turn on ping Export is done - } + } // appears to not be used -jsj 4-29-2016 //private void SaveExportDataWriter() @@ -296,25 +296,25 @@ namespace VEPROMS _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(); - MyFrmVEPROMS.DisablePing = true;// Turn-off SessionPing - bool result = TryToImportUCFs(ref isImported, ref canceledPressed); - MyFrmVEPROMS.DisablePing = false;// Turn-on SessionPing - TurnChangeManagerOn.Execute(); - if (!result) return; - if (isImported) - { - TimeSpan elapsed = DateTime.Now.Subtract(MyStart); - lblImportStatus.Text = "Format Import Completed in " + elapsed.ToString(); - } - else - { - btnImport.Enabled = true; - btnDoImport.Enabled = true; - } - } + if (_MyMode.ToUpper().Contains("FORMAT")) + { + TurnChangeManagerOff.Execute(); + MyFrmVEPROMS.DisablePing = true;// Turn-off SessionPing + bool result = TryToImportUCFs(ref isImported, ref canceledPressed); + MyFrmVEPROMS.DisablePing = false;// Turn-on SessionPing + TurnChangeManagerOn.Execute(); + if (!result) return; + if (isImported) + { + TimeSpan elapsed = DateTime.Now.Subtract(MyStart); + lblImportStatus.Text = "Format Import Completed in " + elapsed.ToString(); + } + else + { + btnImport.Enabled = true; + btnDoImport.Enabled = true; + } + } else if (MyFolder != null) // import a folder - a .expx file { TurnChangeManagerOff.Execute(); @@ -359,8 +359,8 @@ namespace VEPROMS string msg = string.Format("Finished Importing:\n\n{0}", txtImport.Text.Substring(txtImport.Text.LastIndexOf("\\") + 1)); if (_DidConvertTransitionsToText || _DidConvertROsToText) { - string msg1 = (_DidConvertTransitionsToText && _DidConvertROsToText)?"Transitions and Referenced Objects":(_DidConvertTransitionsToText)?"Transitions":"Referenced Objects"; - msg += string.Format("\n\n{0} converted to text.\n\nThe locations can be found by doing a Global Search for the \"Link Converted To Text\" annotation type",msg1); + string msg1 = (_DidConvertTransitionsToText && _DidConvertROsToText) ? "Transitions and Referenced Objects" : (_DidConvertTransitionsToText) ? "Transitions" : "Referenced Objects"; + msg += string.Format("\n\n{0} converted to text.\n\nThe locations can be found by doing a Global Search for the \"Link Converted To Text\" annotation type", msg1); } else if (!_DidProcessTransitions && !_DidProcessROs) // B2017-076 Approved import file does not have ROs nor Transitions { @@ -372,75 +372,75 @@ namespace VEPROMS } if (canceledPressed) { - MessageBox.Show(string.Format("Canceling the import of:\n\n{0}",txtImport.Text.Substring(txtImport.Text.LastIndexOf("\\")+1)),"Import",MessageBoxButtons.OK,MessageBoxIcon.Information); + MessageBox.Show(string.Format("Canceling the import of:\n\n{0}", txtImport.Text.Substring(txtImport.Text.LastIndexOf("\\") + 1)), "Import", MessageBoxButtons.OK, MessageBoxIcon.Information); btnCloseImport.PerformClick(); } } - private bool TryToImportUCFs(ref bool isImported, ref bool canceledPressed) - { - try - { - existingFormat = new Dictionary(); - FormatInfoList fil = FormatInfoList.Get(); - foreach (FormatInfo fi in fil) - existingFormat.Add(fi.Name, fi.FormatID); - XmlDocument xd = new XmlDocument(); - xd.Load(txtImport.Text); - XmlNodeList nl = xd.SelectNodes("ucformats/ucformat"); - foreach (XmlNode nd in nl) - { - int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText); - string name = nd.Attributes.GetNamedItem("name").InnerText; - string config = null; - XmlNode cfg = nd.Attributes.GetNamedItem("config"); - if (cfg != null) config = cfg.InnerText; - string pname = nd.Attributes.GetNamedItem("pname").InnerText; - string description = null; - XmlNode descript = nd.Attributes.GetNamedItem("description"); - if (descript != null) description = descript.InnerText; - string userid = nd.Attributes.GetNamedItem("userid").InnerText; - DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); - if (!existingFormat.ContainsKey(pname)) return false; - int pid = existingFormat[pname]; - Format pformat = Format.Get(pid); - if (existingFormat.ContainsKey(name)) // this UCF already exists in database, just update the record. - { - FormatInfo exFI = FormatInfo.Get(existingFormat[name]); - if (exFI.Config != config) - { - using (Format f = Format.Get(exFI.FormatID)) - { - f.Name = name; - f.MyParent = pformat; - f.Description = description; - f.UserID = userid; - f.DTS = dts; - f.Config = config; - f.Save(); - } - } - } - else // doesn't exist in the database, add it - { - - Format rec = Format.MakeFormat(pformat, name, description, null, null, dts, userid); - rec.Config = config; - rec.Save(); - } - } + private bool TryToImportUCFs(ref bool isImported, ref bool canceledPressed) + { + try + { + existingFormat = new Dictionary(); + FormatInfoList fil = FormatInfoList.Get(); + foreach (FormatInfo fi in fil) + existingFormat.Add(fi.Name, fi.FormatID); + XmlDocument xd = new XmlDocument(); + xd.Load(txtImport.Text); + XmlNodeList nl = xd.SelectNodes("ucformats/ucformat"); + foreach (XmlNode nd in nl) + { + int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText); + string name = nd.Attributes.GetNamedItem("name").InnerText; + string config = null; + XmlNode cfg = nd.Attributes.GetNamedItem("config"); + if (cfg != null) config = cfg.InnerText; + string pname = nd.Attributes.GetNamedItem("pname").InnerText; + string description = null; + XmlNode descript = nd.Attributes.GetNamedItem("description"); + if (descript != null) description = descript.InnerText; + string userid = nd.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); + if (!existingFormat.ContainsKey(pname)) return false; + int pid = existingFormat[pname]; + Format pformat = Format.Get(pid); + if (existingFormat.ContainsKey(name)) // this UCF already exists in database, just update the record. + { + FormatInfo exFI = FormatInfo.Get(existingFormat[name]); + if (exFI.Config != config) + { + using (Format f = Format.Get(exFI.FormatID)) + { + f.Name = name; + f.MyParent = pformat; + f.Description = description; + f.UserID = userid; + f.DTS = dts; + f.Config = config; + f.Save(); + } + } + } + else // doesn't exist in the database, add it + { + + Format rec = Format.MakeFormat(pformat, name, description, null, null, dts, userid); + rec.Config = config; + rec.Save(); + } + } isImported = true; - return true; - } - catch (Exception ex) - { - MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); - _MyLog.Warn("Failed during UC Formats Import", ex); - this.Close(); + return true; + } + catch (Exception ex) + { + MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); + _MyLog.Warn("Failed during UC Formats Import", ex); + this.Close(); isImported = false; - return false; - } - } + return false; + } + } private bool TryToImportProcedure(ref bool isImported, ref bool canceledPressed) { try @@ -563,7 +563,7 @@ namespace VEPROMS } #endregion } // end - need to select RO Path - bool didImp = LoadFormats(xd, "procedure/formats/format"); + bool didImp = LoadFormats(xd, "procedure/formats/format"); if (!didImp) { this.Cursor = Cursors.Default; @@ -631,7 +631,7 @@ namespace VEPROMS ImportProcedureNew(xd); isImported = true; } - if (isImported && UCFImportCase==E_UCFImportOptions.LoadForSetOnly) UpdateFormatForUCFInSet(); + if (isImported && UCFImportCase == E_UCFImportOptions.LoadForSetOnly) UpdateFormatForUCFInSet(); return true;// Import Suceeded } private void UpdateFormatForUCFInSet() @@ -645,10 +645,10 @@ namespace VEPROMS { foreach (ContentInfo ci in cil) { - using (Content c = ci.Get()) + using (Content c = ci.Get()) { ContentInfo.Refresh(c); - } + } } } } @@ -665,9 +665,9 @@ namespace VEPROMS _MyLog.Warn("Failure During Import", ex); } } - private void ImportProcedureNew(XmlDocument xd) - { - //add imported procedure + private void ImportProcedureNew(XmlDocument xd) + { + //add imported procedure floatFoldout = new Dictionary(); importedFormat = new Dictionary(); existingFormat = new Dictionary(); @@ -677,94 +677,94 @@ namespace VEPROMS importedFormat.Add(fi.FormatID, fi.Name); existingFormat.Add(fi.Name, fi.FormatID); } - Old2NewItem = new Dictionary(); - Old2NewContent = new Dictionary(); - Old2NewLibDoc = new Dictionary(); - PendingTransitions = new XmlDocument(); - XmlElement xe = PendingTransitions.CreateElement("transitions"); - PendingTransitions.AppendChild(xe); - string fn = PEIPath + @"\transitions.xml"; - PendingTransitions.Save(fn); - ProcedureInfo lastProcedure = null; - foreach (ProcedureInfo pi in MyDocVersion.Procedures) - lastProcedure = pi; - _MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure); - //update transitions - AddTransitions(PendingTransitions); + Old2NewItem = new Dictionary(); + Old2NewContent = new Dictionary(); + Old2NewLibDoc = new Dictionary(); + PendingTransitions = new XmlDocument(); + XmlElement xe = PendingTransitions.CreateElement("transitions"); + PendingTransitions.AppendChild(xe); + string fn = PEIPath + @"\transitions.xml"; + PendingTransitions.Save(fn); + ProcedureInfo lastProcedure = null; + foreach (ProcedureInfo pi in MyDocVersion.Procedures) + lastProcedure = pi; + _MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure); + //update transitions + AddTransitions(PendingTransitions); PendingTransitions.Save(fn); FixFloatingFoldouts(); //File.Delete(fn); - } - private void ImportProcedureCopy(XmlDocument xd) - { + } + private void ImportProcedureCopy(XmlDocument xd) + { floatFoldout = new Dictionary(); importedFormat = new Dictionary(); - existingFormat = new Dictionary(); - FormatInfoList fil = FormatInfoList.Get(); - foreach (FormatInfo fi in fil) - { - importedFormat.Add(fi.FormatID, fi.Name); - existingFormat.Add(fi.Name, fi.FormatID); - } - Old2NewItem = new Dictionary(); - Old2NewContent = new Dictionary(); - Old2NewLibDoc = new Dictionary(); - PendingTransitions = new XmlDocument(); - XmlElement xe = PendingTransitions.CreateElement("transitions"); - PendingTransitions.AppendChild(xe); - string fn = PEIPath + @"\transitions.xml"; - PendingTransitions.Save(fn); - ProcedureInfo lastProcedure = null; - //determine count of existing procedures with same number - string number = xd.SelectSingleNode("procedure/content/@number").InnerText; + existingFormat = new Dictionary(); + FormatInfoList fil = FormatInfoList.Get(); + foreach (FormatInfo fi in fil) + { + importedFormat.Add(fi.FormatID, fi.Name); + existingFormat.Add(fi.Name, fi.FormatID); + } + Old2NewItem = new Dictionary(); + Old2NewContent = new Dictionary(); + Old2NewLibDoc = new Dictionary(); + PendingTransitions = new XmlDocument(); + XmlElement xe = PendingTransitions.CreateElement("transitions"); + PendingTransitions.AppendChild(xe); + string fn = PEIPath + @"\transitions.xml"; + PendingTransitions.Save(fn); + ProcedureInfo lastProcedure = null; + //determine count of existing procedures with same number + string number = xd.SelectSingleNode("procedure/content/@number").InnerText; // kbr - could replace '-' with unicode in number, here. - int count = 0; - foreach (ProcedureInfo pi in MyDocVersion.Procedures) - { - lastProcedure = pi; - if (pi.MyContent.Number.EndsWith(number)) - count++; - } - xd.SelectSingleNode("procedure/content/@number").InnerText = string.Format("Copy({0}) of {1}", count.ToString(), number); - //add imported procedure and copy count - _MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure); - //update transitions - AddTransitions(PendingTransitions); + int count = 0; + foreach (ProcedureInfo pi in MyDocVersion.Procedures) + { + lastProcedure = pi; + if (pi.MyContent.Number.EndsWith(number)) + count++; + } + xd.SelectSingleNode("procedure/content/@number").InnerText = string.Format("Copy({0}) of {1}", count.ToString(), number); + //add imported procedure and copy count + _MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure); + //update transitions + AddTransitions(PendingTransitions); FixFloatingFoldouts(); - File.Delete(fn); - } - private bool ImportProcedureOverwrite(XmlDocument xd, ProcedureInfo pi) - { + File.Delete(fn); + } + private bool ImportProcedureOverwrite(XmlDocument xd, ProcedureInfo pi) + { floatFoldout = new Dictionary(); importedFormat = new Dictionary(); - existingFormat = new Dictionary( ); - FormatInfoList fil = FormatInfoList.Get(); - foreach (FormatInfo fi in fil) - { - importedFormat.Add(fi.FormatID, fi.Name); - existingFormat.Add(fi.Name, fi.FormatID); - } - Old2NewItem = new Dictionary(); - Old2NewContent = new Dictionary(); - Old2NewLibDoc = new Dictionary(); - PendingTransitions = new XmlDocument(); - XmlElement xe = PendingTransitions.CreateElement("transitions"); - PendingTransitions.AppendChild(xe); - string fn = PEIPath + @"\transitions.xml"; - PendingTransitions.Save(fn); - ProcedureInfo lastProcedure = null; - //delete old procedure - foreach (ProcedureInfo lp in MyDocVersion.Procedures) - lastProcedure = lp; - //delete opi + existingFormat = new Dictionary(); + FormatInfoList fil = FormatInfoList.Get(); + foreach (FormatInfo fi in fil) + { + importedFormat.Add(fi.FormatID, fi.Name); + existingFormat.Add(fi.Name, fi.FormatID); + } + Old2NewItem = new Dictionary(); + Old2NewContent = new Dictionary(); + Old2NewLibDoc = new Dictionary(); + PendingTransitions = new XmlDocument(); + XmlElement xe = PendingTransitions.CreateElement("transitions"); + PendingTransitions.AppendChild(xe); + string fn = PEIPath + @"\transitions.xml"; + PendingTransitions.Save(fn); + ProcedureInfo lastProcedure = null; + //delete old procedure + foreach (ProcedureInfo lp in MyDocVersion.Procedures) + lastProcedure = lp; + //delete opi try { TurnChangeManagerOn.Execute(); // Import Turns off the Change Manager - Delete needs to have it on Item.DeleteItemAndChildren(pi); TurnChangeManagerOff.Execute(); // Assure that the Change Manager is off } - catch(Exception ex) + catch (Exception ex) { // C2018-020: cannot overwrite the procedure because transitions point to this. Show dialog listing transitions and then // return false to flag that import was not successful. @@ -778,28 +778,28 @@ namespace VEPROMS "Cannot Overwrite procedure", MessageBoxButtons.OK, MessageBoxIcon.Question); } } - else + else MessageBox.Show(ex.Message, "SQL Exception", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); File.Delete(fn); TurnChangeManagerOff.Execute(); // Assure that the Change Manager is off return false; } - //add imported procedure - _MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure); - //update transitions - AddTransitions(PendingTransitions); + //add imported procedure + _MyNewProcedure = AddProcedure(xd.DocumentElement, MyDocVersion, lastProcedure); + //update transitions + AddTransitions(PendingTransitions); FixFloatingFoldouts(); return true; - } + } private void LoadImportDataDocument() { - floatFoldout = new Dictionary(); - ZipEntry ze = MyExpxZipFile[0]; - string fn = PEIPath + @"\" + ze.FileName; - ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); + floatFoldout = new Dictionary(); + ZipEntry ze = MyExpxZipFile[0]; + string fn = PEIPath + @"\" + ze.FileName; + ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); XmlDocument xd = new XmlDocument(); xd.Load(fn); - bool didImp = LoadFormats(xd, "folder/formats/format"); + bool didImp = LoadFormats(xd, "folder/formats/format"); if (!didImp) { this.Cursor = Cursors.Default; @@ -807,298 +807,298 @@ namespace VEPROMS this.btnDoImport.Enabled = true; // allow user to change mind and perform the import return; // Return False to Indicate that the Import did not succeed } - Folder ff = AddFolder(Folder.Get(MyFolder.FolderID), xd); - if (ff == null) - { - MessageBox.Show("You can not import the same procedure set more than once", "Duplicate Import Error"); - return; - } - _MyNewFolder = FolderInfo.Get(ff.FolderID); - AddAnnotationTypes(xd); + Folder ff = AddFolder(Folder.Get(MyFolder.FolderID), xd); + if (ff == null) + { + MessageBox.Show("You can not import the same procedure set more than once", "Duplicate Import Error"); + return; + } + _MyNewFolder = FolderInfo.Get(ff.FolderID); + AddAnnotationTypes(xd); DocVersionInfo dvi = AddDocVersion(ff, xd); MyDocVersion = dvi; - xd = null; - lblImportStatus.Text = "Creating Procedures..."; - Application.DoEvents(); - ProcedureInfo pi = null; - pbImportProcedure.Value = 0; - pbImportProcedure.Maximum = MyExpxZipFile.Entries.Count - 1; - for (int i = 1; i < MyExpxZipFile.Entries.Count; i++) - { - ze = MyExpxZipFile[i]; - fn = PEIPath + @"\" + ze.FileName; - ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); - xd = new XmlDocument(); - xd.Load(fn); - pi = AddProcedure(xd.DocumentElement, dvi, pi); + xd = null; + lblImportStatus.Text = "Creating Procedures..."; + Application.DoEvents(); + ProcedureInfo pi = null; + pbImportProcedure.Value = 0; + pbImportProcedure.Maximum = MyExpxZipFile.Entries.Count - 1; + for (int i = 1; i < MyExpxZipFile.Entries.Count; i++) + { + ze = MyExpxZipFile[i]; + fn = PEIPath + @"\" + ze.FileName; + ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); + xd = new XmlDocument(); + xd.Load(fn); + pi = AddProcedure(xd.DocumentElement, dvi, pi); GC.Collect(); // need to cleanup memory after importing each procedure due to use of Regular Expressions in processing RO and Transition links - } - DirectoryInfo di = new DirectoryInfo(PEIPath); - DirectoryInfo[] dis = di.GetDirectories(); - for (int d = 0; d < dis.Length; d++) - dis[d].Delete(true); + } + DirectoryInfo di = new DirectoryInfo(PEIPath); + DirectoryInfo[] dis = di.GetDirectories(); + for (int d = 0; d < dis.Length; d++) + dis[d].Delete(true); lblImportStatus.Text = "Updating Transitions"; AddTransitions(); - FixFloatingFoldouts(); + FixFloatingFoldouts(); SaveTransitionAndItemContentIDs(); } - private void FixSectionStart(ProcedureInfo pi) - { - Content c = Content.Get(pi.MyContent.ContentID); - XmlDocument xd = new XmlDocument(); - // If the config field is empty, add an empty xml node. - if (c.Config == "") c.Config = ""; - xd.LoadXml(c.Config); - XmlNode xn = xd.SelectSingleNode("Config/Procedure/@SectionStart"); - if (xn != null) - { - int iid = int.Parse(xn.InnerText); - if (Old2NewItem.ContainsKey(iid)) - iid = Old2NewItem[iid]; - else - { - int oldid = iid; - iid = pi.ItemID; - XmlAttribute xa = xd.CreateAttribute("ErrorSectionStart"); - xa.InnerText = oldid.ToString(); - XmlNode xp = xd.SelectSingleNode("Config/Procedure"); - xp.Attributes.SetNamedItem(xa); - } - xn.InnerText = iid.ToString(); - c.Config = xd.OuterXml; - c.Save(); - } - } - private void FixFloatingFoldouts() - { - foreach (int key in floatFoldout.Keys) - { - lblImportStatus.Text = "Updating Floating Foldouts"; - int cid = Old2NewContent[key]; - int iid = Old2NewItem[floatFoldout[key]]; - Content c = Content.Get(cid); - XmlDocument xd = new XmlDocument(); - xd.LoadXml(c.Config); - XmlNode xn = xd.SelectSingleNode("Config/Step/@FloatingFoldout"); - xn.InnerText = iid.ToString(); - c.Config = xd.OuterXml; - c.Save(); - } - } - private E_UCFImportOptions UCFImportDefaultFromSettings; - private E_UCFImportOptions UCFImportCase = E_UCFImportOptions.LoadOnlyImported; - Dictionary existingCopyFCName = new Dictionary(); - // note that this is used when importing a folder or a procedure (procedure was added for UCF changes) - private bool LoadFormats(XmlDocument xd, string xmlpath) - { - existingFormat = new Dictionary(); - FormatInfoList fil = FormatInfoList.Get(); - foreach (FormatInfo fi in fil) - existingFormat.Add(fi.Name, fi.FormatID); - - importedFormat = new Dictionary(); - XmlNodeList nl = xd.SelectNodes(xmlpath); - - bool conflictingUCFdata = false; - List existingFC = new List(); - List importedFC = new List(); - List fname = new List(); - - foreach (XmlNode nd in nl) + private void FixSectionStart(ProcedureInfo pi) { - string copyOfUCF = null; - // see if any of the imported formats are 'UCF' formats, i.e. have config data. If they are UCF, - // see if this is different that what is in the database. If it is, the user needs to decide - // whether to associate sections with existing UCF format or the new one. All UCF formats will be - // connected the same way, i.e. existing or new. - int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText); - string name = nd.Attributes.GetNamedItem("name").InnerText; - string config = null; - XmlNode cfg = nd.Attributes.GetNamedItem("config"); - if (cfg != null) config = cfg.InnerText; - if (existingFormat.ContainsKey(name) && config != null && config != "") + Content c = Content.Get(pi.MyContent.ContentID); + XmlDocument xd = new XmlDocument(); + // If the config field is empty, add an empty xml node. + if (c.Config == "") c.Config = ""; + xd.LoadXml(c.Config); + XmlNode xn = xd.SelectSingleNode("Config/Procedure/@SectionStart"); + if (xn != null) { - FormatInfo exFI = FormatInfo.Get(existingFormat[name]); - if (exFI.Config != config && exFI.Config != "" && exFI.Config != null && config != "" && config != null) + int iid = int.Parse(xn.InnerText); + if (Old2NewItem.ContainsKey(iid)) + iid = Old2NewItem[iid]; + else { - // See if there are copies of this UCF format, if so, this may match (have same config) one of those and should - // use it before stating there is conflicting data. - copyOfUCF = ContentsOfUCFExists(name, config); - if (copyOfUCF == null) - { - existingFC.Add(exFI.Config); - importedFC.Add(config); - conflictingUCFdata = true; - fname.Add(name); - } - else - existingCopyFCName.Add(name, copyOfUCF); + int oldid = iid; + iid = pi.ItemID; + XmlAttribute xa = xd.CreateAttribute("ErrorSectionStart"); + xa.InnerText = oldid.ToString(); + XmlNode xp = xd.SelectSingleNode("Config/Procedure"); + xp.Attributes.SetNamedItem(xa); } + xn.InnerText = iid.ToString(); + c.Config = xd.OuterXml; + c.Save(); } } - - // there is a difference in UCF data, see if user wants sections to use the existing or new ucf data: - if (conflictingUCFdata) + private void FixFloatingFoldouts() { - // Bring up dialog to allow user to choose how the UCF data is handled: - // Importing of a procedure(s) (names of UCF exist in current DB and in exported DB) - //Case 0 - ignore (don't bring in new UCF) - //Case 1 - bringing in new UCF and not using it - //Case 2 - bringing in new UCF and only using it for imported data - //Case 3 - bringing in new UCF and using it across the board - //Case 4 - bringing in new UCF and using it for the current procedure set (not applicable for procedure sets) - UCFImportCase = UCFImportDefaultFromSettings; // from the options/settings - dlgUCFImportOptions ucfoptDlg = new dlgUCFImportOptions(fname, existingFC, importedFC, UCFImportCase, xmlpath); - DialogResult dr = ucfoptDlg.ShowDialog(); - if (dr != DialogResult.OK) return false; - UCFImportCase = ucfoptDlg.UCFImportOptionsCase; // may be reset from dialog. - } - // first see if any of the imported formats have different data. If so, - foreach (XmlNode nd in nl) - { - int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText); - string name = nd.Attributes.GetNamedItem("name").InnerText; - string config = null; - XmlNode cfg = nd.Attributes.GetNamedItem("config"); - if (cfg != null) config = cfg.InnerText; - string pname = nd.Attributes.GetNamedItem("pname").InnerText; - string description = null; - XmlNode descript = nd.Attributes.GetNamedItem("description"); - if (descript != null) description = descript.InnerText; - string userid = nd.Attributes.GetNamedItem("userid").InnerText; - DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); - // If the format that is being imported exists as a copy (already was imported and a 'Copy x of name' was created) and the imported and - // existing config match, use the existing (copied) format's name rather than importing it again (the dictionary was set up during - // the import formats process. - if (existingCopyFCName.ContainsKey(name)) name = existingCopyFCName[name]; - - // compare this imported format to the original in the database. - // If format name exists, or if it has same config data, just use it. - if (existingFormat.ContainsKey(name)) + foreach (int key in floatFoldout.Keys) { - // Note that Data & Genmac fields can have different contents. The format information should always be used from - // the original database, not the export file. So no processing is done on these fields when exporting & importing. - // Data or Genmac can be different if formats were updated in one database & not the other. - FormatInfo exFI = FormatInfo.Get(existingFormat[name]); - if ((exFI.Config == config || ((exFI.Config == "" || exFI.Config == null) && (config == "" || config == null)))) - { - // importedFormat is used to set correct formatid on imported sections (if different formatid <-> name between - // the current database and the one from which export came) - importedFormat.Add(formatid, name); - continue; // go on to next format in import list - } + lblImportStatus.Text = "Updating Floating Foldouts"; + int cid = Old2NewContent[key]; + int iid = Old2NewItem[floatFoldout[key]]; + Content c = Content.Get(cid); + XmlDocument xd = new XmlDocument(); + xd.LoadXml(c.Config); + XmlNode xn = xd.SelectSingleNode("Config/Step/@FloatingFoldout"); + xn.InnerText = iid.ToString(); + c.Config = xd.OuterXml; + c.Save(); } - // parent format will always be in there, if it is a new format, it will be added before the child. Check just in case (no null reference). - if (!existingFormat.ContainsKey(pname)) break; - int pid = existingFormat[pname]; - Format pformat = Format.Get(pid); + } + private E_UCFImportOptions UCFImportDefaultFromSettings; + private E_UCFImportOptions UCFImportCase = E_UCFImportOptions.LoadOnlyImported; + Dictionary existingCopyFCName = new Dictionary(); + // note that this is used when importing a folder or a procedure (procedure was added for UCF changes) + private bool LoadFormats(XmlDocument xd, string xmlpath) + { + existingFormat = new Dictionary(); + FormatInfoList fil = FormatInfoList.Get(); + foreach (FormatInfo fi in fil) + existingFormat.Add(fi.Name, fi.FormatID); - // if the new format doesn't exist, it will be added (after these other checks). Otherwise, handle the - // various cases listed above: - if (existingFormat.ContainsKey(name)) + importedFormat = new Dictionary(); + XmlNodeList nl = xd.SelectNodes(xmlpath); + + bool conflictingUCFdata = false; + List existingFC = new List(); + List importedFC = new List(); + List fname = new List(); + + foreach (XmlNode nd in nl) { - // if case 0 and this ucf already exists, ignore it: - if (UCFImportCase == E_UCFImportOptions.Ignore) continue; - - // if case 1, 2, 4 and the name exists, make a 'copy' of the newly imported format: - // 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) + string copyOfUCF = null; + // see if any of the imported formats are 'UCF' formats, i.e. have config data. If they are UCF, + // see if this is different that what is in the database. If it is, the user needs to decide + // whether to associate sections with existing UCF format or the new one. All UCF formats will be + // connected the same way, i.e. existing or new. + int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText); + string name = nd.Attributes.GetNamedItem("name").InnerText; + string config = null; + XmlNode cfg = nd.Attributes.GetNamedItem("config"); + if (cfg != null) config = cfg.InnerText; + if (existingFormat.ContainsKey(name) && config != null && config != "") { - int count = 0; - foreach (FormatInfo fi in fil) if (fi.Name.EndsWith(name)) count++; - if (count > 0) + FormatInfo exFI = FormatInfo.Get(existingFormat[name]); + if (exFI.Config != config && exFI.Config != "" && exFI.Config != null && config != "" && config != null) { - string origname = name; - name = string.Format("Copy {0} of {1}", count.ToString(), name); - if (UCFImportCase == E_UCFImportOptions.LoadOnlyImported || UCFImportCase == E_UCFImportOptions.LoadForSetOnly) + // See if there are copies of this UCF format, if so, this may match (have same config) one of those and should + // use it before stating there is conflicting data. + copyOfUCF = ContentsOfUCFExists(name, config); + if (copyOfUCF == null) { - if (renamedUCFFormatName == null) renamedUCFFormatName = new Dictionary(); - renamedUCFFormatName.Add(origname, name); + existingFC.Add(exFI.Config); + importedFC.Add(config); + conflictingUCFdata = true; + fname.Add(name); } + else + existingCopyFCName.Add(name, copyOfUCF); } } - // if case 3, take the existing config data and create in a record whose name is Old(x) of 'original name' (the record - // creation gets done below). Then modify the existing record to have the config data. The result is that any - // sections that used this UCF throughout the database will have the new config data. - 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) - { - name = string.Format("Old {0} of {1}", count.ToString(), name); - } - // update the 'old' record by getting the original config data. - string savdesc = null; - DateTime savdts = DateTime.Now; - string savuid = null; - int savpar = 0; - string savconfig = null; - using (Format origRecord = Format.Get(existingFormat[savname])) - { - savdesc = origRecord.Description; - savdts = origRecord.DTS; - savuid = origRecord.UserID; - savpar = origRecord.ParentID; - savconfig = origRecord.Config; - origRecord.Name = savname; - origRecord.Description = description; - origRecord.DTS = dts; - origRecord.UserID = userid; - origRecord.MyParent = pformat; - origRecord.Config = config; - origRecord.Save(); - description = savdesc; - dts = savdts; - userid = savuid; - pformat = Format.Get(savpar); - config = savconfig; + } + // there is a difference in UCF data, see if user wants sections to use the existing or new ucf data: + if (conflictingUCFdata) + { + // Bring up dialog to allow user to choose how the UCF data is handled: + // Importing of a procedure(s) (names of UCF exist in current DB and in exported DB) + //Case 0 - ignore (don't bring in new UCF) + //Case 1 - bringing in new UCF and not using it + //Case 2 - bringing in new UCF and only using it for imported data + //Case 3 - bringing in new UCF and using it across the board + //Case 4 - bringing in new UCF and using it for the current procedure set (not applicable for procedure sets) + UCFImportCase = UCFImportDefaultFromSettings; // from the options/settings + dlgUCFImportOptions ucfoptDlg = new dlgUCFImportOptions(fname, existingFC, importedFC, UCFImportCase, xmlpath); + DialogResult dr = ucfoptDlg.ShowDialog(); + if (dr != DialogResult.OK) return false; + UCFImportCase = ucfoptDlg.UCFImportOptionsCase; // may be reset from dialog. + } + // first see if any of the imported formats have different data. If so, + foreach (XmlNode nd in nl) + { + int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText); + string name = nd.Attributes.GetNamedItem("name").InnerText; + string config = null; + XmlNode cfg = nd.Attributes.GetNamedItem("config"); + if (cfg != null) config = cfg.InnerText; + string pname = nd.Attributes.GetNamedItem("pname").InnerText; + string description = null; + XmlNode descript = nd.Attributes.GetNamedItem("description"); + if (descript != null) description = descript.InnerText; + string userid = nd.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); + // If the format that is being imported exists as a copy (already was imported and a 'Copy x of name' was created) and the imported and + // existing config match, use the existing (copied) format's name rather than importing it again (the dictionary was set up during + // the import formats process. + if (existingCopyFCName.ContainsKey(name)) name = existingCopyFCName[name]; + + // compare this imported format to the original in the database. + // If format name exists, or if it has same config data, just use it. + if (existingFormat.ContainsKey(name)) + { + // Note that Data & Genmac fields can have different contents. The format information should always be used from + // the original database, not the export file. So no processing is done on these fields when exporting & importing. + // Data or Genmac can be different if formats were updated in one database & not the other. + FormatInfo exFI = FormatInfo.Get(existingFormat[name]); + if ((exFI.Config == config || ((exFI.Config == "" || exFI.Config == null) && (config == "" || config == null)))) + { + // importedFormat is used to set correct formatid on imported sections (if different formatid <-> name between + // the current database and the one from which export came) + importedFormat.Add(formatid, name); + continue; // go on to next format in import list } } + // parent format will always be in there, if it is a new format, it will be added before the child. Check just in case (no null reference). + if (!existingFormat.ContainsKey(pname)) break; + int pid = existingFormat[pname]; + Format pformat = Format.Get(pid); - } - if (UCFImportCase == 0) // ignore it - { - importedFormat.Add(formatid, name); - } - else - { - Format rec = Format.MakeFormat(pformat, name, description, null, null, dts, userid); - rec.Config = config; - rec.Save(); - if (UCFImportCase == E_UCFImportOptions.LoadNotUsed || UCFImportCase == E_UCFImportOptions.LoadUseAll) // don't reset format id (case 1 don't use it, case 3 copies new data into original record - importedFormat.Add(formatid, name); - else if (UCFImportCase == E_UCFImportOptions.LoadOnlyImported || UCFImportCase == E_UCFImportOptions.LoadForSetOnly) // case 2 uses it for any items imported, case 4 uses it for any sections within current set + // if the new format doesn't exist, it will be added (after these other checks). Otherwise, handle the + // various cases listed above: + if (existingFormat.ContainsKey(name)) { - existingFormat.Add(name, rec.FormatID); // change to original name? - importedFormat.Add(rec.FormatID, name); - - // get format id for the original named format - if (UCFImportCase == E_UCFImportOptions.LoadForSetOnly && renamedUCFFormatName != null) + // if case 0 and this ucf already exists, ignore it: + if (UCFImportCase == E_UCFImportOptions.Ignore) continue; + + // if case 1, 2, 4 and the name exists, make a 'copy' of the newly imported format: + // 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 origformatid = -1; - foreach (var kvp in renamedUCFFormatName) + int count = 0; + foreach (FormatInfo fi in fil) if (fi.Name.EndsWith(name)) count++; + if (count > 0) { - if (kvp.Value == name) + string origname = name; + name = string.Format("Copy {0} of {1}", count.ToString(), name); + if (UCFImportCase == E_UCFImportOptions.LoadOnlyImported || UCFImportCase == E_UCFImportOptions.LoadForSetOnly) { - origformatid = existingFormat[kvp.Key]; - break; + if (renamedUCFFormatName == null) renamedUCFFormatName = new Dictionary(); + renamedUCFFormatName.Add(origname, name); } } - if (origformatid != -1) + } + // if case 3, take the existing config data and create in a record whose name is Old(x) of 'original name' (the record + // creation gets done below). Then modify the existing record to have the config data. The result is that any + // sections that used this UCF throughout the database will have the new config data. + 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) { - if (renamedUCFFormatId == null) renamedUCFFormatId = new Dictionary(); - renamedUCFFormatId.Add(rec.FormatID, origformatid); + name = string.Format("Old {0} of {1}", count.ToString(), name); + } + // update the 'old' record by getting the original config data. + string savdesc = null; + DateTime savdts = DateTime.Now; + string savuid = null; + int savpar = 0; + string savconfig = null; + using (Format origRecord = Format.Get(existingFormat[savname])) + { + savdesc = origRecord.Description; + savdts = origRecord.DTS; + savuid = origRecord.UserID; + savpar = origRecord.ParentID; + savconfig = origRecord.Config; + origRecord.Name = savname; + origRecord.Description = description; + origRecord.DTS = dts; + origRecord.UserID = userid; + origRecord.MyParent = pformat; + origRecord.Config = config; + origRecord.Save(); + description = savdesc; + dts = savdts; + userid = savuid; + pformat = Format.Get(savpar); + config = savconfig; + + } + } + + } + if (UCFImportCase == 0) // ignore it + { + importedFormat.Add(formatid, name); + } + else + { + Format rec = Format.MakeFormat(pformat, name, description, null, null, dts, userid); + rec.Config = config; + rec.Save(); + if (UCFImportCase == E_UCFImportOptions.LoadNotUsed || UCFImportCase == E_UCFImportOptions.LoadUseAll) // don't reset format id (case 1 don't use it, case 3 copies new data into original record + importedFormat.Add(formatid, name); + else if (UCFImportCase == E_UCFImportOptions.LoadOnlyImported || UCFImportCase == E_UCFImportOptions.LoadForSetOnly) // case 2 uses it for any items imported, case 4 uses it for any sections within current set + { + existingFormat.Add(name, rec.FormatID); // change to original name? + importedFormat.Add(rec.FormatID, name); + + // get format id for the original named format + if (UCFImportCase == E_UCFImportOptions.LoadForSetOnly && renamedUCFFormatName != null) + { + int origformatid = -1; + foreach (var kvp in renamedUCFFormatName) + { + if (kvp.Value == name) + { + origformatid = existingFormat[kvp.Key]; + break; + } + } + if (origformatid != -1) + { + if (renamedUCFFormatId == null) renamedUCFFormatId = new Dictionary(); + renamedUCFFormatId.Add(rec.FormatID, origformatid); + } } } } } + FormatInfoList.Reset(); + return true; } - FormatInfoList.Reset(); - return true; - } private string ContentsOfUCFExists(string name, string config) { @@ -1113,7 +1113,7 @@ namespace VEPROMS if (cpy.StartsWith("Copy") && cpy.Contains("of " + name)) { FormatInfo exFI = FormatInfo.Get(existingFormat[cpy]); - if (exFI.Config == config) return cpy; + if (exFI.Config == config) return cpy; } } } @@ -1344,63 +1344,63 @@ namespace VEPROMS // This will create and save the ItemIDs (old and new), ContentIDs (old andnew), library document IDs (old and new), and pending transitions each in their own xml file // the xml files are then added (or replaced) in the .impx file. private void SaveTransitionAndItemContentIDs() - { - XmlDocument xd = new XmlDocument(); - XmlElement xe = xd.CreateElement("items"); - xd.AppendChild(xe); - string fn = PEIPath + @"\items.xml"; - foreach (int key in Old2NewItem.Keys) - { - xe = xd.CreateElement("item"); - xe.Attributes.SetNamedItem(AddAttribute(xd, "old", key.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xd, "new", Old2NewItem[key].ToString())); - xd.DocumentElement.AppendChild(xe); - } - xd.Save(fn); - ZipEntry ze = MyImpxZipFile["items.xml"]; - MyImpxZipFile.RemoveEntry(ze); - MyImpxZipFile.Save(); - MyImpxZipFile.AddFile(fn, ""); - MyImpxZipFile.Save(); - File.Delete(fn); - xd = new XmlDocument(); - xe = xd.CreateElement("contents"); - xd.AppendChild(xe); - fn = PEIPath + @"\contents.xml"; - foreach (int key in Old2NewContent.Keys) - { - xe = xd.CreateElement("content"); - xe.Attributes.SetNamedItem(AddAttribute(xd, "old", key.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xd, "new", Old2NewContent[key].ToString())); - xd.DocumentElement.AppendChild(xe); - } - xd.Save(fn); - ze = MyImpxZipFile["contents.xml"]; - MyImpxZipFile.RemoveEntry(ze); - MyImpxZipFile.Save(); - MyImpxZipFile.AddFile(fn, ""); - MyImpxZipFile.Save(); - File.Delete(fn); - xd = new XmlDocument(); - xe = xd.CreateElement("transitions"); - xd.AppendChild(xe); - fn = PEIPath + @"\transitions.xml"; - if (PendingTransitions != null && PendingTransitions.DocumentElement.HasChildNodes) - { - foreach (XmlNode nd in PendingTransitions.DocumentElement.ChildNodes) - { - if(nd.InnerText == "") - xd.DocumentElement.AppendChild(xd.ImportNode(nd, true)); - } - } - xd.Save(fn); - ze = MyImpxZipFile["transitions.xml"]; - MyImpxZipFile.RemoveEntry(ze); - MyImpxZipFile.Save(); - MyImpxZipFile.AddFile(fn, ""); - MyImpxZipFile.Save(); - File.Delete(fn); - } + { + XmlDocument xd = new XmlDocument(); + XmlElement xe = xd.CreateElement("items"); + xd.AppendChild(xe); + string fn = PEIPath + @"\items.xml"; + foreach (int key in Old2NewItem.Keys) + { + xe = xd.CreateElement("item"); + xe.Attributes.SetNamedItem(AddAttribute(xd, "old", key.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xd, "new", Old2NewItem[key].ToString())); + xd.DocumentElement.AppendChild(xe); + } + xd.Save(fn); + ZipEntry ze = MyImpxZipFile["items.xml"]; + MyImpxZipFile.RemoveEntry(ze); + MyImpxZipFile.Save(); + MyImpxZipFile.AddFile(fn, ""); + MyImpxZipFile.Save(); + File.Delete(fn); + xd = new XmlDocument(); + xe = xd.CreateElement("contents"); + xd.AppendChild(xe); + fn = PEIPath + @"\contents.xml"; + foreach (int key in Old2NewContent.Keys) + { + xe = xd.CreateElement("content"); + xe.Attributes.SetNamedItem(AddAttribute(xd, "old", key.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xd, "new", Old2NewContent[key].ToString())); + xd.DocumentElement.AppendChild(xe); + } + xd.Save(fn); + ze = MyImpxZipFile["contents.xml"]; + MyImpxZipFile.RemoveEntry(ze); + MyImpxZipFile.Save(); + MyImpxZipFile.AddFile(fn, ""); + MyImpxZipFile.Save(); + File.Delete(fn); + xd = new XmlDocument(); + xe = xd.CreateElement("transitions"); + xd.AppendChild(xe); + fn = PEIPath + @"\transitions.xml"; + if (PendingTransitions != null && PendingTransitions.DocumentElement.HasChildNodes) + { + foreach (XmlNode nd in PendingTransitions.DocumentElement.ChildNodes) + { + if (nd.InnerText == "") + xd.DocumentElement.AppendChild(xd.ImportNode(nd, true)); + } + } + xd.Save(fn); + ze = MyImpxZipFile["transitions.xml"]; + MyImpxZipFile.RemoveEntry(ze); + MyImpxZipFile.Save(); + MyImpxZipFile.AddFile(fn, ""); + MyImpxZipFile.Save(); + File.Delete(fn); + } // appears to not be used - jsj 4-28-2016 //private void StoreItemContentIDs() //{ @@ -1477,13 +1477,13 @@ namespace VEPROMS // 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 // This will read in the saved ItemIDs (old and new), ContentIDs (old andnew), library document IDs (old and new), and pending transitions - private void ReadTransitionAndItemContentIDs() - { - ZipEntry ze = MyImpxZipFile["items.xml"]; - ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); - string fn = PEIPath + @"\items.xml"; - XmlDocument xd = new XmlDocument(); - xd.Load(fn); + private void ReadTransitionAndItemContentIDs() + { + ZipEntry ze = MyImpxZipFile["items.xml"]; + ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); + string fn = PEIPath + @"\items.xml"; + 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) @@ -1493,12 +1493,12 @@ namespace VEPROMS // //if (!Old2NewItem.ContainsKey(oldid)) // Old2NewItem.Add(oldid, newid); //} - File.Delete(fn); - ze = MyImpxZipFile["contents.xml"]; - ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); - fn = PEIPath + @"\contents.xml"; - xd = new XmlDocument(); - xd.Load(fn); + File.Delete(fn); + ze = MyImpxZipFile["contents.xml"]; + ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); + fn = PEIPath + @"\contents.xml"; + 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) @@ -1508,12 +1508,12 @@ namespace VEPROMS // //if (!Old2NewContent.ContainsKey(oldid)) // Old2NewContent.Add(oldid, newid); //} - File.Delete(fn); - ze = MyImpxZipFile["libdocs.xml"]; - ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); - fn = PEIPath + @"\libdocs.xml"; - xd = new XmlDocument(); - xd.Load(fn); + File.Delete(fn); + ze = MyImpxZipFile["libdocs.xml"]; + ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); + fn = PEIPath + @"\libdocs.xml"; + xd = new XmlDocument(); + xd.Load(fn); XmlNodeList nl = xd.SelectNodes("//libdoc"); //nl = xd.SelectNodes("//libdoc"); foreach (XmlNode nd in nl) @@ -1523,13 +1523,13 @@ namespace VEPROMS //if (!Old2NewContent.ContainsKey(oldid)) Old2NewLibDoc.Add(oldid, newid); } - File.Delete(fn); - ze = MyImpxZipFile["transitions.xml"]; - ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); - fn = PEIPath + @"\transitions.xml"; - PendingTransitions.Load(fn); - File.Delete(fn); - } + File.Delete(fn); + ze = MyImpxZipFile["transitions.xml"]; + ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); + fn = PEIPath + @"\transitions.xml"; + PendingTransitions.Load(fn); + File.Delete(fn); + } // appears not to be used - jsj 4-28-2016 //private void AddStoredItemContentIDs(XmlDocument xd) //{ @@ -1602,7 +1602,7 @@ namespace VEPROMS // jsj 4-29-2016 appears to not be used //private Dictionary> MyCounts = null; //private Dictionary MySubCounts = null; - //private void GetImportDataCounts() + //private void GetImportDataCounts() //{ // int pCount = 0; // int sCount = 0; @@ -1660,87 +1660,87 @@ namespace VEPROMS private void btnImport_Click(object sender, EventArgs e) { - if (_MyMode.ToUpper().Contains("FORMAT")) - { - ofd.Filter = "PROMS Procedure Export Files|*.pxml"; - if (ofd.ShowDialog(this) == DialogResult.OK) - 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(); - PendingTransitions = new XmlDocument(); - FileInfo fi = new FileInfo(ofd.FileName); - string dn; + if (_MyMode.ToUpper().Contains("FORMAT")) + { + ofd.Filter = "PROMS Procedure Export Files|*.pxml"; + if (ofd.ShowDialog(this) == DialogResult.OK) + 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(); + 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)) - { + 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) - txtImport.Text = ofd.FileName; - } + } + 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) + txtImport.Text = ofd.FileName; + } } private void txtImport_TextChanged(object sender, EventArgs e) { @@ -1751,99 +1751,99 @@ namespace VEPROMS lblImportStatus.Text = "Awaiting Import File Name:"; } #region Export for Merge - private string FromFolderName = string.Empty; - private void ExportFolder(XmlDocument xd, FolderInfo fi, string nodename) - { - /* - FolderID - ParentID - DBID - Name - Title - ShortName - FormatID - ManualOrder - Config - DTS - UsrID - */ - lblExportStatus.Text = "Exporting Folder..."; - Application.DoEvents(); - string formatFileName = (fi.MyFormat != null)? fi.MyFormat.Name:""; - FromFolderName = fi.Name; - XmlElement xe = xd.CreateElement(nodename); - xe.Attributes.SetNamedItem(AddAttribute(xd, "folderid", fi.FolderID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xd, "parentid", fi.ParentID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xd, "dbid", fi.DBID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xd, "name", fi.Name)); - xe.Attributes.SetNamedItem(AddAttribute(xd, "title", fi.Title)); - xe.Attributes.SetNamedItem(AddAttribute(xd, "shortname", fi.ShortName)); - xe.Attributes.SetNamedItem(AddAttribute(xd, "formatid", fi.FormatID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xd, "manualorder", fi.ManualOrder.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xd, "config", fi.Config)); - xe.Attributes.SetNamedItem(AddAttribute(xd, "dts", fi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xe.Attributes.SetNamedItem(AddAttribute(xd, "usrid", fi.UsrID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xd, "formatfilename",formatFileName)); - xd.AppendChild(xe); - ExportAnnotationTypes(xe, "annotationtypes"); - ExportFormats(FormatInfoList.GetFormatInfoListUsed(), xe, "formats", true); - if (fi.FolderDocVersionCount > 0) - foreach (DocVersionInfo dvi in fi.FolderDocVersions) - ExportDocVersion(xe, dvi, "docversion"); - } - private void ExportFormats(FormatInfoList fil, XmlElement xn, string nodename, bool doElement) - { - XmlElement xe = null; - if (doElement) xe = xn.OwnerDocument.CreateElement(nodename); - else xe = xn; - foreach (FormatInfo fi in fil) - ExportFormat(xe, fi, "format"); - if (doElement) xn.AppendChild(xe); - } - private void ExportFormat(XmlElement xn, FormatInfo fi, string nodename) - { - XmlElement xe = xn.OwnerDocument.CreateElement(nodename); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "formatid", fi.FormatID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "name", fi.Name)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "pname", fi.MyParent==null?"null":fi.MyParent.Name)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "description", fi.Description)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", fi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", fi.UserID)); + private string FromFolderName = string.Empty; + private void ExportFolder(XmlDocument xd, FolderInfo fi, string nodename) + { + /* + FolderID + ParentID + DBID + Name + Title + ShortName + FormatID + ManualOrder + Config + DTS + UsrID + */ + lblExportStatus.Text = "Exporting Folder..."; + Application.DoEvents(); + string formatFileName = (fi.MyFormat != null) ? fi.MyFormat.Name : ""; + FromFolderName = fi.Name; + XmlElement xe = xd.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xd, "folderid", fi.FolderID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xd, "parentid", fi.ParentID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xd, "dbid", fi.DBID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xd, "name", fi.Name)); + xe.Attributes.SetNamedItem(AddAttribute(xd, "title", fi.Title)); + xe.Attributes.SetNamedItem(AddAttribute(xd, "shortname", fi.ShortName)); + xe.Attributes.SetNamedItem(AddAttribute(xd, "formatid", fi.FormatID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xd, "manualorder", fi.ManualOrder.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xd, "config", fi.Config)); + xe.Attributes.SetNamedItem(AddAttribute(xd, "dts", fi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.Attributes.SetNamedItem(AddAttribute(xd, "usrid", fi.UsrID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xd, "formatfilename", formatFileName)); + xd.AppendChild(xe); + ExportAnnotationTypes(xe, "annotationtypes"); + ExportFormats(FormatInfoList.GetFormatInfoListUsed(), xe, "formats", true); + if (fi.FolderDocVersionCount > 0) + foreach (DocVersionInfo dvi in fi.FolderDocVersions) + ExportDocVersion(xe, dvi, "docversion"); + } + private void ExportFormats(FormatInfoList fil, XmlElement xn, string nodename, bool doElement) + { + XmlElement xe = null; + if (doElement) xe = xn.OwnerDocument.CreateElement(nodename); + else xe = xn; + foreach (FormatInfo fi in fil) + ExportFormat(xe, fi, "format"); + if (doElement) xn.AppendChild(xe); + } + private void ExportFormat(XmlElement xn, FormatInfo fi, string nodename) + { + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "formatid", fi.FormatID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "name", fi.Name)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "pname", fi.MyParent == null ? "null" : fi.MyParent.Name)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "description", fi.Description)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", fi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", fi.UserID)); - if (fi.Config != null && fi.Config != "") - { - FormatConfig MyFormatConfig = FormatConfig.Get(fi.Config); - string scf = MyFormatConfig.ConvertToString(); - scf = Regex.Replace(scf, " *<[a-zA-Z ]+/>\r\n", ""); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", scf)); - } - xn.AppendChild(xe); - } - private void ExportAnnotationTypes(XmlElement xn, string nodename) - { - XmlElement xe = xn.OwnerDocument.CreateElement(nodename); - AnnotationTypeInfoList atl = AnnotationTypeInfoList.Get(); - foreach (AnnotationTypeInfo ati in atl) - ExportAnnotationType(xe, ati, "annotationtype"); - xn.AppendChild(xe); - } - private void ExportAnnotationType(XmlElement xn, AnnotationTypeInfo ati, string nodename) - { - /* - TypeID - Name - Config - DTS - UserID - */ - XmlElement xe = xn.OwnerDocument.CreateElement(nodename); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "typeid", ati.TypeID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "name", ati.Name)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", ati.Config)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ati.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ati.UserID.ToString())); - xn.AppendChild(xe); - } + if (fi.Config != null && fi.Config != "") + { + FormatConfig MyFormatConfig = FormatConfig.Get(fi.Config); + string scf = MyFormatConfig.ConvertToString(); + scf = Regex.Replace(scf, " *<[a-zA-Z ]+/>\r\n", ""); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", scf)); + } + xn.AppendChild(xe); + } + private void ExportAnnotationTypes(XmlElement xn, string nodename) + { + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + AnnotationTypeInfoList atl = AnnotationTypeInfoList.Get(); + foreach (AnnotationTypeInfo ati in atl) + ExportAnnotationType(xe, ati, "annotationtype"); + xn.AppendChild(xe); + } + private void ExportAnnotationType(XmlElement xn, AnnotationTypeInfo ati, string nodename) + { + /* + TypeID + Name + Config + DTS + UserID + */ + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "typeid", ati.TypeID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "name", ati.Name)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", ati.Config)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ati.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ati.UserID.ToString())); + xn.AppendChild(xe); + } // jsj 4-29-2016 appears to not be used //private void ExportFolder(FolderInfo fi, string nodename) @@ -1877,7 +1877,7 @@ namespace VEPROMS // 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"); @@ -1956,7 +1956,7 @@ namespace VEPROMS } } } - private void ExportDocVersion(DocVersionInfo dvi, string nodename) + private void ExportDocVersion(DocVersionInfo dvi, string nodename) { /* VersionID @@ -1983,9 +1983,9 @@ namespace VEPROMS 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.DocVersionAssociationCount > 0) + foreach (AssociationInfo ai in dvi.DocVersionAssociations) + ExportAssociation(ai, "association"); if (dvi.Procedures.Count > 0) { pbExportProcedure.Value = 0; @@ -1998,29 +1998,29 @@ namespace VEPROMS } MyWriter.WriteEndElement(); } - private void ExportAssociation(XmlElement xn, AssociationInfo ai, string nodename) - { - /* - AssociationID - VersionID - ROFstID - Config - DTS - UserID - */ - lblExportStatus.Text = "Exporting Association..."; - Application.DoEvents(); - XmlElement xe = xn.OwnerDocument.CreateElement(nodename); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "associationid", ai.AssociationID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "versionid", ai.VersionID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rofstid", ai.ROFstID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", ai.Config)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ai.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ai.UserID.ToString())); - xn.AppendChild(xe); - ExportROFst(xe, ai.MyROFst, "rofst"); - } - private void ExportAssociation(AssociationInfo ai, string nodename) + private void ExportAssociation(XmlElement xn, AssociationInfo ai, string nodename) + { + /* + AssociationID + VersionID + ROFstID + Config + DTS + UserID + */ + lblExportStatus.Text = "Exporting Association..."; + Application.DoEvents(); + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "associationid", ai.AssociationID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "versionid", ai.VersionID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rofstid", ai.ROFstID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", ai.Config)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ai.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ai.UserID.ToString())); + xn.AppendChild(xe); + ExportROFst(xe, ai.MyROFst, "rofst"); + } + private void ExportAssociation(AssociationInfo ai, string nodename) { /* AssociationID @@ -2040,30 +2040,30 @@ namespace VEPROMS ExportROFst(ai.MyROFst, "rofst"); MyWriter.WriteEndElement(); } - private void ExportROFst(XmlElement xn, ROFstInfo fst, string nodename) - { - /* - ROFstID - RODbID - ROLookup - Config - DTS - UserID - */ - lblExportStatus.Text = "Exporting ROFst..."; - Application.DoEvents(); - XmlElement xe = xn.OwnerDocument.CreateElement(nodename); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rofstid", fst.ROFstID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rodbid", fst.RODbID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rolookup", Convert.ToBase64String(fst.ROLookup))); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", fst.Config)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", fst.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", fst.UserID.ToString())); - xn.AppendChild(xe); + private void ExportROFst(XmlElement xn, ROFstInfo fst, string nodename) + { + /* + ROFstID + RODbID + ROLookup + Config + DTS + UserID + */ + lblExportStatus.Text = "Exporting ROFst..."; + Application.DoEvents(); + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rofstid", fst.ROFstID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rodbid", fst.RODbID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rolookup", Convert.ToBase64String(fst.ROLookup))); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", fst.Config)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", fst.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", fst.UserID.ToString())); + xn.AppendChild(xe); ExportFigures(xe, fst); - ExportRODb(xe, fst.MyRODb, "rodb"); - } - private void ExportROFst(ROFstInfo fst, string nodename) + ExportRODb(xe, fst.MyRODb, "rodb"); + } + private void ExportROFst(ROFstInfo fst, string nodename) { /* ROFstID @@ -2100,7 +2100,7 @@ namespace VEPROMS xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", figure.UserID)); xe.AppendChild(xee); // B2018-031 Output figure names as they are exported to provide more constant feedback - lblExportStatus.Text = string.Format("Exporting Figure...{0}",figure.MyROImage.FileName); + lblExportStatus.Text = string.Format("Exporting Figure...{0}", figure.MyROImage.FileName); Application.DoEvents(); ExportROImage(xee, figure.MyROImage); } @@ -2118,30 +2118,30 @@ namespace VEPROMS xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", image.UserID)); xn.AppendChild(xe); } - private void ExportRODb(XmlElement xn, RODbInfo db, string nodename) - { - /* - RODbID - ROName - FolderPath - DBConnectionString - Config - DTS - UserID - */ - lblExportStatus.Text = "Exporting RODb..."; - Application.DoEvents(); - XmlElement xe = xn.OwnerDocument.CreateElement(nodename); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rodbid", db.RODbID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "roname", db.ROName)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "folderpath", db.FolderPath)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dbconnectionstring", db.DBConnectionString)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", db.Config)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", db.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", db.UserID.ToString())); - xn.AppendChild(xe); - } - private void ExportRODb(RODbInfo db, string nodename) + private void ExportRODb(XmlElement xn, RODbInfo db, string nodename) + { + /* + RODbID + ROName + FolderPath + DBConnectionString + Config + DTS + UserID + */ + lblExportStatus.Text = "Exporting RODb..."; + Application.DoEvents(); + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rodbid", db.RODbID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "roname", db.ROName)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "folderpath", db.FolderPath)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dbconnectionstring", db.DBConnectionString)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", db.Config)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", db.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", db.UserID.ToString())); + xn.AppendChild(xe); + } + private void ExportRODb(RODbInfo db, string nodename) { /* RODbID @@ -2163,9 +2163,9 @@ namespace VEPROMS MyWriter.WriteEndElement(); } - public void ExportItem(XmlDocument xd, ItemInfo ii, string nodename) - { - XmlElement xe = xd.CreateElement(nodename); + public void ExportItem(XmlDocument xd, ItemInfo ii, string nodename) + { + XmlElement xe = xd.CreateElement(nodename); if (ii.IsProcedure) { xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rodbid", ii.MyDocVersion.DocVersionAssociations[0].MyROFst.MyRODb.RODbID.ToString())); @@ -2173,38 +2173,38 @@ namespace VEPROMS xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rofstid", ii.MyDocVersion.DocVersionAssociations[0].MyROFst.ROFstID.ToString())); xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rofstdts", ii.MyDocVersion.DocVersionAssociations[0].MyROFst.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); } - xd.AppendChild(xe); - ExportItem(xe, ii, nodename); - } - private void ExportItem(XmlElement xn, ItemInfo ii, string nodename) - { - /* - ItemID - PreviousID - ContentID - DTS - */ - XmlElement xe = null; - if (xn.Name == "procedure") - xe = xn; - else - { - xe = xn.OwnerDocument.CreateElement(nodename); - xn.AppendChild(xe); - } - if (ii.IsProcedure) - { - pbExportProcedure.PerformStep(); - lblExportProcedure.Text = string.Format("{0} of {1} Procedures", pbExportProcedure.Value.ToString(), pbExportProcedure.Maximum.ToString()); - TimeSpan elapsed = DateTime.Now.Subtract(MyStart); - lblExportTime.Text = "Elapsed Time: " + elapsed.ToString(); - Application.DoEvents(); - pbExportSection.Value = 0; - pbExportSection.Maximum = pbExportSection.Value; - pbExportStep.Value = 0; - pbExportStep.Maximum = pbExportStep.Value; - if(ii.Sections != null) - pbExportSection.Maximum = ii.Sections.Count; + xd.AppendChild(xe); + ExportItem(xe, ii, nodename); + } + private void ExportItem(XmlElement xn, ItemInfo ii, string nodename) + { + /* + ItemID + PreviousID + ContentID + DTS + */ + XmlElement xe = null; + if (xn.Name == "procedure") + xe = xn; + else + { + xe = xn.OwnerDocument.CreateElement(nodename); + xn.AppendChild(xe); + } + if (ii.IsProcedure) + { + pbExportProcedure.PerformStep(); + lblExportProcedure.Text = string.Format("{0} of {1} Procedures", pbExportProcedure.Value.ToString(), pbExportProcedure.Maximum.ToString()); + TimeSpan elapsed = DateTime.Now.Subtract(MyStart); + lblExportTime.Text = "Elapsed Time: " + elapsed.ToString(); + Application.DoEvents(); + pbExportSection.Value = 0; + pbExportSection.Maximum = pbExportSection.Value; + pbExportStep.Value = 0; + pbExportStep.Maximum = pbExportStep.Value; + if (ii.Sections != null) + pbExportSection.Maximum = ii.Sections.Count; else { pbExportSection.Maximum = 1; @@ -2216,13 +2216,13 @@ namespace VEPROMS Application.DoEvents(); } } - if (ii.IsSection && ii.ActiveParent.IsProcedure) - { - pbExportSection.PerformStep(); - lblExportSection.Text = string.Format("{0} of {1} Sections", pbExportSection.Value.ToString(), pbExportSection.Maximum.ToString()); - Application.DoEvents(); - pbExportStep.Value = 0; - pbExportStep.Maximum = pbExportStep.Value; + if (ii.IsSection && ii.ActiveParent.IsProcedure) + { + pbExportSection.PerformStep(); + lblExportSection.Text = string.Format("{0} of {1} Sections", pbExportSection.Value.ToString(), pbExportSection.Maximum.ToString()); + Application.DoEvents(); + pbExportStep.Value = 0; + pbExportStep.Maximum = pbExportStep.Value; if (ii.Steps != null) pbExportStep.Maximum = ii.Steps.Count; else @@ -2232,63 +2232,63 @@ namespace VEPROMS lblExportStep.Text = "Word Section Data"; Application.DoEvents(); } - } - if (ii.IsStep && ii.ActiveParent.IsSection && ii.ActiveParent.ActiveParent.IsProcedure) - { - pbExportStep.PerformStep(); - lblExportStep.Text = string.Format("{0} of {1} Steps", pbExportStep.Value.ToString(), pbExportStep.Maximum.ToString()); + } + if (ii.IsStep && ii.ActiveParent.IsSection && ii.ActiveParent.ActiveParent.IsProcedure) + { + pbExportStep.PerformStep(); + lblExportStep.Text = string.Format("{0} of {1} Steps", pbExportStep.Value.ToString(), pbExportStep.Maximum.ToString()); Application.DoEvents(); - } - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "itemid", ii.ItemID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "previousid", ii.PreviousID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "contentid", ii.ContentID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ii.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - //item audits - ExportItemAudits(xe, ii); - ExportContent(xe, ii.MyContent, "content"); - if (ii.ItemAnnotationCount > 0) - foreach (AnnotationInfo ai in ii.ItemAnnotations) - ExportAnnotation(xe, ai, "annotation"); - } - private void ExportItemAudits(XmlElement xn, ItemInfo ii) - { - if (cbxExportAudits.Checked) - { - ItemAuditInfoList audits = ItemAuditInfoList.Get(ii.ItemID); - if (audits.Count > 0) - { - XmlElement xe = xn.OwnerDocument.CreateElement("audits"); - foreach (ItemAuditInfo audit in audits) - { - if (audit.DeleteStatus == 0) - { - XmlElement xee = xn.OwnerDocument.CreateElement("audit"); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "itemid", audit.ItemID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "previousid", audit.PreviousID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); - xe.AppendChild(xee); - } - } - xn.AppendChild(xe); - } - } - } + } + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "itemid", ii.ItemID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "previousid", ii.PreviousID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "contentid", ii.ContentID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ii.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + //item audits + ExportItemAudits(xe, ii); + ExportContent(xe, ii.MyContent, "content"); + if (ii.ItemAnnotationCount > 0) + foreach (AnnotationInfo ai in ii.ItemAnnotations) + ExportAnnotation(xe, ai, "annotation"); + } + private void ExportItemAudits(XmlElement xn, ItemInfo ii) + { + if (cbxExportAudits.Checked) + { + ItemAuditInfoList audits = ItemAuditInfoList.Get(ii.ItemID); + if (audits.Count > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("audits"); + foreach (ItemAuditInfo audit in audits) + { + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "itemid", audit.ItemID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "previousid", audit.PreviousID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xe.AppendChild(xee); + } + } + xn.AppendChild(xe); + } + } + } // used to save word sections with resolved ROs (export generated from Approve) private Dictionary _DocReplace; public Dictionary DocReplace { get { return _DocReplace; } - set + set { _DocReplace = value; _ConvertROsAndTransitionsToText = (value != null); } } - private void ExportItem(ItemInfo ii, string nodename) + private void ExportItem(ItemInfo ii, string nodename) { /* ItemID @@ -2350,81 +2350,81 @@ namespace VEPROMS ExportAnnotation(ai, "annotation"); MyWriter.WriteEndElement(); } - private void ExportContent(XmlElement xn, ContentInfo ci, string nodename) - { - /* - ContentID - Number - Text - Type - FormatID - Config - DTS - UserID - */ - XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + private void ExportContent(XmlElement xn, ContentInfo ci, string nodename) + { + /* + ContentID + Number + Text + Type + FormatID + Config + DTS + 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; + string ciText = (_ConvertROsAndTransitionsToText) ? ItemInfo.StripLinks(ci.Text) : ci.Text; string formatFileName = (ci.MyFormat != null) ? ci.MyFormat.Name : ""; - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "contentid", ci.ContentID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "number", ci.Number)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "text", ciText)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "type", ci.Type.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "formatid", ci.FormatID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", ci.Config)); - 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)); - //content audits - ExportContentAudits(xe, ci); - xn.AppendChild(xe); - if (ci.ContentTransitionCount > 0) - foreach (TransitionInfo ti in ci.ContentTransitions) - ExportTransition(xe, ti, "transition"); - if (ci.ContentRoUsageCount > 0) - foreach (RoUsageInfo ri in ci.ContentRoUsages) - ExportROUsage(xe, ri, "rousage"); - if (ci.ContentEntryCount > 0) - ExportEntry(xe, ci.MyEntry, "entry"); - if (ci.ContentGridCount > 0) - ExportGrid(xe, ci.MyGrid, "grid"); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "contentid", ci.ContentID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "number", ci.Number)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "text", ciText)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "type", ci.Type.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "formatid", ci.FormatID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", ci.Config)); + 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)); + //content audits + ExportContentAudits(xe, ci); + xn.AppendChild(xe); + if (ci.ContentTransitionCount > 0) + foreach (TransitionInfo ti in ci.ContentTransitions) + ExportTransition(xe, ti, "transition"); + if (ci.ContentRoUsageCount > 0) + foreach (RoUsageInfo ri in ci.ContentRoUsages) + ExportROUsage(xe, ri, "rousage"); + if (ci.ContentEntryCount > 0) + ExportEntry(xe, ci.MyEntry, "entry"); + if (ci.ContentGridCount > 0) + ExportGrid(xe, ci.MyGrid, "grid"); if (ci.ContentImageCount > 0) ExportImage(xe, ci.MyImage, "image"); - if (ci.ContentPartCount > 0) - foreach (PartInfo pi in ci.ContentParts) - ExportPart(xe, pi, ((E_FromTypes)pi.FromType).ToString().ToLower()); - } - private void ExportContentAudits(XmlElement xn, ContentInfo ci) - { - if (cbxExportAudits.Checked) - { - ContentAuditInfoList audits = ContentAuditInfoList.Get(ci.ContentID); - if (audits.Count > 0) - { - XmlElement xe = xn.OwnerDocument.CreateElement("audits"); - foreach (ContentAuditInfo audit in audits) - { - if (audit.DeleteStatus == 0) - { - XmlElement xee = xn.OwnerDocument.CreateElement("audit"); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "number", audit.Number)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "text", audit.Text)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "type", audit.Type.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "formatid", audit.FormatID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "config", audit.Config)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "actiondts", audit.ActionWhen.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xe.AppendChild(xee); - } - } - } - } - } - private void ExportContent(ContentInfo ci, string nodename) + if (ci.ContentPartCount > 0) + foreach (PartInfo pi in ci.ContentParts) + ExportPart(xe, pi, ((E_FromTypes)pi.FromType).ToString().ToLower()); + } + private void ExportContentAudits(XmlElement xn, ContentInfo ci) + { + if (cbxExportAudits.Checked) + { + ContentAuditInfoList audits = ContentAuditInfoList.Get(ci.ContentID); + if (audits.Count > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("audits"); + foreach (ContentAuditInfo audit in audits) + { + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "number", audit.Number)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "text", audit.Text)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "type", audit.Type.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "formatid", audit.FormatID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "config", audit.Config)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "actiondts", audit.ActionWhen.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.AppendChild(xee); + } + } + } + } + } + private void ExportContent(ContentInfo ci, string nodename) { /* ContentID @@ -2466,60 +2466,60 @@ namespace VEPROMS ExportPart(pi, ((E_FromTypes)pi.FromType).ToString().ToLower()); MyWriter.WriteEndElement(); } - private void ExportGrid(XmlElement xn, GridInfo gi, string nodename) - { - /* - ContentID - Data - Config - DTS - UserID - */ + private void ExportGrid(XmlElement xn, GridInfo gi, string nodename) + { + /* + ContentID + Data + Config + DTS + UserID + */ string giData = gi.Data; if (_ConvertROsAndTransitionsToText) { giData = giData.Replace("True", "False"); // converts a RO table to a unlinked regular table giData = ItemInfo.StripLinks(giData); // this converts ROs and transitions to text } - XmlElement xe = xn.OwnerDocument.CreateElement(nodename); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "contentid", gi.ContentID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "data", giData)); - 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())); - //grid audits - ExportGridAudits(xe, gi); - xn.AppendChild(xe); - } - private void ExportGridAudits(XmlElement xn, GridInfo gi) - { - if (cbxExportAudits.Checked) - { - GridAuditInfoList audits = GridAuditInfoList.Get(gi.ContentID); - if (audits.Count > 0) - { - XmlElement xe = xn.OwnerDocument.CreateElement("audits"); - foreach (GridAuditInfo audit in audits) - { - if (audit.DeleteStatus == 0) - { - XmlElement xee = xn.OwnerDocument.CreateElement("audit"); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "data", audit.Data)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "config", audit.Config)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentauditid", audit.ContentAuditID.ToString())); - xe.AppendChild(xee); + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "contentid", gi.ContentID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "data", giData)); + 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())); + //grid audits + ExportGridAudits(xe, gi); + xn.AppendChild(xe); + } + private void ExportGridAudits(XmlElement xn, GridInfo gi) + { + if (cbxExportAudits.Checked) + { + GridAuditInfoList audits = GridAuditInfoList.Get(gi.ContentID); + if (audits.Count > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("audits"); + foreach (GridAuditInfo audit in audits) + { + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "data", audit.Data)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "config", audit.Config)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentauditid", audit.ContentAuditID.ToString())); + xe.AppendChild(xee); - } - } - } - } - } - private void ExportGrid(GridInfo gi, string nodename) + } + } + } + } + } + private void ExportGrid(GridInfo gi, string nodename) { /* ContentID @@ -2560,32 +2560,32 @@ namespace VEPROMS xn.AppendChild(xe); ExportDocument(xe, ei.MyDocument, "document"); } - private void ExportEntryAudits(XmlElement xn, EntryInfo ei) - { - if (cbxExportAudits.Checked) - { - EntryAuditInfoList audits = EntryAuditInfoList.Get(ei.ContentID); - if (audits.Count > 0) - { - XmlElement xe = xn.OwnerDocument.CreateElement("audits"); - foreach (EntryAuditInfo audit in audits) - { - if (audit.DeleteStatus == 0) - { - XmlElement xee = xn.OwnerDocument.CreateElement("audit"); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "docid", audit.DocID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); - xe.AppendChild(xee); - } - } - } - } - } - private void ExportEntry(EntryInfo ei, string nodename) + private void ExportEntryAudits(XmlElement xn, EntryInfo ei) + { + if (cbxExportAudits.Checked) + { + EntryAuditInfoList audits = EntryAuditInfoList.Get(ei.ContentID); + if (audits.Count > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("audits"); + foreach (EntryAuditInfo audit in audits) + { + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "docid", audit.DocID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xe.AppendChild(xee); + } + } + } + } + } + private void ExportEntry(EntryInfo ei, string nodename) { /* ContentID @@ -2673,18 +2673,18 @@ namespace VEPROMS MyWriter.WriteAttributeString("userid", ii.UserID.ToString()); MyWriter.WriteEndElement(); } - private void ExportDocument(XmlElement xn, DocumentInfo di, string nodename) - { - /* - DocID - LibTitle - DocContent - DocAscii - Config - DTS - UserID - FileExtension - */ + private void ExportDocument(XmlElement xn, 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) @@ -2692,49 +2692,49 @@ namespace VEPROMS buf = DocReplace[di.DocID]; libDocTitle = null; // unlink the word section from the library document } - XmlElement xe = xn.OwnerDocument.CreateElement(nodename); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "docid", di.DocID.ToString())); + 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, "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)); - //document audits - ExportDocumentAudits(xe, di); - xn.AppendChild(xe); - } - private void ExportDocumentAudits(XmlElement xn, DocumentInfo di) - { - if (cbxExportAudits.Checked) - { - DocumentAuditInfoList audits = DocumentAuditInfoList.Get(di.DocID); - if (audits.Count > 0) - { - XmlElement xe = xn.OwnerDocument.CreateElement("audits"); - foreach (DocumentAuditInfo audit in audits) - { - if (audit.DeleteStatus == 0) - { - XmlElement xee = xn.OwnerDocument.CreateElement("audit"); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "docid", audit.DocID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "libtitle", audit.LibTitle)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "doccontent",Convert.ToBase64String(audit.DocContent))); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "docascii", audit.DocAscii)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "config", audit.Config)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "fileextension", audit.FileExtension)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); - xe.AppendChild(xee); - } - } - } - } - } - private void ExportDocument(DocumentInfo di, string nodename) + 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)); + //document audits + ExportDocumentAudits(xe, di); + xn.AppendChild(xe); + } + private void ExportDocumentAudits(XmlElement xn, DocumentInfo di) + { + if (cbxExportAudits.Checked) + { + DocumentAuditInfoList audits = DocumentAuditInfoList.Get(di.DocID); + if (audits.Count > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("audits"); + foreach (DocumentAuditInfo audit in audits) + { + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "docid", audit.DocID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "libtitle", audit.LibTitle)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "doccontent", Convert.ToBase64String(audit.DocContent))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "docascii", audit.DocAscii)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "config", audit.Config)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "fileextension", audit.FileExtension)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xe.AppendChild(xee); + } + } + } + } + } + private void ExportDocument(DocumentInfo di, string nodename) { /* DocID @@ -2764,36 +2764,36 @@ namespace VEPROMS MyWriter.WriteAttributeString("fileextension", di.FileExtension); MyWriter.WriteEndElement(); } - private void ExportROUsage(XmlElement xn, RoUsageInfo ri, string nodename) - { - /* - ROUsageID - ContentID - ROID - Config - DTS - UserID - RODbID - */ - XmlElement xe = xn.OwnerDocument.CreateElement(nodename); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rousageid", ri.ROUsageID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "contentid", ri.ContentID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "roid", ri.ROID)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", ri.Config)); - 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); - xn.AppendChild(xe); - } - private void ExportROUsageAudits(XmlElement xe, RoUsageInfo ri) - { - if (cbxExportAudits.Checked) - { - } - } - private void ExportROUsage(RoUsageInfo ri, string nodename) + private void ExportROUsage(XmlElement xn, RoUsageInfo ri, string nodename) + { + /* + ROUsageID + ContentID + ROID + Config + DTS + UserID + RODbID + */ + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rousageid", ri.ROUsageID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "contentid", ri.ContentID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "roid", ri.ROID)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", ri.Config)); + 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); + xn.AppendChild(xe); + } + private void ExportROUsageAudits(XmlElement xe, RoUsageInfo ri) + { + if (cbxExportAudits.Checked) + { + } + } + private void ExportROUsage(RoUsageInfo ri, string nodename) { /* ROUsageID @@ -2814,54 +2814,54 @@ namespace VEPROMS MyWriter.WriteAttributeString("rodbid", ri.RODbID.ToString()); MyWriter.WriteEndElement(); } - private void ExportPart(XmlElement xn, PartInfo pi, string nodename) - { - /* - ContentID - FromType - ItemID - DTS - UserID - */ - XmlElement xe = xn.OwnerDocument.CreateElement(nodename); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "contentid", pi.ContentID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "fromtype", pi.FromType.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "itemid", pi.ItemID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", pi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", pi.UserID.ToString())); - //part audits - ExportPartAudits(xe, pi); - xn.AppendChild(xe); - foreach (ItemInfo ii in pi.MyItems) - ExportItem(xe, ii, pi.PartType.ToString().ToLower()); - } - private void ExportPartAudits(XmlElement xn, PartInfo pi) - { - if (cbxExportAudits.Checked) - { - PartAuditInfoList audits = PartAuditInfoList.Get(pi.ContentID); - if (audits.Count > 0) - { - XmlElement xe = xn.OwnerDocument.CreateElement("audits"); - foreach (PartAuditInfo audit in audits) - { - if (audit.DeleteStatus == 0) - { - XmlElement xee = xn.OwnerDocument.CreateElement("audit"); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "fromtype", audit.FromType.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "itemid", audit.ItemID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); - xe.AppendChild(xee); - } - } - } - } - } - private void ExportPart(PartInfo pi, string nodename) + private void ExportPart(XmlElement xn, PartInfo pi, string nodename) + { + /* + ContentID + FromType + ItemID + DTS + UserID + */ + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "contentid", pi.ContentID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "fromtype", pi.FromType.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "itemid", pi.ItemID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", pi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", pi.UserID.ToString())); + //part audits + ExportPartAudits(xe, pi); + xn.AppendChild(xe); + foreach (ItemInfo ii in pi.MyItems) + ExportItem(xe, ii, pi.PartType.ToString().ToLower()); + } + private void ExportPartAudits(XmlElement xn, PartInfo pi) + { + if (cbxExportAudits.Checked) + { + PartAuditInfoList audits = PartAuditInfoList.Get(pi.ContentID); + if (audits.Count > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("audits"); + foreach (PartAuditInfo audit in audits) + { + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "contentid", audit.ContentID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "fromtype", audit.FromType.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "itemid", audit.ItemID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xe.AppendChild(xee); + } + } + } + } + } + private void ExportPart(PartInfo pi, string nodename) { /* ContentID @@ -2880,40 +2880,7 @@ namespace VEPROMS ExportItem(ii, pi.PartType.ToString().ToLower()); MyWriter.WriteEndElement(); } - private void ExportTransition(XmlElement xn, TransitionInfo ti, string nodename) - { - /* - TransitionID - FromID - ToID - RangeID - IsRange - TranType - Config - DTS - UserID - */ - XmlElement xe = xn.OwnerDocument.CreateElement(nodename); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "transitionid", ti.TransitionID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "fromid", ti.FromID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "toid", ti.ToID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rangeid", ti.RangeID.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "isrange", ti.IsRange.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "trantype", ti.TranType.ToString())); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", ti.Config)); - 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) + private void ExportTransition(XmlElement xn, TransitionInfo ti, string nodename) { /* TransitionID @@ -2926,20 +2893,53 @@ namespace VEPROMS 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); + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "transitionid", ti.TransitionID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "fromid", ti.FromID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "toid", ti.ToID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "rangeid", ti.RangeID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "isrange", ti.IsRange.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "trantype", ti.TranType.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", ti.Config)); + 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()); @@ -2951,65 +2951,65 @@ namespace VEPROMS MyWriter.WriteAttributeString("userid", ti.UserID.ToString()); MyWriter.WriteEndElement(); } - private void ExportAnnotation(XmlElement xn, AnnotationInfo ai, string nodename) - { - /* - AnnotationID - ItemID - TypeID - RtfText - SearchText - Config - DTS - UserID - */ - XmlElement xe = xn.OwnerDocument.CreateElement(nodename); - 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)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", ai.Config)); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ai.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ai.UserID.ToString())); - //annotation audits - ExportAnnotationAudits(xe, ai); - xn.AppendChild(xe); - } - private void ExportAnnotationAudits(XmlElement xn, AnnotationInfo ai) - { - if (cbxExportAudits.Checked) - { - AnnotationAuditInfoList audits = AnnotationAuditInfoList.GetByAnnotationID(ai.AnnotationID); - if (audits.Count > 0) - { - XmlElement xe = xn.OwnerDocument.CreateElement("audits"); - foreach (AnnotationAuditInfo audit in audits) - { - if (audit.DeleteStatus == 0) - { - XmlElement xee = xn.OwnerDocument.CreateElement("audit"); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "annotationid", audit.AnnotationID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "itemid", audit.ItemID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "typeid", audit.TypeID.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "rtftext", audit.RtfText)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "searchtext", audit.SearchText)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "config", audit.Config)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); - xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "actiondts", audit.ActionWhen.ToString("MM/dd/yyyy HH:mm:ss.fff"))); - xe.AppendChild(xee); - } - } - xn.AppendChild(xe); - } - } - } - private void ExportAnnotation(AnnotationInfo ai, string nodename) + private void ExportAnnotation(XmlElement xn, AnnotationInfo ai, string nodename) + { + /* + AnnotationID + ItemID + TypeID + RtfText + SearchText + Config + DTS + UserID + */ + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + 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)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", ai.Config)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ai.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ai.UserID.ToString())); + //annotation audits + ExportAnnotationAudits(xe, ai); + xn.AppendChild(xe); + } + private void ExportAnnotationAudits(XmlElement xn, AnnotationInfo ai) + { + if (cbxExportAudits.Checked) + { + AnnotationAuditInfoList audits = AnnotationAuditInfoList.GetByAnnotationID(ai.AnnotationID); + if (audits.Count > 0) + { + XmlElement xe = xn.OwnerDocument.CreateElement("audits"); + foreach (AnnotationAuditInfo audit in audits) + { + if (audit.DeleteStatus == 0) + { + XmlElement xee = xn.OwnerDocument.CreateElement("audit"); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "auditid", audit.AuditID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "annotationid", audit.AnnotationID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "itemid", audit.ItemID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "typeid", audit.TypeID.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "rtftext", audit.RtfText)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "searchtext", audit.SearchText)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "config", audit.Config)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "deletestatus", audit.DeleteStatus.ToString())); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "dts", audit.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "userid", audit.UserID)); + xee.Attributes.SetNamedItem(AddAttribute(xee.OwnerDocument, "actiondts", audit.ActionWhen.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.AppendChild(xee); + } + } + xn.AppendChild(xe); + } + } + } + private void ExportAnnotation(AnnotationInfo ai, string nodename) { /* AnnotationID @@ -3160,10 +3160,10 @@ namespace VEPROMS } } } - private void AddTransitions() - { - AddTransitions(PendingTransitions); - } + private void AddTransitions() + { + AddTransitions(PendingTransitions); + } private void AddTransitions(XmlDocument xd) { @@ -3306,8 +3306,8 @@ namespace VEPROMS private Dictionary Old2NewItem; private Dictionary Old2NewContent; - private Dictionary Old2NewLibDoc; - private XmlDocument PendingTransitions; + private Dictionary Old2NewLibDoc; + private XmlDocument PendingTransitions; private RODb MyRODb = null; // jsj 4-29-2016 appears to not be used @@ -3331,24 +3331,24 @@ namespace VEPROMS private Folder AddFolder(Folder p, XmlDocument xd) { - lblImportStatus.Text = "Creating Folder..."; - Application.DoEvents(); - string title = xd.DocumentElement.Attributes.GetNamedItem("title").InnerText; + 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); - string formatid = xd.DocumentElement.Attributes.GetNamedItem("formatid").InnerText; + string formatid = xd.DocumentElement.Attributes.GetNamedItem("formatid").InnerText; XmlNode fnNode = xd.DocumentElement.Attributes.GetNamedItem("formatfilename"); //Bug fix B2016-103 the formatid in an Export file may not match the formatid where you are importing to string formatfilename = (fnNode != null) ? fnNode.InnerText : ""; - Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid),formatfilename); - if (Folder.GetByParentID_Name(p.FolderID, name) != null) - return null; + Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid), formatfilename); + if (Folder.GetByParentID_Name(p.FolderID, name) != null) + return null; Folder f = Folder.MakeFolder(p, p.MyConnection, name, title, shortname, format, null, dts, usrid); return f; } - private Format OldToNewFormat(int formatID, string formatFileName) - { + private Format OldToNewFormat(int formatID, string formatFileName) + { try { string formatName = formatFileName; // B2016-103, new export files include the format filename use that if it exists @@ -3365,7 +3365,7 @@ namespace VEPROMS { return null; // format not found return null to use default format } - } + } private DocVersion AddDocVersion(Folder f, XmlReader xr) { int versiontype = int.Parse(xr.GetAttribute("versiontype")); @@ -3375,25 +3375,25 @@ namespace VEPROMS 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); + 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"); - foreach (XmlNode nd in nl) - { - AnnotationTypeInfo ati = AnnotationTypeInfo.GetByName(nd.Attributes.GetNamedItem("name").InnerText); - if (ati == null) - AnnotationType.MakeAnnotationType(nd.Attributes.GetNamedItem("name").InnerText, nd.Attributes.GetNamedItem("config").InnerText, DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText), nd.Attributes.GetNamedItem("userid").InnerText); - } - } + private void AddAnnotationTypes(XmlDocument xd) + { + XmlNodeList nl = xd.SelectNodes("folder/annotationtypes/annotationtype"); + foreach (XmlNode nd in nl) + { + AnnotationTypeInfo ati = AnnotationTypeInfo.GetByName(nd.Attributes.GetNamedItem("name").InnerText); + if (ati == null) + AnnotationType.MakeAnnotationType(nd.Attributes.GetNamedItem("name").InnerText, nd.Attributes.GetNamedItem("config").InnerText, DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText), nd.Attributes.GetNamedItem("userid").InnerText); + } + } private DocVersionInfo AddDocVersion(Folder f, XmlDocument xd) { - lblImportStatus.Text = "Creating DocVersion..."; - Application.DoEvents(); - XmlElement xe = (XmlElement)xd.SelectSingleNode("folder/docversion"); + lblImportStatus.Text = "Creating DocVersion..."; + Application.DoEvents(); + XmlElement xe = (XmlElement)xd.SelectSingleNode("folder/docversion"); int versiontype = int.Parse(xe.Attributes.GetNamedItem("versiontype").InnerText); string name = xe.Attributes.GetNamedItem("name").InnerText; string config = xe.Attributes.GetNamedItem("config").InnerText; @@ -3403,18 +3403,18 @@ namespace VEPROMS string formatid = xe.Attributes.GetNamedItem("formatid").InnerText; XmlNode fnNode = xe.Attributes.GetNamedItem("formatfilename"); //Bug fix B2016-103 the formatid in an Export file may not match the formatid where you are importing to string formatfilename = (fnNode != null) ? fnNode.InnerText : ""; - Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid),formatfilename); + Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid), formatfilename); DocVersion dv = DocVersion.MakeDocVersion(f, versiontype, name, null, null, format, config, dts, userid); XmlNode xassoc = xe.SelectSingleNode("association"); - if (xassoc != null) - { - XmlNode xrofst = xassoc.SelectSingleNode("rofst"); - XmlNode xrodb = xrofst.SelectSingleNode("rodb"); + if (xassoc != null) + { + XmlNode xrofst = xassoc.SelectSingleNode("rofst"); + XmlNode xrodb = xrofst.SelectSingleNode("rodb"); MyRODb = AddRODb(xrodb); - ROFst rofst = AddROFst(xrofst); - DocVersionAssociation dva = dv.DocVersionAssociations.Add(rofst); - dv.Save(); - } + ROFst rofst = AddROFst(xrofst); + DocVersionAssociation dva = dv.DocVersionAssociations.Add(rofst); + dv.Save(); + } return DocVersionInfo.Get(dv.VersionID); } @@ -3445,14 +3445,14 @@ namespace VEPROMS private ROFst AddROFst(XmlNode xrofst) { - lblImportStatus.Text = "Creating ROFst..."; - Application.DoEvents(); - byte[] rolookup = Convert.FromBase64String(xrofst.Attributes.GetNamedItem("rolookup").InnerText); + lblImportStatus.Text = "Creating ROFst..."; + Application.DoEvents(); + byte[] rolookup = Convert.FromBase64String(xrofst.Attributes.GetNamedItem("rolookup").InnerText); string config = xrofst.Attributes.GetNamedItem("config").InnerText; string userid = xrofst.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xrofst.Attributes.GetNamedItem("dts").InnerText); ROFst rv = null; - rv = ROFst.GetByRODbID_DTS(MyRODb.RODbID, dts); + rv = ROFst.GetByRODbID_DTS(MyRODb.RODbID, dts); // if the RO database is not found in the current data (does not have the same RODBid nor date/time stamp // then spin through the list of RO databases and compare the FST information. // If the RO FST information is the same, then use that current RO database when importing @@ -3462,7 +3462,7 @@ namespace VEPROMS foreach (RODbInfo roinfo in rodblst) { rv = ROFst.GetByRODbID_DTS(roinfo.RODbID, dts); - if (rv != null && Same(rv.ROLookup,rolookup)) return rv; + if (rv != null && Same(rv.ROLookup, rolookup)) return rv; } rv = ROFst.MakeROFst(MyRODb, rolookup, config, dts, userid); XmlNode xfigures = xrofst.SelectSingleNode("figures"); @@ -3505,7 +3505,7 @@ namespace VEPROMS dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); userid = nd.Attributes.GetNamedItem("userid").InnerText; // Dispose when done - using(Figure fig = Figure.MakeFigure(rofst, roimage, config, dts, userid)){;} + using (Figure fig = Figure.MakeFigure(rofst, roimage, config, dts, userid)) { ;} } } else @@ -3514,7 +3514,7 @@ namespace VEPROMS dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); userid = nd.Attributes.GetNamedItem("userid").InnerText; // Dispose when done - using(Figure fig = Figure.MakeFigure(rofst, roimage, config, dts, userid)){;} + using (Figure fig = Figure.MakeFigure(rofst, roimage, config, dts, userid)) { ;} } } } @@ -3540,10 +3540,10 @@ namespace VEPROMS private RODb AddRODb(XmlNode xrodb) { - lblImportStatus.Text = "Creating RODb..."; - Application.DoEvents(); - oldRODbID = int.Parse(xrodb.Attributes.GetNamedItem("rodbid").InnerText); - string roname = xrodb.Attributes.GetNamedItem("roname").InnerText; + lblImportStatus.Text = "Creating RODb..."; + Application.DoEvents(); + oldRODbID = int.Parse(xrodb.Attributes.GetNamedItem("rodbid").InnerText); + string roname = xrodb.Attributes.GetNamedItem("roname").InnerText; string folderpath = xrodb.Attributes.GetNamedItem("folderpath").InnerText; string dbconnectionstring = xrodb.Attributes.GetNamedItem("dbconnectionstring").InnerText; string config = xrodb.Attributes.GetNamedItem("config").InnerText; @@ -3567,10 +3567,10 @@ namespace VEPROMS // if the ROname we are importing is the same as one already in the database // and the ROpaths are different, then rename the one we are importing while (roDbNameList.Contains(roNameNew)) - roNameNew = string.Format("{0}_{1}",roname,(++cnt).ToString()); + roNameNew = string.Format("{0}_{1}", roname, (++cnt).ToString()); rv = RODb.MakeRODb(roNameNew, folderpath, dbconnectionstring, config, dts, userid); } - newRODbID = rv.RODbID; + newRODbID = rv.RODbID; return rv; } @@ -3610,9 +3610,9 @@ namespace VEPROMS { pbImportProcedure.PerformStep(); lblImportProcedure.Text = string.Format("{0} of {1} Procedures", pbImportProcedure.Value.ToString(), pbImportProcedure.Maximum.ToString()); - TimeSpan elapsed = DateTime.Now.Subtract(MyStart); - lblImportTime.Text = "Elapsed Time: " + elapsed.ToString(); - Application.DoEvents(); + TimeSpan elapsed = DateTime.Now.Subtract(MyStart); + lblImportTime.Text = "Elapsed Time: " + elapsed.ToString(); + Application.DoEvents(); XmlNode xc = xn.SelectSingleNode("content"); string number = xc.Attributes.GetNamedItem("number").InnerText; string text = xc.Attributes.GetNamedItem("text").InnerText; @@ -3706,7 +3706,7 @@ namespace VEPROMS } private void ConvertImportProcedureROsToText(Content content, XmlNode xn) { - foreach (XmlNode nd in xn.SelectNodes("rousage")) + foreach (XmlNode nd in xn.SelectNodes("rousage")) { string rousageid = nd.Attributes.GetNamedItem("rousageid").InnerText; string roid = nd.Attributes.GetNamedItem("roid").InnerText; @@ -3771,7 +3771,7 @@ namespace VEPROMS txtRO = txtRO.Replace(@"\u8209?", "-"); // dash txtRO = txtRO.Replace(@"\u9586?", @"\\"); // backslash txtRO = txtRO.Replace(@"\'b0", "\xb0"); //degree - txtRO = txtRO.Replace(@"\u160?"," "); //hard space + txtRO = txtRO.Replace(@"\u160?", " "); //hard space txtRO = txtRO.Replace(@"\u916?", "\x7F"); // delta txtRO = txtRO.Replace(@"\u8805?", "\xF2"); //greater than or equal txtRO = txtRO.Replace(@"\u8804?", "\xF3"); // less than or equal @@ -3799,7 +3799,7 @@ namespace VEPROMS 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); + Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", string.Format("RO value ({0}) converted to text", txtRO), null); //} _DidConvertROsToText |= true; } @@ -3841,7 +3841,7 @@ namespace VEPROMS RoUsageInfo roui = RoUsageInfo.Get(rou.ROUsageID); string lookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString()); string replaceWith = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString()); - _DidProcessROs = content.Text.Contains(lookFor); // B2017-076 RO link in the text so we will be processing it + _DidProcessROs = content.Text.Contains(lookFor); // B2017-076 RO link in the text so we will be processing it if (lookFor != replaceWith) { content.Text = content.Text.Replace(lookFor, replaceWith); @@ -3901,7 +3901,7 @@ namespace VEPROMS string config = nd.Attributes.GetNamedItem("config").InnerText; string userid = nd.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); - AnnotationType annType = AnnotationType.GetByNameOrCreate(nd.Attributes.GetNamedItem("typename").InnerText); + AnnotationType annType = AnnotationType.GetByNameOrCreate(nd.Attributes.GetNamedItem("typename").InnerText); Annotation ann = Annotation.MakeAnnotation(itm, annType, rtftext, searchtext, config, dts, userid); ann.Save(); } @@ -4004,8 +4004,8 @@ namespace VEPROMS string config = xc.Attributes.GetNamedItem("config").InnerText; config = StripEnhanced(config); int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText); - CheckForFloatingFoldout(contentid, config); - string userid = xc.Attributes.GetNamedItem("userid").InnerText; + CheckForFloatingFoldout(contentid, config); + string userid = xc.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); using (step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Table)) { @@ -4101,8 +4101,8 @@ namespace VEPROMS string config = xc.Attributes.GetNamedItem("config").InnerText; config = StripEnhanced(config); int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText); - CheckForFloatingFoldout(contentid, config); - string userid = xc.Attributes.GetNamedItem("userid").InnerText; + CheckForFloatingFoldout(contentid, config); + string userid = xc.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); using (step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Step)) { @@ -4211,8 +4211,8 @@ namespace VEPROMS string config = xc.Attributes.GetNamedItem("config").InnerText; config = StripEnhanced(config); int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText); - CheckForFloatingFoldout(contentid, config); - string userid = xc.Attributes.GetNamedItem("userid").InnerText; + CheckForFloatingFoldout(contentid, config); + string userid = xc.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); using (step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.RNO)) { @@ -4351,8 +4351,8 @@ namespace VEPROMS string config = xc.Attributes.GetNamedItem("config").InnerText; config = StripEnhanced(config); int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText); - CheckForFloatingFoldout(contentid, config); - string userid = xc.Attributes.GetNamedItem("userid").InnerText; + CheckForFloatingFoldout(contentid, config); + string userid = xc.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); using (step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Note)) { @@ -4445,8 +4445,8 @@ namespace VEPROMS string config = xc.Attributes.GetNamedItem("config").InnerText; config = StripEnhanced(config); int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText); - CheckForFloatingFoldout(contentid, config); - string userid = xc.Attributes.GetNamedItem("userid").InnerText; + CheckForFloatingFoldout(contentid, config); + string userid = xc.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); using (step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Caution)) { @@ -4544,8 +4544,8 @@ namespace VEPROMS string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; string config = xc.Attributes.GetNamedItem("config").InnerText; config = StripEnhanced(config); - int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText); - CheckForFloatingFoldout(contentid, config); + int contentid = int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText); + CheckForFloatingFoldout(contentid, config); string userid = xc.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); using (sect = Section.MakeSection(parentInfo, prevInfo, number, text, sectiontype)) @@ -4601,17 +4601,17 @@ namespace VEPROMS } return config; } - private void CheckForFloatingFoldout(int contentid, string config) - { - if (config != string.Empty) - { - XmlDocument xd = new XmlDocument(); - xd.LoadXml(config); - XmlNode xn = xd.SelectSingleNode("Config/Step/@FloatingFoldout"); - if (xn != null) - floatFoldout.Add(contentid, int.Parse(xn.InnerText)); - } - } + private void CheckForFloatingFoldout(int contentid, string config) + { + if (config != string.Empty) + { + XmlDocument xd = new XmlDocument(); + xd.LoadXml(config); + XmlNode xn = xd.SelectSingleNode("Config/Step/@FloatingFoldout"); + if (xn != null) + floatFoldout.Add(contentid, int.Parse(xn.InnerText)); + } + } // jsj 2016Feb16 - This appears to not be used //private void AddGrid(XmlReader xr) @@ -4630,9 +4630,9 @@ namespace VEPROMS { XmlNode nd = xc.SelectSingleNode("grid"); string data = nd.Attributes.GetNamedItem("data").InnerText; - XmlDocument xd = new XmlDocument(); - xd.LoadXml(data); - XmlNode gn = xd.SelectSingleNode("C1FlexGrid/Control/IsRoTable"); + XmlDocument xd = new XmlDocument(); + xd.LoadXml(data); + XmlNode gn = xd.SelectSingleNode("C1FlexGrid/Control/IsRoTable"); if (gn.InnerText.ToLower() == "true") { if (_ConvertROsToTextDuringImport) @@ -4745,17 +4745,17 @@ namespace VEPROMS //} private Document AddDocument(XmlNode xn) { - Document d; - int docid = int.Parse(xn.Attributes.GetNamedItem("docid").InnerText); - if (Old2NewLibDoc.ContainsKey(docid)) - { - docid = Old2NewLibDoc[docid]; - d = Document.Get(docid); - } - else - { - string libtitle = xn.Attributes.GetNamedItem("libtitle").InnerText; - DateTime dts = DateTime.Parse(xn.Attributes.GetNamedItem("dts").InnerText); + Document d; + int docid = int.Parse(xn.Attributes.GetNamedItem("docid").InnerText); + if (Old2NewLibDoc.ContainsKey(docid)) + { + docid = Old2NewLibDoc[docid]; + d = Document.Get(docid); + } + else + { + string libtitle = xn.Attributes.GetNamedItem("libtitle").InnerText; + DateTime dts = DateTime.Parse(xn.Attributes.GetNamedItem("dts").InnerText); if (libtitle != "") { DocumentInfoList dil = DocumentInfoList.GetLibraries(true); @@ -4765,27 +4765,27 @@ namespace VEPROMS return di.Get(); // found library document in exiting database } } - byte[] doccontent = Convert.FromBase64String(xn.Attributes.GetNamedItem("doccontent").InnerText); - string docascii = xn.Attributes.GetNamedItem("docascii").InnerText; - string config = xn.Attributes.GetNamedItem("config").InnerText; - string userid = xn.Attributes.GetNamedItem("userid").InnerText; - string fileextension = xn.Attributes.GetNamedItem("fileextension").InnerText; - d = Document.MakeDocument(libtitle, doccontent, docascii, config, dts, userid, fileextension); - d.Save(); - Old2NewLibDoc.Add(docid, d.DocID); - } + byte[] doccontent = Convert.FromBase64String(xn.Attributes.GetNamedItem("doccontent").InnerText); + string docascii = xn.Attributes.GetNamedItem("docascii").InnerText; + string config = xn.Attributes.GetNamedItem("config").InnerText; + string userid = xn.Attributes.GetNamedItem("userid").InnerText; + string fileextension = xn.Attributes.GetNamedItem("fileextension").InnerText; + d = Document.MakeDocument(libtitle, doccontent, docascii, config, dts, userid, fileextension); + d.Save(); + Old2NewLibDoc.Add(docid, d.DocID); + } return d; } #endregion - private void btnCloseExport_Click(object sender, EventArgs e) - { - this.Close(); - } + private void btnCloseExport_Click(object sender, EventArgs e) + { + this.Close(); + } - private void btnCloseImport_Click(object sender, EventArgs e) - { - this.Close(); - } + private void btnCloseImport_Click(object sender, EventArgs e) + { + this.Close(); + } } }