Added ability to perform a profile (Determine which sections of code are using the majority of the CPU time.)
Fixed logic that determines if the debug output should be created in the PDF. Added ability to track DB actions. Change cursor to a wait curcor when the print button is pressed. Added Profile debug Added a time-out for determining if a RO.FST file is newer. Added a property (PrintAllAtOnce) to the ItemInfo object so that the code can differentiate between objects that are being used for edit or print. Added logic to improve print performance. Specifically initialize a number of item properties when the procedure is loaded for printing, rather than waiting for the properties to be lazy-loaded. Added Profile debug Changed NextItem property to use GetNextItem method when printing.
This commit is contained in:
parent
1b0079388e
commit
29ffd0329c
@ -506,6 +506,10 @@ namespace VEPROMS
|
||||
private string _MultiunitPdfLocation = string.Empty;
|
||||
private void CreatePDFs()
|
||||
{
|
||||
if (VlnSettings.GetCommandFlag("PROFILE")) ProfileTimer.TurnOnTracking("Profile.txt");
|
||||
VEPROMS.CSLA.Library.Database.TrackDBUsage = VlnSettings.GetCommandFlag("DBTrack");
|
||||
ProfileTimer.Reset();
|
||||
int profileDepth = ProfileTimer.Push(">>>> CreatePdf");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (MySessionInfo != null)
|
||||
{
|
||||
@ -525,8 +529,7 @@ namespace VEPROMS
|
||||
}
|
||||
CreateDebugFiles();
|
||||
// If file exists, determine if overwrite checkbox allows overwrite, if not prompt.
|
||||
|
||||
Volian.Print.Library.Rtf2Pdf.PdfDebug = true;
|
||||
Volian.Print.Library.Rtf2Pdf.PdfDebug = cbxDebug.Checked;
|
||||
PrintWatermark pw = (btnWaterMarkOn.Checked) ? (PrintWatermark)cbxWaterMark.SelectedValue : PrintWatermark.None;
|
||||
// Determine change bar settings. First get from config & then see if override from dialog.
|
||||
// Also check that format allows override.
|
||||
@ -549,7 +552,7 @@ namespace VEPROMS
|
||||
pbPDFsStatus.TextVisible = true;
|
||||
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
pbPDFsStatus.Value = i;
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
string myPDFPath = GetMultiunitPDFPath();
|
||||
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
|
||||
@ -570,10 +573,10 @@ namespace VEPROMS
|
||||
pbPDFsStatus.TextVisible = true;
|
||||
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
pbPDFsStatus.Value = i;
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50), cbxBlankPgsForDuplex.Checked);
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50), cbxBlankPgsForDuplex.Checked);
|
||||
frmStatus.CloseWhenDone = true;
|
||||
Application.DoEvents();
|
||||
frmStatus.CancelStop = true;
|
||||
@ -588,13 +591,15 @@ namespace VEPROMS
|
||||
pbPDFsStatus.TextVisible = true;
|
||||
pbPDFsStatus.Text = string.Format("Creating PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
pbPDFsStatus.Value = i;
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
// this.Text = string.Format("Create PDF for {0} ({1} of {2})", myProc.DisplayNumber, ++i, n);
|
||||
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
|
||||
int profileDepth1 = ProfileTimer.Push(">>>> GetItemAndChildren");
|
||||
if (MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
else
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50), cbxBlankPgsForDuplex.Checked);
|
||||
ProfileTimer.Pop(profileDepth1);
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50), cbxBlankPgsForDuplex.Checked);
|
||||
frmStatus.CloseWhenDone = true;
|
||||
Application.DoEvents();
|
||||
frmStatus.CancelStop = true;
|
||||
@ -606,6 +611,13 @@ namespace VEPROMS
|
||||
pbPDFsStatus.Visible = false;
|
||||
if(!Automatic)
|
||||
ShowDebugFiles();
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
ProfileTimer.ShowTimerTable();
|
||||
if (VlnSettings.GetCommandFlag("DBTrack"))
|
||||
{
|
||||
VEPROMS.CSLA.Library.Database.TrackDBUsage = false;
|
||||
VEPROMS.CSLA.Library.Database.ShowDBTracking("DBTracking.txt");
|
||||
}
|
||||
}
|
||||
|
||||
private string GetMultiunitPDFPath()
|
||||
@ -642,6 +654,10 @@ namespace VEPROMS
|
||||
}
|
||||
private void CreatePDF()
|
||||
{
|
||||
if (VlnSettings.GetCommandFlag("PROFILE")) ProfileTimer.TurnOnTracking("Profile.txt");
|
||||
VEPROMS.CSLA.Library.Database.TrackDBUsage = VlnSettings.GetCommandFlag("DBTrack");
|
||||
ProfileTimer.Reset();
|
||||
int profileDepth = ProfileTimer.Push(">>>> CreatePdf");
|
||||
string message = string.Empty;
|
||||
if (!MySessionInfo.CanCheckOutItem(MyProcedure.ItemID, CheckOutType.Procedure, ref message))
|
||||
{
|
||||
@ -650,23 +666,34 @@ namespace VEPROMS
|
||||
}
|
||||
CreateDebugFiles();
|
||||
// If file exists, determine if overwrite checkbox allows overwrite, if not prompt.
|
||||
|
||||
Volian.Print.Library.Rtf2Pdf.PdfDebug = true;
|
||||
|
||||
Volian.Print.Library.Rtf2Pdf.PdfDebug = cbxDebug.Checked;
|
||||
PrintWatermark pw = (btnWaterMarkOn.Checked) ? (PrintWatermark)cbxWaterMark.SelectedValue : PrintWatermark.None;
|
||||
// Determine change bar settings. First get from config & then see if override from dialog.
|
||||
// Also check that format allows override.
|
||||
ChangeBarDefinition cbd = DetermineChangeBarSettings();
|
||||
int profileDepth2 = ProfileTimer.Push(">>>> CreatePdf.GetItemAndChildren");
|
||||
if (MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave > 0 || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseTransitionModifier || MyProcedure.ActiveFormat.PlantFormat.FormatData.TransData.UseSpecificTransitionModifier)
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildrenByUnit(MyProcedure.ItemID, 0, MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave);
|
||||
else
|
||||
MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
|
||||
// RHM 20120925 Overlay the bottom of the dialog so that cancel button is covered.
|
||||
ProfileTimer.Pop(profileDepth2);
|
||||
frmPDFStatusForm frmStatus = new frmPDFStatusForm(MyProcedure, RevNumAndDate, pw.ToString(), cbxDebug.Checked, cbxOrPgBrk.Checked, cbxOpenAfterCreate2.Checked, cbxOverwritePDF2.Checked, PDFPath, cbd, txbPDFName.Text, new Point(Left, Bottom - 50), cbxBlankPgsForDuplex.Checked);
|
||||
frmStatus.MakePlaceKeeper = cbxGeneratePlacekeeper.Checked;
|
||||
int profileDepth3 = ProfileTimer.Push(">>>> frmStatus");
|
||||
frmStatus.ShowDialog();
|
||||
ProfileTimer.Pop(profileDepth3);
|
||||
MyProcedure.MyDocVersion.DocVersionConfig.SelectedSlave = 0;
|
||||
this.Close();
|
||||
ShowDebugFiles();
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
ProfileTimer.ShowTimerTable();
|
||||
if (VlnSettings.GetCommandFlag("DBTrack"))
|
||||
{
|
||||
VEPROMS.CSLA.Library.Database.TrackDBUsage = false;
|
||||
VEPROMS.CSLA.Library.Database.ShowDBTracking("DBTracking.txt");
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if any dialog selections for change bars have overridden the data
|
||||
@ -723,11 +750,13 @@ namespace VEPROMS
|
||||
Rtf2iTextSharp.DoingComparison = cbxDebug.Checked;
|
||||
if (_AllProcedures)
|
||||
{
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
DateTime dtStart = DateTime.Now;
|
||||
_MultiunitPdfLocation = cbxMultiunitPdfLocation.SelectedItem.ToString();
|
||||
PromsPrinter.ClearTransPageNumProblems();
|
||||
CreatePDFs();
|
||||
PromsPrinter.ReportTransPageNumProblems();
|
||||
this.Cursor = Cursors.Default;
|
||||
if (VlnSettings.DebugMode)
|
||||
{
|
||||
MessageBox.Show(string.Format("{0} Minutes to Print All Procedures"
|
||||
@ -741,7 +770,11 @@ namespace VEPROMS
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
CreatePDF();
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
}
|
||||
private bool _Initializing = false;
|
||||
private void tbSettings_Click(object sender, EventArgs e)
|
||||
|
@ -123,7 +123,9 @@ namespace VEPROMS
|
||||
if (!CancelStop) PromsPrinter.ClearTransPageNumProblems();
|
||||
do
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> MyPromsPrinter.Print");
|
||||
_PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
while (_PdfFile == null && MessageBox.Show("Try Again?", "PDF Creation Failed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes);
|
||||
if (_PdfFile == null)
|
||||
|
@ -15,6 +15,7 @@ using Csla;
|
||||
using Csla.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
//using VEPROMS.Properties;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
@ -164,6 +165,27 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
public partial class DocVersionInfo : IVEDrillDownReadOnly
|
||||
{
|
||||
public TimeSpan tsTimeOut = TimeSpan.FromSeconds(6);
|
||||
public bool pathExists(string path)
|
||||
{
|
||||
bool exists = true;
|
||||
Thread t = new Thread(
|
||||
new ThreadStart(delegate()
|
||||
{
|
||||
exists = System.IO.File.Exists(path);
|
||||
})
|
||||
);
|
||||
t.Start();
|
||||
bool completed = t.Join(tsTimeOut); //wait 6 seconds then 3 then 1.5 then .75 seconds
|
||||
if (!completed)
|
||||
{
|
||||
exists = false;
|
||||
t.Abort();
|
||||
if (tsTimeOut > TimeSpan.FromSeconds(1))
|
||||
tsTimeOut = TimeSpan.FromTicks( tsTimeOut.Ticks / 2);
|
||||
}
|
||||
return exists;
|
||||
}
|
||||
public bool NewerRoFst
|
||||
{
|
||||
get
|
||||
@ -172,7 +194,12 @@ namespace VEPROMS.CSLA.Library
|
||||
ROFstInfo roFstInfo = ROFstInfo.GetJustROFst(DocVersionAssociations[0].ROFstID);
|
||||
RODbInfo rdi = RODbInfo.GetJustRODB(roFstInfo.RODbID);
|
||||
string rofstPath = rdi.FolderPath + @"\ro.fst";
|
||||
if (!File.Exists(rofstPath)) return false;
|
||||
//if (!File.Exists(rofstPath)) return false;
|
||||
if (!pathExists(rofstPath))
|
||||
{
|
||||
_MyLog.WarnFormat("RO Path '{0}' could not be found", rofstPath);
|
||||
return false;
|
||||
}
|
||||
FileInfo fiRofst = new FileInfo(rofstPath);
|
||||
|
||||
// if the database Ro.Fst is newer or if the files have identical DTS,
|
||||
|
@ -10,6 +10,7 @@ using System.Data.SqlClient;
|
||||
using System.Xml;
|
||||
using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
using Volian.Base.Library;
|
||||
|
||||
namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
@ -324,6 +325,12 @@ namespace VEPROMS.CSLA.Library
|
||||
#region ItemInfo
|
||||
public partial class ItemInfo : IVEDrillDownReadOnly
|
||||
{
|
||||
private bool _PrintAllAtOnce = false;
|
||||
public bool PrintAllAtOnce
|
||||
{
|
||||
get { return _PrintAllAtOnce; }
|
||||
set { _PrintAllAtOnce = value; }
|
||||
}
|
||||
public SectionInfo GetSectionInfo()
|
||||
{
|
||||
if (this is SectionInfo) return this as SectionInfo;
|
||||
@ -439,6 +446,50 @@ namespace VEPROMS.CSLA.Library
|
||||
// return ii._ItemID == _ItemID;
|
||||
// return false;
|
||||
//}
|
||||
internal static void SetFromType(ItemInfo myItemInfo)
|
||||
{
|
||||
myItemInfo.PrintAllAtOnce = true;
|
||||
if (myItemInfo.MyContent.ContentPartCount > 0)
|
||||
{
|
||||
foreach (PartInfo pi in myItemInfo.MyContent.ContentParts)
|
||||
{
|
||||
ItemInfo il = null;
|
||||
switch ((E_FromType)pi.FromType)
|
||||
{
|
||||
case E_FromType.Procedure:
|
||||
myItemInfo._Procedures = pi.MyItems;
|
||||
break;
|
||||
case E_FromType.Section:
|
||||
myItemInfo._Sections = pi.MyItems;
|
||||
break;
|
||||
case E_FromType.Step:
|
||||
myItemInfo._Steps = pi.MyItems;
|
||||
break;
|
||||
case E_FromType.Caution:
|
||||
myItemInfo._Cautions = pi.MyItems;
|
||||
break;
|
||||
case E_FromType.Note:
|
||||
myItemInfo._Notes = pi.MyItems;
|
||||
break;
|
||||
case E_FromType.RNO:
|
||||
myItemInfo._RNOs = pi.MyItems;
|
||||
break;
|
||||
case E_FromType.Table:
|
||||
myItemInfo._Tables = pi.MyItems;
|
||||
break;
|
||||
}
|
||||
foreach (ItemInfo ii in pi.MyItems)
|
||||
{
|
||||
if (ii.ItemID == 95759)
|
||||
Console.WriteLine("\"SetFromType\",{0},{1},\"{2}\",{3}", ii.ItemID, ii.MyContent.Type, ii.DisplayNumber, ii.MyItemInfoUnique);
|
||||
ii.FromType = (E_FromType)pi.FromType;
|
||||
SetFromType(ii);
|
||||
ii.MyPrevious = il;
|
||||
il = ii;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
internal static void SetParentSectionAndDocVersion(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo)
|
||||
{
|
||||
if (itemInfo == null) return;
|
||||
@ -448,15 +499,22 @@ namespace VEPROMS.CSLA.Library
|
||||
// Fix for Active Section when printing. BGE_OI4 OI27D-2
|
||||
//itemInfo.ActiveSection = (itemInfo as SectionInfo) ?? sectionInfo;// - possible fix for not accessing correct format
|
||||
itemInfo.ActiveSection = sectionInfo;
|
||||
itemInfo.ActiveFormat = sectionInfo == null ? itemParent.ActiveFormat : sectionInfo.ActiveFormat;
|
||||
itemInfo.MyProcedure = procInfo;
|
||||
itemInfo.MyDocVersion = docVersionInfo;
|
||||
if (itemInfo.IsStep)
|
||||
{
|
||||
ItemInfo ip = itemParent as ItemInfo;
|
||||
int profileDepth = ProfileTimer.Push(">>>> itemInfo.CombinedTab");
|
||||
itemInfo.CombinedTab = (ip == null) ? itemInfo.MyTab.CleanText.Trim() : GetCombinedTab(itemInfo, ip.CombinedTab);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
if (itemInfo.MyContent.ContentGridCount > 0)
|
||||
{
|
||||
int profileDepth1 = ProfileTimer.Push(">>>> itemInfo.MyContent.LoadNonCachedGrid");
|
||||
itemInfo.MyContent.LoadNonCachedGrid();
|
||||
ProfileTimer.Pop(profileDepth1);
|
||||
}
|
||||
if (itemInfo.MyContent.ContentPartCount > 0)
|
||||
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
|
||||
{
|
||||
@ -530,14 +588,15 @@ namespace VEPROMS.CSLA.Library
|
||||
internal static string GetCombinedTab(ItemInfo itemInfo, string parTab)
|
||||
{
|
||||
string pTab = parTab == null ? "" : parTab;
|
||||
int profileDepth = ProfileTimer.Push( ">>>> itemInfo.MyTab.CleanText.Trim");
|
||||
string thisTab = itemInfo.MyTab.CleanText.Trim();
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
if (thisTab != null && thisTab != "" && !char.IsLetterOrDigit(thisTab[0])) return pTab;
|
||||
if (itemInfo.FormatStepData.NumberWithLevel) pTab = itemInfo.MyHLS.MyTab.CleanText.Trim();
|
||||
// if the parent tab ends with a alphanumeric and this tab is alphanumeric, add a '.' to separate them
|
||||
bool ms = pTab != "" && char.IsLetterOrDigit(pTab.TrimEnd()[pTab.Length - 1]); // parent tab ends with alphanumeric
|
||||
bool mn = thisTab.TrimStart().Length > 0 && char.IsLetterOrDigit(thisTab.TrimStart()[0]);// this starts with alpha
|
||||
if (ms && mn) pTab = pTab.TrimEnd() + ".";
|
||||
|
||||
// remove ending '.' (if this is a hls, don't remove the '.')
|
||||
if (!itemInfo.IsHigh && thisTab.EndsWith(".")) thisTab = thisTab.Substring(0, thisTab.Length - 1);
|
||||
return pTab + thisTab.Trim();
|
||||
@ -550,6 +609,7 @@ namespace VEPROMS.CSLA.Library
|
||||
itemInfo.MyParent = itemParent as ItemInfo;
|
||||
// itemInfo.ActiveSection = (itemInfo as SectionInfo) ?? sectionInfo;
|
||||
itemInfo.ActiveSection = sectionInfo;
|
||||
itemInfo.ActiveFormat = sectionInfo == null ? itemParent.ActiveFormat : sectionInfo.ActiveFormat;
|
||||
itemInfo.MyDocVersion = docVersionInfo;
|
||||
if (itemInfo.IsStep)
|
||||
{
|
||||
@ -1137,10 +1197,23 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
#endregion
|
||||
#region IsType
|
||||
private E_FromType? _FromType = null;
|
||||
public E_FromType? FromType
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ItemID == 95759 && _FromType == null)
|
||||
Console.WriteLine("\"Null FromType\",{0},{1},\"{2}\",{3}", ItemID, MyContent.Type,DisplayNumber,MyItemInfoUnique);
|
||||
return _FromType;
|
||||
}
|
||||
set { _FromType = value; }
|
||||
}
|
||||
public bool IsFirstCautionPart
|
||||
{
|
||||
get
|
||||
{
|
||||
if (FromType != null)
|
||||
return (MyPrevious == null && FromType == E_FromType.Caution);
|
||||
return ((ItemPartCount > 0) && (ItemParts[0].PartType == E_FromType.Caution));
|
||||
}
|
||||
}
|
||||
@ -1148,6 +1221,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (FromType != null)
|
||||
return (MyPrevious == null && FromType == E_FromType.Note);
|
||||
return ((ItemPartCount > 0) && (ItemParts[0].PartType == E_FromType.Note));
|
||||
}
|
||||
}
|
||||
@ -1156,6 +1231,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (FromType != null)
|
||||
return (FromType == E_FromType.Caution);
|
||||
return ((FirstSibling.ItemPartCount > 0) && (FirstSibling.ItemParts[0].PartType == E_FromType.Caution));
|
||||
}
|
||||
}
|
||||
@ -1163,6 +1240,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (FromType != null)
|
||||
return (FromType == E_FromType.Note);
|
||||
return ((FirstSibling.ItemPartCount > 0) && (FirstSibling.ItemParts[0].PartType == E_FromType.Note));
|
||||
}
|
||||
}
|
||||
@ -1322,20 +1401,29 @@ namespace VEPROMS.CSLA.Library
|
||||
return IsType("ContAcSequential");
|
||||
}
|
||||
}
|
||||
private bool? _IsHigh = null;
|
||||
public bool IsHigh
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_IsHigh != null) return (bool)_IsHigh;
|
||||
int profileDepth = ProfileTimer.Push(">>>> BeginIsHigh");
|
||||
|
||||
// check to see if ActiveParent is a section, if so it is a high level step
|
||||
if (MyContent.Type / 10000 != 2) return false;
|
||||
ItemInfo parent = ActiveParent as ItemInfo;
|
||||
if (parent == null) return false;
|
||||
// IsHigh was returning true if this item is a caution or note off of a section..
|
||||
// from the (parent.MyContent.Type / 1000) == 1.
|
||||
if (IsCaution || IsNote) return false;
|
||||
if ((parent.MyContent.Type / 10000) == 1)
|
||||
return true;
|
||||
return false;
|
||||
if (MyContent.Type / 10000 != 2) _IsHigh = false;
|
||||
else
|
||||
{
|
||||
ItemInfo parent = ActiveParent as ItemInfo;
|
||||
if (parent == null) _IsHigh = false;
|
||||
// IsHigh was returning true if this item is a caution or note off of a section..
|
||||
// from the (parent.MyContent.Type / 1000) == 1.
|
||||
else if ((parent.MyContent.Type / 10000) != 1)
|
||||
_IsHigh = false;
|
||||
else if (IsCaution || IsNote) _IsHigh = false;
|
||||
else _IsHigh = true;
|
||||
}
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return (bool)_IsHigh;
|
||||
}
|
||||
}
|
||||
public bool IsSequential
|
||||
@ -1365,6 +1453,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (FromType != null)
|
||||
return (FromType == E_FromType.Table);
|
||||
return ((ItemPartCount > 0) && (ItemParts[0].PartType == E_FromType.Table));
|
||||
}
|
||||
}
|
||||
@ -1372,7 +1462,10 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
return ((ItemPartCount > 0) && (ItemParts[0].PartType == E_FromType.RNO));
|
||||
if (FromType != null)
|
||||
return (FromType == E_FromType.RNO);
|
||||
bool retval = ((ItemPartCount > 0) && (ItemParts[0].PartType == E_FromType.RNO));
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
public bool IsInRNO
|
||||
@ -1541,6 +1634,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (FromType != null)
|
||||
return (FromType == E_FromType.Procedure);
|
||||
return ((FirstSibling.ItemPartCount > 0) && (FirstSibling.ItemParts[0].PartType == E_FromType.Procedure));
|
||||
}
|
||||
}
|
||||
@ -1548,6 +1643,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (FromType != null)
|
||||
return (FromType == E_FromType.Section);
|
||||
return ((FirstSibling.ItemPartCount > 0) && (FirstSibling.ItemParts[0].PartType == E_FromType.Section));
|
||||
}
|
||||
}
|
||||
@ -1555,6 +1652,8 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (FromType != null)
|
||||
return (FromType == E_FromType.Step);
|
||||
return ((FirstSibling.ItemPartCount > 0) && (FirstSibling.ItemParts[0].PartType == E_FromType.Step));
|
||||
}
|
||||
}
|
||||
@ -2224,6 +2323,7 @@ namespace VEPROMS.CSLA.Library
|
||||
//if (ItemDocVersionCount > 0) return ItemDocVersions[0]; Need to create one interface to support Folders, DocVersions and Items
|
||||
ContentInfo parentContent = ParentContent;
|
||||
if (parentContent == null || parentContent.ContentItemCount == 0) return null;
|
||||
if (parentContent.ContentItems.Count == 0) return null;
|
||||
_MyParent = parentContent.ContentItems[0];
|
||||
}
|
||||
return _MyParent;
|
||||
@ -2643,11 +2743,15 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
//if (_ActiveFormat == null) // jsj added check for NULL ActiveParent
|
||||
if (_ActiveFormat == null || !PrintAllAtOnce) // jsj added check for NULL ActiveParent
|
||||
_ActiveFormat = (LocalFormat != null ? LocalFormat : (ActiveParent != null) ? ActiveParent.ActiveFormat : null);
|
||||
//Console.WriteLine("Active {0}", (_ActiveFormat == null) ? "_ActiveFormat is null" : _ActiveFormat.Name);
|
||||
return _ActiveFormat;
|
||||
}
|
||||
set
|
||||
{
|
||||
_ActiveFormat = value;
|
||||
}
|
||||
//get { return LocalFormat != null ? LocalFormat : ActiveParent.ActiveFormat; }
|
||||
}
|
||||
public FormatInfo LocalFormat
|
||||
@ -3236,6 +3340,7 @@ namespace VEPROMS.CSLA.Library
|
||||
|
||||
public int GetStepLevel() // ref int bias)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> GetStepLevel");
|
||||
int level = 0;
|
||||
ItemInfo par = this;
|
||||
ItemInfo LastRNO = null;
|
||||
@ -3297,6 +3402,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (MyDocStyle != null && (MyDocStyle.StructureStyle.Style & E_DocStructStyle.DSS_SkipTwoStepLevels) == E_DocStructStyle.DSS_SkipTwoStepLevels && level == 0)
|
||||
level += 2;
|
||||
if (level < 0) level = 0;
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
return level;
|
||||
}
|
||||
public int CurrentSectionLevel()
|
||||
@ -3402,15 +3508,16 @@ namespace VEPROMS.CSLA.Library
|
||||
// for calvert alarms, need to check if next item is a different type, if a different type.
|
||||
// If it is the same type, clear the header so that the header text isn't printed two times.
|
||||
bool specialCalvertAlarm = false;
|
||||
ItemInfo nextItem = NextItem;
|
||||
if (ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm)
|
||||
{
|
||||
if (GetNextItem() != null && MyContent.Type != GetNextItem().MyContent.Type) specialCalvertAlarm = true;
|
||||
if (nextItem != null && MyContent.Type != nextItem.MyContent.Type) specialCalvertAlarm = true;
|
||||
}
|
||||
if (NextItem != null && !specialCalvertAlarm)
|
||||
if (nextItem != null && !specialCalvertAlarm)
|
||||
{
|
||||
nextStepData = NextItem.FormatStepData;
|
||||
nextStepData = nextItem.FormatStepData;
|
||||
// tried to duplicate functionality from 16-bit code.
|
||||
nextTbFormat = NextItem.IsInRNO ? nextStepData.TabData.RNOIdentPrint : nextStepData.TabData.IdentPrint;
|
||||
nextTbFormat = nextItem.IsInRNO ? nextStepData.TabData.RNOIdentPrint : nextStepData.TabData.IdentPrint;
|
||||
nextTbFormat = ReplaceStepToken(nextTbFormat);
|
||||
}
|
||||
// Handle the centered tab - if this tab is centered make it a header.
|
||||
@ -3423,7 +3530,7 @@ namespace VEPROMS.CSLA.Library
|
||||
// use of the MixCautionsAndNotes format flag - no bullet is used, if more that one replace the tab
|
||||
// with a bullet. Also, if only one in group and tab text ends with 'S', remove it:
|
||||
bool mixCandN = MixCautionNotesDiffType();
|
||||
if ((MyPrevious == null && (NextItem == null||specialCalvertAlarm)) || mixCandN || FormatStepData.SeparateBox)
|
||||
if ((MyPrevious == null && (nextItem == null||specialCalvertAlarm)) || mixCandN || FormatStepData.SeparateBox)
|
||||
{
|
||||
if (_MyHeader.CleanText.ToUpper().EndsWith("S"))
|
||||
{
|
||||
@ -3452,7 +3559,7 @@ namespace VEPROMS.CSLA.Library
|
||||
else
|
||||
_MyHeader = null;
|
||||
}
|
||||
else if (this.NextItem == null)
|
||||
else if (nextItem == null)
|
||||
tbformat = "";
|
||||
}
|
||||
if (!this.FormatStepData.SeparateBox)
|
||||
@ -3483,10 +3590,10 @@ namespace VEPROMS.CSLA.Library
|
||||
else if (FormatStepData.TabData.IsTransition)
|
||||
return tbformat;
|
||||
// else if this has a next
|
||||
else if (tbformat != null && NextItem != null && !FormatStepData.AlwaysTab &&
|
||||
else if (tbformat != null && nextItem != null && !FormatStepData.AlwaysTab &&
|
||||
(!FormatStepData.MixCautionsAndNotes ||
|
||||
(FormatStepData.TabData.UsePreviousStyle && !nextStepData.TabData.UsePreviousStyle && tbformat == nextTbFormat) ||
|
||||
((prevTbFormat != tbformat && (NextItem.MyContent.Type == (int)(MyContent.Type % 10000))))))
|
||||
((prevTbFormat != tbformat && (nextItem.MyContent.Type == (int)(MyContent.Type % 10000))))))
|
||||
{
|
||||
tbformat = tbformat + ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
|
||||
//string bstr = ActiveFormat.PlantFormat.FormatData.SectData.StepSectionData.IdentB;
|
||||
@ -3525,12 +3632,12 @@ namespace VEPROMS.CSLA.Library
|
||||
if (ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvertAlarm || ActiveFormat.PlantFormat.FormatData.PrintData.SpecialCaseCalvert)
|
||||
{
|
||||
if (MyPrevious != null && MyContent.Type != MyPrevious.MyContent.Type) return false;
|
||||
if (GetNextItem() != null && MyContent.Type != GetNextItem().MyContent.Type) return false;
|
||||
if (NextItem != null && MyContent.Type != NextItem.MyContent.Type) return false;
|
||||
}
|
||||
|
||||
if (!FormatStepData.MixCautionsAndNotes) return false;
|
||||
if (IsNote && ((GetNextItem() != null && GetNextItem().IsCaution) || (MyPrevious != null && MyPrevious.IsCaution))) return true;
|
||||
if (IsCaution && ((GetNextItem() != null && GetNextItem().IsNote) || (MyPrevious != null && MyPrevious.IsNote))) return true;
|
||||
if (IsNote && ((NextItem != null && NextItem.IsCaution) || (MyPrevious != null && MyPrevious.IsCaution))) return true;
|
||||
if (IsCaution && ((NextItem != null && NextItem.IsNote) || (MyPrevious != null && MyPrevious.IsNote))) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5143,6 +5250,8 @@ namespace VEPROMS.CSLA.Library
|
||||
tranLookup.NewLookupNeeded += new TransitionLookupEvent(GetNewLookup);
|
||||
//ItemInfo.ResetTicks();
|
||||
//DateTime dt = DateTime.Now;
|
||||
tmp.FromType = E_FromType.Procedure;
|
||||
SetFromType(tmp);
|
||||
SetParentSectionAndDocVersion(tmp, tmp.MyDocVersion, null, tmp.MyDocVersion, tranLookup);
|
||||
//TimeSpan ts = DateTime.Now.Subtract(dt);
|
||||
//ticksItems = ts.Ticks - (ticksROUsage + ticksTrans);
|
||||
@ -5155,7 +5264,6 @@ namespace VEPROMS.CSLA.Library
|
||||
throw new DbCslaException("Error on ItemInfoList.GetChildren", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static ProcedureInfo GetNewLookup(object sender, TransitionLookupEventArgs args)
|
||||
{
|
||||
ProcedureInfo tmp = DataPortal.Fetch<ProcedureInfo>(new ItemAndChildrenByUnitCriteria(args.ProcID, 0, args.UnitID));
|
||||
@ -5171,6 +5279,8 @@ namespace VEPROMS.CSLA.Library
|
||||
//{
|
||||
tmp.MyDocVersion.DocVersionConfig.SelectedSlave = args.UnitID;
|
||||
(tmp.MyConfig as ProcedureConfig).SelectedSlave = args.UnitID;
|
||||
tmp.FromType = E_FromType.Procedure;
|
||||
SetFromType(tmp);
|
||||
ItemInfo.SetParentSectionAndDocVersion(tmp, tmp.MyDocVersion, null, tmp, tmp.MyDocVersion);
|
||||
//}
|
||||
}
|
||||
@ -5313,7 +5423,13 @@ namespace VEPROMS.CSLA.Library
|
||||
//AddToCache(tmp);
|
||||
if (tmp.ErrorMessage == "No Record Found") tmp = null;
|
||||
if (tmp != null)
|
||||
{
|
||||
int profileDepth = ProfileTimer.Push(">>>> SetParentSectionAndDocVersion");
|
||||
tmp.FromType = E_FromType.Procedure;
|
||||
SetFromType(tmp);
|
||||
SetParentSectionAndDocVersion(tmp, tmp.MyDocVersion, null, tmp, tmp.MyDocVersion);
|
||||
ProfileTimer.Pop(profileDepth);
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -991,6 +991,7 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (PrintAllAtOnce) return GetNextItem();
|
||||
if (NextItemCount > 0 && NextItems != null && NextItems.Count > 0)
|
||||
return NextItems[0];
|
||||
return null;
|
||||
|
@ -1030,12 +1030,12 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return next.NextItem;
|
||||
}
|
||||
while (next.GetNextItem() == null)
|
||||
while (next.NextItem == null)
|
||||
{
|
||||
next = next.ActiveParent as ItemInfo;
|
||||
if(next == null) throw(new Exception("Cannot find Next Item"));
|
||||
}
|
||||
return next.GetNextItem();
|
||||
return next.NextItem;
|
||||
}
|
||||
private static bool AddOptionalTranGetSectionHdr(TransitionBuilder tb)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user