logic to save word sections with resolved RO values for exporting the approved procedure
logic to create an export file with unlinked RO and Transition Commented out debug statements to help evaluate memory usage
This commit is contained in:
@@ -14,7 +14,8 @@ using Ionic.Zip;
|
||||
namespace VEPROMS
|
||||
{
|
||||
public partial class dlgExportImport : Form
|
||||
{
|
||||
{
|
||||
private bool _ConvertROsAndTransitionsToText = false; // set to true when Approval creates an Export file
|
||||
private ItemInfo _ExternalTransitionItem = null;
|
||||
public ItemInfo ExternalTransitionItem
|
||||
{
|
||||
@@ -527,195 +528,196 @@ namespace VEPROMS
|
||||
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<string, string> dicRofst = null;
|
||||
Dictionary<string, string> 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
|
||||
{
|
||||
// jsj 2016Feb17 - this appears to not be used
|
||||
//private void LoadImportDataReader()
|
||||
//{
|
||||
// int pCount = 0;
|
||||
// int sCount = 0;
|
||||
// Folder folder = null;
|
||||
// DocVersion docversion = null;
|
||||
// Dictionary<string, string> dicRofst = null;
|
||||
// Dictionary<string, string> 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);
|
||||
}
|
||||
// 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();
|
||||
@@ -1091,9 +1093,7 @@ namespace VEPROMS
|
||||
{
|
||||
ofd.Filter = "PROMS Procedure Export Files|*.pxml";
|
||||
if (ofd.ShowDialog(this) == DialogResult.OK)
|
||||
{
|
||||
txtImport.Text = ofd.FileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void txtImport_TextChanged(object sender, EventArgs e)
|
||||
@@ -1574,6 +1574,17 @@ namespace VEPROMS
|
||||
}
|
||||
}
|
||||
}
|
||||
// used to save word sections with resolved ROs (export generated from Approve)
|
||||
private Dictionary<int, byte[]> _DocReplace;
|
||||
public Dictionary<int, byte[]> DocReplace
|
||||
{
|
||||
get { return _DocReplace; }
|
||||
set
|
||||
{
|
||||
_DocReplace = value;
|
||||
_ConvertROsAndTransitionsToText = (value != null);
|
||||
}
|
||||
}
|
||||
private void ExportItem(ItemInfo ii, string nodename)
|
||||
{
|
||||
/*
|
||||
@@ -1630,9 +1641,11 @@ namespace VEPROMS
|
||||
UserID
|
||||
*/
|
||||
XmlElement xe = xn.OwnerDocument.CreateElement(nodename);
|
||||
// strip the link information if we are convertingthe RO and Transitions to text
|
||||
string ciText = (_ConvertROsAndTransitionsToText)?ItemInfo.StripLinks(ci.Text):ci.Text;
|
||||
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, "text", ciText));
|
||||
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));
|
||||
@@ -1697,10 +1710,12 @@ namespace VEPROMS
|
||||
DTS
|
||||
UserID
|
||||
*/
|
||||
// strip the link information if we are convertinga the ROs and Transitions to text
|
||||
string ciText = (_ConvertROsAndTransitionsToText) ? ItemInfo.StripLinks(ci.Text) : ci.Text;
|
||||
MyWriter.WriteStartElement(nodename);
|
||||
MyWriter.WriteAttributeString("contentid", ci.ContentID.ToString());
|
||||
MyWriter.WriteAttributeString("number", ci.Number);
|
||||
MyWriter.WriteAttributeString("text", ci.Text);
|
||||
MyWriter.WriteAttributeString("text", ciText);
|
||||
MyWriter.WriteAttributeString("type", ci.Type.ToString());
|
||||
MyWriter.WriteAttributeString("formatid", ci.FormatID.ToString());
|
||||
MyWriter.WriteAttributeString("config", ci.Config);
|
||||
@@ -1730,9 +1745,15 @@ namespace VEPROMS
|
||||
DTS
|
||||
UserID
|
||||
*/
|
||||
string giData = gi.Data;
|
||||
if (_ConvertROsAndTransitionsToText)
|
||||
{
|
||||
giData = giData.Replace("<IsRoTable>True", "<IsRoTable>False"); // converts a RO table to a unlinked regular table
|
||||
giData = ItemInfo.StripLinks(giData); // this converts ROs and transitions to text
|
||||
}
|
||||
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, "data", giData));
|
||||
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()));
|
||||
@@ -1777,9 +1798,15 @@ namespace VEPROMS
|
||||
DTS
|
||||
UserID
|
||||
*/
|
||||
string giData = gi.Data;
|
||||
if (_ConvertROsAndTransitionsToText)
|
||||
{
|
||||
giData = giData.Replace("IsRoTable>True", "IsRoTable>False"); // converts a RO table to regular table
|
||||
giData = ItemInfo.StripLinks(giData); // converts ROs and Transitions to text
|
||||
}
|
||||
MyWriter.WriteStartElement(nodename);
|
||||
MyWriter.WriteAttributeString("contentid", gi.ContentID.ToString());
|
||||
MyWriter.WriteAttributeString("data", gi.Data);
|
||||
MyWriter.WriteAttributeString("data", giData);
|
||||
MyWriter.WriteAttributeString("config", gi.Config);
|
||||
MyWriter.WriteAttributeString("dts", gi.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
|
||||
MyWriter.WriteAttributeString("userid", gi.UserID.ToString());
|
||||
@@ -1856,10 +1883,17 @@ namespace VEPROMS
|
||||
UserID
|
||||
FileExtension
|
||||
*/
|
||||
byte[] buf = di.DocContent;
|
||||
string libDocTitle = di.LibTitle;
|
||||
if (DocReplace != null && DocReplace.ContainsKey(di.DocID) && _ConvertROsAndTransitionsToText)
|
||||
{
|
||||
buf = DocReplace[di.DocID];
|
||||
libDocTitle = null; // unlink the word section from the library document
|
||||
}
|
||||
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, "libtitle", libDocTitle)); // di.LibTitle));
|
||||
xe.Attributes.SetNamedItem(AddAttribute(xe.OwnerDocument, "doccontent", Convert.ToBase64String(buf)));
|
||||
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")));
|
||||
@@ -1910,10 +1944,17 @@ namespace VEPROMS
|
||||
UserID
|
||||
FileExtension
|
||||
*/
|
||||
byte[] buf = di.DocContent;
|
||||
string libDocTitle = di.LibTitle;
|
||||
if (DocReplace != null && DocReplace.ContainsKey(di.DocID) && _ConvertROsAndTransitionsToText)
|
||||
{
|
||||
buf = DocReplace[di.DocID];
|
||||
libDocTitle = null; // unlink the word section from the library document
|
||||
}
|
||||
MyWriter.WriteStartElement(nodename);
|
||||
MyWriter.WriteAttributeString("docid", di.DocID.ToString());
|
||||
MyWriter.WriteAttributeString("libtitle", di.LibTitle);
|
||||
MyWriter.WriteAttributeString("doccontent", Convert.ToBase64String(di.DocContent));
|
||||
MyWriter.WriteAttributeString("libtitle", libDocTitle);// di.LibTitle);
|
||||
MyWriter.WriteAttributeString("doccontent", Convert.ToBase64String(buf));
|
||||
MyWriter.WriteAttributeString("docascii", di.DocAscii);
|
||||
MyWriter.WriteAttributeString("config", di.Config);
|
||||
MyWriter.WriteAttributeString("dts", di.DTS.ToString("MM/dd/yyyy HH:mm:ss.fff"));
|
||||
@@ -2246,69 +2287,69 @@ namespace VEPROMS
|
||||
cc.Text = cc.Text.Replace(lookfor, replacewith);
|
||||
cc.Save();
|
||||
}
|
||||
private void AddTransitions(Content content, XmlNode xn)
|
||||
{
|
||||
/*
|
||||
Content
|
||||
Item
|
||||
Item
|
||||
int
|
||||
int
|
||||
string
|
||||
dts
|
||||
string
|
||||
<transition transitionid="1" fromid="186" toid="175" rangeid="177" isrange="1" trantype="2" config="" dts="4/11/1997 1:20:00 PM" userid="MH" />
|
||||
private void AddTransitions(Content content, XmlNode xn)
|
||||
{
|
||||
/*
|
||||
Content
|
||||
Item
|
||||
Item
|
||||
int
|
||||
int
|
||||
string
|
||||
dts
|
||||
string
|
||||
<transition transitionid="1" fromid="186" toid="175" rangeid="177" isrange="1" trantype="2" config="" dts="4/11/1997 1:20:00 PM" userid="MH" />
|
||||
|
||||
#Link:Transition:1 2 187
|
||||
type,id,toid
|
||||
#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);
|
||||
#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.FixTransitionText(TransitionInfo.Get(tt.TransitionID));
|
||||
content.Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
PendingTransitions.DocumentElement.AppendChild(PendingTransitions.ImportNode(nd, true));
|
||||
//save to holding pen
|
||||
}
|
||||
}
|
||||
}
|
||||
content.Save();
|
||||
}
|
||||
else
|
||||
{
|
||||
PendingTransitions.DocumentElement.AppendChild(PendingTransitions.ImportNode(nd, true));
|
||||
//save to holding pen
|
||||
}
|
||||
}
|
||||
}
|
||||
private void AddTransitions()
|
||||
{
|
||||
AddTransitions(PendingTransitions);
|
||||
}
|
||||
private void AddTransitions(XmlDocument xd)
|
||||
private void AddTransitions(XmlDocument xd)
|
||||
{
|
||||
/*
|
||||
Content
|
||||
@@ -2684,26 +2725,27 @@ namespace VEPROMS
|
||||
FixSectionStart(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} {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();
|
||||
}
|
||||
}
|
||||
// jsj 2016Feb16 - This appears to not be used
|
||||
//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} {1} {2}[END>", rousageid, roid, oldRODbID.ToString());
|
||||
// string replaceWith = (cbxCvrtROsToText.Checked) ? "" : 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"))
|
||||
@@ -2812,29 +2854,30 @@ namespace VEPROMS
|
||||
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 = OldToNewFormat(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;
|
||||
}
|
||||
// jsj 2016Feb16 - This appears to not be used
|
||||
//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 = OldToNewFormat(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();
|
||||
@@ -3285,17 +3328,18 @@ namespace VEPROMS
|
||||
floatFoldout.Add(contentid, int.Parse(xn.InnerText));
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
// jsj 2016Feb16 - This appears to not be used
|
||||
//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");
|
||||
@@ -3303,29 +3347,29 @@ namespace VEPROMS
|
||||
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;
|
||||
}
|
||||
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;
|
||||
DateTime dts = DateTime.Parse(nd.Attributes.GetNamedItem("dts").InnerText);
|
||||
@@ -3349,23 +3393,24 @@ namespace VEPROMS
|
||||
Entry ee = Entry.MakeEntry(content, dd, dts, userid);
|
||||
ee.Save();
|
||||
}
|
||||
private void AddDocument(XmlReader xr, Dictionary<string, string> 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);
|
||||
}
|
||||
// jsj 2016Feb16 - This appears to not be used
|
||||
//private void AddDocument(XmlReader xr, Dictionary<string, string> 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)
|
||||
{
|
||||
Document d;
|
||||
|
Reference in New Issue
Block a user