Added code to resolve rodbid value in text proiperty of content object

Added code to correct error in refreshing treeview after importing procedure set
This commit is contained in:
Rich 2014-06-17 03:04:02 +00:00
parent ed9d8d641b
commit f9d47b82cb
3 changed files with 38 additions and 25 deletions

View File

@ -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);

View File

@ -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)
{

View File

@ -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);
}
}