Added code to handle new Close buttons
Added code to translate old formatid's to new formatid's Added new Close buttons
This commit is contained in:
@@ -15,8 +15,15 @@ namespace DataLoader
|
||||
{
|
||||
public partial class dlgExportImport : Form
|
||||
{
|
||||
private Dictionary<int, string> oldFormat;
|
||||
private Dictionary<string, int> 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<int, string>();
|
||||
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<string, int>();
|
||||
FormatInfoList fil = FormatInfoList.Get();
|
||||
foreach (FormatInfo fi in fil)
|
||||
newFormat.Add(fi.Name, fi.FormatID);
|
||||
}
|
||||
Dictionary<int, ItemInfo> 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();
|
||||
}
|
||||
}
|
||||
}
|
36
PROMS/DataLoader/dlgExportImport.designer.cs
generated
36
PROMS/DataLoader/dlgExportImport.designer.cs
generated
@@ -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;
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user