Added a missing MAXRECURSION 10000

Changed Through Transition Format and User Interface
Added Automatic Print Options to shutoff DebugText (/NT), DebugPagination (/NP) and Compare (/NC)
Added logic to allow the use of the default path for PDFs.
Update the Print_PDFLocation property of the Working Draft when the user changes the value on the Working Draft property page.  Fixed Bug B2013-117
Set the date/time stamp for the Document based upon the current time.
Make sure that the output is set to Final without revisions and comments before ROs are replaced.
Added function to restore valid previous version of MSWord document if the current version is not a valid document.
Check for Null to eliminate errors.
Removed Unused field DocPDF
Support MSWord document restore function.
Add check for Transition Node count before updating values.
Restore latest valid MSWord document if the current version is not valid.
Eliminate File Commands so that the user can only close the MSWord section, and then verify if the changes to the document will be saved.
This commit is contained in:
Rich 2013-07-01 17:39:15 +00:00
parent 569ed454b8
commit 78add0ccd2
13 changed files with 165 additions and 33 deletions

View File

@ -5793,6 +5793,7 @@ select I.[Level],I.[FromType],I.[Ordinal], I.[ParentID], I.[ItemID],I.[PreviousI
join Contents C on C.ContentID = I.ContentID join Contents C on C.ContentID = I.ContentID
where i.apple = 1 where i.apple = 1
order by I.[Level] , I.[FromType], I.[Ordinal] order by I.[Level] , I.[FromType], I.[Ordinal]
OPTION (MAXRECURSION 10000)
END END
GO GO
-- Display the status of Procedure Creation -- Display the status of Procedure Creation

View File

@ -26,6 +26,17 @@ namespace VEPROMS
cbxDebugPagination.Checked = true; cbxDebugPagination.Checked = true;
cbxDebugText.Checked = true; cbxDebugText.Checked = true;
Application.DoEvents(); Application.DoEvents();
string[] parameters = System.Environment.CommandLine.Split(" ".ToCharArray());
bool ranAuto = false;
foreach (string parameter in parameters)
{
if (parameter.ToUpper() == "/NT")
cbxDebugText.Checked = false;
else if (parameter.ToUpper() == "/NP")
cbxDebugPagination.Checked = false;
else if (parameter.ToUpper() == "/NC")
cbxDebug.Checked = false;
}
CreatePDFs(); CreatePDFs();
this.Close(); this.Close();
} }
@ -566,6 +577,7 @@ namespace VEPROMS
newPDFPath = PDFPath + @"\" + MyProcedure.MyDocVersion.DocVersionConfig.Unit_Text; newPDFPath = PDFPath + @"\" + MyProcedure.MyDocVersion.DocVersionConfig.Unit_Text;
if (_MultiunitPdfLocation == "Unit ID") if (_MultiunitPdfLocation == "Unit ID")
newPDFPath = PDFPath + @"\" + MyProcedure.MyDocVersion.DocVersionConfig.Unit_ID; newPDFPath = PDFPath + @"\" + MyProcedure.MyDocVersion.DocVersionConfig.Unit_ID;
if (newPDFPath == "") newPDFPath = Volian.Base.Library.VlnSettings.TemporaryFolder;
if (!Directory.Exists(newPDFPath)) if (!Directory.Exists(newPDFPath))
Directory.CreateDirectory(newPDFPath); Directory.CreateDirectory(newPDFPath);
return newPDFPath; return newPDFPath;

View File

@ -341,10 +341,16 @@ namespace VEPROMS
btnApplicability.Visible = false; btnApplicability.Visible = false;
tiApplicability.Visible = false; tiApplicability.Visible = false;
} }
ppTxtBxPDFLoc.TextChanged += new EventHandler(ppTxtBxPDFLoc_TextChanged);
//end add new applicability stuff //end add new applicability stuff
_Initializing = false; _Initializing = false;
} }
// The following code was added to fix Bug B2013-117
void ppTxtBxPDFLoc_TextChanged(object sender, EventArgs e)
{
if (_Initializing == false)
_DocVersionConfig.Print_PDFLocation = ppTxtBxPDFLoc.Text;
}
#region General tab #region General tab
/// <summary> /// <summary>

View File

@ -34,6 +34,16 @@ namespace VEPROMS.CSLA.Library
return _LibTitle; return _LibTitle;
} }
} }
private static LBApplicationClass _MyApp = null;
public static LBApplicationClass MyApp
{
get
{
if (_MyApp == null)
_MyApp = new LBApplicationClass();
return _MyApp;
}
}
public void UpdateDRoUsages(List<string> roids) public void UpdateDRoUsages(List<string> roids)
{ {
_DocumentDROUsageCount = -1; _DocumentDROUsageCount = -1;
@ -57,6 +67,94 @@ namespace VEPROMS.CSLA.Library
DocumentDROUsages.Add(parts[1], RODb.GetJustRoDb(int.Parse(parts[0]))); DocumentDROUsages.Add(parts[1], RODb.GetJustRoDb(int.Parse(parts[0])));
} }
} }
private int _Unique = 0;
private string Unique
{
get
{
string retval = "";
if (_Unique != 0) retval = "_" + _Unique.ToString();
_Unique++;
return retval;
}
}
public void StatusChanged(VolianStatusType type, int count, string text)
{
//if (Parent != null && Parent.Parent != null && Parent.Parent.Parent is DisplayTabControl)
//{
// DisplayTabControl tc = Parent.Parent.Parent as DisplayTabControl;
// tc.ONStatusChanged(this, new DisplayTabControlStatusEventArgs(type, count, text));
//}
}
public void RestoreWordDoc(ItemInfo myItemInfo)
{
DocumentAuditInfo savDocAuditInfo = null;
using (DocumentAuditInfoList dail = DocumentAuditInfoList.Get(DocID))
{
if (dail.Count > 0)
{
DocumentAuditInfo dai = dail[0];
foreach (DocumentAuditInfo tmpa in dail)
{
FileInfo tmpFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}{3}", VlnSettings.TemporaryFolder, DocID, Unique, tmpa.FileExtension));
while (tmpFile.Exists)
{
tmpFile = new FileInfo(string.Format(@"{0}\tmp_{1}{2}{3}", VlnSettings.TemporaryFolder, DocID, Unique, tmpa.FileExtension));
}
FileStream fs = tmpFile.Create();
if (tmpa.DocContent != null) fs.Write(tmpa.DocContent, 0, tmpa.DocContent.Length);
fs.Close();
LBDocumentClass myDoc = null;
try
{
myDoc = MyApp.Documents.Open(tmpFile.FullName, false);
savDocAuditInfo = tmpa;
myDoc.Close();
break;
}
catch (Exception ex)
{
if (myDoc != null) myDoc.Close();
continue; // get next document audit item.
}
}
}
if (savDocAuditInfo != null)
{
FileExtension = savDocAuditInfo.FileExtension;
DocContent = savDocAuditInfo.DocContent;
DocAscii = savDocAuditInfo.DocAscii;
Config = savDocAuditInfo.Config;
UserID = savDocAuditInfo.UserID;
DTS = savDocAuditInfo.DTS;
Save();
List<string> roids = new List<string>();
DocumentInfo docinfo = DocumentInfo.Get(DocID);
string pdfTmp = MSWordToPDF.ToPDFReplaceROs(docinfo, roids, myItemInfo, StatusChanged);
FileInfo pdfFile = new FileInfo(pdfTmp);
FileStream fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
Byte[] buf = new byte[pdfFile.Length];
fs.Read(buf, 0, buf.Length);
fs.Close();
pdfFile.Delete();
Pdf.DeleteAll(DocID); // clear the PDF table for DocID first
DocStyle myDocStyle = myItemInfo.ActiveSection.MyDocStyle;
SectionConfig sc = myItemInfo.ActiveSection.MyConfig as SectionConfig;
if (sc != null && sc.Section_WordMargin == "Y")
{
using (Pdf myPdf = Pdf.MakePdf(this, MSWordToPDF.DebugStatus, 0, 0, 0, 0, (double)myItemInfo.MSWordPageCount, buf)) { ;}
}
else
{
using (Pdf myPdf = Pdf.MakePdf(this, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength,
(int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)myItemInfo.MSWordPageCount, buf)) { ;}
}
UpdateDRoUsages(roids);
Save();
}
}
}
/// <summary> /// <summary>
/// FixString processes the string returned and changes any symbols (0xF0??) to normal characters /// FixString processes the string returned and changes any symbols (0xF0??) to normal characters
/// </summary> /// </summary>
@ -417,7 +515,8 @@ namespace VEPROMS.CSLA.Library
cfg.Edit_Initialized = true; cfg.Edit_Initialized = true;
doc.Config = cfg.ToString(); doc.Config = cfg.ToString();
doc.UserID = Volian.Base.Library.VlnSettings.UserID; doc.UserID = Volian.Base.Library.VlnSettings.UserID;
doc.DTS = _MyFile.LastWriteTimeUtc; //doc.DTS = _MyFile.LastWriteTimeUtc;
doc.DTS = DateTime.Now.ToUniversalTime();
doc = doc.Save(); doc = doc.Save();
List<string> roids = new List<string>(); List<string> roids = new List<string>();
string pdfTmp = MSWordToPDF.ToPDFReplaceROs(_MyDocument, roids, myItemInfo,statusChange); string pdfTmp = MSWordToPDF.ToPDFReplaceROs(_MyDocument, roids, myItemInfo,statusChange);
@ -658,7 +757,7 @@ namespace VEPROMS.CSLA.Library
LBRange myRange = selxy.Paragraphs.First.Range; LBRange myRange = selxy.Paragraphs.First.Range;
float yTop = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage); float yTop = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage);
float yTop1 = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToTextBoundary); float yTop1 = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToTextBoundary);
// some data had regular text embedded in the xyplot definition. If so, the plain text must // some data had regular text embedded in the xyplot definition. If so, the plain text must
// be left in the file. Otherwise, we can replace with empty text. // be left in the file. Otherwise, we can replace with empty text.
string resXyPlot = xyplot; string resXyPlot = xyplot;
@ -670,8 +769,8 @@ namespace VEPROMS.CSLA.Library
} }
else else
{ {
selxy.Text = ""; selxy.Text = "";
if (cnt>0)for (int icnt = 0; icnt < cnt; icnt++) selxy.Text = selxy.Text + "\r"; if (cnt > 0) for (int icnt = 0; icnt < cnt; icnt++) selxy.Text = selxy.Text + "\r";
} }
pngFile = VlnSettings.TemporaryFolder + @"\XYPlot" + filecount.ToString() + @".png"; //@"C:\Temp\XYPlot1.png"; pngFile = VlnSettings.TemporaryFolder + @"\XYPlot" + filecount.ToString() + @".png"; //@"C:\Temp\XYPlot1.png";
@ -694,6 +793,9 @@ namespace VEPROMS.CSLA.Library
if(statusChange != null) statusChange(VolianStatusType.Initialize, sel.End, "Refreshing ROs"); if(statusChange != null) statusChange(VolianStatusType.Initialize, sel.End, "Refreshing ROs");
sel = hasRos ? FindRO() : null; sel = hasRos ? FindRO() : null;
int roCount = 0; int roCount = 0;
// force Print of MS Word Attachment to Final without revisions and comments
myDoc.ActiveWindow.View.ShowRevisionsAndComments = false;
myDoc.ActiveWindow.View.RevisionsView = LBWdRevisionsView.wdRevisionsViewFinal;
while (sel != null) while (sel != null)
{ {
if (statusChange != null) statusChange(VolianStatusType.Update, sel.Start, string.Format("{0} ROs Refreshed", ++roCount)); if (statusChange != null) statusChange(VolianStatusType.Update, sel.Start, string.Format("{0} ROs Refreshed", ++roCount));
@ -817,9 +919,6 @@ namespace VEPROMS.CSLA.Library
//sel.Range.Font.Color = (LBWdColor)WordColor(PrintOverride.OverrideTextColor(System.Drawing.Color.Black)); //sel.Range.Font.Color = (LBWdColor)WordColor(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
sel.Range.Font.Color = (LBWdColor)WordColor(OverrideColor == System.Drawing.Color.Transparent ? System.Drawing.Color.Black : OverrideColor); sel.Range.Font.Color = (LBWdColor)WordColor(OverrideColor == System.Drawing.Color.Transparent ? System.Drawing.Color.Black : OverrideColor);
sect.MSWordPageCount = myDoc.Length; sect.MSWordPageCount = myDoc.Length;
// force Print of MS Word Attachment to Final without revisions and comments
myDoc.ActiveWindow.View.ShowRevisionsAndComments = false;
myDoc.ActiveWindow.View.RevisionsView = LBWdRevisionsView.wdRevisionsViewFinal;
fileName = CreatePDF(fileName, openPdf); fileName = CreatePDF(fileName, openPdf);
MyApp.ActiveDocument.Close(false); MyApp.ActiveDocument.Close(false);
if (CloseWordWhenDone) if (CloseWordWhenDone)
@ -987,7 +1086,7 @@ namespace VEPROMS.CSLA.Library
, _MySection.ItemID, _MySection.MyDocVersion.MyFolder.Name, _MySection.ShortPath); , _MySection.ItemID, _MySection.MyDocVersion.MyFolder.Name, _MySection.ShortPath);
} }
else else
_MyLog.Error("Could not set margins", ex); _MyLog.Error("Could not set margins", ex);
} }
} }
} }

View File

@ -4730,7 +4730,7 @@ namespace VEPROMS.CSLA.Library
string tmpstr = indx+1<DisplayNumber.Length?DisplayNumber.Substring(indx+1):null; string tmpstr = indx+1<DisplayNumber.Length?DisplayNumber.Substring(indx+1):null;
// if the section's tab is a letter, we don't want a 0 on the section.... for example A.0. // if the section's tab is a letter, we don't want a 0 on the section.... for example A.0.
if (IsSection && tmpstr == null && System.Char.IsLetter(DisplayNumber, 0)) return -1; if (IsSection && tmpstr == null && System.Char.IsLetter(DisplayNumber, 0)) return -1;
if (tmpstr.IndexOf('-') >= 0) return -1; if (tmpstr != null && tmpstr.IndexOf('-') >= 0) return -1;
return tmpstr==null?0:System.Convert.ToInt32(tmpstr); return tmpstr==null?0:System.Convert.ToInt32(tmpstr);
} }
return (-1); return (-1);

View File

@ -180,16 +180,6 @@ namespace VEPROMS.CSLA.Library
return _FileExtension; return _FileExtension;
} }
} }
private byte[] _DocPdf;
public byte[] DocPdf
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("DocPdf", true);
return _DocPdf;
}
}
private int _DeleteStatus; private int _DeleteStatus;
public int DeleteStatus public int DeleteStatus
{ {
@ -281,7 +271,6 @@ namespace VEPROMS.CSLA.Library
_DTS = tmp.DTS; _DTS = tmp.DTS;
_UserID = tmp.UserID; _UserID = tmp.UserID;
_FileExtension = tmp.FileExtension; _FileExtension = tmp.FileExtension;
_DocPdf = tmp.DocPdf;
_DeleteStatus = tmp.DeleteStatus; _DeleteStatus = tmp.DeleteStatus;
_DocumentAuditInfoExtension.Refresh(this); _DocumentAuditInfoExtension.Refresh(this);
OnChange();// raise an event OnChange();// raise an event
@ -350,7 +339,6 @@ namespace VEPROMS.CSLA.Library
_DTS = dr.GetDateTime("DTS"); _DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID"); _UserID = dr.GetString("UserID");
_FileExtension = dr.GetString("FileExtension"); _FileExtension = dr.GetString("FileExtension");
_DocPdf = (byte[])dr.GetValue("DocPdf");
_DeleteStatus = dr.GetInt32("DeleteStatus"); _DeleteStatus = dr.GetInt32("DeleteStatus");
} }
catch (Exception ex) catch (Exception ex)

View File

@ -90,9 +90,11 @@ namespace Volian.Controls.Library
//private frmPG _frm = null; //private frmPG _frm = null;
#region Constructors #region Constructors
private Timer _RefreshTimer; private Timer _RefreshTimer;
public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myDisplayTabControl) private ItemInfo _ItemInfo;
public DSOTabPanel(DocumentInfo documentInfo, DisplayTabControl myDisplayTabControl, ItemInfo itemInfo)
{ {
_MyDisplayTabControl = myDisplayTabControl; _MyDisplayTabControl = myDisplayTabControl;
_ItemInfo = itemInfo;
InitializeComponent(); InitializeComponent();
SetupDSOTabPanel(); SetupDSOTabPanel();
_MyDocumentInfo = documentInfo; _MyDocumentInfo = documentInfo;
@ -159,14 +161,23 @@ namespace Volian.Controls.Library
{ {
if (dail.Count > 0) if (dail.Count > 0)
{ {
DocumentAuditInfo dai = dail[0]; //DocumentAuditInfo dai = dail[0];
foreach (DocumentAuditInfo tmpa in dail) //foreach (DocumentAuditInfo tmpa in dail)
{ //{
if (tmpa.DTS > dai.DTS) dai = tmpa; // if (tmpa.DTS > dai.DTS) dai = tmpa;
} //}
if(MessageBox.Show("Do you want to revert to a previous version?", "Error in MS Word section", if(MessageBox.Show("Do you want to revert to a previous version?", "Error in MS Word section",
MessageBoxButtons.YesNo, MessageBoxIcon.Question)==DialogResult.Yes) MessageBoxButtons.YesNo, MessageBoxIcon.Question)==DialogResult.Yes)
fs.Write(dai.DocContent, 0, dai.DocContent.Length); {
//fs.Write(dai.DocContent, 0, dai.DocContent.Length);
using (Document myDoc = Document.Get(MyDocumentInfo.DocID))
{
myDoc.RestoreWordDoc(_ItemInfo);
_DSOFile = null;
_MyDocumentInfo = DocumentInfo.Get(MyDocumentInfo.DocID);
}
}
} }
else else
MessageBox.Show("Reverting to Blank Document", "Error in MS Word section", MessageBox.Show("Reverting to Blank Document", "Error in MS Word section",
@ -175,7 +186,20 @@ namespace Volian.Controls.Library
fs.Close(); fs.Close();
this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName); this._MyDSOFramer.Open(MyDSOFile.MyFile.FullName);
} }
this._MyDSOFramer.Menubar = false; LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
Console.WriteLine("Version {0}", doc.Application.Version);
float ver;
if (!float.TryParse(doc.Application.Version, out ver))
ver = 12.0F;
this._MyDSOFramer.Menubar = ver < 12.0F;
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileClose, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileNew, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFilePageSetup, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFilePrint, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFilePrintPreview, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileProperties, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileSave, false);
this._MyDSOFramer.set_EnableFileCommand(DSOFramer.dsoFileCommandType.dsoFileSaveAs, false);
this._MyDSOFramer.Titlebar = false; this._MyDSOFramer.Titlebar = false;
//if (_MyCount < 20) //if (_MyCount < 20)
// this._MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow; // this._MyDSOFramer.FrameHookPolicy = DSOFramer.dsoFrameHookPolicy.dsoResetNow;
@ -191,7 +215,6 @@ namespace Volian.Controls.Library
//this.GotFocus += new EventHandler(DSOTabPanel_GotFocus); //this.GotFocus += new EventHandler(DSOTabPanel_GotFocus);
//this.LostFocus += new EventHandler(DSOTabPanel_LostFocus); //this.LostFocus += new EventHandler(DSOTabPanel_LostFocus);
Application.DoEvents(); Application.DoEvents();
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
// The following line corrects Symbol characters in MSWord Sections // The following line corrects Symbol characters in MSWord Sections
// CheckForSymbolCharacters(doc); // CheckForSymbolCharacters(doc);
InitializeWordDocument(doc); InitializeWordDocument(doc);
@ -364,6 +387,8 @@ namespace Volian.Controls.Library
return; return;
} }
LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument); LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument);
while (doc.Saved = false)
Application.DoEvents();
string tmp = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName"); string tmp = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName");
if (System.IO.File.Exists(tmp)) if (System.IO.File.Exists(tmp))
MyDSOFile.FullName = tmp; MyDSOFile.FullName = tmp;

View File

@ -204,7 +204,7 @@ namespace Volian.Controls.Library
private void SetupDSOTabPanel() private void SetupDSOTabPanel()
{ {
EntryInfo myEntry = _MyItemInfo.MyContent.MyEntry; EntryInfo myEntry = _MyItemInfo.MyContent.MyEntry;
_MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl); _MyDSOTabPanel = new DSOTabPanel(myEntry.MyDocument, _MyDisplayTabControl, _MyItemInfo);
// //
// tabItem // tabItem
// //
@ -228,7 +228,7 @@ namespace Volian.Controls.Library
} }
private void SetupLibraryDocumentDSOTabPanel() private void SetupLibraryDocumentDSOTabPanel()
{ {
_MyDSOTabPanel = new DSOTabPanel(_MyDocumentInfo, _MyDisplayTabControl); _MyDSOTabPanel = new DSOTabPanel(_MyDocumentInfo, _MyDisplayTabControl, _MyItemInfo);
// //
// tabItem // tabItem
// //

View File

@ -248,6 +248,7 @@ namespace Volian.Controls.Library
} }
// Find sameParent1 in tree, expand down to toItem: // Find sameParent1 in tree, expand down to toItem:
if (tvTran.Nodes.Count == 0) return;
tvFillInRangeNodes(path, (VETreeNode)tvTran.Nodes[0], lev1, true); tvFillInRangeNodes(path, (VETreeNode)tvTran.Nodes[0], lev1, true);
path.Clear(); path.Clear();
parRng = rngItem; parRng = rngItem;

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.