Added code to resolve reference object links in grids
This commit is contained in:
parent
01913ed0ba
commit
b6d89593b9
@ -46,6 +46,11 @@ namespace DataLoader
|
|||||||
PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database;
|
PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database;
|
||||||
if (!Directory.Exists(PEIPath))
|
if (!Directory.Exists(PEIPath))
|
||||||
Directory.CreateDirectory(PEIPath);
|
Directory.CreateDirectory(PEIPath);
|
||||||
|
if (MyFolder.ChildFolderCount == 0)
|
||||||
|
{
|
||||||
|
Directory.Delete(PEIPath, true);
|
||||||
|
Directory.CreateDirectory(PEIPath);
|
||||||
|
}
|
||||||
pnlExport.Dock = DockStyle.Fill;
|
pnlExport.Dock = DockStyle.Fill;
|
||||||
pnlImport.Dock = DockStyle.Fill;
|
pnlImport.Dock = DockStyle.Fill;
|
||||||
if (_MyMode.ToLower() == "export")
|
if (_MyMode.ToLower() == "export")
|
||||||
@ -2506,7 +2511,33 @@ namespace DataLoader
|
|||||||
{
|
{
|
||||||
XmlNode nd = xc.SelectSingleNode("grid");
|
XmlNode nd = xc.SelectSingleNode("grid");
|
||||||
string data = nd.Attributes.GetNamedItem("data").InnerText;
|
string data = nd.Attributes.GetNamedItem("data").InnerText;
|
||||||
string config = nd.Attributes.GetNamedItem("config").InnerText;
|
XmlDocument xd = new XmlDocument();
|
||||||
|
xd.LoadXml(data);
|
||||||
|
XmlNode gn = xd.SelectSingleNode("C1FlexGrid/Control/IsRoTable");
|
||||||
|
if (gn.InnerText.ToLower() == "true")
|
||||||
|
{
|
||||||
|
gn = xd.SelectSingleNode("C1FlexGrid/Control/RODbId");
|
||||||
|
gn.InnerText = newRODbID.ToString();
|
||||||
|
data = xd.OuterXml;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Cells/Cell/Data");
|
||||||
|
bool modified = false;
|
||||||
|
string lookFor = string.Format(" {0}[END", oldRODbID.ToString());
|
||||||
|
string replaceWith = string.Format(" {0}[END", newRODbID.ToString());
|
||||||
|
foreach (XmlNode nn in nl)
|
||||||
|
{
|
||||||
|
if (nn.InnerText.Contains("#Link:ReferencedObject:"))
|
||||||
|
{
|
||||||
|
nn.InnerText = nn.InnerText.Replace(lookFor, replaceWith);
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (modified)
|
||||||
|
data = xd.OuterXml;
|
||||||
|
}
|
||||||
|
string config = nd.Attributes.GetNamedItem("config").InnerText;
|
||||||
string userid = nd.Attributes.GetNamedItem("userid").InnerText;
|
string userid = nd.Attributes.GetNamedItem("userid").InnerText;
|
||||||
DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
|
DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
|
||||||
Grid gg = Grid.MakeGrid(content, data, config, dts, userid);
|
Grid gg = Grid.MakeGrid(content, data, config, dts, userid);
|
||||||
|
@ -51,6 +51,11 @@ namespace VEPROMS
|
|||||||
PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database;
|
PEIPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS\PEI_" + Database.VEPROMS_SqlConnection.Database;
|
||||||
if (!Directory.Exists(PEIPath))
|
if (!Directory.Exists(PEIPath))
|
||||||
Directory.CreateDirectory(PEIPath);
|
Directory.CreateDirectory(PEIPath);
|
||||||
|
if (MyFolder.ChildFolderCount == 0)
|
||||||
|
{
|
||||||
|
Directory.Delete(PEIPath,true);
|
||||||
|
Directory.CreateDirectory(PEIPath);
|
||||||
|
}
|
||||||
pnlExport.Dock = DockStyle.Fill;
|
pnlExport.Dock = DockStyle.Fill;
|
||||||
pnlImport.Dock = DockStyle.Fill;
|
pnlImport.Dock = DockStyle.Fill;
|
||||||
if (_MyMode.ToLower() == "export")
|
if (_MyMode.ToLower() == "export")
|
||||||
@ -2512,6 +2517,32 @@ namespace VEPROMS
|
|||||||
{
|
{
|
||||||
XmlNode nd = xc.SelectSingleNode("grid");
|
XmlNode nd = xc.SelectSingleNode("grid");
|
||||||
string data = nd.Attributes.GetNamedItem("data").InnerText;
|
string data = nd.Attributes.GetNamedItem("data").InnerText;
|
||||||
|
XmlDocument xd = new XmlDocument();
|
||||||
|
xd.LoadXml(data);
|
||||||
|
XmlNode gn = xd.SelectSingleNode("C1FlexGrid/Control/IsRoTable");
|
||||||
|
if (gn.InnerText.ToLower() == "true")
|
||||||
|
{
|
||||||
|
gn = xd.SelectSingleNode("C1FlexGrid/Control/RODbId");
|
||||||
|
gn.InnerText = newRODbID.ToString();
|
||||||
|
data = xd.OuterXml;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
XmlNodeList nl = xd.SelectNodes("C1FlexGrid/Cells/Cell/Data");
|
||||||
|
bool modified = false;
|
||||||
|
string lookFor = string.Format(" {0}[END", oldRODbID.ToString());
|
||||||
|
string replaceWith = string.Format(" {0}[END", newRODbID.ToString());
|
||||||
|
foreach (XmlNode nn in nl)
|
||||||
|
{
|
||||||
|
if (nn.InnerText.Contains("#Link:ReferencedObject:"))
|
||||||
|
{
|
||||||
|
nn.InnerText = nn.InnerText.Replace(lookFor, replaceWith);
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(modified)
|
||||||
|
data = xd.OuterXml;
|
||||||
|
}
|
||||||
string config = nd.Attributes.GetNamedItem("config").InnerText;
|
string config = nd.Attributes.GetNamedItem("config").InnerText;
|
||||||
string userid = nd.Attributes.GetNamedItem("userid").InnerText;
|
string userid = nd.Attributes.GetNamedItem("userid").InnerText;
|
||||||
DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
|
DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user