diff --git a/PROMS/DataLoader/dlgExportImport.cs b/PROMS/DataLoader/dlgExportImport.cs index acfe049a..6a87a638 100644 --- a/PROMS/DataLoader/dlgExportImport.cs +++ b/PROMS/DataLoader/dlgExportImport.cs @@ -15,6 +15,8 @@ namespace DataLoader { public partial class dlgExportImport : Form { + private int oldRODbID; + private int newRODbID; private string PEIPath; private string _MyMode; private FolderInfo MyFolder = null; @@ -1828,7 +1830,8 @@ namespace DataLoader } private RODb AddRODb(XmlReader xr) { - string roname = xr.GetAttribute("roname"); + oldRODbID = int.Parse(xr.GetAttribute("rodbid")); + string roname = xr.GetAttribute("roname"); string folderpath = xr.GetAttribute("folderpath"); string dbconnectionstring = xr.GetAttribute("dbconnectionstring"); string config = xr.GetAttribute("config"); @@ -1838,12 +1841,14 @@ namespace DataLoader rv = RODb.GetByFolderPath(folderpath); if (rv == null) rv = RODb.MakeRODb(roname, folderpath, dbconnectionstring, config, dts, userid); - return rv; + newRODbID = rv.RODbID; + return rv; } private RODb AddRODb(XmlNode xrodb) { lblImportStatus.Text = "Creating RODb..."; Application.DoEvents(); + oldRODbID = int.Parse(xrodb.Attributes.GetNamedItem("rodbid").InnerText); string roname = xrodb.Attributes.GetNamedItem("roname").InnerText; string folderpath = xrodb.Attributes.GetNamedItem("folderpath").InnerText; string dbconnectionstring = xrodb.Attributes.GetNamedItem("dbconnectionstring").InnerText; @@ -1854,6 +1859,7 @@ namespace DataLoader rv = RODb.GetByFolderPath(folderpath); if (rv == null) rv = RODb.MakeRODb(roname, folderpath, dbconnectionstring, config, dts, userid); + newRODbID = rv.RODbID; return rv; } private int GetProcedureData(XmlReader xr) @@ -1933,8 +1939,8 @@ namespace DataLoader 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()); + string lookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString()); + string replaceWith = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString()); if (lookFor != replaceWith) { content.Text = content.Text.Replace(lookFor, replaceWith); @@ -1952,8 +1958,8 @@ namespace DataLoader 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()); + string lookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString()); + string replaceWith = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString()); if (lookFor != replaceWith) { content.Text = content.Text.Replace(lookFor, replaceWith); diff --git a/PROMS/VEPROMS User Interface/dlgExportImport.cs b/PROMS/VEPROMS User Interface/dlgExportImport.cs index c066a44b..d357dcb2 100644 --- a/PROMS/VEPROMS User Interface/dlgExportImport.cs +++ b/PROMS/VEPROMS User Interface/dlgExportImport.cs @@ -15,6 +15,8 @@ namespace VEPROMS { public partial class dlgExportImport : Form { + private int oldRODbID; + private int newRODbID; private FolderInfo _MyNewFolder; public FolderInfo MyNewFolder { @@ -1834,7 +1836,8 @@ namespace VEPROMS } private RODb AddRODb(XmlReader xr) { - string roname = xr.GetAttribute("roname"); + oldRODbID = int.Parse(xr.GetAttribute("rodbid")); + string roname = xr.GetAttribute("roname"); string folderpath = xr.GetAttribute("folderpath"); string dbconnectionstring = xr.GetAttribute("dbconnectionstring"); string config = xr.GetAttribute("config"); @@ -1844,12 +1847,14 @@ namespace VEPROMS rv = RODb.GetByFolderPath(folderpath); if (rv == null) rv = RODb.MakeRODb(roname, folderpath, dbconnectionstring, config, dts, userid); - return rv; + newRODbID = rv.RODbID; + return rv; } private RODb AddRODb(XmlNode xrodb) { lblImportStatus.Text = "Creating RODb..."; Application.DoEvents(); + oldRODbID = int.Parse(xrodb.Attributes.GetNamedItem("rodbid").InnerText); string roname = xrodb.Attributes.GetNamedItem("roname").InnerText; string folderpath = xrodb.Attributes.GetNamedItem("folderpath").InnerText; string dbconnectionstring = xrodb.Attributes.GetNamedItem("dbconnectionstring").InnerText; @@ -1860,6 +1865,7 @@ namespace VEPROMS rv = RODb.GetByFolderPath(folderpath); if (rv == null) rv = RODb.MakeRODb(roname, folderpath, dbconnectionstring, config, dts, userid); + newRODbID = rv.RODbID; return rv; } private int GetProcedureData(XmlReader xr) @@ -1939,14 +1945,14 @@ namespace VEPROMS 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(); - } - } + string lookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString()); + string replaceWith = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString()); + 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")) @@ -1958,14 +1964,14 @@ namespace VEPROMS 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(); - } - } + string lookFor = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rousageid, roid, oldRODbID.ToString()); + string replaceWith = string.Format("#Link:ReferencedObject:{0} {1} {2}[END>", rou.ROUsageID.ToString(), roid, newRODbID.ToString()); + if (lookFor != replaceWith) + { + content.Text = content.Text.Replace(lookFor, replaceWith); + content.Save(); + } + } } private void AddAnnotation(XmlReader xr) { diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index 1eae8677..1496c7e5 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -299,7 +299,8 @@ namespace VEPROMS dlgExportImport dlg = new dlgExportImport(args.Index == 0 ? "Export" : "Import", fi); dlg.ShowDialog(this); MySessionInfo.CheckInItem(ownerid); - tv.AddNewNode(dlg.MyNewFolder); + if(args.Index == 1 && dlg.MyNewFolder != null) + tv.AddNewNode(dlg.MyNewFolder); } }