From ad7307ab876687a5e6e664dd9ab01bd222013ffb Mon Sep 17 00:00:00 2001 From: Rich Date: Sat, 14 Jun 2014 01:13:52 +0000 Subject: [PATCH] New dialog box to manage the importing and exporting of docversions --- .../VEPROMS User Interface/dlgExportImport.cs | 2564 +++++++++++++++++ .../dlgExportImport.designer.cs | 385 +++ .../dlgExportImport.resx | 126 + 3 files changed, 3075 insertions(+) create mode 100644 PROMS/VEPROMS User Interface/dlgExportImport.cs create mode 100644 PROMS/VEPROMS User Interface/dlgExportImport.designer.cs create mode 100644 PROMS/VEPROMS User Interface/dlgExportImport.resx diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs new file mode 100644 index 00000000..c066a44b --- /dev/null +++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs @@ -0,0 +1,2564 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using VEPROMS.CSLA.Library; +using Volian.Base.Library; +using System.Xml; +using System.IO; +using Ionic.Zip; + +namespace VEPROMS +{ + public partial class dlgExportImport : Form + { + private FolderInfo _MyNewFolder; + public FolderInfo MyNewFolder + { + get { return _MyNewFolder; } + } + private string PEIPath; + private string _MyMode; + private FolderInfo MyFolder = 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) + { + _MyMode = mode; + MyFolder = folderInfo; + InitializeComponent(); + this.Text = mode + " Dialog for " + folderInfo.Name; + } + public dlgExportImport(string mode, ProcedureInfo procedureInfo) + { + _MyMode = mode; + MyProcedure = procedureInfo; + InitializeComponent(); + this.Text += " 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); + pnlExport.Dock = DockStyle.Fill; + pnlImport.Dock = DockStyle.Fill; + if (_MyMode.ToLower() == "export") + { + sfd.InitialDirectory = PEIPath; + pnlExport.BringToFront(); + } + else + { + ofd.InitialDirectory = PEIPath; + pnlImport.BringToFront(); + } + this.Height = this.Height / 2; + } + private void btnExport_Click(object sender, EventArgs e) + { + if (MyFolder != null) + { + sfd.FileName = string.Format("{0}.expx", 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}.xml", PEIPath, MyProcedure.DisplayNumber); + } + } + private void txtExport_TextChanged(object sender, EventArgs e) + { + btnDoExport.Enabled = txtExport.TextLength > 0; + if (btnDoExport.Enabled) + lblExportStatus.Text = "Ready To Perform Export"; + else + lblExportStatus.Text = "Awaiting Export File Name:"; + } + private XmlWriter MyWriter = null; + private ZipFile MyExpxZipFile = null; + private ZipFile MyImpxZipFile = null; + private DateTime MyStart; + private void btnDoExport_Click(object sender, EventArgs e) + { + 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; + } + else if (MyProcedure != null) + { + this.Cursor = Cursors.WaitCursor; + MyStart = DateTime.Now; + btnDoExport.Enabled = false; + lblExportStatus.Text = "Performing Export"; + XmlDocument xd = new XmlDocument(); + ExportItem(xd, MyProcedure, "procedure"); + xd.Save(txtExport.Text); + TimeSpan elapsed = DateTime.Now.Subtract(MyStart); + lblExportStatus.Text = "Export Completed in " + elapsed.ToString(); + this.Cursor = Cursors.Default; + } + } + private void SaveExportData() + { + XmlDocument xd = new XmlDocument(); + ExportFolder(xd, MyFolder, "folder"); + } + private void SaveExportDataWriter() + { + XmlWriterSettings ws = new XmlWriterSettings(); + ws.Indent = true; + ws.NewLineHandling = NewLineHandling.Entitize; + ws.CheckCharacters = false; + MyWriter = XmlWriter.Create(txtExport.Text, ws); + ExportFolder(MyFolder, "folder"); + MyWriter.Close(); + } + private void btnDoImport_Click(object sender, EventArgs e) + { + this.Cursor = Cursors.WaitCursor; + MyStart = DateTime.Now; + btnDoImport.Enabled = false; + lblImportStatus.Text = "Performing Import"; + //LoadImportDataReader(); + TurnChangeManagerOff.Execute(); + LoadImportDataDocument(); + TurnChangeManagerOn.Execute(); + TimeSpan elapsed = DateTime.Now.Subtract(MyStart); + lblImportStatus.Text = "Import Completed in " + elapsed.ToString(); + this.Cursor = Cursors.Default; + } + private void LoadImportDataDocument() + { + ZipEntry ze = MyExpxZipFile[0]; + string fn = PEIPath + @"\" + ze.FileName; + ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); + XmlDocument xd = new XmlDocument(); + xd.Load(fn); + Folder ff = AddFolder(Folder.Get(MyFolder.FolderID), xd); + _MyNewFolder = FolderInfo.Get(ff.FolderID); + AddAnnotationTypes(xd); + DocVersionInfo dvi = AddDocVersion(ff, xd); + 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); + } + 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(); + SaveTransitionAndItemContentIDs(); + } + Dictionary dicParentItem = null; + private void UpdateParentItem(int depth, ItemInfo ii) + { + if (dicParentItem == null) dicParentItem = new Dictionary(); + if (!dicParentItem.ContainsKey(depth)) dicParentItem.Add(depth, null); + dicParentItem[depth] = ii; + } + Dictionary dicPreviousItem = null; + private void UpdatePreviousItem(int depth, ItemInfo ii) + { + if (dicPreviousItem == null) dicPreviousItem = new Dictionary(); + if (!dicPreviousItem.ContainsKey(depth)) dicPreviousItem.Add(depth, null); + dicPreviousItem[depth] = ii; + } + Dictionary dicItemDepth = null; + private void UpdateItemDepth(int depth, int id) + { + if (dicItemDepth == null) dicItemDepth = new Dictionary(); + if (!dicItemDepth.ContainsKey(depth)) dicItemDepth.Add(depth, 0); + dicItemDepth[depth] = id; + } + private void LoadImportDataReader() + { + int pCount = 0; + int sCount = 0; + Folder folder = null; + DocVersion docversion = null; + Dictionary dicRofst = null; + Dictionary dicEntry = null; + ROFst rofst = null; + GetImportDataCounts(); + pbImportProcedure.Maximum = MyCounts.Count; + pbImportProcedure.Value = 0; + Application.DoEvents(); + FileStream fs = File.OpenRead(txtImport.Text); + XmlReaderSettings rs = new XmlReaderSettings(); + rs.CheckCharacters = false; + XmlReader xr = XmlReader.Create(fs, rs); + while (xr.Read()) + { + if (xr.IsStartElement()) + { + switch (xr.Name) + { + case "annotation": + AddAnnotation(xr); + break; + //case "association": + // break; + case "content": + { + if (xr.Depth == 3) //content for procedure + { + ItemInfo ii = AddProcedure(xr, docversion, dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]); + UpdatePreviousItem(xr.Depth, ii); + UpdateParentItem(xr.Depth, ii); + } + else + { + + int fromtype = dicItemDepth.ContainsKey(xr.Depth - 2) ? dicItemDepth[xr.Depth - 2] : 0; + switch (fromtype) + { + case 2: + { //sections + ItemInfo ii = AddSection(xr, dicParentItem[xr.Depth], dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]); + UpdatePreviousItem(xr.Depth, ii); + UpdateParentItem(xr.Depth, ii); + break; + } + case 3: + { //cautions + ItemInfo ii = AddCaution(xr, dicParentItem[xr.Depth], dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]); + UpdatePreviousItem(xr.Depth, ii); + UpdateParentItem(xr.Depth, ii); + break; + } + case 4: + { //notes + ItemInfo ii = AddNote(xr, dicParentItem[xr.Depth], dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]); + UpdatePreviousItem(xr.Depth, ii); + UpdateParentItem(xr.Depth, ii); + break; + } + case 5: + { //rnos + ItemInfo ii = AddRNO(xr, dicParentItem[xr.Depth], dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]); + UpdatePreviousItem(xr.Depth, ii); + UpdateParentItem(xr.Depth, ii); + break; + } + case 6: + { //steps + ItemInfo ii = AddStep(xr, dicParentItem[xr.Depth], dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]); + UpdatePreviousItem(xr.Depth, ii); + UpdateParentItem(xr.Depth, ii); + break; + } + case 7: + { //tables + ItemInfo ii = AddTable(xr, dicParentItem[xr.Depth], dicPreviousItem[xr.Depth], dicItemDepth[xr.Depth]); + UpdatePreviousItem(xr.Depth, ii); + UpdateParentItem(xr.Depth, ii); + break; + } + default: + break; + } + } + break; + } + case "document": + AddDocument(xr, dicEntry); + break; + case "docversion": + { + docversion = AddDocVersion(folder, xr); + UpdatePreviousItem(xr.Depth + 2, null); + break; + } + case "entry": + dicEntry = AddEntry(xr); + break; + case "folder": + folder = AddFolder(Folder.Get(MyFolder.FolderID), xr); + break; + case "grid": + AddGrid(xr); + break; + case "procedure": + { + UpdateItemDepth(xr.Depth + 1, int.Parse(xr.GetAttribute("itemid"))); + pbImportProcedure.PerformStep(); + lblImportProcedure.Text = string.Format("{0} of {1} Procedures", pbImportProcedure.Value.ToString(), pbImportProcedure.Maximum.ToString()); + pCount++; + pbImportSection.Maximum = MyCounts[pCount].Count; + pbImportSection.Value = 0; + sCount = 0; + Application.DoEvents(); + break; + } + case "section": + { + UpdateItemDepth(xr.Depth + 1, int.Parse(xr.GetAttribute("itemid"))); + pbImportSection.PerformStep(); + lblImportSection.Text = string.Format("{0} of {1} Sections", pbImportSection.Value.ToString(), pbImportSection.Maximum.ToString()); + sCount++; + pbImportStep.Maximum = MyCounts[pCount][sCount]; + pbImportStep.Value = 0; + Application.DoEvents(); + break; + } + case "step": + { + UpdateItemDepth(xr.Depth + 1, int.Parse(xr.GetAttribute("itemid"))); + if (xr.Depth == 8) + { + pbImportStep.PerformStep(); + lblImportStep.Text = string.Format("{0} of {1} Steps", pbImportStep.Value.ToString(), pbImportStep.Maximum.ToString()); + Application.DoEvents(); + } + break; + } + case "caution": + case "note": + case "rno": + case "table": + UpdateItemDepth(xr.Depth + 1, int.Parse(xr.GetAttribute("itemid"))); + break; + case "cautions": + case "notes": + case "rnos": + case "sections": + case "steps": + case "tables": + { + UpdateItemDepth(xr.Depth, int.Parse(xr.GetAttribute("fromtype"))); + UpdatePreviousItem(xr.Depth + 2, null); + UpdateParentItem(xr.Depth + 2, dicParentItem[xr.Depth - 1]); + break; + } + case "rodb": + { + MyRODb = AddRODb(xr); + rofst = AddROFst(dicRofst); + docversion.DocVersionAssociations.Add(rofst); + docversion.Save(); + break; + } + case "rofst": + dicRofst = GetROFstData(xr); + break; + case "rousage": + AddROUsage(xr); + break; + //case "transition": + // break; + default: + break; + } + Console.WriteLine("{0} - {1}", xr.Name, xr.Depth.ToString()); + } + } + pbImportProcedure.PerformStep(); + Application.DoEvents(); + fs.Close(); + FixImportDataTransitions(); + StoreItemContentIDs(); + ResolveExternalTransitions(folder); + } + 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); + } + private void StoreItemContentIDs() + { + XmlDocument xd = new XmlDocument(); + string fn = PEIPath + @"\ExternalTransitions.xml"; + xd.Load(fn); + XmlElement xe = (XmlElement)xd.SelectSingleNode("externaltransitions/oldtonewitem"); + foreach (int key in Old2NewItem.Keys) + { + XmlElement xee = xd.CreateElement("item"); + XmlAttribute xa = AddAttribute(xd, "old", key.ToString()); + xee.Attributes.SetNamedItem(xa); + xa = AddAttribute(xd, "new", Old2NewItem[key].ToString()); + xee.Attributes.SetNamedItem(xa); + xe.AppendChild(xee); + } + xd.Save(fn); + xe = (XmlElement)xd.SelectSingleNode("externaltransitions/oldtonewcontent"); + foreach (int key in Old2NewContent.Keys) + { + XmlElement xee = xd.CreateElement("content"); + XmlAttribute xa = AddAttribute(xd, "old", key.ToString()); + xee.Attributes.SetNamedItem(xa); + xa = AddAttribute(xd, "new", Old2NewContent[key].ToString()); + xee.Attributes.SetNamedItem(xa); + xe.AppendChild(xee); + } + xd.Save(fn); + } + private void ResolveExternalTransitions(Folder folder) + { + XmlDocument xd = new XmlDocument(); + string fn = PEIPath + @"\ExternalTransitions.xml"; + xd.Load(fn); + AddStoredItemContentIDs(xd); + XmlNodeList nl = xd.SelectNodes("//transition[@folder!='']"); + foreach (XmlNode nd in nl) + { + int transitionid = int.Parse(nd.Attributes.GetNamedItem("transitionid").InnerText); + int fromid = int.Parse(nd.Attributes.GetNamedItem("fromid").InnerText); + int toid = int.Parse(nd.Attributes.GetNamedItem("toid").InnerText); + int rangeid = int.Parse(nd.Attributes.GetNamedItem("rangeid").InnerText); + if (Old2NewContent.ContainsKey(fromid) && Old2NewItem.ContainsKey(toid) && Old2NewItem.ContainsKey(rangeid)) + { + int isrange = int.Parse(nd.Attributes.GetNamedItem("isrange").InnerText); + int trantype = int.Parse(nd.Attributes.GetNamedItem("trantype").InnerText); + string config = nd.Attributes.GetNamedItem("config").InnerText; + string userid = nd.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); + string lookfor; + if (isrange == 0) + lookfor = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); + else + lookfor = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); + fromid = Old2NewContent[fromid]; + toid = Old2NewItem[toid]; + rangeid = Old2NewItem[rangeid]; + Content cc = Content.Get(fromid); + Transition tt = Transition.MakeTransition(cc, Item.Get(toid), Item.Get(rangeid), isrange, trantype, config, dts, userid); + transitionid = tt.TransitionID; + string replacewith; + if (isrange == 0) + replacewith = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); + else + replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); + cc.Text = cc.Text.Replace(lookfor, replacewith); + cc.Save(); + nd.Attributes.GetNamedItem("folder").InnerText = ""; + } + } + xd.Save(fn); + } + 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); + XmlNodeList nl = xd.SelectNodes("//item"); + foreach (XmlNode nd in nl) + { + int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText); + int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText); + //if (!Old2NewItem.ContainsKey(oldid)) + Old2NewItem.Add(oldid, newid); + } + ze = MyImpxZipFile["contents.xml"]; + ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); + fn = PEIPath + @"\contents.xml"; + xd = new XmlDocument(); + xd.Load(fn); + nl = xd.SelectNodes("//content"); + foreach (XmlNode nd in nl) + { + int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText); + int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText); + //if (!Old2NewContent.ContainsKey(oldid)) + Old2NewContent.Add(oldid, newid); + } + ze = MyImpxZipFile["transitions.xml"]; + ze.Extract(PEIPath, ExtractExistingFileAction.OverwriteSilently); + fn = PEIPath + @"\transitions.xml"; + PendingTransitions.Load(fn); + } + private void AddStoredItemContentIDs(XmlDocument xd) + { + XmlNodeList nl = xd.SelectNodes("//item"); + foreach (XmlNode nd in nl) + { + int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText); + int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText); + if (!Old2NewItem.ContainsKey(oldid)) + Old2NewItem.Add(oldid, newid); + } + nl = xd.SelectNodes("//content"); + foreach (XmlNode nd in nl) + { + int oldid = int.Parse(nd.Attributes.GetNamedItem("old").InnerText); + int newid = int.Parse(nd.Attributes.GetNamedItem("new").InnerText); + if (!Old2NewContent.ContainsKey(oldid)) + Old2NewContent.Add(oldid, newid); + } + } + private void FixImportDataTransitions() + { + XmlDocument xd = new XmlDocument(); + string fn = PEIPath + @"\ExternalTransitions.xml"; + if (!File.Exists(fn)) + { + XmlElement xe = xd.CreateElement("externaltransitions"); + XmlElement xee = xd.CreateElement("oldtonewitem"); + xe.AppendChild(xee); + xee = xd.CreateElement("oldtonewcontent"); + xe.AppendChild(xee); + xee = xd.CreateElement("transitions"); + xe.AppendChild(xee); + xd.AppendChild(xe); + xd.Save(fn); + } + else + { + xd.Load(fn); + } + FileStream fs = File.OpenRead(txtImport.Text); + XmlReaderSettings rs = new XmlReaderSettings(); + rs.CheckCharacters = false; + XmlReader xr = XmlReader.Create(fs, rs); + while (xr.Read()) + { + if (xr.IsStartElement()) + { + switch (xr.Name) + { + case "transition": + AddTransitions(xr); + break; + case "externaltransition": + { + AddExternalTransition(xr, xd); + break; + } + default: + break; + } + } + } + fs.Close(); + xd.Save(fn); + } + private Dictionary> MyCounts = null; + private Dictionary MySubCounts = null; + private void GetImportDataCounts() + { + int pCount = 0; + int sCount = 0; + int tCount = 0; + MyCounts = new Dictionary>(); + MySubCounts = new Dictionary(); + FileStream fs = File.OpenRead(txtImport.Text); + XmlReaderSettings rs = new XmlReaderSettings(); + rs.CheckCharacters = false; + XmlReader xr = XmlReader.Create(fs, rs); + while (xr.Read()) + { + if (xr.IsStartElement()) + { + switch (xr.Name) + { + case "procedure": + { + if (pCount > 0) + { + MySubCounts.Add(sCount, tCount); + MyCounts.Add(pCount, MySubCounts); + sCount = 0; + tCount = 0; + MySubCounts = new Dictionary(); + } + pCount++; + break; + } + case "section": + { + if (sCount > 0) + { + MySubCounts.Add(sCount, tCount); + tCount = 0; + } + sCount++; + break; + } + case "step": + { + if (xr.Depth == 8) + tCount++; + break; + } + default: + break; + } + } + } + MySubCounts.Add(sCount, tCount); + MyCounts.Add(pCount, MySubCounts); + fs.Close(); + } + private void btnImport_Click(object sender, EventArgs e) + { + if (ofd.ShowDialog(this) == DialogResult.OK) + { + if (ofd.FileName != string.Empty) + { + Old2NewItem = new Dictionary(); + Old2NewContent = new Dictionary(); + PendingTransitions = new XmlDocument(); + FileInfo fi = new FileInfo(ofd.FileName); + string dn = fi.Directory.Name; + 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); + } + } + } + } + private void txtImport_TextChanged(object sender, EventArgs e) + { + btnDoImport.Enabled = txtImport.TextLength > 0; + if (btnDoImport.Enabled) + lblImportStatus.Text = "Ready To Perform Import"; + else + 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(); + 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())); + xd.AppendChild(xe); + ExportAnnotationTypes(xe, "annotationtypes"); + if (fi.FolderDocVersionCount > 0) + foreach (DocVersionInfo dvi in fi.FolderDocVersions) + ExportDocVersion(xe, dvi, "docversion"); + } + 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); + } + private void ExportFolder(FolderInfo fi, string nodename) + { + /* + FolderID + ParentID + DBID + Name + Title + ShortName + FormatID + ManualOrder + Config + DTS + UsrID + */ + FromFolderName = fi.Name; + MyWriter.WriteStartDocument(); + MyWriter.WriteStartElement(nodename); + MyWriter.WriteAttributeString("folderid", fi.FolderID.ToString()); + MyWriter.WriteAttributeString("parentid", fi.ParentID.ToString()); + MyWriter.WriteAttributeString("dbid", fi.DBID.ToString()); + MyWriter.WriteAttributeString("name", fi.Name); + MyWriter.WriteAttributeString("title", fi.Title); + MyWriter.WriteAttributeString("shortname", fi.ShortName); + MyWriter.WriteAttributeString("formatid", fi.FormatID.ToString()); + MyWriter.WriteAttributeString("manualorder", fi.ManualOrder.ToString()); + MyWriter.WriteAttributeString("config", fi.Config); + MyWriter.WriteAttributeString("dts", fi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + MyWriter.WriteAttributeString("usrid", fi.UsrID.ToString()); + + if (fi.FolderDocVersionCount > 0) + foreach (DocVersionInfo dvi in fi.FolderDocVersions) + ExportDocVersion(dvi, "docversion"); + MyWriter.WriteEndElement(); + MyWriter.WriteEndDocument(); + } + private void ExportDocVersion(XmlElement xn, DocVersionInfo dvi, string nodename) + { + /* + VersionID + FolderID + VersionType + Name + Title + ItemID + FormatID + Config + DTS + UserID + */ + lblExportStatus.Text = "Exporting DocVersion..."; + Application.DoEvents(); + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "versionid", dvi.VersionID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "folderid", dvi.FolderID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "versiontype", dvi.VersionType.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "name", dvi.Name)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "title", dvi.Title)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "itemid", dvi.ItemID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "formatid", dvi.FormatID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "config", dvi.Config)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", dvi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", dvi.UserID.ToString())); + xn.AppendChild(xe); + if (dvi.DocVersionAssociationCount > 0) + foreach (AssociationInfo ai in dvi.DocVersionAssociations) + ExportAssociation(xe, ai, "association"); + string fn = PEIPath + @"\folder.xml"; + xn.OwnerDocument.Save(fn); + MyExpxZipFile.AddFile(fn, "folder"); + MyExpxZipFile.Save(); + File.Delete(fn); + //here + lblExportStatus.Text = "Exporting Procedures..."; + Application.DoEvents(); + if (dvi.Procedures.Count > 0) + { + pbExportProcedure.Value = 0; + pbExportProcedure.Maximum = dvi.Procedures.Count; + lblExportProcedure.Text = pbExportProcedure.Maximum.ToString() + " Procedures"; + foreach (ItemInfo ii in dvi.Procedures) + { + XmlDocument xd = new XmlDocument(); + ExportItem(xd, ii, "procedure"); + fn = string.Format(@"{0}\proc{1}.xml", PEIPath, pbExportProcedure.Value.ToString().PadLeft(4, '0')); + xd.Save(fn); + MyExpxZipFile.AddFile(fn, "procedures"); + MyExpxZipFile.Save(); + File.Delete(fn); + xd = null; + } + } + } + private void ExportDocVersion(DocVersionInfo dvi, string nodename) + { + /* + VersionID + FolderID + VersionType + Name + Title + ItemID + FormatID + Config + DTS + UserID + */ + MyWriter.WriteStartElement(nodename); + MyWriter.WriteAttributeString("versionid", dvi.VersionID.ToString()); + MyWriter.WriteAttributeString("folderid", dvi.FolderID.ToString()); + MyWriter.WriteAttributeString("versiontype", dvi.VersionType.ToString()); + MyWriter.WriteAttributeString("name", dvi.Name); + MyWriter.WriteAttributeString("title", dvi.Title); + MyWriter.WriteAttributeString("itemid", dvi.ItemID.ToString()); + MyWriter.WriteAttributeString("formatid", dvi.FormatID.ToString()); + MyWriter.WriteAttributeString("config", dvi.Config); + MyWriter.WriteAttributeString("dts", dvi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + MyWriter.WriteAttributeString("userid", dvi.UserID.ToString()); + if (dvi.DocVersionAssociationCount > 0) + foreach (AssociationInfo ai in dvi.DocVersionAssociations) + ExportAssociation(ai, "association"); + if (dvi.Procedures.Count > 0) + { + pbExportProcedure.Value = 0; + pbExportProcedure.Maximum = dvi.Procedures.Count; + lblExportProcedure.Text = pbExportProcedure.Maximum.ToString() + " Procedures"; + foreach (ItemInfo ii in dvi.Procedures) + { + ExportItem(ii, "procedure"); + } + } + MyWriter.WriteEndElement(); + } + private void ExportAssociation(XmlElement xn, AssociationInfo ai, string nodename) + { + /* + 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 + VersionID + ROFstID + Config + DTS + UserID + */ + MyWriter.WriteStartElement(nodename); + MyWriter.WriteAttributeString("associationid", ai.AssociationID.ToString()); + MyWriter.WriteAttributeString("versionid", ai.VersionID.ToString()); + MyWriter.WriteAttributeString("rofstid", ai.ROFstID.ToString()); + MyWriter.WriteAttributeString("config", ai.Config); + MyWriter.WriteAttributeString("dts", ai.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + MyWriter.WriteAttributeString("userid", ai.UserID.ToString()); + ExportROFst(ai.MyROFst, "rofst"); + MyWriter.WriteEndElement(); + } + private void ExportROFst(XmlElement xn, ROFstInfo fst, string nodename) + { + /* + 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); + ExportRODb(xe, fst.MyRODb, "rodb"); + } + private void ExportROFst(ROFstInfo fst, string nodename) + { + /* + ROFstID + RODbID + ROLookup + Config + DTS + UserID + */ + MyWriter.WriteStartElement(nodename); + MyWriter.WriteAttributeString("rofstid", fst.ROFstID.ToString()); + MyWriter.WriteAttributeString("rodbid", fst.RODbID.ToString()); + MyWriter.WriteAttributeString("rolookup", Convert.ToBase64String(fst.ROLookup)); + MyWriter.WriteAttributeString("config", fst.Config); + MyWriter.WriteAttributeString("dts", fst.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + MyWriter.WriteAttributeString("userid", fst.UserID.ToString()); + ExportRODb(fst.MyRODb, "rodb"); + MyWriter.WriteEndElement(); + } + private void 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 + ROName + FolderPath + DBConnectionString + Config + DTS + UserID + */ + MyWriter.WriteStartElement(nodename); + MyWriter.WriteAttributeString("rodbid", db.RODbID.ToString()); + MyWriter.WriteAttributeString("roname", db.ROName); + MyWriter.WriteAttributeString("folderpath", db.FolderPath); + MyWriter.WriteAttributeString("dbconnectionstring", db.DBConnectionString); + MyWriter.WriteAttributeString("config", db.Config); + MyWriter.WriteAttributeString("dts", db.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + MyWriter.WriteAttributeString("userid", db.UserID.ToString()); + MyWriter.WriteEndElement(); + } + private void ExportItem(XmlDocument xd, ItemInfo ii, string nodename) + { + XmlElement xe = xd.CreateElement(nodename); + 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; + pbExportSection.Maximum = ii.Sections.Count; + } + 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; + } + 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"))); + ExportContent(xe, ii.MyContent, "content"); + if (ii.ItemAnnotationCount > 0) + foreach (AnnotationInfo ai in ii.ItemAnnotations) + ExportAnnotation(xe, ai, "annotation"); + } + private void ExportItem(ItemInfo ii, string nodename) + { + /* + ItemID + PreviousID + ContentID + DTS + */ + if (ii.IsProcedure) + { + pbExportProcedure.PerformStep(); + lblExportProcedure.Text = string.Format("{0} of {1} Procedures", pbExportProcedure.Value.ToString(), pbExportProcedure.Maximum.ToString()); + Application.DoEvents(); + pbExportSection.Value = 0; + pbExportStep.Value = 0; + pbExportSection.Maximum = ii.Sections.Count; + } + if (ii.IsSection) + { + pbExportSection.PerformStep(); + lblExportSection.Text = string.Format("{0} of {1} Sections", pbExportSection.Value.ToString(), pbExportSection.Maximum.ToString()); + Application.DoEvents(); + pbExportStep.Value = 0; + if (ii.Steps != null) + pbExportStep.Maximum = ii.Steps.Count; + } + if (ii.IsStep) + { + pbExportStep.PerformStep(); + lblExportStep.Text = string.Format("{0} of {1} Steps", pbExportStep.Value.ToString(), pbExportStep.Maximum.ToString()); + Application.DoEvents(); + } + MyWriter.WriteStartElement(nodename); + MyWriter.WriteAttributeString("itemid", ii.ItemID.ToString()); + MyWriter.WriteAttributeString("previousid", ii.PreviousID.ToString()); + MyWriter.WriteAttributeString("contentid", ii.ContentID.ToString()); + MyWriter.WriteAttributeString("dts", ii.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + ExportContent(ii.MyContent, "content"); + if (ii.ItemAnnotationCount > 0) + foreach (AnnotationInfo ai in ii.ItemAnnotations) + ExportAnnotation(ai, "annotation"); + MyWriter.WriteEndElement(); + } + private void ExportContent(XmlElement xn, ContentInfo ci, string nodename) + { + /* + ContentID + Number + Text + Type + FormatID + Config + DTS + UserID + */ + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + 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", ci.Text)); + 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())); + 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.ContentPartCount > 0) + foreach (PartInfo pi in ci.ContentParts) + ExportPart(xe, pi, ((E_FromTypes)pi.FromType).ToString().ToLower()); + } + private void ExportContent(ContentInfo ci, string nodename) + { + /* + ContentID + Number + Text + Type + FormatID + Config + DTS + UserID + */ + MyWriter.WriteStartElement(nodename); + MyWriter.WriteAttributeString("contentid", ci.ContentID.ToString()); + MyWriter.WriteAttributeString("number", ci.Number); + MyWriter.WriteAttributeString("text", ci.Text); + MyWriter.WriteAttributeString("type", ci.Type.ToString()); + MyWriter.WriteAttributeString("formatid", ci.FormatID.ToString()); + MyWriter.WriteAttributeString("config", ci.Config); + MyWriter.WriteAttributeString("dts", ci.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + MyWriter.WriteAttributeString("userid", ci.UserID.ToString()); + if (ci.ContentTransitionCount > 0) + foreach (TransitionInfo ti in ci.ContentTransitions) + ExportTransition(ti, "transition"); + if (ci.ContentRoUsageCount > 0) + foreach (RoUsageInfo ri in ci.ContentRoUsages) + ExportROUsage(ri, "rousage"); + if (ci.ContentEntryCount > 0) + ExportEntry(ci.MyEntry, "entry"); + if (ci.ContentGridCount > 0) + ExportGrid(ci.MyGrid, "grid"); + if (ci.ContentPartCount > 0) + foreach (PartInfo pi in ci.ContentParts) + ExportPart(pi, ((E_FromTypes)pi.FromType).ToString().ToLower()); + MyWriter.WriteEndElement(); + } + private void ExportGrid(XmlElement xn, GridInfo gi, string nodename) + { + /* + ContentID + Data + Config + DTS + UserID + */ + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "contentid", gi.ContentID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "data", gi.Data)); + 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())); + xn.AppendChild(xe); + } + private void ExportGrid(GridInfo gi, string nodename) + { + /* + ContentID + Data + Config + DTS + UserID + */ + MyWriter.WriteStartElement(nodename); + MyWriter.WriteAttributeString("contentid", gi.ContentID.ToString()); + MyWriter.WriteAttributeString("data", gi.Data); + MyWriter.WriteAttributeString("config", gi.Config); + MyWriter.WriteAttributeString("dts", gi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + MyWriter.WriteAttributeString("userid", gi.UserID.ToString()); + MyWriter.WriteEndElement(); + } + private void ExportEntry(XmlElement xn, EntryInfo ei, string nodename) + { + /* + ContentID + DocID + DTS + UserID + */ + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "contentid", ei.ContentID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "docid", ei.DocID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "dts", ei.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"))); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "userid", ei.UserID.ToString())); + xn.AppendChild(xe); + ExportDocument(xe, ei.MyDocument, "document"); + } + private void ExportEntry(EntryInfo ei, string nodename) + { + /* + ContentID + DocID + DTS + UserID + */ + MyWriter.WriteStartElement(nodename); + MyWriter.WriteAttributeString("contentid", ei.ContentID.ToString()); + MyWriter.WriteAttributeString("docid", ei.DocID.ToString()); + MyWriter.WriteAttributeString("dts", ei.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + MyWriter.WriteAttributeString("userid", ei.UserID.ToString()); + ExportDocument(ei.MyDocument, "document"); + MyWriter.WriteEndElement(); + } + private void ExportDocument(XmlElement xn, DocumentInfo di, string nodename) + { + /* + DocID + LibTitle + DocContent + DocAscii + Config + DTS + UserID + FileExtension + */ + XmlElement xe = xn.OwnerDocument.CreateElement(nodename); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "docid", di.DocID.ToString())); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "libtitle", di.LibTitle)); + xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "doccontent", Convert.ToBase64String(di.DocContent))); + 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)); + xn.AppendChild(xe); + } + private void ExportDocument(DocumentInfo di, string nodename) + { + /* + DocID + LibTitle + DocContent + DocAscii + Config + DTS + UserID + FileExtension + */ + MyWriter.WriteStartElement(nodename); + MyWriter.WriteAttributeString("docid", di.DocID.ToString()); + MyWriter.WriteAttributeString("libtitle", di.LibTitle); + MyWriter.WriteAttributeString("doccontent", Convert.ToBase64String(di.DocContent)); + MyWriter.WriteAttributeString("docascii", di.DocAscii); + MyWriter.WriteAttributeString("config", di.Config); + MyWriter.WriteAttributeString("dts", di.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + MyWriter.WriteAttributeString("userid", di.UserID.ToString()); + MyWriter.WriteAttributeString("fileextension", di.FileExtension); + MyWriter.WriteEndElement(); + } + private void ExportROUsage(XmlElement xn, RoUsageInfo ri, string nodename) + { + /* + 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())); + xn.AppendChild(xe); + } + private void ExportROUsage(RoUsageInfo ri, string nodename) + { + /* + ROUsageID + ContentID + ROID + Config + DTS + UserID + RODbID + */ + MyWriter.WriteStartElement(nodename); + MyWriter.WriteAttributeString("rousageid", ri.ROUsageID.ToString()); + MyWriter.WriteAttributeString("contentid", ri.ContentID.ToString()); + MyWriter.WriteAttributeString("roid", ri.ROID); + MyWriter.WriteAttributeString("config", ri.Config); + MyWriter.WriteAttributeString("dts", ri.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + MyWriter.WriteAttributeString("userid", ri.UserID.ToString()); + MyWriter.WriteAttributeString("rodbid", ri.RODbID.ToString()); + MyWriter.WriteEndElement(); + } + private void ExportPart(XmlElement xn, PartInfo pi, string nodename) + { + /* + 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())); + xn.AppendChild(xe); + foreach (ItemInfo ii in pi.MyItems) + ExportItem(xe, ii, pi.PartType.ToString().ToLower()); + } + private void ExportPart(PartInfo pi, string nodename) + { + /* + ContentID + FromType + ItemID + DTS + UserID + */ + MyWriter.WriteStartElement(nodename); + MyWriter.WriteAttributeString("contentid", pi.ContentID.ToString()); + MyWriter.WriteAttributeString("fromtype", pi.FromType.ToString()); + MyWriter.WriteAttributeString("itemid", pi.ItemID.ToString()); + MyWriter.WriteAttributeString("dts", pi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + MyWriter.WriteAttributeString("userid", pi.UserID.ToString()); + foreach (ItemInfo ii in pi.MyItems) + ExportItem(ii, pi.PartType.ToString().ToLower()); + MyWriter.WriteEndElement(); + } + private void ExportTransition(XmlElement xn, TransitionInfo ti, string nodename) + { + /* + 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())); + xn.AppendChild(xe); + } + private void ExportTransition(TransitionInfo ti, string nodename) + { + /* + TransitionID + FromID + ToID + RangeID + IsRange + TranType + Config + DTS + UserID + */ + string folder = string.Empty; + if (ti.MyItemToID.MyDocVersion != null && ti.MyItemToID.MyDocVersion.MyFolder.Name != MyFolder.Name) + { + nodename = "external" + nodename; + folder = ti.MyItemToID.MyDocVersion.MyFolder.Name; + } + else + { + nodename = "external" + nodename; + folder = "UNKNOWN"; + } + MyWriter.WriteStartElement(nodename); + if (folder != string.Empty) + MyWriter.WriteAttributeString("folder", folder); + MyWriter.WriteAttributeString("transitionid", ti.TransitionID.ToString()); + MyWriter.WriteAttributeString("fromid", ti.FromID.ToString()); + MyWriter.WriteAttributeString("toid", ti.ToID.ToString()); + MyWriter.WriteAttributeString("rangeid", ti.RangeID.ToString()); + MyWriter.WriteAttributeString("isrange", ti.IsRange.ToString()); + MyWriter.WriteAttributeString("trantype", ti.TranType.ToString()); + MyWriter.WriteAttributeString("config", ti.Config); + MyWriter.WriteAttributeString("dts", ti.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + MyWriter.WriteAttributeString("userid", ti.UserID.ToString()); + MyWriter.WriteEndElement(); + } + private void ExportAnnotation(XmlElement xn, AnnotationInfo ai, string nodename) + { + /* + 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())); + xn.AppendChild(xe); + } + private void ExportAnnotation(AnnotationInfo ai, string nodename) + { + /* + AnnotationID + ItemID + TypeID + RtfText + SearchText + Config + DTS + UserID + */ + MyWriter.WriteStartElement(nodename); + MyWriter.WriteAttributeString("annotationid", ai.AnnotationID.ToString()); + MyWriter.WriteAttributeString("itemid", ai.ItemID.ToString()); + MyWriter.WriteAttributeString("typeid", ai.TypeID.ToString()); + MyWriter.WriteAttributeString("rtftext", ai.RtfText); + MyWriter.WriteAttributeString("searchtext", ai.SearchText); + MyWriter.WriteAttributeString("config", ai.Config); + MyWriter.WriteAttributeString("dts", ai.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff")); + MyWriter.WriteAttributeString("userid", ai.UserID.ToString()); + MyWriter.WriteEndElement(); + } + #endregion + #region Import for Merge + private void AddExternalTransition(XmlReader xr, XmlDocument xd) + { + XmlElement xe = xd.CreateElement("transition"); + XmlAttribute xa = AddAttribute(xd, "folder", xr.GetAttribute("folder")); + xe.Attributes.SetNamedItem(xa); + xa = AddAttribute(xd, "transitionid", xr.GetAttribute("transitionid")); + xe.Attributes.SetNamedItem(xa); + xa = AddAttribute(xd, "fromid", xr.GetAttribute("fromid")); + xe.Attributes.SetNamedItem(xa); + xa = AddAttribute(xd, "toid", xr.GetAttribute("toid")); + xe.Attributes.SetNamedItem(xa); + xa = AddAttribute(xd, "rangeid", xr.GetAttribute("rangeid")); + xe.Attributes.SetNamedItem(xa); + xa = AddAttribute(xd, "isrange", xr.GetAttribute("isrange")); + xe.Attributes.SetNamedItem(xa); + xa = AddAttribute(xd, "trantype", xr.GetAttribute("trantype")); + xe.Attributes.SetNamedItem(xa); + xa = AddAttribute(xd, "config", xr.GetAttribute("config")); + xe.Attributes.SetNamedItem(xa); + xa = AddAttribute(xd, "userid", xr.GetAttribute("userid")); + xe.Attributes.SetNamedItem(xa); + xa = AddAttribute(xd, "dts", xr.GetAttribute("dts")); + xe.Attributes.SetNamedItem(xa); + xd.SelectSingleNode("externaltransitions/transitions").AppendChild(xe); + } + private void AddTransitions(XmlReader xr) + { + int transitionid = int.Parse(xr.GetAttribute("transitionid")); + int fromid = int.Parse(xr.GetAttribute("fromid")); + int toid = int.Parse(xr.GetAttribute("toid")); + int rangeid = int.Parse(xr.GetAttribute("rangeid")); + int isrange = int.Parse(xr.GetAttribute("isrange")); + int trantype = int.Parse(xr.GetAttribute("trantype")); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + string lookfor; + if (isrange == 0) + lookfor = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); + else + lookfor = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); + fromid = Old2NewContent[fromid]; + toid = Old2NewItem[toid]; + rangeid = Old2NewItem[rangeid]; + Content cc = Content.Get(fromid); + Transition tt = Transition.MakeTransition(cc, Item.Get(toid), Item.Get(rangeid), isrange, trantype, config, dts, userid); + transitionid = tt.TransitionID; + string replacewith; + if (isrange == 0) + replacewith = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); + else + replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); + cc.Text = cc.Text.Replace(lookfor, replacewith); + cc.Save(); + } + private void AddTransitions(Content content, XmlNode xn) + { + /* + Content + Item + Item + int + int + string + dts + string + + + #Link:Transition:1 2 187 + type,id,toid + + #Link:TransitionRange:2 1 175 177 + type,id,toid,rangeid + */ + XmlNodeList nl = xn.SelectNodes("./transition"); + foreach (XmlNode nd in nl) + { + int toid = int.Parse(nd.Attributes.GetNamedItem("toid").InnerText); + int rangeid = int.Parse(nd.Attributes.GetNamedItem("rangeid").InnerText); + if (Old2NewItem.ContainsKey(toid) && Old2NewItem.ContainsKey(rangeid)) + { + int transitionid = int.Parse(nd.Attributes.GetNamedItem("transitionid").InnerText); + int isrange = int.Parse(nd.Attributes.GetNamedItem("isrange").InnerText); + int trantype = int.Parse(nd.Attributes.GetNamedItem("trantype").InnerText); + string config = nd.Attributes.GetNamedItem("config").InnerText; + string userid = nd.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); + string lookfor; + if (isrange == 0) + lookfor = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); + else + lookfor = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); + //fromid = content.ContentID; + toid = Old2NewItem[toid]; + rangeid = Old2NewItem[rangeid]; + Transition tt = Transition.MakeTransition(content, Item.Get(toid), Item.Get(rangeid), isrange, trantype, config, dts, userid); + transitionid = tt.TransitionID; + string replacewith; + if (isrange == 0) + replacewith = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); + else + replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); + content.Text = content.Text.Replace(lookfor, replacewith); + content.Save(); + } + else + { + PendingTransitions.DocumentElement.AppendChild(PendingTransitions.ImportNode(nd, true)); + //save to holding pen + } + } + } + private void AddTransitions() + { + AddTransitions(PendingTransitions); + } + private void AddTransitions(XmlDocument xd) + { + /* + Content + Item + Item + int + int + string + dts + string + + + #Link:Transition:1 2 187 + type,id,toid + + #Link:TransitionRange:2 1 175 177 + type,id,toid,rangeid + */ + XmlNodeList nl = xd.SelectNodes("//transition"); + lblImportStatus.Text = string.Format("Updating {0} Tranistions", nl.Count.ToString()); + foreach (XmlNode nd in nl) + { + int fromid = int.Parse(nd.Attributes.GetNamedItem("fromid").InnerText); + int toid = int.Parse(nd.Attributes.GetNamedItem("toid").InnerText); + int rangeid = int.Parse(nd.Attributes.GetNamedItem("rangeid").InnerText); + if (Old2NewContent.ContainsKey(fromid) && Old2NewItem.ContainsKey(toid) && Old2NewItem.ContainsKey(rangeid)) + { + int transitionid = int.Parse(nd.Attributes.GetNamedItem("transitionid").InnerText); + int isrange = int.Parse(nd.Attributes.GetNamedItem("isrange").InnerText); + int trantype = int.Parse(nd.Attributes.GetNamedItem("trantype").InnerText); + string config = nd.Attributes.GetNamedItem("config").InnerText; + string userid = nd.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); + string lookfor; + if (isrange == 0) + lookfor = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); + else + lookfor = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); + fromid = Old2NewContent[fromid]; + toid = Old2NewItem[toid]; + rangeid = Old2NewItem[rangeid]; + Content cc = Content.Get(fromid); + Transition tt = Transition.MakeTransition(cc, Item.Get(toid), Item.Get(rangeid), isrange, trantype, config, dts, userid); + transitionid = tt.TransitionID; + string replacewith; + if (isrange == 0) + replacewith = string.Format("#Link:Transition:{0} {1} {2}", trantype, transitionid, toid); + else + replacewith = string.Format("#Link:TransitionRange:{0} {1} {2} {3}", trantype, transitionid, toid, rangeid); + cc.Text = cc.Text.Replace(lookfor, replacewith); + cc.Save(); + nd.InnerText = "done"; + } + } + } + private Dictionary Old2NewItem; + private Dictionary Old2NewContent; + private XmlDocument PendingTransitions; + private RODb MyRODb = null; + private Folder AddFolder(Folder folder, XmlReader xr) + { + Old2NewItem = new Dictionary(); + Old2NewContent = new Dictionary(); + string title = xr.GetAttribute("title"); + string name = xr.GetAttribute("name"); + string shortname = xr.GetAttribute("shortname"); + string usrid = xr.GetAttribute("usrid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + folder = Folder.MakeFolder(folder, folder.MyConnection, name, title, shortname, null, null, dts, usrid); + //f.Save(); + return folder; + } + private Folder AddFolder(Folder p, XmlDocument xd) + { + 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); + Folder f = Folder.MakeFolder(p, p.MyConnection, name, title, shortname, null, null, dts, usrid); + return f; + } + private DocVersion AddDocVersion(Folder f, XmlReader xr) + { + int versiontype = int.Parse(xr.GetAttribute("versiontype")); + string name = xr.GetAttribute("name"); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + string formatid = xr.GetAttribute("formatid"); + Format format = formatid == string.Empty ? null : Format.Get(int.Parse(formatid)); + 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 DocVersionInfo AddDocVersion(Folder f, XmlDocument xd) + { + 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; + 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)); + 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"); + MyRODb = AddRODb(xrodb); + ROFst rofst = AddROFst(xrofst); + DocVersionAssociation dva = dv.DocVersionAssociations.Add(rofst); + dv.Save(); + } + return DocVersionInfo.Get(dv.VersionID); + } + private Dictionary GetROFstData(XmlReader xr) + { + Dictionary rv = new Dictionary(); + rv.Add("rolookup", xr.GetAttribute("rolookup")); + rv.Add("config", xr.GetAttribute("config")); + rv.Add("userid", xr.GetAttribute("userid")); + rv.Add("dts", xr.GetAttribute("dts")); + return rv; + } + private ROFst AddROFst(Dictionary dic) + { + byte[] rolookup = Convert.FromBase64String(dic["rolookup"]); + string config = dic["config"]; + string userid = dic["userid"]; + DateTime dts = DateTime.Parse(dic["dts"]); + ROFst rv = null; + rv = ROFst.GetByRODbID_DTS(MyRODb.RODbID, dts); //MyRODb.DTS); + if (rv == null) + rv = ROFst.MakeROFst(MyRODb, rolookup, config, dts, userid); + return rv; + } + private ROFst AddROFst(XmlNode xrofst) + { + lblImportStatus.Text = "Creating ROFst..."; + 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); //MyRODb.DTS); + if (rv == null) + rv = ROFst.MakeROFst(MyRODb, rolookup, config, dts, userid); + return rv; + } + private RODb AddRODb(XmlReader xr) + { + string roname = xr.GetAttribute("roname"); + string folderpath = xr.GetAttribute("folderpath"); + string dbconnectionstring = xr.GetAttribute("dbconnectionstring"); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + RODb rv = null; + rv = RODb.GetByFolderPath(folderpath); + if (rv == null) + rv = RODb.MakeRODb(roname, folderpath, dbconnectionstring, config, dts, userid); + return rv; + } + private RODb AddRODb(XmlNode xrodb) + { + lblImportStatus.Text = "Creating RODb..."; + Application.DoEvents(); + 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; + string userid = xrodb.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(xrodb.Attributes.GetNamedItem("dts").InnerText); + RODb rv = null; + rv = RODb.GetByFolderPath(folderpath); + if (rv == null) + rv = RODb.MakeRODb(roname, folderpath, dbconnectionstring, config, dts, userid); + return rv; + } + private int GetProcedureData(XmlReader xr) + { + return int.Parse(xr.GetAttribute("itemid")); + } + private ItemInfo AddProcedure(XmlReader xr, DocVersion dv, ItemInfo procInfo, int oldid) + { + DocVersionInfo dvInfo = DocVersionInfo.Get(dv.VersionID); + string number = xr.GetAttribute("number"); + string text = xr.GetAttribute("text"); + int proctype = int.Parse(xr.GetAttribute("type")); + string formatid = xr.GetAttribute("formatid"); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + Procedure p = Procedure.MakeProcedure(dvInfo, procInfo, number, text, proctype); + p.DTS = dts; + p.UserID = userid; + if (formatid != string.Empty) + p.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + p.MyContent.Config = config; + p.MyContent.DTS = dts; + p.MyContent.UserID = userid; + p.Save(); + Old2NewItem.Add(oldid, p.ItemID); + Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), p.MyContent.ContentID); + procInfo = ProcedureInfo.Get(p.ItemID); + return procInfo; + } + private ProcedureInfo AddProcedure(XmlNode xn, DocVersionInfo dvInfo, ProcedureInfo procInfo) + { + pbImportProcedure.PerformStep(); + 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(); + XmlNode xc = xn.SelectSingleNode("content"); + string number = xc.Attributes.GetNamedItem("number").InnerText; + string text = xc.Attributes.GetNamedItem("text").InnerText; + int proctype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText); + string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; + string config = xc.Attributes.GetNamedItem("config").InnerText; + string userid = xc.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); + Procedure p = Procedure.MakeProcedure(dvInfo, procInfo, number, text, proctype); + p.DTS = dts; + p.UserID = userid; + if (formatid != string.Empty) + p.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + p.MyContent.Config = config; + p.MyContent.DTS = dts; + p.MyContent.UserID = userid; + p.Save(); + Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), p.ItemID); + Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), p.MyContent.ContentID); + if (xn.SelectNodes("annotation").Count > 0) + AddAnnotations(p.ItemID, xn); + if (xc.SelectNodes("rousage").Count > 0) + AddROUsages(p.MyContent, xc); + if (xc.SelectNodes("transition").Count > 0) + AddTransitions(p.MyContent, xc); + procInfo = ProcedureInfo.Get(p.ItemID); + if (xc.HasChildNodes) + AddParts(xc, procInfo); + return procInfo; + } + private void AddROUsage(XmlReader xr) + { + int contentid = int.Parse(xr.GetAttribute("contentid")); + contentid = Old2NewContent[contentid]; + Content content = Content.Get(contentid); + string rousageid = xr.GetAttribute("rousageid"); + string roid = xr.GetAttribute("roid"); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + RoUsage rou = RoUsage.MakeRoUsage(content, roid, config, dts, userid, MyRODb); + rou.Save(); + string lookFor = string.Format("#Link:ReferencedObject:{0} ", rousageid); + string replaceWith = string.Format("#Link:ReferencedObject:{0} ", rou.ROUsageID.ToString()); + if (lookFor != replaceWith) + { + content.Text = content.Text.Replace(lookFor, replaceWith); + content.Save(); + } + } + private void AddROUsages(Content content, XmlNode xn) + { + foreach (XmlNode nd in xn.SelectNodes("rousage")) + { + string rousageid = nd.Attributes.GetNamedItem("rousageid").InnerText; + string roid = nd.Attributes.GetNamedItem("roid").InnerText; + string config = nd.Attributes.GetNamedItem("config").InnerText; + string userid = nd.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); + RoUsage rou = RoUsage.MakeRoUsage(content, roid, config, dts, userid, MyRODb); + rou.Save(); + string lookFor = string.Format("#Link:ReferencedObject:{0} ", rousageid); + string replaceWith = string.Format("#Link:ReferencedObject:{0} ", rou.ROUsageID.ToString()); + if (lookFor != replaceWith) + { + content.Text = content.Text.Replace(lookFor, replaceWith); + content.Save(); + } + } + } + private void AddAnnotation(XmlReader xr) + { + int itemid = int.Parse(xr.GetAttribute("itemid")); + itemid = Old2NewItem[itemid]; + Item itm = Item.Get(itemid); + int typeid = int.Parse(xr.GetAttribute("typeid")); + string rtftext = xr.GetAttribute("rtftext"); + string searchtext = xr.GetAttribute("searchtext"); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + Annotation ann = Annotation.MakeAnnotation(itm, AnnotationType.Get(typeid), rtftext, searchtext, config, dts, userid); + } + private void AddAnnotations(int itemID, XmlNode xn) + { + Item itm = Item.Get(itemID); + foreach (XmlNode nd in xn.SelectNodes("annotation")) + { + int typeid = int.Parse(nd.Attributes.GetNamedItem("typeid").InnerText); + string rtftext = nd.Attributes.GetNamedItem("rtftext").InnerText; + string searchtext = nd.Attributes.GetNamedItem("searchtext").InnerText; + 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.GetByName(nd.Attributes.GetNamedItem("typename").InnerText); + Annotation ann = Annotation.MakeAnnotation(itm, annType, rtftext, searchtext, config, dts, userid); + ann.Save(); + } + } + private void AddParts(XmlNode myNode, ItemInfo parentInfo) + { + foreach (XmlNode xn in myNode.ChildNodes) + { + switch (xn.Name) + { + case "sections": + AddSections(xn, parentInfo); + break; + case "cautions": + AddCautions(xn, parentInfo); + break; + case "notes": + AddNotes(xn, parentInfo); + break; + case "rnos": + AddRNOs(xn, parentInfo); + break; + case "steps": + AddSteps(xn, parentInfo); + break; + case "tables": + AddTables(xn, parentInfo); + break; + default: + break; + } + } + } + private void AddTables(XmlNode xn, ItemInfo parentInfo) + { + if (parentInfo.IsProcedure) + { + pbImportSection.Value = 0; + pbImportStep.Value = 0; + pbImportSection.Maximum = xn.ChildNodes.Count; + } + if (parentInfo.IsSection) + { + pbImportStep.Value = 0; + pbImportStep.Maximum = xn.ChildNodes.Count; + } + ItemInfo prevInfo = null; + foreach (XmlNode nd in xn.ChildNodes) + prevInfo = AddTable(nd, parentInfo, prevInfo); + } + private ItemInfo AddTable(XmlReader xr, ItemInfo parentInfo, ItemInfo prevInfo, int oldid) + { + string number = xr.GetAttribute("number"); + string text = xr.GetAttribute("text"); + int steptype = int.Parse(xr.GetAttribute("type")); + string formatid = xr.GetAttribute("formatid"); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + Step step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Table); + step.DTS = dts; + step.UserID = userid; + if (formatid != string.Empty) + step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.Config = config; + step.MyContent.DTS = dts; + step.MyContent.UserID = userid; + step.Save(); + Old2NewItem.Add(oldid, step.ItemID); + Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), step.MyContent.ContentID); + prevInfo = StepInfo.Get(step.ItemID); + return prevInfo; + } + private ItemInfo AddTable(XmlNode xn, ItemInfo parentInfo, ItemInfo prevInfo) + { + pbImportStep.PerformStep(); + lblImportStep.Text = string.Format("{0} of {1} Steps", pbImportStep.Value.ToString(), pbImportStep.Maximum.ToString()); + Application.DoEvents(); + XmlNode xc = xn.SelectSingleNode("content"); + Step step; + string number = xc.Attributes.GetNamedItem("number").InnerText; + string text = xc.Attributes.GetNamedItem("text").InnerText; + int steptype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText); + string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; + string config = xc.Attributes.GetNamedItem("config").InnerText; + string userid = xc.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); + step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Table); + step.DTS = dts; + step.UserID = userid; + if (formatid != string.Empty) + step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.Config = config; + step.MyContent.DTS = dts; + step.MyContent.UserID = userid; + step.Save(); + Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); + Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); + if (xc.SelectNodes("grid").Count > 0) + AddGrid(step.MyContent, xc); + if (xn.SelectNodes("annotation").Count > 0) + AddAnnotations(step.ItemID, xn); + if (xc.SelectNodes("rousage").Count > 0) + AddROUsages(step.MyContent, xc); + if (xc.SelectNodes("transition").Count > 0) + AddTransitions(step.MyContent, xc); + prevInfo = StepInfo.Get(step.ItemID); + if (xc.HasChildNodes) + AddParts(xc, prevInfo); + return prevInfo; + } + private void AddSteps(XmlNode xn, ItemInfo parentInfo) + { + if (parentInfo.IsProcedure) + { + pbImportSection.Value = 0; + pbImportStep.Value = 0; + pbImportSection.Maximum = xn.ChildNodes.Count; + } + if (parentInfo.IsSection) + { + pbImportStep.Value = 0; + pbImportStep.Maximum = xn.ChildNodes.Count; + } + ItemInfo prevInfo = null; + foreach (XmlNode nd in xn.ChildNodes) + prevInfo = AddStep(nd, parentInfo, prevInfo); + } + private ItemInfo AddStep(XmlReader xr, ItemInfo parentInfo, ItemInfo prevInfo, int oldid) + { + string number = xr.GetAttribute("number"); + string text = xr.GetAttribute("text"); + int steptype = int.Parse(xr.GetAttribute("type")); + string formatid = xr.GetAttribute("formatid"); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + Step step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Step); + step.DTS = dts; + step.UserID = userid; + if (formatid != string.Empty) + step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.Config = config; + step.MyContent.DTS = dts; + step.MyContent.UserID = userid; + step.Save(); + Old2NewItem.Add(oldid, step.ItemID); + Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), step.MyContent.ContentID); + prevInfo = StepInfo.Get(step.ItemID); + return prevInfo; + } + private ItemInfo AddStep(XmlNode xn, ItemInfo parentInfo, ItemInfo prevInfo) + { + pbImportStep.PerformStep(); + lblImportStep.Text = string.Format("{0} of {1} Steps", pbImportStep.Value.ToString(), pbImportStep.Maximum.ToString()); + Application.DoEvents(); + XmlNode xc = xn.SelectSingleNode("content"); + Step step; + string number = xc.Attributes.GetNamedItem("number").InnerText; + string text = xc.Attributes.GetNamedItem("text").InnerText; + int steptype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText); + string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; + string config = xc.Attributes.GetNamedItem("config").InnerText; + string userid = xc.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); + step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Step); + step.DTS = dts; + step.UserID = userid; + if (formatid != string.Empty) + step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.Config = config; + step.MyContent.DTS = dts; + step.MyContent.UserID = userid; + step.Save(); + Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); + Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); + if (xn.SelectNodes("annotation").Count > 0) + AddAnnotations(step.ItemID, xn); + if (xc.SelectNodes("rousage").Count > 0) + AddROUsages(step.MyContent, xc); + if (xc.SelectNodes("transition").Count > 0) + AddTransitions(step.MyContent, xc); + prevInfo = StepInfo.Get(step.ItemID); + if (xc.HasChildNodes) + AddParts(xc, prevInfo); + return prevInfo; + } + private void AddRNOs(XmlNode xn, ItemInfo parentInfo) + { + if (parentInfo.IsProcedure) + { + pbImportSection.Value = 0; + pbImportStep.Value = 0; + pbImportSection.Maximum = xn.ChildNodes.Count; + } + if (parentInfo.IsSection) + { + pbImportStep.Value = 0; + pbImportStep.Maximum = xn.ChildNodes.Count; + } + ItemInfo prevInfo = null; + foreach (XmlNode nd in xn.ChildNodes) + prevInfo = AddRNO(nd, parentInfo, prevInfo); + } + private ItemInfo AddRNO(XmlReader xr, ItemInfo parentInfo, ItemInfo prevInfo, int oldid) + { + string number = xr.GetAttribute("number"); + string text = xr.GetAttribute("text"); + int steptype = int.Parse(xr.GetAttribute("type")); + string formatid = xr.GetAttribute("formatid"); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + Step step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.RNO); + step.DTS = dts; + step.UserID = userid; + if (formatid != string.Empty) + step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.Config = config; + step.MyContent.DTS = dts; + step.MyContent.UserID = userid; + step.Save(); + Old2NewItem.Add(oldid, step.ItemID); + Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), step.MyContent.ContentID); + prevInfo = StepInfo.Get(step.ItemID); + return prevInfo; + } + private ItemInfo AddRNO(XmlNode xn, ItemInfo parentInfo, ItemInfo prevInfo) + { + pbImportStep.PerformStep(); + lblImportStep.Text = string.Format("{0} of {1} Steps", pbImportStep.Value.ToString(), pbImportStep.Maximum.ToString()); + Application.DoEvents(); + XmlNode xc = xn.SelectSingleNode("content"); + Step step; + string number = xc.Attributes.GetNamedItem("number").InnerText; + string text = xc.Attributes.GetNamedItem("text").InnerText; + int steptype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText); + string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; + string config = xc.Attributes.GetNamedItem("config").InnerText; + string userid = xc.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); + step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.RNO); + step.DTS = dts; + step.UserID = userid; + if (formatid != string.Empty) + step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.Config = config; + step.MyContent.DTS = dts; + step.MyContent.UserID = userid; + step.Save(); + Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); + Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); + if (xn.SelectNodes("annotation").Count > 0) + AddAnnotations(step.ItemID, xn); + if (xc.SelectNodes("rousage").Count > 0) + AddROUsages(step.MyContent, xc); + if (xc.SelectNodes("transition").Count > 0) + AddTransitions(step.MyContent, xc); + prevInfo = StepInfo.Get(step.ItemID); + if (xc.HasChildNodes) + AddParts(xc, prevInfo); + return prevInfo; + } + private void AddNotes(XmlNode xn, ItemInfo parentInfo) + { + if (parentInfo.IsProcedure) + { + pbImportSection.Value = 0; + pbImportStep.Value = 0; + pbImportSection.Maximum = xn.ChildNodes.Count; + } + if (parentInfo.IsSection) + { + pbImportStep.Value = 0; + pbImportStep.Maximum = xn.ChildNodes.Count; + } + ItemInfo prevInfo = null; + foreach (XmlNode nd in xn.ChildNodes) + prevInfo = AddNote(nd, parentInfo, prevInfo); + } + private ItemInfo AddNote(XmlReader xr, ItemInfo parentInfo, ItemInfo prevInfo, int oldid) + { + string number = xr.GetAttribute("number"); + string text = xr.GetAttribute("text"); + int steptype = int.Parse(xr.GetAttribute("type")); + string formatid = xr.GetAttribute("formatid"); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + Step step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Note); + step.DTS = dts; + step.UserID = userid; + if (formatid != string.Empty) + step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.Config = config; + step.MyContent.DTS = dts; + step.MyContent.UserID = userid; + step.Save(); + Old2NewItem.Add(oldid, step.ItemID); + Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), step.MyContent.ContentID); + prevInfo = StepInfo.Get(step.ItemID); + return prevInfo; + } + private ItemInfo AddNote(XmlNode xn, ItemInfo parentInfo, ItemInfo prevInfo) + { + pbImportStep.PerformStep(); + lblImportStep.Text = string.Format("{0} of {1} Steps", pbImportStep.Value.ToString(), pbImportStep.Maximum.ToString()); + Application.DoEvents(); + XmlNode xc = xn.SelectSingleNode("content"); + Step step; + string number = xc.Attributes.GetNamedItem("number").InnerText; + string text = xc.Attributes.GetNamedItem("text").InnerText; + int steptype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText); + string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; + string config = xc.Attributes.GetNamedItem("config").InnerText; + string userid = xc.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); + step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Note); + step.DTS = dts; + step.UserID = userid; + if (formatid != string.Empty) + step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.Config = config; + step.MyContent.DTS = dts; + step.MyContent.UserID = userid; + step.Save(); + Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); + Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); + if (xn.SelectNodes("annotation").Count > 0) + AddAnnotations(step.ItemID, xn); + if (xc.SelectNodes("rousage").Count > 0) + AddROUsages(step.MyContent, xc); + if (xc.SelectNodes("transition").Count > 0) + AddTransitions(step.MyContent, xc); + prevInfo = StepInfo.Get(step.ItemID); + if (xc.HasChildNodes) + AddParts(xc, prevInfo); + return prevInfo; + } + private void AddCautions(XmlNode xn, ItemInfo parentInfo) + { + if (parentInfo.IsProcedure) + { + pbImportSection.Value = 0; + pbImportStep.Value = 0; + pbImportSection.Maximum = xn.ChildNodes.Count; + } + if (parentInfo.IsSection) + { + pbImportStep.Value = 0; + pbImportStep.Maximum = xn.ChildNodes.Count; + } + ItemInfo prevInfo = null; + foreach (XmlNode nd in xn.ChildNodes) + prevInfo = AddCaution(nd, parentInfo, prevInfo); + } + private ItemInfo AddCaution(XmlReader xr, ItemInfo parentInfo, ItemInfo prevInfo, int oldid) + { + string number = xr.GetAttribute("number"); + string text = xr.GetAttribute("text"); + int steptype = int.Parse(xr.GetAttribute("type")); + string formatid = xr.GetAttribute("formatid"); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + Step step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Caution); + step.DTS = dts; + step.UserID = userid; + if (formatid != string.Empty) + step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.Config = config; + step.MyContent.DTS = dts; + step.MyContent.UserID = userid; + step.Save(); + Old2NewItem.Add(oldid, step.ItemID); + Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), step.MyContent.ContentID); + prevInfo = StepInfo.Get(step.ItemID); + return prevInfo; + } + private ItemInfo AddCaution(XmlNode xn, ItemInfo parentInfo, ItemInfo prevInfo) + { + pbImportStep.PerformStep(); + lblImportStep.Text = string.Format("{0} of {1} Steps", pbImportStep.Value.ToString(), pbImportStep.Maximum.ToString()); + Application.DoEvents(); + XmlNode xc = xn.SelectSingleNode("content"); + Step step; + string number = xc.Attributes.GetNamedItem("number").InnerText; + string text = xc.Attributes.GetNamedItem("text").InnerText; + int steptype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText); + string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; + string config = xc.Attributes.GetNamedItem("config").InnerText; + string userid = xc.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); + step = Step.MakeStep(parentInfo, prevInfo, number, text, steptype, E_FromType.Caution); + step.DTS = dts; + step.UserID = userid; + if (formatid != string.Empty) + step.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + step.MyContent.Config = config; + step.MyContent.DTS = dts; + step.MyContent.UserID = userid; + step.Save(); + Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), step.ItemID); + Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), step.MyContent.ContentID); + if (xn.SelectNodes("annotation").Count > 0) + AddAnnotations(step.ItemID, xn); + if (xc.SelectNodes("rousage").Count > 0) + AddROUsages(step.MyContent, xc); + if (xc.SelectNodes("transition").Count > 0) + AddTransitions(step.MyContent, xc); + prevInfo = StepInfo.Get(step.ItemID); + if (xc.HasChildNodes) + AddParts(xc, prevInfo); + return prevInfo; + } + private void AddSections(XmlNode xn, ItemInfo parentInfo) + { + if (parentInfo.IsProcedure) + { + pbImportSection.Value = 0; + pbImportStep.Value = 0; + pbImportSection.Maximum = xn.ChildNodes.Count; + } + if (parentInfo.IsSection) + { + pbImportStep.Value = 0; + pbImportStep.Maximum = xn.ChildNodes.Count; + } + ItemInfo prevInfo = null; + foreach (XmlNode nd in xn.ChildNodes) + prevInfo = AddSection(nd, parentInfo, prevInfo); + } + private Dictionary GetSectionData(XmlReader xr) + { + Dictionary rv = new Dictionary(); + rv.Add("itemid", xr.GetAttribute("itemid")); + return rv; + } + private ItemInfo AddSection(XmlReader xr, ItemInfo parentInfo, ItemInfo prevInfo, int oldid) + { + string number = xr.GetAttribute("number"); + string text = xr.GetAttribute("text"); + int sectiontype = int.Parse(xr.GetAttribute("type")); + string formatid = xr.GetAttribute("formatid"); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + Section sect = Section.MakeSection(parentInfo, prevInfo, number, text, sectiontype); + sect.DTS = dts; + sect.UserID = userid; + if (formatid != string.Empty) + sect.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + sect.MyContent.Config = config; + sect.MyContent.DTS = dts; + sect.MyContent.UserID = userid; + sect.Save(); + Old2NewItem.Add(oldid, sect.ItemID); + Old2NewContent.Add(int.Parse(xr.GetAttribute("contentid")), sect.MyContent.ContentID); + prevInfo = SectionInfo.Get(sect.ItemID); + return prevInfo; + } + private ItemInfo AddSection(XmlNode xn, ItemInfo parentInfo, ItemInfo prevInfo) + { + pbImportSection.PerformStep(); + lblImportSection.Text = string.Format("{0} of {1} Sections", pbImportSection.Value.ToString(), pbImportSection.Maximum.ToString()); + Application.DoEvents(); + XmlNode xc = xn.SelectSingleNode("content"); + Section sect; + string number = xc.Attributes.GetNamedItem("number").InnerText; + string text = xc.Attributes.GetNamedItem("text").InnerText; + int sectiontype = int.Parse(xc.Attributes.GetNamedItem("type").InnerText); + string formatid = xc.Attributes.GetNamedItem("formatid").InnerText; + string config = xc.Attributes.GetNamedItem("config").InnerText; + string userid = xc.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(xc.Attributes.GetNamedItem("dts").InnerText); + sect = Section.MakeSection(parentInfo, prevInfo, number, text, sectiontype); + sect.DTS = dts; + sect.UserID = userid; + if (formatid != string.Empty) + sect.MyContent.MyFormat = Format.Get(int.Parse(formatid)); + sect.MyContent.Config = config; + sect.MyContent.DTS = dts; + sect.MyContent.UserID = userid; + sect.Save(); + Old2NewItem.Add(int.Parse(xn.Attributes.GetNamedItem("itemid").InnerText), sect.ItemID); + Old2NewContent.Add(int.Parse(xc.Attributes.GetNamedItem("contentid").InnerText), sect.MyContent.ContentID); + if (xn.SelectNodes("annotation").Count > 0) + AddAnnotations(sect.ItemID, xn); + if (xc.SelectNodes("entry").Count > 0) + AddEntry(sect.MyContent, xc); + if (xc.SelectNodes("rousage").Count > 0) + AddROUsages(sect.MyContent, xc); + if (xc.SelectNodes("transition").Count > 0) + AddTransitions(sect.MyContent, xc); + prevInfo = SectionInfo.Get(sect.ItemID); + if (xc.HasChildNodes) + AddParts(xc, prevInfo); + return prevInfo; + } + private void AddGrid(XmlReader xr) + { + int contentid = int.Parse(xr.GetAttribute("contentid")); + contentid = Old2NewContent[contentid]; + Content content = Content.Get(contentid); + string data = xr.GetAttribute("data"); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + Grid gg = Grid.MakeGrid(content, data, config, dts, userid); + } + private void AddGrid(Content content, XmlNode xc) + { + XmlNode nd = xc.SelectSingleNode("grid"); + string data = nd.Attributes.GetNamedItem("data").InnerText; + string config = nd.Attributes.GetNamedItem("config").InnerText; + string userid = nd.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); + Grid gg = Grid.MakeGrid(content, data, config, dts, userid); + gg.Save(); + } + private Dictionary AddEntry(XmlReader xr) + { + Dictionary dic = new Dictionary(); + dic.Add("contentid", xr.GetAttribute("contentid")); + dic.Add("dts", xr.GetAttribute("dts")); + dic.Add("userid", xr.GetAttribute("userid")); + return dic; + } + private void AddEntry(Content content, XmlNode xc) + { + XmlNode nd = xc.SelectSingleNode("entry"); + string userid = nd.Attributes.GetNamedItem("userid").InnerText; + DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText); + Document dd = AddDocument(nd.SelectSingleNode("document")); + Entry ee = Entry.MakeEntry(content, dd, dts, userid); + ee.Save(); + } + private void AddDocument(XmlReader xr, Dictionary dic) + { + string libtitle = xr.GetAttribute("libtitle"); + byte[] doccontent = Convert.FromBase64String(xr.GetAttribute("doccontent")); + string docascii = xr.GetAttribute("docascii"); + string config = xr.GetAttribute("config"); + string userid = xr.GetAttribute("userid"); + DateTime dts = DateTime.Parse(xr.GetAttribute("dts")); + string fileextension = xr.GetAttribute("fileextension"); + Document dd = Document.MakeDocument(libtitle, doccontent, docascii, config, dts, userid, fileextension); + int contentid = int.Parse(dic["contentid"]); + contentid = Old2NewContent[contentid]; + Content content = Content.Get(contentid); + dts = DateTime.Parse(dic["dts"]); + userid = dic["userid"]; + Entry ee = Entry.MakeEntry(content, dd, dts, userid); + } + private Document AddDocument(XmlNode xn) + { + string libtitle = xn.Attributes.GetNamedItem("libtitle").InnerText; + 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; + DateTime dts = DateTime.Parse(xn.Attributes.GetNamedItem("dts").InnerText); + string fileextension = xn.Attributes.GetNamedItem("fileextension").InnerText; + Document d = Document.MakeDocument(libtitle, doccontent, docascii, config, dts, userid, fileextension); + d.Save(); + return d; + } + #endregion + } +} \ No newline at end of file diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.designer.cs b/PROMS/VEPROMS User Interface/dlgExportImport.designer.cs new file mode 100644 index 00000000..e9f831ef --- /dev/null +++ b/PROMS/VEPROMS User Interface/dlgExportImport.designer.cs @@ -0,0 +1,385 @@ +namespace VEPROMS +{ + partial class dlgExportImport + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.pnlExport = new System.Windows.Forms.Panel(); + this.lblExportTime = new System.Windows.Forms.Label(); + this.lblExportStatus = new System.Windows.Forms.Label(); + this.pbExportStep = new System.Windows.Forms.ProgressBar(); + this.lblExportStep = new System.Windows.Forms.Label(); + this.pbExportSection = new System.Windows.Forms.ProgressBar(); + this.lblExportSection = new System.Windows.Forms.Label(); + this.pbExportProcedure = new System.Windows.Forms.ProgressBar(); + this.lblExportProcedure = new System.Windows.Forms.Label(); + this.btnDoExport = new System.Windows.Forms.Button(); + this.btnExport = new System.Windows.Forms.Button(); + this.txtExport = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.pnlImport = new System.Windows.Forms.Panel(); + this.lblImportTime = new System.Windows.Forms.Label(); + this.lblImportStatus = new System.Windows.Forms.Label(); + this.pbImportStep = new System.Windows.Forms.ProgressBar(); + this.lblImportStep = new System.Windows.Forms.Label(); + this.pbImportSection = new System.Windows.Forms.ProgressBar(); + this.lblImportSection = new System.Windows.Forms.Label(); + this.pbImportProcedure = new System.Windows.Forms.ProgressBar(); + this.lblImportProcedure = new System.Windows.Forms.Label(); + this.btnDoImport = new System.Windows.Forms.Button(); + this.btnImport = new System.Windows.Forms.Button(); + this.txtImport = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.ofd = new System.Windows.Forms.OpenFileDialog(); + this.sfd = new System.Windows.Forms.SaveFileDialog(); + this.pnlExport.SuspendLayout(); + this.pnlImport.SuspendLayout(); + this.SuspendLayout(); + // + // pnlExport + // + this.pnlExport.Controls.Add(this.lblExportTime); + this.pnlExport.Controls.Add(this.lblExportStatus); + this.pnlExport.Controls.Add(this.pbExportStep); + this.pnlExport.Controls.Add(this.lblExportStep); + this.pnlExport.Controls.Add(this.pbExportSection); + this.pnlExport.Controls.Add(this.lblExportSection); + this.pnlExport.Controls.Add(this.pbExportProcedure); + this.pnlExport.Controls.Add(this.lblExportProcedure); + this.pnlExport.Controls.Add(this.btnDoExport); + this.pnlExport.Controls.Add(this.btnExport); + this.pnlExport.Controls.Add(this.txtExport); + 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.TabIndex = 0; + // + // lblExportTime + // + this.lblExportTime.AutoSize = true; + this.lblExportTime.Location = new System.Drawing.Point(407, 30); + this.lblExportTime.Name = "lblExportTime"; + this.lblExportTime.Size = new System.Drawing.Size(28, 13); + this.lblExportTime.TabIndex = 11; + this.lblExportTime.Text = "0:00"; + this.lblExportTime.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // lblExportStatus + // + this.lblExportStatus.AutoSize = true; + this.lblExportStatus.Location = new System.Drawing.Point(140, 30); + this.lblExportStatus.Name = "lblExportStatus"; + this.lblExportStatus.Size = new System.Drawing.Size(133, 13); + this.lblExportStatus.TabIndex = 10; + this.lblExportStatus.Text = "Awaiting Export File Name:"; + // + // pbExportStep + // + this.pbExportStep.Location = new System.Drawing.Point(15, 155); + this.pbExportStep.Name = "pbExportStep"; + this.pbExportStep.Size = new System.Drawing.Size(561, 20); + this.pbExportStep.Step = 1; + this.pbExportStep.TabIndex = 9; + // + // lblExportStep + // + this.lblExportStep.AutoSize = true; + this.lblExportStep.Location = new System.Drawing.Point(12, 139); + this.lblExportStep.Name = "lblExportStep"; + this.lblExportStep.Size = new System.Drawing.Size(34, 13); + this.lblExportStep.TabIndex = 8; + this.lblExportStep.Text = "Steps"; + // + // pbExportSection + // + this.pbExportSection.Location = new System.Drawing.Point(15, 116); + this.pbExportSection.Name = "pbExportSection"; + this.pbExportSection.Size = new System.Drawing.Size(561, 20); + this.pbExportSection.Step = 1; + this.pbExportSection.TabIndex = 7; + // + // lblExportSection + // + this.lblExportSection.AutoSize = true; + this.lblExportSection.Location = new System.Drawing.Point(12, 100); + this.lblExportSection.Name = "lblExportSection"; + this.lblExportSection.Size = new System.Drawing.Size(48, 13); + this.lblExportSection.TabIndex = 6; + this.lblExportSection.Text = "Sections"; + // + // pbExportProcedure + // + this.pbExportProcedure.Location = new System.Drawing.Point(15, 77); + this.pbExportProcedure.Name = "pbExportProcedure"; + this.pbExportProcedure.Size = new System.Drawing.Size(561, 20); + this.pbExportProcedure.Step = 1; + this.pbExportProcedure.TabIndex = 5; + // + // lblExportProcedure + // + this.lblExportProcedure.AutoSize = true; + this.lblExportProcedure.Location = new System.Drawing.Point(12, 61); + this.lblExportProcedure.Name = "lblExportProcedure"; + this.lblExportProcedure.Size = new System.Drawing.Size(61, 13); + this.lblExportProcedure.TabIndex = 4; + this.lblExportProcedure.Text = "Procedures"; + // + // btnDoExport + // + this.btnDoExport.Enabled = false; + this.btnDoExport.Location = new System.Drawing.Point(15, 25); + this.btnDoExport.Name = "btnDoExport"; + this.btnDoExport.Size = new System.Drawing.Size(119, 23); + this.btnDoExport.TabIndex = 3; + this.btnDoExport.Text = "Process Export"; + this.btnDoExport.UseVisualStyleBackColor = true; + this.btnDoExport.Click += new System.EventHandler(this.btnDoExport_Click); + // + // btnExport + // + this.btnExport.Location = new System.Drawing.Point(582, 3); + this.btnExport.Name = "btnExport"; + this.btnExport.Size = new System.Drawing.Size(25, 23); + this.btnExport.TabIndex = 2; + this.btnExport.Text = "..."; + this.btnExport.UseVisualStyleBackColor = true; + this.btnExport.Click += new System.EventHandler(this.btnExport_Click); + // + // txtExport + // + this.txtExport.Location = new System.Drawing.Point(141, 6); + this.txtExport.Name = "txtExport"; + this.txtExport.ReadOnly = true; + this.txtExport.Size = new System.Drawing.Size(435, 20); + this.txtExport.TabIndex = 1; + this.txtExport.TextChanged += new System.EventHandler(this.txtExport_TextChanged); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(123, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Select Export File Name:"; + // + // pnlImport + // + this.pnlImport.Controls.Add(this.lblImportTime); + this.pnlImport.Controls.Add(this.lblImportStatus); + this.pnlImport.Controls.Add(this.pbImportStep); + this.pnlImport.Controls.Add(this.lblImportStep); + this.pnlImport.Controls.Add(this.pbImportSection); + this.pnlImport.Controls.Add(this.lblImportSection); + this.pnlImport.Controls.Add(this.pbImportProcedure); + this.pnlImport.Controls.Add(this.lblImportProcedure); + this.pnlImport.Controls.Add(this.btnDoImport); + this.pnlImport.Controls.Add(this.btnImport); + this.pnlImport.Controls.Add(this.txtImport); + 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.TabIndex = 1; + // + // lblImportTime + // + this.lblImportTime.AutoSize = true; + this.lblImportTime.Location = new System.Drawing.Point(407, 31); + 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; + // + // lblImportStatus + // + this.lblImportStatus.AutoSize = true; + this.lblImportStatus.Location = new System.Drawing.Point(137, 31); + this.lblImportStatus.Name = "lblImportStatus"; + this.lblImportStatus.Size = new System.Drawing.Size(132, 13); + this.lblImportStatus.TabIndex = 16; + this.lblImportStatus.Text = "Awaiting Import File Name:"; + // + // pbImportStep + // + this.pbImportStep.Location = new System.Drawing.Point(15, 156); + this.pbImportStep.Name = "pbImportStep"; + this.pbImportStep.Size = new System.Drawing.Size(561, 20); + this.pbImportStep.Step = 1; + this.pbImportStep.TabIndex = 15; + // + // lblImportStep + // + this.lblImportStep.AutoSize = true; + this.lblImportStep.Location = new System.Drawing.Point(12, 140); + this.lblImportStep.Name = "lblImportStep"; + this.lblImportStep.Size = new System.Drawing.Size(34, 13); + this.lblImportStep.TabIndex = 14; + this.lblImportStep.Text = "Steps"; + // + // pbImportSection + // + this.pbImportSection.Location = new System.Drawing.Point(14, 117); + this.pbImportSection.Name = "pbImportSection"; + this.pbImportSection.Size = new System.Drawing.Size(561, 20); + this.pbImportSection.Step = 1; + this.pbImportSection.TabIndex = 13; + // + // lblImportSection + // + this.lblImportSection.AutoSize = true; + this.lblImportSection.Location = new System.Drawing.Point(12, 101); + this.lblImportSection.Name = "lblImportSection"; + this.lblImportSection.Size = new System.Drawing.Size(48, 13); + this.lblImportSection.TabIndex = 12; + this.lblImportSection.Text = "Sections"; + // + // pbImportProcedure + // + this.pbImportProcedure.Location = new System.Drawing.Point(14, 78); + this.pbImportProcedure.Name = "pbImportProcedure"; + this.pbImportProcedure.Size = new System.Drawing.Size(561, 20); + this.pbImportProcedure.Step = 1; + this.pbImportProcedure.TabIndex = 11; + // + // lblImportProcedure + // + this.lblImportProcedure.AutoSize = true; + this.lblImportProcedure.Location = new System.Drawing.Point(12, 62); + this.lblImportProcedure.Name = "lblImportProcedure"; + this.lblImportProcedure.Size = new System.Drawing.Size(61, 13); + this.lblImportProcedure.TabIndex = 10; + this.lblImportProcedure.Text = "Procedures"; + // + // btnDoImport + // + this.btnDoImport.Enabled = false; + this.btnDoImport.Location = new System.Drawing.Point(15, 26); + this.btnDoImport.Name = "btnDoImport"; + this.btnDoImport.Size = new System.Drawing.Size(119, 23); + this.btnDoImport.TabIndex = 5; + this.btnDoImport.Text = "Process Import"; + this.btnDoImport.UseVisualStyleBackColor = true; + this.btnDoImport.Click += new System.EventHandler(this.btnDoImport_Click); + // + // btnImport + // + this.btnImport.Location = new System.Drawing.Point(581, 4); + this.btnImport.Name = "btnImport"; + this.btnImport.Size = new System.Drawing.Size(25, 23); + this.btnImport.TabIndex = 4; + this.btnImport.Text = "..."; + this.btnImport.UseVisualStyleBackColor = true; + this.btnImport.Click += new System.EventHandler(this.btnImport_Click); + // + // txtImport + // + this.txtImport.Location = new System.Drawing.Point(140, 7); + this.txtImport.Name = "txtImport"; + this.txtImport.ReadOnly = true; + this.txtImport.Size = new System.Drawing.Size(435, 20); + this.txtImport.TabIndex = 3; + this.txtImport.TextChanged += new System.EventHandler(this.txtImport_TextChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 10); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(122, 13); + this.label2.TabIndex = 1; + this.label2.Text = "Select Import File Name:"; + // + // ofd + // + this.ofd.AddExtension = false; + this.ofd.Filter = "PROMS Export Files|*.expx"; + this.ofd.Title = "Import File Name"; + // + // sfd + // + this.sfd.DefaultExt = "expx"; + this.sfd.Filter = "PROMS Export Files|*.expx"; + this.sfd.Title = "Export File Name"; + // + // dlgExportImport + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(633, 452); + this.Controls.Add(this.pnlImport); + this.Controls.Add(this.pnlExport); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "dlgExportImport"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Export Import Dialog"; + this.Load += new System.EventHandler(this.dlgExportImport_Load); + this.pnlExport.ResumeLayout(false); + this.pnlExport.PerformLayout(); + this.pnlImport.ResumeLayout(false); + this.pnlImport.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel pnlExport; + private System.Windows.Forms.Panel pnlImport; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button btnExport; + private System.Windows.Forms.TextBox txtExport; + private System.Windows.Forms.Button btnImport; + private System.Windows.Forms.TextBox txtImport; + private System.Windows.Forms.Button btnDoExport; + private System.Windows.Forms.Button btnDoImport; + private System.Windows.Forms.ProgressBar pbExportStep; + private System.Windows.Forms.Label lblExportStep; + private System.Windows.Forms.ProgressBar pbExportSection; + private System.Windows.Forms.Label lblExportSection; + private System.Windows.Forms.ProgressBar pbExportProcedure; + private System.Windows.Forms.Label lblExportProcedure; + private System.Windows.Forms.ProgressBar pbImportStep; + private System.Windows.Forms.Label lblImportStep; + private System.Windows.Forms.ProgressBar pbImportSection; + private System.Windows.Forms.Label lblImportSection; + private System.Windows.Forms.ProgressBar pbImportProcedure; + private System.Windows.Forms.Label lblImportProcedure; + private System.Windows.Forms.OpenFileDialog ofd; + private System.Windows.Forms.SaveFileDialog sfd; + private System.Windows.Forms.Label lblExportStatus; + private System.Windows.Forms.Label lblImportStatus; + private System.Windows.Forms.Label lblExportTime; + private System.Windows.Forms.Label lblImportTime; + + } +} \ No newline at end of file diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.resx b/PROMS/VEPROMS User Interface/dlgExportImport.resx new file mode 100644 index 00000000..c8010a4d --- /dev/null +++ b/PROMS/VEPROMS User Interface/dlgExportImport.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 87, 17 + + \ No newline at end of file