From fbe6dba8108e781958c854bcf1672ea7efb05a4a Mon Sep 17 00:00:00 2001 From: Rich Date: Thu, 19 Jun 2014 02:29:33 +0000 Subject: [PATCH] Added code to handle new Close buttons Added code to translate old formatid's to new formatid's Added new Close buttons --- PROMS/DataLoader/dlgExportImport.cs | 111 ++++++++++++++---- PROMS/DataLoader/dlgExportImport.designer.cs | 36 +++++- .../VEPROMS User Interface/dlgExportImport.cs | 99 ++++++++++++---- .../dlgExportImport.designer.cs | 36 +++++- 4 files changed, 231 insertions(+), 51 deletions(-) diff --git a/PROMS/DataLoader/dlgExportImport.cs b/PROMS/DataLoader/dlgExportImport.cs index e5887d7c..167b171f 100644 --- a/PROMS/DataLoader/dlgExportImport.cs +++ b/PROMS/DataLoader/dlgExportImport.cs @@ -15,8 +15,15 @@ namespace DataLoader { public partial class dlgExportImport : Form { + private Dictionary oldFormat; + private Dictionary newFormat; private int oldRODbID; private int newRODbID; + private FolderInfo _MyNewFolder; + public FolderInfo MyNewFolder + { + get { return _MyNewFolder; } + } private string PEIPath; private string _MyMode; private FolderInfo MyFolder = null; @@ -32,7 +39,7 @@ namespace DataLoader _MyMode = mode; MyFolder = folderInfo; InitializeComponent(); - this.Text += " for " + folderInfo.Name; + this.Text = mode + " Dialog for " + folderInfo.Name; } public dlgExportImport(string mode, ProcedureInfo procedureInfo) { @@ -101,6 +108,7 @@ namespace DataLoader private DateTime MyStart; private void btnDoExport_Click(object sender, EventArgs e) { + btnExport.Enabled = false; if (MyFolder != null) { this.Cursor = Cursors.WaitCursor; @@ -127,7 +135,8 @@ namespace DataLoader lblExportStatus.Text = "Export Completed in " + elapsed.ToString(); this.Cursor = Cursors.Default; } - } + btnCloseExport.Enabled = true; + } private void SaveExportData() { XmlDocument xd = new XmlDocument(); @@ -145,7 +154,8 @@ namespace DataLoader } private void btnDoImport_Click(object sender, EventArgs e) { - this.Cursor = Cursors.WaitCursor; + btnImport.Enabled = false; + this.Cursor = Cursors.WaitCursor; MyStart = DateTime.Now; btnDoImport.Enabled = false; lblImportStatus.Text = "Performing Import"; @@ -156,7 +166,8 @@ namespace DataLoader TimeSpan elapsed = DateTime.Now.Subtract(MyStart); lblImportStatus.Text = "Import Completed in " + elapsed.ToString(); this.Cursor = Cursors.Default; - } + btnCloseImport.Enabled = true; + } private void LoadImportDataDocument() { ZipEntry ze = MyExpxZipFile[0]; @@ -164,7 +175,9 @@ namespace DataLoader ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); XmlDocument xd = new XmlDocument(); xd.Load(fn); + LoadFormats(xd); Folder ff = AddFolder(Folder.Get(MyFolder.FolderID), xd); + _MyNewFolder = FolderInfo.Get(ff.FolderID); AddAnnotationTypes(xd); DocVersionInfo dvi = AddDocVersion(ff, xd); xd = null; @@ -190,6 +203,22 @@ namespace DataLoader AddTransitions(); SaveTransitionAndItemContentIDs(); } + + private void LoadFormats(XmlDocument xd) + { + oldFormat = new Dictionary(); + XmlNodeList nl = xd.SelectNodes("folder/formats/format"); + foreach (XmlNode nd in nl) + { + int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText); + string name = nd.Attributes.GetNamedItem("name").InnerText; + oldFormat.Add(formatid, name); + } + newFormat = new Dictionary(); + FormatInfoList fil = FormatInfoList.Get(); + foreach (FormatInfo fi in fil) + newFormat.Add(fi.Name, fi.FormatID); + } Dictionary dicParentItem = null; private void UpdateParentItem(int depth, ItemInfo ii) { @@ -780,10 +809,26 @@ namespace DataLoader xe.Attributes.SetNamedItem(AddAttribute(xd, "usrid", fi.UsrID.ToString())); xd.AppendChild(xe); ExportAnnotationTypes(xe, "annotationtypes"); + ExportFormats(xe, "formats"); if (fi.FolderDocVersionCount > 0) foreach (DocVersionInfo dvi in fi.FolderDocVersions) ExportDocVersion(xe, dvi, "docversion"); } + private void ExportFormats(XmlElement xn, string nodename) + { + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + FormatInfoList fil = FormatInfoList.Get(); + foreach (FormatInfo fi in fil) + ExportFormat(xe, fi, "format"); + 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)); + xn.AppendChild(xe); + } private void ExportAnnotationTypes(XmlElement xn, string nodename) { XmlElement xe = xn.OwnerDocument.CreateElement(nodename); @@ -1735,7 +1780,9 @@ namespace DataLoader string shortname = xr.GetAttribute("shortname"); string usrid = xr.GetAttribute("usrid"); DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); - folder = Folder.MakeFolder(folder, folder.MyConnection, name, title, shortname, null, null, dts, usrid); + string formatid = xr.GetAttribute("formatid"); + Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid)); + folder = Folder.MakeFolder(folder, folder.MyConnection, name, title, shortname, format, null, dts, usrid); //f.Save(); return folder; } @@ -1748,9 +1795,17 @@ namespace DataLoader 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); - Folder f = Folder.MakeFolder(p, p.MyConnection, name, title, shortname, null, null, dts, usrid); + string formatid = xd.DocumentElement.Attributes.GetNamedItem("formatid").InnerText; + Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid)); + Folder f = Folder.MakeFolder(p, p.MyConnection, name, title, shortname, format, null, dts, usrid); return f; } + private Format OldToNewFormat(int formatID) + { + string formatName = oldFormat[formatID]; + formatID = newFormat[formatName]; + return Format.Get(formatID); + } private DocVersion AddDocVersion(Folder f, XmlReader xr) { int versiontype = int.Parse(xr.GetAttribute("versiontype")); @@ -1759,7 +1814,7 @@ namespace DataLoader string userid = xr.GetAttribute("userid"); DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); string formatid = xr.GetAttribute("formatid"); - Format format = formatid == string.Empty ? null : Format.Get(int.Parse(formatid)); + Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid)); DocVersion dv = DocVersion.MakeDocVersion(f, versiontype, name, null, null, format, config, dts, userid); return dv; } @@ -1784,7 +1839,7 @@ namespace DataLoader string userid = xe.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xe.Attributes.GetNamedItem("dts").InnerText); string formatid = xe.Attributes.GetNamedItem("formatid").InnerText; - Format format = formatid == string.Empty ? null : Format.Get(int.Parse(formatid)); + Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid)); DocVersion dv = DocVersion.MakeDocVersion(f, versiontype, name, null, null, format, config, dts, userid); XmlNode xassoc = xe.SelectSingleNode("association"); if (xassoc != null) @@ -1885,7 +1940,7 @@ namespace DataLoader p.DTS = dts; p.UserID = userid; if (formatid != string.Empty) - p.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + p.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); p.MyContent.Config = config; p.MyContent.DTS = dts; p.MyContent.UserID = userid; @@ -1914,7 +1969,7 @@ namespace DataLoader p.DTS = dts; p.UserID = userid; if (formatid != string.Empty) - p.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + p.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); p.MyContent.Config = config; p.MyContent.DTS = dts; p.MyContent.UserID = userid; @@ -2060,7 +2115,7 @@ namespace DataLoader step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2088,7 +2143,7 @@ namespace DataLoader step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2138,7 +2193,7 @@ namespace DataLoader step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2166,7 +2221,7 @@ namespace DataLoader step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2214,7 +2269,7 @@ namespace DataLoader step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2242,7 +2297,7 @@ namespace DataLoader step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2290,7 +2345,7 @@ namespace DataLoader step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2318,7 +2373,7 @@ namespace DataLoader step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2366,7 +2421,7 @@ namespace DataLoader step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2394,7 +2449,7 @@ namespace DataLoader step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2448,7 +2503,7 @@ namespace DataLoader sect.DTS = dts; sect.UserID = userid; if (formatid != string.Empty) - sect.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + sect.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); sect.MyContent.Config = config; sect.MyContent.DTS = dts; sect.MyContent.UserID = userid; @@ -2476,7 +2531,7 @@ namespace DataLoader sect.DTS = dts; sect.UserID = userid; if (formatid != string.Empty) - sect.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + sect.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); sect.MyContent.Config = config; sect.MyContent.DTS = dts; sect.MyContent.UserID = userid; @@ -2591,5 +2646,15 @@ namespace DataLoader return d; } #endregion - } + + private void btnCloseExport_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void btnCloseImport_Click(object sender, EventArgs e) + { + this.Close(); + } + } } \ No newline at end of file diff --git a/PROMS/DataLoader/dlgExportImport.designer.cs b/PROMS/DataLoader/dlgExportImport.designer.cs index 09202f79..1d470b27 100644 --- a/PROMS/DataLoader/dlgExportImport.designer.cs +++ b/PROMS/DataLoader/dlgExportImport.designer.cs @@ -54,6 +54,8 @@ namespace DataLoader this.label2 = new System.Windows.Forms.Label(); this.ofd = new System.Windows.Forms.OpenFileDialog(); this.sfd = new System.Windows.Forms.SaveFileDialog(); + this.btnCloseExport = new System.Windows.Forms.Button(); + this.btnCloseImport = new System.Windows.Forms.Button(); this.lblExportTime = new System.Windows.Forms.Label(); this.lblImportTime = new System.Windows.Forms.Label(); this.pnlExport.SuspendLayout(); @@ -62,6 +64,7 @@ namespace DataLoader // // pnlExport // + this.pnlExport.Controls.Add(this.btnCloseExport); this.pnlExport.Controls.Add(this.lblExportTime); this.pnlExport.Controls.Add(this.lblExportStatus); this.pnlExport.Controls.Add(this.pbExportStep); @@ -76,7 +79,7 @@ namespace DataLoader this.pnlExport.Controls.Add(this.label1); this.pnlExport.Location = new System.Drawing.Point(12, 12); this.pnlExport.Name = "pnlExport"; - this.pnlExport.Size = new System.Drawing.Size(610, 199); + this.pnlExport.Size = new System.Drawing.Size(618, 199); this.pnlExport.TabIndex = 0; // // lblExportStatus @@ -180,6 +183,7 @@ namespace DataLoader // // pnlImport // + this.pnlImport.Controls.Add(this.btnCloseImport); this.pnlImport.Controls.Add(this.lblImportTime); this.pnlImport.Controls.Add(this.lblImportStatus); this.pnlImport.Controls.Add(this.pbImportStep); @@ -194,7 +198,7 @@ namespace DataLoader this.pnlImport.Controls.Add(this.label2); this.pnlImport.Location = new System.Drawing.Point(12, 217); this.pnlImport.Name = "pnlImport"; - this.pnlImport.Size = new System.Drawing.Size(610, 225); + this.pnlImport.Size = new System.Drawing.Size(618, 225); this.pnlImport.TabIndex = 1; // // lblImportStatus @@ -311,7 +315,7 @@ namespace DataLoader // lblExportTime // this.lblExportTime.AutoSize = true; - this.lblExportTime.Location = new System.Drawing.Point(407, 30); + this.lblExportTime.Location = new System.Drawing.Point(392, 29); this.lblExportTime.Name = "lblExportTime"; this.lblExportTime.Size = new System.Drawing.Size(28, 13); this.lblExportTime.TabIndex = 11; @@ -321,13 +325,35 @@ namespace DataLoader // lblImportTime // this.lblImportTime.AutoSize = true; - this.lblImportTime.Location = new System.Drawing.Point(407, 31); + this.lblImportTime.Location = new System.Drawing.Point(392, 30); this.lblImportTime.Name = "lblImportTime"; this.lblImportTime.Size = new System.Drawing.Size(28, 13); this.lblImportTime.TabIndex = 17; this.lblImportTime.Text = "0.00"; this.lblImportTime.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // + // btnCloseExport + // + this.btnCloseExport.Enabled = false; + this.btnCloseExport.Location = new System.Drawing.Point(562, 32); + this.btnCloseExport.Name = "btnCloseExport"; + this.btnCloseExport.Size = new System.Drawing.Size(53, 23); + this.btnCloseExport.TabIndex = 12; + this.btnCloseExport.Text = "Close"; + this.btnCloseExport.UseVisualStyleBackColor = true; + this.btnCloseExport.Click += new System.EventHandler(this.btnCloseExport_Click); + // + // btnCloseImport + // + this.btnCloseImport.Enabled = false; + this.btnCloseImport.Location = new System.Drawing.Point(562, 33); + this.btnCloseImport.Name = "btnCloseImport"; + this.btnCloseImport.Size = new System.Drawing.Size(53, 23); + this.btnCloseImport.TabIndex = 18; + this.btnCloseImport.Text = "Close"; + this.btnCloseImport.UseVisualStyleBackColor = true; + this.btnCloseImport.Click += new System.EventHandler(this.btnCloseImport_Click); + // // dlgExportImport // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -380,6 +406,8 @@ namespace DataLoader private System.Windows.Forms.Label lblImportStatus; private System.Windows.Forms.Label lblExportTime; private System.Windows.Forms.Label lblImportTime; + private System.Windows.Forms.Button btnCloseExport; + private System.Windows.Forms.Button btnCloseImport; } } \ No newline at end of file diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs index af80aacd..4d923425 100644 --- a/PROMS/VEPROMS User Interface/dlgExportImport.cs +++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs @@ -15,6 +15,8 @@ namespace VEPROMS { public partial class dlgExportImport : Form { + private Dictionary oldFormat; + private Dictionary newFormat; private int oldRODbID; private int newRODbID; private FolderInfo _MyNewFolder; @@ -44,7 +46,7 @@ namespace VEPROMS _MyMode = mode; MyProcedure = procedureInfo; InitializeComponent(); - this.Text += " for " + procedureInfo.DisplayNumber; + this.Text = mode + " Dialog for " + procedureInfo.DisplayNumber; } private void dlgExportImport_Load(object sender, EventArgs e) { @@ -106,6 +108,7 @@ namespace VEPROMS private DateTime MyStart; private void btnDoExport_Click(object sender, EventArgs e) { + btnExport.Enabled = false; if (MyFolder != null) { this.Cursor = Cursors.WaitCursor; @@ -132,7 +135,8 @@ namespace VEPROMS lblExportStatus.Text = "Export Completed in " + elapsed.ToString(); this.Cursor = Cursors.Default; } - } + btnCloseExport.Enabled = true; + } private void SaveExportData() { XmlDocument xd = new XmlDocument(); @@ -150,6 +154,7 @@ namespace VEPROMS } private void btnDoImport_Click(object sender, EventArgs e) { + btnImport.Enabled = false; this.Cursor = Cursors.WaitCursor; MyStart = DateTime.Now; btnDoImport.Enabled = false; @@ -161,6 +166,7 @@ namespace VEPROMS TimeSpan elapsed = DateTime.Now.Subtract(MyStart); lblImportStatus.Text = "Import Completed in " + elapsed.ToString(); this.Cursor = Cursors.Default; + btnCloseImport.Enabled = true; } private void LoadImportDataDocument() { @@ -169,6 +175,7 @@ namespace VEPROMS ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); XmlDocument xd = new XmlDocument(); xd.Load(fn); + LoadFormats(xd); Folder ff = AddFolder(Folder.Get(MyFolder.FolderID), xd); _MyNewFolder = FolderInfo.Get(ff.FolderID); AddAnnotationTypes(xd); @@ -196,6 +203,22 @@ namespace VEPROMS AddTransitions(); SaveTransitionAndItemContentIDs(); } + + private void LoadFormats(XmlDocument xd) + { + oldFormat = new Dictionary(); + XmlNodeList nl = xd.SelectNodes("folder/formats/format"); + foreach (XmlNode nd in nl) + { + int formatid = int.Parse(nd.Attributes.GetNamedItem("formatid").InnerText); + string name = nd.Attributes.GetNamedItem("name").InnerText; + oldFormat.Add(formatid, name); + } + newFormat = new Dictionary(); + FormatInfoList fil = FormatInfoList.Get(); + foreach (FormatInfo fi in fil) + newFormat.Add(fi.Name, fi.FormatID); + } Dictionary dicParentItem = null; private void UpdateParentItem(int depth, ItemInfo ii) { @@ -786,10 +809,26 @@ namespace VEPROMS xe.Attributes.SetNamedItem(AddAttribute(xd, "usrid", fi.UsrID.ToString())); xd.AppendChild(xe); ExportAnnotationTypes(xe, "annotationtypes"); + ExportFormats(xe, "formats"); if (fi.FolderDocVersionCount > 0) foreach (DocVersionInfo dvi in fi.FolderDocVersions) ExportDocVersion(xe, dvi, "docversion"); } + private void ExportFormats(XmlElement xn, string nodename) + { + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + FormatInfoList fil = FormatInfoList.Get(); + foreach (FormatInfo fi in fil) + ExportFormat(xe, fi, "format"); + 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)); + xn.AppendChild(xe); + } private void ExportAnnotationTypes(XmlElement xn, string nodename) { XmlElement xe = xn.OwnerDocument.CreateElement(nodename); @@ -1741,7 +1780,9 @@ namespace VEPROMS string shortname = xr.GetAttribute("shortname"); string usrid = xr.GetAttribute("usrid"); DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); - folder = Folder.MakeFolder(folder, folder.MyConnection, name, title, shortname, null, null, dts, usrid); + string formatid = xr.GetAttribute("formatid"); + Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid)); + folder = Folder.MakeFolder(folder, folder.MyConnection, name, title, shortname, format, null, dts, usrid); //f.Save(); return folder; } @@ -1754,9 +1795,17 @@ namespace VEPROMS 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); - Folder f = Folder.MakeFolder(p, p.MyConnection, name, title, shortname, null, null, dts, usrid); + string formatid = xd.DocumentElement.Attributes.GetNamedItem("formatid").InnerText; + Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid)); + Folder f = Folder.MakeFolder(p, p.MyConnection, name, title, shortname, format, null, dts, usrid); return f; } + private Format OldToNewFormat(int formatID) + { + string formatName = oldFormat[formatID]; + formatID = newFormat[formatName]; + return Format.Get(formatID); + } private DocVersion AddDocVersion(Folder f, XmlReader xr) { int versiontype = int.Parse(xr.GetAttribute("versiontype")); @@ -1765,7 +1814,7 @@ namespace VEPROMS string userid = xr.GetAttribute("userid"); DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); string formatid = xr.GetAttribute("formatid"); - Format format = formatid == string.Empty ? null : Format.Get(int.Parse(formatid)); + Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid)); DocVersion dv = DocVersion.MakeDocVersion(f, versiontype, name, null, null, format, config, dts, userid); return dv; } @@ -1790,7 +1839,7 @@ namespace VEPROMS string userid = xe.Attributes.GetNamedItem("userid").InnerText; DateTime dts = DateTime.Parse(xe.Attributes.GetNamedItem("dts").InnerText); string formatid = xe.Attributes.GetNamedItem("formatid").InnerText; - Format format = formatid == string.Empty ? null : Format.Get(int.Parse(formatid)); + Format format = formatid == string.Empty ? null : OldToNewFormat(int.Parse(formatid)); DocVersion dv = DocVersion.MakeDocVersion(f, versiontype, name, null, null, format, config, dts, userid); XmlNode xassoc = xe.SelectSingleNode("association"); if (xassoc != null) @@ -1891,7 +1940,7 @@ namespace VEPROMS p.DTS = dts; p.UserID = userid; if (formatid != string.Empty) - p.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + p.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); p.MyContent.Config = config; p.MyContent.DTS = dts; p.MyContent.UserID = userid; @@ -1920,7 +1969,7 @@ namespace VEPROMS p.DTS = dts; p.UserID = userid; if (formatid != string.Empty) - p.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + p.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); p.MyContent.Config = config; p.MyContent.DTS = dts; p.MyContent.UserID = userid; @@ -2066,7 +2115,7 @@ namespace VEPROMS step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2094,7 +2143,7 @@ namespace VEPROMS step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2144,7 +2193,7 @@ namespace VEPROMS step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2172,7 +2221,7 @@ namespace VEPROMS step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2220,7 +2269,7 @@ namespace VEPROMS step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2248,7 +2297,7 @@ namespace VEPROMS step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2296,7 +2345,7 @@ namespace VEPROMS step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2324,7 +2373,7 @@ namespace VEPROMS step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2372,7 +2421,7 @@ namespace VEPROMS step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2400,7 +2449,7 @@ namespace VEPROMS step.DTS = dts; step.UserID = userid; if (formatid != string.Empty) - step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); step.MyContent.Config = config; step.MyContent.DTS = dts; step.MyContent.UserID = userid; @@ -2454,7 +2503,7 @@ namespace VEPROMS sect.DTS = dts; sect.UserID = userid; if (formatid != string.Empty) - sect.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + sect.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); sect.MyContent.Config = config; sect.MyContent.DTS = dts; sect.MyContent.UserID = userid; @@ -2482,7 +2531,7 @@ namespace VEPROMS sect.DTS = dts; sect.UserID = userid; if (formatid != string.Empty) - sect.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + sect.MyContent.MyFormat = OldToNewFormat(int.Parse(formatid)); sect.MyContent.Config = config; sect.MyContent.DTS = dts; sect.MyContent.UserID = userid; @@ -2597,5 +2646,15 @@ namespace VEPROMS return d; } #endregion + + private void btnCloseExport_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void btnCloseImport_Click(object sender, EventArgs e) + { + this.Close(); + } } } \ No newline at end of file diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.designer.cs b/PROMS/VEPROMS User Interface/dlgExportImport.designer.cs index e9f831ef..63b2504c 100644 --- a/PROMS/VEPROMS User Interface/dlgExportImport.designer.cs +++ b/PROMS/VEPROMS User Interface/dlgExportImport.designer.cs @@ -56,12 +56,15 @@ namespace VEPROMS this.label2 = new System.Windows.Forms.Label(); this.ofd = new System.Windows.Forms.OpenFileDialog(); this.sfd = new System.Windows.Forms.SaveFileDialog(); + this.btnCloseExport = new System.Windows.Forms.Button(); + this.btnCloseImport = new System.Windows.Forms.Button(); this.pnlExport.SuspendLayout(); this.pnlImport.SuspendLayout(); this.SuspendLayout(); // // pnlExport // + this.pnlExport.Controls.Add(this.btnCloseExport); this.pnlExport.Controls.Add(this.lblExportTime); this.pnlExport.Controls.Add(this.lblExportStatus); this.pnlExport.Controls.Add(this.pbExportStep); @@ -76,13 +79,13 @@ namespace VEPROMS this.pnlExport.Controls.Add(this.label1); this.pnlExport.Location = new System.Drawing.Point(12, 12); this.pnlExport.Name = "pnlExport"; - this.pnlExport.Size = new System.Drawing.Size(610, 199); + this.pnlExport.Size = new System.Drawing.Size(618, 199); this.pnlExport.TabIndex = 0; // // lblExportTime // this.lblExportTime.AutoSize = true; - this.lblExportTime.Location = new System.Drawing.Point(407, 30); + this.lblExportTime.Location = new System.Drawing.Point(392, 29); this.lblExportTime.Name = "lblExportTime"; this.lblExportTime.Size = new System.Drawing.Size(28, 13); this.lblExportTime.TabIndex = 11; @@ -190,6 +193,7 @@ namespace VEPROMS // // pnlImport // + this.pnlImport.Controls.Add(this.btnCloseImport); this.pnlImport.Controls.Add(this.lblImportTime); this.pnlImport.Controls.Add(this.lblImportStatus); this.pnlImport.Controls.Add(this.pbImportStep); @@ -204,13 +208,13 @@ namespace VEPROMS this.pnlImport.Controls.Add(this.label2); this.pnlImport.Location = new System.Drawing.Point(12, 217); this.pnlImport.Name = "pnlImport"; - this.pnlImport.Size = new System.Drawing.Size(610, 225); + this.pnlImport.Size = new System.Drawing.Size(618, 225); this.pnlImport.TabIndex = 1; // // lblImportTime // this.lblImportTime.AutoSize = true; - this.lblImportTime.Location = new System.Drawing.Point(407, 31); + this.lblImportTime.Location = new System.Drawing.Point(392, 30); this.lblImportTime.Name = "lblImportTime"; this.lblImportTime.Size = new System.Drawing.Size(28, 13); this.lblImportTime.TabIndex = 17; @@ -328,6 +332,28 @@ namespace VEPROMS this.sfd.Filter = "PROMS Export Files|*.expx"; this.sfd.Title = "Export File Name"; // + // btnCloseExport + // + this.btnCloseExport.Enabled = false; + this.btnCloseExport.Location = new System.Drawing.Point(562, 32); + this.btnCloseExport.Name = "btnCloseExport"; + this.btnCloseExport.Size = new System.Drawing.Size(53, 23); + this.btnCloseExport.TabIndex = 12; + this.btnCloseExport.Text = "Close"; + this.btnCloseExport.UseVisualStyleBackColor = true; + this.btnCloseExport.Click += new System.EventHandler(this.btnCloseExport_Click); + // + // btnCloseImport + // + this.btnCloseImport.Enabled = false; + this.btnCloseImport.Location = new System.Drawing.Point(562, 33); + this.btnCloseImport.Name = "btnCloseImport"; + this.btnCloseImport.Size = new System.Drawing.Size(53, 23); + this.btnCloseImport.TabIndex = 18; + this.btnCloseImport.Text = "Close"; + this.btnCloseImport.UseVisualStyleBackColor = true; + this.btnCloseImport.Click += new System.EventHandler(this.btnCloseImport_Click); + // // dlgExportImport // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -380,6 +406,8 @@ namespace VEPROMS private System.Windows.Forms.Label lblImportStatus; private System.Windows.Forms.Label lblExportTime; private System.Windows.Forms.Label lblImportTime; + private System.Windows.Forms.Button btnCloseExport; + private System.Windows.Forms.Button btnCloseImport; } } \ No newline at end of file