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:
John Jenko 2016-02-18 15:29:25 +00:00
parent 6ae1fcda1a
commit 8cd75c0c14
7 changed files with 820 additions and 734 deletions

View File

@ -1103,6 +1103,7 @@ namespace VEPROMS
frmPDFStatusForm frm = new frmPDFStatusForm(pi, ap.RevNumAndDate, /* revdate change: ap.RevDate.ToString("MM/dd/yyyy") ,*/ waterMark, false, false, ViewPDF, true, VlnSettings.TemporaryFolder, new ChangeBarDefinition(pi.MyDocVersion.MyConfig as DocVersionConfig, pi.ActiveFormat), pdfTmp, location, pi.MyDocVersion.DocVersionConfig.Print_AddBlankPagesWhenUsingDuplexFoldouts, true,"",false,false);
frm.AllowAllWatermarks = true;
frm.CloseWhenDone = !ViewPDF;
frm.DocReplace = new Dictionary<int, byte[]>(); // will hold the Word Attachments with resolved ROs
frm.ShowDialog();
//if (ap.ProcInfo.MyDocVersion.DocVersionConfig.SelectedSlave > 0)
//{
@ -1139,9 +1140,11 @@ namespace VEPROMS
pi.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
if (si.IsApproved == 1)
{
dlgExportImport dlg = new dlgExportImport("Export", pi);
dlgExportImport dlg = new dlgExportImport("Export", pi); // "true tell export to convert ROs and Transitions to text
dlg.DocReplace = frm.DocReplace; // this tells approval to prepare an export file with resolved transitions and ROs, word sections are saved with resolved ROs during approval PDF creation and saved in DocReplace
System.Xml.XmlDocument xd = new System.Xml.XmlDocument();
dlg.ExportItem(xd, pi, "procedure");
frm.DocReplace = dlg.DocReplace = null;
version.ApprovedXML = xd.OuterXml;
version.Save();
dlg.Dispose();

View File

@ -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&gtTrue", "IsRoTable&gt;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;

View File

@ -28,379 +28,377 @@ namespace VEPROMS
/// </summary>
private void InitializeComponent()
{
this.pnlExport = new System.Windows.Forms.Panel();
this.btnCloseExport = new System.Windows.Forms.Button();
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.btnCloseImport = new System.Windows.Forms.Button();
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.cbxExportAudits = new System.Windows.Forms.CheckBox();
this.cbxImportAudits = new System.Windows.Forms.CheckBox();
this.pnlExport.SuspendLayout();
this.pnlImport.SuspendLayout();
this.SuspendLayout();
//
// pnlExport
//
this.pnlExport.Controls.Add(this.cbxExportAudits);
this.pnlExport.Controls.Add(this.btnCloseExport);
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(618, 199);
this.pnlExport.TabIndex = 0;
//
// btnCloseExport
//
this.btnCloseExport.Enabled = false;
this.btnCloseExport.Location = new System.Drawing.Point(562, 32);
this.btnCloseExport.Name = "btnCloseExport";
this.btnCloseExport.Size = new System.Drawing.Size(53, 23);
this.btnCloseExport.TabIndex = 12;
this.btnCloseExport.Text = "Close";
this.btnCloseExport.UseVisualStyleBackColor = true;
this.btnCloseExport.Click += new System.EventHandler(this.btnCloseExport_Click);
//
// lblExportTime
//
this.lblExportTime.AutoSize = true;
this.lblExportTime.Location = new System.Drawing.Point(392, 29);
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.cbxImportAudits);
this.pnlImport.Controls.Add(this.btnCloseImport);
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(618, 225);
this.pnlImport.TabIndex = 1;
//
// btnCloseImport
//
this.btnCloseImport.Enabled = false;
this.btnCloseImport.Location = new System.Drawing.Point(562, 33);
this.btnCloseImport.Name = "btnCloseImport";
this.btnCloseImport.Size = new System.Drawing.Size(53, 23);
this.btnCloseImport.TabIndex = 18;
this.btnCloseImport.Text = "Close";
this.btnCloseImport.UseVisualStyleBackColor = true;
this.btnCloseImport.Click += new System.EventHandler(this.btnCloseImport_Click);
//
// lblImportTime
//
this.lblImportTime.AutoSize = true;
this.lblImportTime.Location = new System.Drawing.Point(392, 30);
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";
//
// cbxExportAudits
//
this.cbxExportAudits.AutoSize = true;
this.cbxExportAudits.Location = new System.Drawing.Point(141, 47);
this.cbxExportAudits.Name = "cbxExportAudits";
this.cbxExportAudits.Size = new System.Drawing.Size(123, 17);
this.cbxExportAudits.TabIndex = 13;
this.cbxExportAudits.Text = "Include Audit History";
this.cbxExportAudits.UseVisualStyleBackColor = true;
this.cbxExportAudits.Checked = false;
this.pnlExport = new System.Windows.Forms.Panel();
this.cbxExportAudits = new System.Windows.Forms.CheckBox();
this.btnCloseExport = new System.Windows.Forms.Button();
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.cbxImportAudits = new System.Windows.Forms.CheckBox();
this.btnCloseImport = new System.Windows.Forms.Button();
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.cbxExportAudits);
this.pnlExport.Controls.Add(this.btnCloseExport);
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(618, 199);
this.pnlExport.TabIndex = 0;
//
// cbxExportAudits
//
this.cbxExportAudits.AutoSize = true;
this.cbxExportAudits.Location = new System.Drawing.Point(141, 54);
this.cbxExportAudits.Name = "cbxExportAudits";
this.cbxExportAudits.Size = new System.Drawing.Size(123, 17);
this.cbxExportAudits.TabIndex = 13;
this.cbxExportAudits.Text = "Include Audit History";
this.cbxExportAudits.UseVisualStyleBackColor = true;
this.cbxExportAudits.Visible = false;
//
// cbxImportAudits
//
this.cbxImportAudits.AutoSize = true;
this.cbxImportAudits.Location = new System.Drawing.Point(140, 47);
this.cbxImportAudits.Name = "cbxImportAudits";
this.cbxImportAudits.Size = new System.Drawing.Size(182, 17);
this.cbxImportAudits.TabIndex = 19;
this.cbxImportAudits.Text = "Include Audit History (if available)";
this.cbxImportAudits.UseVisualStyleBackColor = true;
this.cbxImportAudits.Checked = false;
//
// btnCloseExport
//
this.btnCloseExport.Enabled = false;
this.btnCloseExport.Location = new System.Drawing.Point(562, 32);
this.btnCloseExport.Name = "btnCloseExport";
this.btnCloseExport.Size = new System.Drawing.Size(53, 23);
this.btnCloseExport.TabIndex = 12;
this.btnCloseExport.Text = "Close";
this.btnCloseExport.UseVisualStyleBackColor = true;
this.btnCloseExport.Click += new System.EventHandler(this.btnCloseExport_Click);
//
// lblExportTime
//
this.lblExportTime.AutoSize = true;
this.lblExportTime.Location = new System.Drawing.Point(392, 29);
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.cbxImportAudits);
this.pnlImport.Controls.Add(this.btnCloseImport);
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(618, 225);
this.pnlImport.TabIndex = 1;
//
// cbxImportAudits
//
this.cbxImportAudits.AutoSize = true;
this.cbxImportAudits.Location = new System.Drawing.Point(360, 56);
this.cbxImportAudits.Name = "cbxImportAudits";
this.cbxImportAudits.Size = new System.Drawing.Size(182, 17);
this.cbxImportAudits.TabIndex = 19;
this.cbxImportAudits.Text = "Include Audit History (if available)";
this.cbxImportAudits.UseVisualStyleBackColor = true;
this.cbxImportAudits.Visible = false;
//
// 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);
//
// btnCloseImport
//
this.btnCloseImport.Enabled = false;
this.btnCloseImport.Location = new System.Drawing.Point(562, 33);
this.btnCloseImport.Name = "btnCloseImport";
this.btnCloseImport.Size = new System.Drawing.Size(53, 23);
this.btnCloseImport.TabIndex = 18;
this.btnCloseImport.Text = "Close";
this.btnCloseImport.UseVisualStyleBackColor = true;
this.btnCloseImport.Click += new System.EventHandler(this.btnCloseImport_Click);
//
// lblImportTime
//
this.lblImportTime.AutoSize = true;
this.lblImportTime.Location = new System.Drawing.Point(392, 30);
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(16, 180);
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(13, 164);
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(15, 141);
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(13, 125);
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(15, 102);
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(13, 86);
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);
}
@ -437,7 +435,7 @@ namespace VEPROMS
private System.Windows.Forms.Button btnCloseExport;
private System.Windows.Forms.Button btnCloseImport;
private System.Windows.Forms.CheckBox cbxExportAudits;
private System.Windows.Forms.CheckBox cbxImportAudits;
private System.Windows.Forms.CheckBox cbxImportAudits;
}
}

View File

@ -88,6 +88,14 @@ namespace VEPROMS
_NewLocation = newLocation;
DialogResult = DialogResult.OK;
}
// used when the approved function creates an export file with unlinked ROs and Transitons. Word sections that have RO tokens are saved with the RO Vaules in DocReplace
// DocReplace is passed on to the Export functions.
private Dictionary<int, byte[]> _DocReplace;
public Dictionary<int, byte[]> DocReplace
{
get { return _DocReplace; }
set { _DocReplace = value; }
}
public bool AllowAllWatermarks
{
get { return MyPromsPrinter.AllowAllWatermarks; }
@ -146,6 +154,7 @@ namespace VEPROMS
if (CancelStop) btnCancel.Visible = true;
Application.DoEvents();
MyPromsPrinter.StatusChanged += new PromsPrinterStatusEvent(pp_StatusChanged);
MyPromsPrinter.DocReplace = DocReplace; // used when approve generates an export with unlinked ROs and Transitions
DateTime tStart = DateTime.Now;
if (!CancelStop) PromsPrinter.ClearTransPageNumProblems();
do

View File

@ -572,6 +572,13 @@ namespace VEPROMS.CSLA.Library
}
public static class MSWordToPDF
{
// used to save Word sections with resolved ROs (for export generated from Approve)
private static Dictionary<int, byte[]> _DocReplace;
public static Dictionary<int, byte[]> DocReplace
{
get { return MSWordToPDF._DocReplace; }
set { MSWordToPDF._DocReplace = value; }
}
private static bool _CloseWordWhenDone = true;
public static bool CloseWordWhenDone
{
@ -615,7 +622,7 @@ namespace VEPROMS.CSLA.Library
string fileName = GetFileName(sect);
FileInfo fi = new FileInfo(fileName);
FileStream fs = fi.Create();
PdfInfo myPdf = PdfInfo.Get(sect);
PdfInfo myPdf = PdfInfo.Get(sect,false);
if (myPdf != null && myPdf.DocPdf != null) fs.Write(myPdf.DocPdf, 0, myPdf.DocPdf.Length);
fs.Close();
return fileName;
@ -624,7 +631,7 @@ namespace VEPROMS.CSLA.Library
public static bool UpdateDocPdf(DocumentInfo mydoc, Color overrideColor, ItemInfo sect)
{
MSWordToPDF.OverrideColor = overrideColor;
PdfInfo myPdf = PdfInfo.Get(sect);
PdfInfo myPdf = PdfInfo.Get(sect,DocReplace!=null);
return true;
}
public static bool SetDocPdf(DocumentInfo docInfo, ItemInfo sect)
@ -982,15 +989,32 @@ namespace VEPROMS.CSLA.Library
sel.Range.Font.Color = (LBWdColor)WordColor(OverrideColor == System.Drawing.Color.Transparent ? System.Drawing.Color.Black : OverrideColor);
sect.MSWordPageCount = myDoc.Length;
fileName = CreatePDF(fileName, openPdf,MSWordToPDF.DebugStatus);
if (DocReplace != null)
{
MyApp.ActiveDocument.SaveAs2000();
DocReplace.Add(sect.MyContent.MyEntry.DocID, GetBytes(MyApp.ActiveDocument.FullName)); // save the word document containing resolved ROs
}
CloseDocument();
if (CloseWordWhenDone)
{
CloseAppAfterWait();
}
if (statusChange != null) statusChange(VolianStatusType.Complete, 0, "");
GC.Collect(); //jsj 2-15-2016 - for memeory garbage collection
return fileName;
}
}
// Reads the Word file containing the resolved ROs
// used when adding to DocReplace
private static byte[] GetBytes(string filename)
{
FileInfo fi = new FileInfo(filename);
FileStream fs = fi.Open(FileMode.Open,FileAccess.Read,FileShare.ReadWrite);
byte[] buf = new byte[fi.Length];
fs.Read(buf, 0, buf.Length);
fs.Close();
return buf;
}
private static void CloseDocument()
{
int attempts = 0;
@ -1323,6 +1347,7 @@ namespace VEPROMS.CSLA.Library
VG.IVGOutput vgOut = new VG.VGOut_Graphics(grfx);
vgOut.DebugStatus = MSWordToPDF.DebugStatus;
myPlot.Process(vgOut);
GC.Collect(); // memory garbage collection (Regex bug)
grfx.Dispose();
GraphicsUnit gu = new GraphicsUnit();
retval = mf.GetBounds(ref gu);

View File

@ -63,7 +63,7 @@ namespace VEPROMS.CSLA.Library
}
public partial class PdfInfo
{
public static PdfInfo Get(ItemInfo sect)
public static PdfInfo Get(ItemInfo sect, bool ovrride)
{
int count = 0;
while (count < 2)
@ -81,8 +81,12 @@ namespace VEPROMS.CSLA.Library
myPdf = Get(sect.MyContent.MyEntry.DocID, ss*10 + MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth);
}
if (myPdf != null) return myPdf;
if (count > 0) return null; // Could not find or create a pdf
// ovrride forces the the printing of the word seciton, which creates a word file with resolved ROs, which is saved for an approved export
if (!ovrride || (ovrride && count ==1))
{
if (myPdf != null) return myPdf;
if (count > 0) return null; // Could not find or create a pdf
}
MSWordToPDF.SetDocPdf(sect.MyContent.MyEntry.MyDocument, sect);
count++;
}

View File

@ -878,14 +878,16 @@ namespace VEPROMS.CSLA.Library
{
get
{
//_MyLog.WarnFormat("LatestVersion 1 - {0}",GC.GetTotalMemory(true));
if (this.RevisionVersions == null || this.RevisionVersions.Count == 0) return null;
VersionInfo latest = this.RevisionVersions[0];
foreach (VersionInfo vi in this.RevisionVersions)
{
if (vi.DTS > latest.DTS)
latest = vi;
}
return latest;
VersionInfo latest = this.RevisionVersions[0];
foreach (VersionInfo vi in this.RevisionVersions)
{
if (vi.DTS > latest.DTS)
latest = vi;
}
//_MyLog.WarnFormat("LatestVersion 2 - {0}", GC.GetTotalMemory(true));
return latest;
}
}
public override string ToString()