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,6 +15,8 @@ namespace VEPROMS
|
||||
{
|
||||
public partial class dlgExportImport : Form
|
||||
{
|
||||
private Dictionary<int, string> oldFormat;
|
||||
private Dictionary<string, int> 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<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)
|
||||
{
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user