B2022-026 RO Memory reduction coding

This commit is contained in:
2022-05-26 19:55:07 +00:00
parent 61febac1a0
commit 27993553cb
21 changed files with 6827 additions and 5160 deletions
File diff suppressed because it is too large Load Diff
@@ -31,6 +31,7 @@ namespace VEPROMS
setupProgessSteps1(); // C2017-030 - new Admin Tools user interface
UserInfo ui = UserInfo.GetByUserID(MySessionInfo.UserID);
IsAdministratorUser = ui.IsAdministrator();
if (!IsAdministratorUser)
{
//C2020-035 if not full Admin disable repair tools
@@ -176,6 +177,15 @@ namespace VEPROMS
tnc = tmp;
}
}
else
{
if (tnc != null && tnc.Text != "VEPROMS") // B2020-114 - mad if statement removed: && !IsUsedPath(tnc.FullPath))
{
TreeNode tmp = tnc.Parent;
tnc.Remove();
tnc = tmp;
}
}
}
return rtnval;
}
@@ -253,7 +263,7 @@ namespace VEPROMS
if (dvil.Count > 0)
{
StringBuilder sb = new StringBuilder();
sb.AppendLine("The batch update process was not usccessful for all working drafts selected.");
sb.AppendLine("The batch update process was not successful for all working drafts selected.");
sb.AppendLine("The following working drafts were not able to be refreshed...");
sb.AppendLine();
sb.AppendLine(sbDocVersions.ToString());
@@ -536,8 +546,7 @@ namespace VEPROMS
this.Cursor = Cursors.Default;
}
// C2017-030 - new Admin Tools user interface
// is one of two tools run from Remove Obsolete RO Data
// C2017-030 - new Admin Tools user interface is one of two tools run from Remove Obsolete RO Data
private void RemoveUnusedRoFstsAndFigures()
{
this.Cursor = Cursors.WaitCursor;
@@ -621,6 +630,21 @@ namespace VEPROMS
DateTime pEnd = DateTime.Now;
txtProcess.AppendText(string.Format("Completed: {0}",pEnd.ToString("MM/dd/yyyy @ HH:mm")));
txtProcess.AppendText(Environment.NewLine);
if (rowCount > 0)
{
txtResults.AppendText(string.Format("The database contains {0} unused RO Associations.", rowCount));
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
}
else
{
txtResults.AppendText("No unused RO Associations Found");// B2017-108 Always output results even if there isn't any
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
}
DateTime pEnd = DateTime.Now;
txtProcess.AppendText(string.Format("Completed: {0}",pEnd.ToString("MM/dd/yyyy @ HH:mm")));
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
this.Cursor = Cursors.Default;
@@ -744,6 +768,7 @@ namespace VEPROMS
txtResults.AppendText(statmsg);
txtResults.AppendText(Environment.NewLine);
Application.DoEvents();
if (dq.DocVersionAssociationCount < 1)
{
ProgressBar.ColorTable = eProgressBarItemColor.Error;
@@ -758,8 +783,11 @@ namespace VEPROMS
txtResults.AppendText(Environment.NewLine);
return;
}
ROFstInfo roFstInfo = dq.DocVersionAssociations[0].MyROFst;
string rofstPath = roFstInfo.MyRODb.FolderPath + @"\ro.fst";
//if (!pathExists(rofstPath))
if (!File.Exists(rofstPath))
{
ProgressBar.ColorTable = eProgressBarItemColor.Error;
@@ -774,14 +802,24 @@ namespace VEPROMS
txtResults.AppendText(Environment.NewLine);
return;
}
FileInfo fiRofst = new FileInfo(rofstPath);
//FileInfo fiRofst = new FileInfo(rofstPath);
Cursor = Cursors.WaitCursor;
using (DocVersion dv = DocVersion.Get(dq.VersionID))
{
// B2022-026 RO Memory Reduction code - first load the new ro.fst so that we can assign the ROTableUpdate event to the correct roFstInfo
if (dv.ROfstLoadingFigures || dv.NewerRoFst) // B2017-125 see if loading figures was completed
{
// only load the RO.fst
ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh);
roFstInfo = dq.DocVersionAssociations[0].MyROFst;
}
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ROFst newrofst = ROFstInfo.RefreshROFst(roFstInfo.MyRODb, dv.DocVersionAssociations[0], dv, roFstInfo, DoProgressBarRefresh, txtProcess);
ROFst newrofst = ROFstInfo.RefreshROFst(dv, roFstInfo, DoProgressBarRefresh, txtProcess);
roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
}
Cursor = Cursors.Default;
ProgressBar.ColorTable = eProgressBarItemColor.Normal;
FinalProgressBarMessage = "ROs values updated";
@@ -790,6 +828,7 @@ namespace VEPROMS
txtResults.AppendText("ROs values updated");
txtResults.AppendText(Environment.NewLine);
txtResults.AppendText(Environment.NewLine);
return;
}
@@ -890,6 +929,7 @@ namespace VEPROMS
sfd.FileName = string.Format("BatchRefreshResults_{0}", DateTime.Now.ToString("yyyyMMdd_HHmm"));
sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\VEPROMS";
DialogResult dr = sfd.ShowDialog();
if (dr == DialogResult.OK)
{
System.IO.StreamWriter sw = new System.IO.StreamWriter(sfd.FileName);
@@ -901,8 +941,13 @@ namespace VEPROMS
private void myTV_AfterCheck(object sender, TreeViewEventArgs e)
{
if (e.Action != TreeViewAction.Unknown)
if(e.Node.Nodes.Count > 0)
{
if (e.Node.Nodes.Count > 0)
{
CheckChildNodes(e.Node, e.Node.Checked);
}
}
btnFixLinks.Enabled = AtLeastOneNodeChecked(); // C2017-030 support for Refresh Transitions/Update RO Values
}
@@ -911,12 +956,16 @@ namespace VEPROMS
foreach (TreeNode tn in treeNode.Nodes)
{
tn.Checked = ischecked;
if (tn.Nodes.Count > 0)
{
CheckChildNodes(tn, ischecked);
}
}
}
private ProgressBarItem _ProgressBar = null;
public ProgressBarItem ProgressBar
{
get { return _ProgressBar; }
@@ -930,9 +979,11 @@ namespace VEPROMS
private void DoProgressBarRefresh(int value, int max, string text)
{
if (ProgressBar == null) return;
ProgressBar.Maximum = max;
ProgressBar.Value = value;
ProgressBar.Text = text;
Application.DoEvents();
}
@@ -941,12 +992,14 @@ namespace VEPROMS
set
{
if (ProgressBar == null) return;
ProgressBar.Maximum = 100;
ProgressBar.Value = 0;
ProgressBar.Text = value;
txtProcess.AppendText(value);
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
}
}
@@ -956,12 +1009,14 @@ namespace VEPROMS
set
{
if (ProgressBar == null) return;
ProgressBar.Value = 100;
ProgressBar.Maximum = 100;
ProgressBar.Text = value;
txtProcess.AppendText(value);
txtProcess.AppendText(Environment.NewLine);
txtProcess.AppendText(Environment.NewLine);
Application.DoEvents();
}
}
@@ -985,8 +1040,11 @@ namespace VEPROMS
AdminToolType = E_AdminToolType.Repair;
lblAdmToolProgressType.Text = "Repairing:";
setupProgessSteps1();
if (!IsAdministratorUser) // C2020-035 notify Set Amin user that only Full Admins can run repair tools
MessageBox.Show("Only Full PROMS Administrator Users can run these data repair tools","Data Repair Tools",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
{
MessageBox.Show("Only Full PROMS Administrator Users can run these data repair tools", "Data Repair Tools", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
// C2017-030 new Admin Tools user interface
@@ -994,6 +1052,7 @@ namespace VEPROMS
{
AdminToolType = E_AdminToolType.Links;
setupProgessSteps1();
if (swUpdateROVals.Value)
ResetTV(true);
else
@@ -1014,6 +1073,7 @@ namespace VEPROMS
}
#region On/Off Swiches
// C2017-030 new Admin Tools user interface
private enum E_AdminToolType : int
{
@@ -1035,6 +1095,7 @@ namespace VEPROMS
{
progressSteps1.Visible = false;
progressSteps1.Items.Clear();
switch (AdminToolType)
{
case E_AdminToolType.Check:
@@ -1048,6 +1109,7 @@ namespace VEPROMS
progressSteps1.Visible = true;
progressSteps1.Refresh();
break;
case E_AdminToolType.Repair:
if (swRmOrphanDataRecs.Value)
progressSteps1.Items.Add(siOrphDatRecs);
@@ -1061,6 +1123,7 @@ namespace VEPROMS
progressSteps1.Visible = true;
progressSteps1.Refresh();
break;
case E_AdminToolType.Links:
case E_AdminToolType.Users:
splitContainer3.Panel2Collapsed = true;
@@ -1068,6 +1131,7 @@ namespace VEPROMS
break;
}
}
// used for all of the Switch buttons (ON/OFF buttons)
private void swCk_ValueChanged(object sender, EventArgs e)
{
@@ -1091,6 +1155,7 @@ namespace VEPROMS
ResetTV(false);
}
}
#endregion
// C2017-030 New Admin Tools user interface
@@ -1100,15 +1165,17 @@ namespace VEPROMS
((DevComponents.DotNetBar.StepItem)progressSteps1.Items[prgStpIdx]).Value = val;
return;
}
private void ClearStepProgress()
{
for (int i = 0; i < progressSteps1.Items.Count; i++)
{
((DevComponents.DotNetBar.StepItem)progressSteps1.Items[i]).Value = 0;
}
}
// C2017-030 New Admin Tools user interface
// button clicks for processing selected tools
//B2017-221 Allow the batch dialog to close when waiting to process.
private bool CheckProcessLater() // see if we should delay processing until later
{
@@ -1116,6 +1183,7 @@ namespace VEPROMS
{
long later = long.Parse(dtpDate.Value.ToString("yyyyMMdd") + dtpTime.Value.ToString("HHmm"));
long now = long.Parse(DateTime.Now.ToString("yyyyMMddHHmm"));
while (now < later)
{
txtProcess.Clear();
@@ -1126,6 +1194,7 @@ namespace VEPROMS
now = long.Parse(DateTime.Now.ToString("yyyyMMddHHmm"));
}
}
return true;// Close after complete
}
@@ -1133,18 +1202,23 @@ namespace VEPROMS
private void btn_ShowUsers_Click(object sender, EventArgs e)
{
if (!CheckProcessLater()) return; // delay processing if set//B2017-221 Allow the batch dialog to close when waiting to process.
txtProcess.Clear();
txtResults.Clear();
GetDatabaseSessions();
}
private void btnFixLinks_Click(object sender, EventArgs e)
{
if (!CheckProcessLater()) return; // delay processing if set//B2017-221 Allow the batch dialog to close when waiting to process.
txtProcess.Clear();
txtResults.Clear();
if (swRefreshTrans.Value)
RefreshTransitions();
if (swUpdateROVals.Value)
UpdateROValues();
}
@@ -1152,21 +1226,25 @@ namespace VEPROMS
private void btnRunCheck_Click(object sender, EventArgs e)
{
if (!CheckProcessLater()) return; // delay processing if set//B2017-221 Allow the batch dialog to close when waiting to process.
int prgStpIdx = -1;
txtResults.Clear();
txtProcess.Clear();
if (swCkOrphanDataRecs.Value)
{
StepProgress(++prgStpIdx, 50);
IdentifyDisconnectedItems(); // orphan items
StepProgress(prgStpIdx, 100);
}
if (swHiddenDataLocs.Value)
{
StepProgress(++prgStpIdx, 50);
IdentifyNonEditableItems(); // hidden items
StepProgress(prgStpIdx, 100);
}
if (swCkObsoleteROData.Value)
{
StepProgress(++prgStpIdx, 25);
@@ -1175,22 +1253,27 @@ namespace VEPROMS
IdentifyUnusedRoFstsAndFigures();
StepProgress(prgStpIdx, 100);
}
MessageBox.Show("Check Functions Completed", "Check");
ClearStepProgress();
}
private void btnRunRepair_Click(object sender, EventArgs e)
{
if (!CheckProcessLater()) return; // delay processing if set//B2017-221 Allow the batch dialog to close when waiting to process.
int prgStpIdx = -1;
txtResults.Clear();
txtProcess.Clear();
if (swRmOrphanDataRecs.Value)
{
StepProgress(++prgStpIdx, 50);
PurgeDisconnectedItems(); // Orphan Items
StepProgress(prgStpIdx, 100);
}
if (swRmObsoleteROData.Value)
{
StepProgress(++prgStpIdx, 25);
@@ -1199,12 +1282,14 @@ namespace VEPROMS
RemoveUnusedRoFstsAndFigures();
StepProgress(prgStpIdx, 100);
}
if (swStandardHypenChars.Value)
{
StepProgress(++prgStpIdx, 50);
FixHyphens();
StepProgress(prgStpIdx, 100);
}
if (swRefreshWordAttmts.Value)
{
StepProgress(++prgStpIdx, 50);
@@ -1213,6 +1298,7 @@ namespace VEPROMS
}
MessageBox.Show("Repair Functions Completed", "Repair");
ClearStepProgress();
}
@@ -86,28 +86,37 @@ namespace VEPROMS
{
// B2021-088 moved this if/else from CreatePDF() so that the Approval logic will have access to this logic
ProcedureInfo MyProcedure = myItem as ProcedureInfo;
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);
else
MyProcedure = ProcedureInfo.GetItemAndChildren(MyProcedure.ItemID);
// B2021-102 moved the baseline meta file write here too - should have been done with B2021-088 fix
// C2018-015 add the procedure tree path and the procedure number and title to the meta file
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0}", MyProcedure.SearchDVPath.Replace("\a", " | "));
if (BaselineMetaFile.IsOpen) BaselineMetaFile.WriteLine("!! {0} | {1}", MyProcedure.DisplayNumber, MyProcedure.DisplayText);
myItem = MyProcedure;
Prefix = prefix;
OpenPDF = openPDF;
DidAll = didAll;
InitializeComponent();
// if the version number of PROMS is 1.0, then we are running a Demo version.
// When running a Demo version, force a "Sample" watermark when printing.
// B2020-022 append a ".pdf" extension if the file name does on have one.
MyPromsPrinter = new PromsPrinter(myItem, rev, (VlnSettings.ReleaseMode.Equals("DEMO")) ? "Sample" : watermark, debugOutput, origPgBrk, pdfPath + @"\Compare", false, overWrite, cbd, (pdfFile.ToUpper().EndsWith(".PDF"))?pdfFile:pdfFile+".pdf", insertBlankPages, allOrAuto,Prefix,saveLinks,removeTrailingHardReturnsAndManualPageBreaks, blankPageText, DidAll, mergedPdf, watermarkColor);
MyPromsPrinter.PromsVersion = (showPROMSVer) ? AboutVEPROMS.PROMSVersion : ""; //C2018-009 print PROMS version
PDFPath = pdfPath;
this.Text = "Creating PDF of " + myItem.DisplayNumber;
_NewLocation = newLocation;
DialogResult = DialogResult.OK;
}
public static void SetUnitWatermark(ProcedureInfo procInfo, ref string waterMarkText, ref string watermarkColor)
@@ -156,6 +165,7 @@ namespace VEPROMS
}
void pp_StatusChanged(object sender, PromsPrintStatusArgs args)
{
if (args.Type == PromsPrinterStatusType.ProgressSetup)
pb.Maximum = args.Progress;
else if (args.Type == PromsPrinterStatusType.Progress)
@@ -168,6 +178,7 @@ namespace VEPROMS
}
MyStatus = args.MyStatus;
Application.DoEvents();
}
public string MyStatus
{
@@ -210,13 +221,17 @@ namespace VEPROMS
tmrRun.Enabled = false;
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();
// B2018-029: delete any pdf files related to printing supplemental information facing pages:
// B2018-039 Delete only pdf files that begin with "SupInof"
string[] filePaths = System.IO.Directory.GetFiles(Volian.Base.Library.VlnSettings.TemporaryFolder, "SupInfo*.pdf");
// B2018-039 Delete only pdf files that begin with "SupInof"
string[] filePaths = System.IO.Directory.GetFiles(Volian.Base.Library.VlnSettings.TemporaryFolder, "SupInfo*.pdf");
foreach (string filePath in filePaths) System.IO.File.Delete(filePath);
do
@@ -224,46 +239,59 @@ namespace VEPROMS
int profileDepth = ProfileTimer.Push(">>>> MyPromsPrinter.Print");
// B2018-099: remove cache items for contents, items and parts to prevent out of memory errors when
// doing print all or automated print testing or approval of some or all procedures, i.e. HashSet and use of them below.
HashSet<int> cacheContentInfo = null;
HashSet<int> cacheItemInfo = null;
HashSet<int> cachePartInfo = null;
if (DidAll)
{
cacheContentInfo = ContentInfo.CacheList;
cacheItemInfo = ItemInfo.CacheList;
cachePartInfo = PartInfo.CacheList;
}
_PdfFile = MyPromsPrinter.Print(PDFPath, MakePlaceKeeper, MakeContinuousActionSummary);
ProfileTimer.Pop(profileDepth);
if (DidAll)
{
ContentInfo.RestoreCacheList(cacheContentInfo);
ItemInfo.RestoreCacheList(cacheItemInfo);
PartInfo.RestoreCacheList(cachePartInfo);
}
}
while (!MyPromsPrinter.MergeNotIncluded && _PdfFile == null && MessageBox.Show("Try Again?", "PDF Creation Failed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes);
if (_PdfFile == null)
{
this.Close();
return;
}
if (!CancelStop)
{
if (PromsPrinter.ReportTransPageNumProblems() == DialogResult.Yes && MyPromsPrinter.BeforePageNumberPdf != null)
{
System.Diagnostics.Process.Start(MyPromsPrinter.BeforePageNumberPdf);
// C2017-018 - Open Pass 2 output if it exists
if (MyPromsPrinter.BeforePageNumber2Pdf != null) System.Diagnostics.Process.Start(MyPromsPrinter.BeforePageNumber2Pdf);
}
}
DateTime tEnd = DateTime.Now;
MyStatus = _PdfFile + " created.";
MyStatus = string.Format("{0} created in {1:0.} milliseconds", _PdfFile, (TimeSpan.FromTicks(tEnd.Ticks - tStart.Ticks).TotalMilliseconds));
if (OpenPDF)
{
OpenPDFandPlacekeeper(_PdfFile);
this.Close();
// C2021-010: Remove trailing returns/spaces & manual page breaks & allow save. Ask if user wants to save chanages
// if they were found.
if ((MyPromsPrinter.RemoveManualPageBreaks != null && MyPromsPrinter.RemoveManualPageBreaks.Count > 0)
@@ -281,6 +309,7 @@ namespace VEPROMS
}
return;
}
btnOpenFolder.Visible = btnOpenPDF.Visible = true;
if (CloseWhenDone)
@@ -290,11 +319,13 @@ namespace VEPROMS
return;
}
}
private void btnOpenPDF_Click(object sender, EventArgs e)
{
OpenPDFandPlacekeeper(_PdfFile);
this.Close();
}
// set a delay so that the word document containing the newly generated placekeeper will appear on top of everything else.
// - requested by Calvert Cliffs
private void OpenPDFandPlacekeeper(string pdffile)
@@ -304,32 +335,41 @@ namespace VEPROMS
if ((pdffile ?? "") != "" && !OnlyShowContinuousActionSummary)
{
System.Diagnostics.Process sdp = System.Diagnostics.Process.Start(pdffile);
if (sdp != null)
sdp.WaitForInputIdle();
}
if (OnlyShowContinuousActionSummary)
System.IO.File.Delete(pdffile); // remove the temporary PDF file used to create the Continuous Action Summary
if (MyPromsPrinter.MyPlacekeeper != null)
{
// The PlacekeeperDelay is a switch that can be added to the PROMS.exe shortcut
// ex: VEPROMS.EXE /PlacekeeperDelay=2.5 will delay it 2 1/2 seconds
float delay = Volian.Base.Library.VlnSettings.GetCommandFloat("PlacekeeperDelay", 3.0f);
int mydelay = (int)(1000 * delay);
System.Threading.Thread.Sleep(mydelay);
MyPromsPrinter.MyPlacekeeper.Visible();
}
// this will display the generated Continuous Action Summary in MS Word (starting a new instance of MS Word outside of PROMS)
if (MyPromsPrinter.MyContActSummary != null)
{
string instructions = "The Continuous Action Summary will be opened in MS Word.\n\nYou can make modifications and copy it into a PROMS Word section.";
MessageBox.Show(instructions, "Continuous Action Summary");
// The ContActSummaryDelay is a switch that can be added to the PROMS.exe shortcut
// ex: VEPROMS.EXE /ContActSummaryDelay=2.5 will delay it 2 1/2 seconds
float delay = Volian.Base.Library.VlnSettings.GetCommandFloat("ContActSummaryDelay", 1.0f);
int mydelay = (int)(1000 * delay);
System.Threading.Thread.Sleep(mydelay);
MyPromsPrinter.MyContActSummary.Visible();
}
}
catch (Exception ex)
{
@@ -337,12 +377,14 @@ namespace VEPROMS
MessageBox.Show(str, "Error Opening PDFFile", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
private void btnOpenFolder_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("Explorer", "/select," + _PdfFile);
OpenPDFandPlacekeeper(null);
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
CancelPrinting = true;
+39 -20
View File
@@ -189,9 +189,9 @@ namespace VEPROMS
displaySearch1.TopFolderID = myDocVersion.FolderID;
SelectedDVI = myDocVersion;
tc.VersionID = myDocVersion.VersionID;
tc.SeparateWindows = true; // need to set this in child window for goto Outside Transitions
displayBookMarks.MyBookMarks = MyParent.displayBookMarks.MyBookMarks;
displayBookMarks.SetupBookMarks(); // setup bookmarks in the child window
tc.SeparateWindows = true; // need to set this in child window for goto Outside Transitions
displayBookMarks.MyBookMarks = MyParent.displayBookMarks.MyBookMarks;
displayBookMarks.SetupBookMarks(); // setup bookmarks in the child window
tc.MyCopyStep = myParent.tc.MyCopyStep; // copy the copystep info to the child window
(tv.Nodes[0] as VETreeNode).InChildWindow = true; // tells us this folder's tree nodes are in the child window
}
@@ -324,8 +324,8 @@ namespace VEPROMS
if(Properties.Settings.Default.VersionWindows != null)
Properties.Settings.Default.VersionWindows.Clear();
Properties.Settings.Default.MRIList = null;
Properties.Settings.Default.DefaultDB = Database.SelectedDatabase;
Properties.Settings.Default.Save();
Properties.Settings.Default.DefaultDB = Database.SelectedDatabase;
Properties.Settings.Default.Save();
}
displayBookMarks.SetupBookMarks();
DateTime dtSunday = DateTime.Now.AddDays(-((int)DateTime.Now.DayOfWeek));
@@ -348,6 +348,8 @@ namespace VEPROMS
tc.SeparateWindows = Properties.Settings.Default.SeparateWindows;
tv.PauseRefresh += tv_PauseRefresh;
tv.UnPauseRefresh += tv_UnPauseRefresh;
}
void displaySearch1_SearchComplete(object sender, DisplaySearchEventArgs args)
{
@@ -432,7 +434,7 @@ namespace VEPROMS
tv.Processing += tv_Processing;
tv.CreateContinuousActionSummary += new vlnTreeViewEvent(tv_CreateContinuousActionSummary);
tv.SelectDateToStartChangeBars += tv_SelectDateToStartChangeBars;
displayBookMarks.ResetBookMarksInPROMSWindows += displayBookMarks_ResetBookMarksInPROMSWindows;
displayBookMarks.ResetBookMarksInPROMSWindows += displayBookMarks_ResetBookMarksInPROMSWindows;
}
// Part of Separate Windows upgrade C2015-022
@@ -1284,10 +1286,10 @@ namespace VEPROMS
VolianTimer.ShowTimers();
foreach (DisplayTabItem dti in tc.MyBar.Items)
{
if (dti.MyDSOTabPanel != null)
dti.MyDSOTabPanel.CloseDSO();
else
MySessionInfo.CheckInItem(dti.OwnerID); //C2015-022 Separate Windows closing child form only left procedure ownership active
if (dti.MyDSOTabPanel != null)
dti.MyDSOTabPanel.CloseDSO();
else
MySessionInfo.CheckInItem(dti.OwnerID); //C2015-022 Separate Windows closing child form only left procedure ownership active
}
//_MyLog.WarnFormat("frmVEPROMS_FormClosing");
if (MyParent == null)
@@ -2767,6 +2769,7 @@ namespace VEPROMS
/// <param name="e"></param>
private void tmrTreeView_Tick(object sender, EventArgs e)
{
_TimeActivity2.Open();
bool giveTvFocus = true;
@@ -3231,6 +3234,7 @@ namespace VEPROMS
displayRO.MyRTB = (SelectedStepTabPanel == null) ? null :
SelectedStepTabPanel.MyStepPanel.SelectedEditItem == null ? null : SelectedStepTabPanel.MyStepPanel.SelectedEditItem.MyStepRTB;
displayRO.ProgressBar = bottomProgBar;
displayRO.LoadTree(); // B2022-026 RO Memory Reduction code
}
#endregion
#region InfoTabTransition
@@ -3385,6 +3389,8 @@ namespace VEPROMS
}
private void tc_SelectedDisplayTabItemChanged(object sender, EventArgs args)
{
if (tc.ShuttingDown) return; // B2022-026 RO Memory Reduction code - to prevent refreshing the RO tree again
// If the current procedure or section in the treeview doesn't match then change the treeview selection.
//jcb added for error B2012-117
ItemInfo tvii;
@@ -3413,7 +3419,10 @@ namespace VEPROMS
SetCaption(tv.SelectedNode as VETreeNode);
displayApplicability.MyDisplayTabItem = tc.SelectedDisplayTabItem;
if (tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion.DocVersionAssociationCount > 0)
{
displayRO.MyROFSTLookup = tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst.GetROFSTLookup(tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion);
displayRO.LoadTree(); // B2022-026 RO Memory Reduction code
}
lblUser.Text = tc.SelectedDisplayTabItem.MyUserRole;
if (tc.SelectedDisplayTabItem.MyItemInfo.MyDocVersion.MultiUnitCount > 1)
btnPrint.Visible = false;
@@ -3471,21 +3480,19 @@ namespace VEPROMS
private void tc_ItemSelectedChanged(object sender, ItemSelectedChangedEventArgs args)
{
tc.HideTheCaret();
//if (args.MyEditItem != null)
//Volian.Base.Library.vlnStackTrace.ShowStackLocal(2,10,"Edit item {0}, Step Panel {1}",args.MyEditItem.MyStepRTB.ContainsFocus, args.MyEditItem.MyStepPanel.ContainsFocus);
if (args != null && args.MyEditItem != null && !args.MyEditItem.MyStepPanel.ContainsFocus) return;
//if (args != null && args.MyEditItem != null && !args.MyEditItem.MyStepPanel.ContainsFocus)
//{
// _RefreshRTB = args.MyEditItem.MyStepRTB;
// TmrRefreshItem.Enabled = true;
// return;
//}
if (args != null && args.MyEditItem != null && !args.MyEditItem.MyStepPanel.ContainsFocus)
return;
btnFixMSWord.Visible = (args != null && ( args.MyItemInfo != null && args.MyEditItem == null));
if (_LastStepRTB != null && !_LastStepRTB.Disposing && !_LastStepRTB.Closed)
_LastStepRTB.EditModeChanged -= new StepRTBEvent(_LastStepRTB_EditModeChanged);
_LastStepRTB = args != null && args.MyEditItem != null ? args.MyEditItem.MyStepRTB : null;
if (_LastStepRTB != null) _LastStepRTB.EditModeChanged += new StepRTBEvent(_LastStepRTB_EditModeChanged);
lblEditView.Text = " ";
if (args == null)
{
_CurrentItem = null;
@@ -3507,12 +3514,13 @@ namespace VEPROMS
{
lblItemID.Text = string.Format("ItemID = {0}", args.MyItemInfo.ItemID);
lblItemID.ForeColor = Color.DarkBlue;
if (_CurrentItem != args.MyItemInfo)
{
if (_CurrentItem != null) _CurrentItem.Deleted -= new ItemInfoEvent(_CurrentItem_Deleted);
_CurrentItem = args.MyItemInfo;
}
//vlnStackTrace.ShowStack("enter tc_ItemSelectedChanged {0}", _CurrentItem);
if (args.MyEditItem == null)
{
ctrlAnnotationDetails.Enabled = false;
@@ -3520,12 +3528,15 @@ namespace VEPROMS
infotabFoldoutMaint.Visible = false;
infotabTransition.Visible = false;
infotabRO.Visible = false;
if (args.MyItemInfo.MyDocVersion.DocVersionAssociations != null)
{
displayRO.MyROFST = args.MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst;
displayRO.MyRTB = null;
infotabRO.Visible = true;
displayRO.LoadTree(); // B2022-026 RO Memory Reduction code
}
infotabTags.Visible = false;
infotabApplicability.Visible = false;
// Not sure why but the following line was causing a hang if
@@ -3613,10 +3624,14 @@ namespace VEPROMS
displayTags.MyEditItem = args.MyEditItem;
displayRO.ROTypeFilter = SelectedStepTabPanel.MyStepPanel.SelectedEditItem is Volian.Controls.Library.GridItem && (SelectedStepTabPanel.MyStepPanel.SelectedEditItem as Volian.Controls.Library.GridItem).MyFlexGrid.IsRoTable ?
E_ROValueType.Table : (SelectedStepTabPanel.MyStepPanel.SelectedEditItem.MyItemInfo.IsFigure) ? E_ROValueType.Image : E_ROValueType.Text;
displayRO.LoadTree(); // B2022-026 RO Memory Reduction code
if (_LastStepRTB.IsRoTable && _LastStepRTB.MyItemInfo.MyContent.ContentRoUsageCount > 0)
displayRO.CurROLink = _LastStepRTB.MyItemInfo.MyContent.ContentRoUsages[0];
if (_LastStepRTB.IsRoFigure && _LastStepRTB.MyItemInfo.MyContent.ContentRoUsageCount > 0)
displayRO.CurROLink = _LastStepRTB.MyItemInfo.MyContent.ContentRoUsages[0];
// if this is an enhanced step (linked from a source document), don't bring up the ro or transition panel,
// and don't allow replace on the find/replace dialog.
if (args.MyItemInfo.IsEnhancedStep)
@@ -3642,6 +3657,7 @@ namespace VEPROMS
displayRO.MyROFST = args.MyItemInfo.MyDocVersion.DocVersionAssociations[0].MyROFst;
}
displayRO.ROTypeFilter = E_ROValueType.All; // allow all RO types for Word attachments (but fix)
displayRO.LoadTree(); // B2022-026 RO Memory Reduction code
displayRO.SetFindDocROButton(true);
}
}
@@ -3654,8 +3670,10 @@ namespace VEPROMS
{
ctrlAnnotationDetails.UpdateAnnotationGrid(_CurrentItem); // set the CurrentItem (send Message) when the MSWord section is opened.
}
btnPrint.Enabled = (_CurrentItem != null);
}
/*KBR:Timer _tmrSetTransROInVisible;
public Timer TmrSetTransROInVisible
{
@@ -3750,6 +3768,7 @@ namespace VEPROMS
E_ROValueType.Table : (SelectedStepTabPanel.MyStepPanel.SelectedEditItem.MyItemInfo.IsFigure) ? E_ROValueType.Image: E_ROValueType.Text;
//displayRO.Mydvi = SelectedDVI;
displayRO.ProgressBar = bottomProgBar;
displayRO.LoadTree(); // B2022-026 RO Memory Reduction code
}
#endregion
#region VButton
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -48,10 +48,13 @@ namespace VEPROMS.CSLA.Library
get
{
if (DocVersionAssociations == null || DocVersionAssociations.Count == 0) return false;
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;
FileInfo fiRofst = new FileInfo(rofstPath);
// if the database Ro.Fst is newer or if the files have identical DTS,
@@ -60,7 +63,11 @@ namespace VEPROMS.CSLA.Library
// next see if the data is the same size, i.e. byte count of record and byte count
// of file. If different sizes, the date/time stamp check will hold.
if (fiRofst.Length != roFstInfo.ROLookup.Length) return fiRofst.LastWriteTimeUtc > roFstInfo.DTS;
// B2022-026 RO Memory reduction - new logic
var bytes = ROFSTLookup.GetRofstLookupBytes(roFstInfo.ROFstID);
if (bytes != null && fiRofst.Length != bytes.Length)
return fiRofst.LastWriteTimeUtc > roFstInfo.DTS;
// if we can't tell by the DTS or size, compare the contents. Get all of the rodb's
// rofsts of the size of the file & compare bytes.
@@ -249,15 +256,18 @@ namespace VEPROMS.CSLA.Library
get
{
if (DocVersionAssociations == null || DocVersionAssociationCount==0) return false;
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 (!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,
@@ -265,14 +275,21 @@ namespace VEPROMS.CSLA.Library
// put this in a dictionary so we don't have to keep testing to see if the file version of ro.fst is newer than database version
string key = string.Format("{0}-{1}", DocVersionAssociations[0].ROFstID, fiRofst.LastWriteTimeUtc);
if (NewerRoFstLookup.ContainsKey(key)) return NewerRoFstLookup[key];
if (roFstInfo.DTS >= fiRofst.LastWriteTimeUtc) return AddToRoFstLookup(key, false);
TimeSpan ts = roFstInfo.DTS - fiRofst.LastWriteTimeUtc;
if (ts.TotalSeconds > -1F) return AddToRoFstLookup(key, false);
// next see if the data is the same size, i.e. byte count of record and byte count
// of file. If different sizes, the date/time stamp check will hold.
if (fiRofst.Length != roFstInfo.ROLookup.Length) return AddToRoFstLookup(key,fiRofst.LastWriteTimeUtc > roFstInfo.DTS);
// B2022-026 RO Memory reduction - new logic
var bytes = ROFSTLookup.GetRofstLookupBytes(roFstInfo.ROFstID);
if (bytes != null && fiRofst.Length != bytes.Length)
return AddToRoFstLookup(key, fiRofst.LastWriteTimeUtc > roFstInfo.DTS);
// if we can't tell by the DTS or size, compare the contents. Get all of the rodb's
// rofsts of the size of the file & compare bytes.
+106 -96
View File
@@ -326,26 +326,31 @@ namespace VEPROMS.CSLA.Library
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;
return SectionInfo.Get(ItemID);
}
public StepInfo GetStepInfo()
{
if (this is StepInfo) return this as StepInfo;
return StepInfo.Get(ItemID);
}
public ProcedureInfo GetProcedureInfo()
{
if (this is ProcedureInfo) return this as ProcedureInfo;
return ProcedureInfo.Get(ItemID);
}
private string _EnhType = null;
public string EnhType
{
@@ -379,10 +384,12 @@ namespace VEPROMS.CSLA.Library
if (id == ItemID) return true;
return false;
}
public static bool IsInCache(int itemID)
{
return _CacheByPrimaryKey.ContainsKey(itemID.ToString());
}
public static string ReplaceLinkWithNewID(string tmpForLink)
{
tmpForLink = Regex.Replace(tmpForLink, @"#Link:ReferencedObject:[0-9]+ ", @"#Link:ReferencedObject:<NewID> ");
@@ -394,6 +401,7 @@ namespace VEPROMS.CSLA.Library
tmpForLink = tmpForLink.Replace(@"\u8211 ", @"-"); // Replace EN Dash with hyphen
return tmpForLink;
}
public void SetHeader(VE_Font myFont, string myText)
{
_MyHeader = new MetaTag(myFont);
@@ -402,6 +410,7 @@ namespace VEPROMS.CSLA.Library
_MyHeader.Text = myText;
_MyHeader.Justify = ContentAlignment.MiddleCenter;
}
public void MoveItem(IVEDrillDownReadOnly pInfo, int index)
{
using (ItemInfoList movedItems = ItemInfoList.GetMoveItem(ItemID, index))
@@ -416,6 +425,7 @@ namespace VEPROMS.CSLA.Library
if (parentInfo != null)
ItemInfo.ResetParts(parentInfo.ItemID);
}
public static void Refresh(ItemInfo tmp)
{
string key = tmp.ItemID.ToString();
@@ -424,6 +434,7 @@ namespace VEPROMS.CSLA.Library
foreach (ItemInfo tmpInfo in _CacheByPrimaryKey[key])
tmpInfo.RefreshFields(tmp);
}
protected virtual void RefreshFields(ItemInfo tmp)
{
if (_PreviousID != tmp.PreviousID)
@@ -574,6 +585,7 @@ namespace VEPROMS.CSLA.Library
}
}
}
/// <summary>
/// The following method is used only in print because the 'printed' data is loaded into
/// memory before printing. Find the next item from memory (do not go out to database).
@@ -596,43 +608,35 @@ namespace VEPROMS.CSLA.Library
}
return null;
}
public static void ResetTranCounters()
{
TranCheckCount = 0;
TranFixCount = 0;
TranConvertCount = 0;// B2018-002 - Invalid Transitions - Initialize Transition Conversion Count
}
public static int TranCheckCount = 0;
public static int TranFixCount = 0;
public static int TranConvertCount = 0;// B2018-002 - Invalid Transitions - Declare Transition Conversion Count
internal static TransitionInfoList TransitionsToDisconnected;
internal static TransitionInfoList TransitionsToNonEditable;
internal static void MyRefreshTransitions(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
{
//TransitionInfoList til = TransitionInfoList.GetByFromID(itemInfo.ItemID);
//Console.WriteLine("Procedure: {0}, transitions: {1}", (itemInfo as ProcedureInfo).DisplayNumber, til.Count);
//foreach (TransitionInfo traninfo in til)
//{
// string oldText = itemInfo.MyContent.Text;
// itemInfo.MyContent.FixTransitionText(traninfo, tranLookup);
// string newText = itemInfo.MyContent.Text;
// if (newText != oldText)
// {
// Content content = Content.Get(itemInfo.MyContent.ContentID);
// content.FixTransitionText(traninfo);
// content.Save();
// }
//}
if (itemInfo == null) return;
if (itemInfo.MyContent.ContentPartCount > 0)
{
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
{
//List<ItemInfo> myItems = new List<ItemInfo>();
foreach (ItemInfo ii in pi.MyItems)
// myItems.Add(ii);
//foreach (ItemInfo ii in myItems)
{
MyRefreshTransitions(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, procInfo, docVersionInfo, tranLookup);
}
}
}
// B2018-002 - Invalid Transitions - Convert Invalid Transitions to Text
// An invalid transition is a transition embedded in the content text that does not match the transition table record.
if(ConvertInvalidTransitionsToText(itemInfo))
@@ -642,18 +646,7 @@ namespace VEPROMS.CSLA.Library
{
bool forceConvertToText = false;
TranCheckCount++;
//if (TransitionsToNonEditable != null)
//{
// if (IsTransitionToNonEditable(traninfo))
// {
// forceConvertToText = true;
// TranFixCount++;
// itemInfo.MyContent.FixTransitionText(traninfo, itemInfo, "Reason for Change: Transition to Non-Editable Step");
// Content content = Content.Get(itemInfo.MyContent.ContentID);
// content.FixTransitionText(traninfo, true);
// content.Save();
// }
//}
if (!forceConvertToText)
{
if (traninfo.MyItemToID.ActiveSection != null)
@@ -661,6 +654,7 @@ namespace VEPROMS.CSLA.Library
SectionConfig sc = traninfo.MyItemToID.ActiveSection.MyConfig as SectionConfig;
forceConvertToText = (sc.SubSection_Edit == "N" && traninfo.MyItemToID.IsStep); // Bug fix B2016-081 also check if transition is to a step element
}
if (forceConvertToText)
{
TranFixCount++;
@@ -670,11 +664,14 @@ namespace VEPROMS.CSLA.Library
content.Save();
}
}
if (!forceConvertToText)
{
if (itemInfo.MyProcedure.ItemID != traninfo.MyItemToID.MyProcedure.ItemID) //different proc
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("Proc")) //internal format
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("other proc")) //B2017-068 paste with transition fix
if (itemInfo.MyProcedure.ItemID != traninfo.MyItemToID.MyProcedure.ItemID) //different proc
{
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("Proc")) //internal format
{
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("other proc")) //B2017-068 paste with transition fix
{
forceConvertToText = true;
TranFixCount++;
@@ -683,13 +680,17 @@ namespace VEPROMS.CSLA.Library
content.FixTransitionText(traninfo, true);
content.Save();
}
}
}
}
if (!forceConvertToText)
{
if (itemInfo.MyDocVersion != null && traninfo.MyItemToID.MyDocVersion != null && itemInfo.MyDocVersion.VersionID != traninfo.MyItemToID.MyDocVersion.VersionID) //different doc version
{
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("Proc")) //internal format
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("other proc")) //B2017-068 paste with transition fix
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("Proc")) //internal format
{
if (!itemInfo.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[traninfo.TranType].TransMenu.Contains("other proc")) //B2017-068 paste with transition fix
{
forceConvertToText = true;
TranFixCount++;
@@ -698,8 +699,10 @@ namespace VEPROMS.CSLA.Library
content.FixTransitionText(traninfo, true);
content.Save();
}
}
}
}
if (!forceConvertToText)
{
string oldText = itemInfo.MyContent.Text;
@@ -718,6 +721,7 @@ namespace VEPROMS.CSLA.Library
}
}
}
// // B2018-002 - Invalid Transitions - Method to check for invalid transitions and convert them to text
public static bool ConvertInvalidTransitionsToText(ItemInfo itemInfo)
{
@@ -729,25 +733,30 @@ namespace VEPROMS.CSLA.Library
retval = false;
if (itemInfo.MyContent.Text.Contains("Link:Transition"))
{
//Console.WriteLine("\"TranCount\"\t\"{0}\"\t{1}\t{2}\t{3}", itemInfo.ShortPath, itemInfo.ItemID, mc.Count, itemInfo.MyContent.ContentTransitionCount);
Content content = Content.Get(itemInfo.MyContent.ContentID);
//if (itemInfo.InList(616031, 615898, 5516866))
// Console.WriteLine("here");
if (itemInfo.MyContent.ContentTransitions != null)
{
foreach (TransitionInfo ct in itemInfo.MyContent.ContentTransitions)
{
Transition.Delete(ct.TransitionID);
}
}
itemInfo.MyContent.RefreshContentTransitions();
//if (content.Text.Contains("Link:TransitionRange"))
// Console.WriteLine("Here");
while (content.Text.Contains("Link:Transition"))
{
TranCheckCount++;
TranConvertCount++;
if (content.FixTransitionText(null, true))
{
ContentInfo.OnStaticContentInfoChange(itemInfo, new StaticContentInfoEventArgs("", "", ""));
if (itemInfo.MyContent.MyGrid != null)
{
content.ConvertTransitionToTextInGrid(null, null);
}
content.Save();
}
else // B2018-043 Eliminate infinite loop for invalid transition structure
@@ -759,14 +768,21 @@ namespace VEPROMS.CSLA.Library
}
}
}
// B2021-008: Delete the transition record if there is no link in the text
if (mc.Count == 0 && itemInfo.MyContent.ContentTransitionCount > 0)
{
TranCheckCount++;
TranFixCount++;
if (itemInfo.MyContent.ContentTransitions != null)
{
foreach (TransitionInfo ct in itemInfo.MyContent.ContentTransitions)
{
Transition.Delete(ct.TransitionID);
}
}
itemInfo.MyContent.RefreshContentTransitions();
}
@@ -800,10 +816,12 @@ namespace VEPROMS.CSLA.Library
string txt = myContent.Text;
string regDelete = @"(\\v |)\<START\]\#Link\:Transition(|Range)\:[0-9]+ [0-9]+ [0-9]+(| [0-9]+)\[END\>(\\v0 |)";
string txt2=txt;
do{
txt = txt2;
txt2 = Regex.Replace(txt, regDelete, "");
} while(txt2 != txt);
if(txt2 != myContent.Text)
{
using(Content tmp = myContent.Get())
@@ -814,15 +832,7 @@ namespace VEPROMS.CSLA.Library
AddInvalidTransitionAnnotation(itemInfo, "Removed Empty Transition Text");
}
}
//private static bool IsTransitionToDisconnected(TransitionInfo ti)
//{
// foreach (TransitionInfo til in TransitionsToDisconnected)
// {
// if (ti.TransitionID == til.TransitionID)
// return true;
// }
// return false;
//}
private static bool IsTransitionToNonEditable(TransitionInfo ti)
{
foreach (TransitionInfo til in TransitionsToNonEditable)
@@ -832,32 +842,39 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public static void ResetROCounters()
{
ROCheckCount = 0;
ROFixCount = 0;
}
public static int ROCheckCount = 0;
public static int ROFixCount = 0;
private static AnnotationType _VolianCommentType = null; // Using this to flag ro value issues with byron to braidwood
public static AnnotationType VolianCommentType
{
get
{
if (_VolianCommentType == null)
_VolianCommentType = AnnotationType.GetByName("Volian Comment");
if (_VolianCommentType == null)
_VolianCommentType = AnnotationType.MakeAnnotationType("Volian Comment", null);
return _VolianCommentType;
}
}
public void UpdateROText()
{
if (this.MyDocVersion.DocVersionAssociationCount == 0) return;
ROFstInfo rofstinfo = this.MyDocVersion.DocVersionAssociations[0].MyROFst;
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(this.MyDocVersion);
lookup.MyDocVersionInfo = this.MyDocVersion;
lookup.MyItemInfo = this; // B2022-020 to pass information into error log if needed
if (this.MyContent.ContentRoUsageCount > 0)
{
foreach (RoUsageInfo rousage in this.MyContent.ContentRoUsages)
@@ -878,33 +895,39 @@ namespace VEPROMS.CSLA.Library
using (Item myitem = content.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{
myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060
// B2016-225 (follow through) added more descriptive Annotation Type when RO is converted to text
// B2016-225 (follow through) added more descriptive Annotation Type when RO is converted to text
Annotation.MakeAnnotation(myitem, AnnotationType.GetByNameOrCreate("Link Converted To Text"), "", string.Format("RO value ({0}) converted to text", ItemInfo.ConvertToDisplayText(oldText)), null);
}
}
else
{
content.FixContentText(rousage, roval, roch.type, rofstinfo);
}
content.Save();
}
}
}
}
}
internal static void MyRefreshReferenceObjects(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, DocVersionInfo docVersionInfo)
// B2022-026 RO Memory Reduction code - pass in ROFstInfo
internal static void MyRefreshReferenceObjects(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, DocVersionInfo docVersionInfo, ROFstInfo origROFst)
{
if (itemInfo.MyContent.ContentPartCount > 0)
{
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
{
//List<ItemInfo> myItems = new List<ItemInfo>();
foreach (ItemInfo ii in pi.MyItems)
// myItems.Add(ii);
//foreach (ItemInfo ii in myItems)
MyRefreshReferenceObjects(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, docVersionInfo);
{
MyRefreshReferenceObjects(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, docVersionInfo, origROFst);
}
}
ROFstInfo rofstinfo = docVersionInfo.DocVersionAssociations[0].MyROFst;
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(docVersionInfo);
lookup.MyDocVersionInfo = docVersionInfo;
}
// B2022-026 RO Memory Reduction code - get ROLookup from passed in ROFstInfo
ROFSTLookup lookup = origROFst.GetROFSTLookup(docVersionInfo);
lookup.MyItemInfo = itemInfo; // B2022-020 to pass information into error log if needed
if (itemInfo.MyContent.ContentRoUsageCount > 0)
{
foreach (RoUsageInfo rousage in itemInfo.MyContent.ContentRoUsages)
@@ -915,8 +938,9 @@ namespace VEPROMS.CSLA.Library
string oldText = itemInfo.MyContent.Text;
string roval = lookup.GetTranslatedRoValue(rousage.ROID, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.ConvertCaretToDelta, sectionInfo.ActiveFormat.PlantFormat.FormatData.SectData.UseTildaPoundCharsForSuperSubScriptInROValues);
ROFSTLookup.rochild roch = lookup.GetRoChild(rousage.ROID);
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, rofstinfo, itemInfo);
itemInfo.MyContent.FixContentText(rousage, roval, roch.type, origROFst, itemInfo);
string newText = itemInfo.MyContent.Text;
if (DifferentROtext(newText,oldText))
{
//ShowDifference(oldText, newText); // debug - display in Visual Studio Output window
@@ -924,7 +948,7 @@ namespace VEPROMS.CSLA.Library
Content content = Content.Get(itemInfo.MyContent.ContentID);
if (roval == "?")
{
oldText = content.ConvertROToText(rousage, roval, roch.type, rofstinfo);
oldText = content.ConvertROToText(rousage, roval, roch.type, origROFst);
using (Item myitem = content.ContentItems[0].MyItem) // so that myitem does not stay in cache B2016-153
{
myitem.DisposeOfContent = false; // don't dispose of the contents may be needed if more than one RO needs processed - part of B2017-060
@@ -934,7 +958,7 @@ namespace VEPROMS.CSLA.Library
}
else
{
content.FixContentText(rousage, roval, roch.type, rofstinfo);
content.FixContentText(rousage, roval, roch.type, origROFst);
}
content.UserID = Volian.Base.Library.VlnSettings.UserID;
content.DTS = DateTime.Now;
@@ -949,12 +973,17 @@ namespace VEPROMS.CSLA.Library
{
string nt = newText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
string ot = oldText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
if (nt.Equals(ot))
{
return false;
}
return true;
}
#region debug
#region Debug Code
//private static void ShowDifference(string oldText, string newText)
//{
// string nt = newText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " ");
@@ -974,7 +1003,9 @@ namespace VEPROMS.CSLA.Library
// }
// Console.WriteLine("{0}='{1}'",title,sb.ToString());
//}
#endregion // debug
internal static void SetParentSectionAndDocVersionPageNum(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, ProcedureInfo procInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
{
if (itemInfo.MyContent.ContentPartCount > 0)
@@ -995,21 +1026,7 @@ namespace VEPROMS.CSLA.Library
}
}
}
//internal static long ticksROUsage;
//internal static long ticksItems;
//internal static long ticksTrans;
//internal static void ResetTicks()
//{
// ticksROUsage = 0;
// ticksItems = 0;
// ticksTrans = 0;
//}
//internal static void ShowTicks()
//{
// Console.WriteLine("ROUsage: {0}", TimeSpan.FromTicks(ticksROUsage).TotalSeconds);
// Console.WriteLine("Items: {0}", TimeSpan.FromTicks(ticksItems).TotalSeconds);
// Console.WriteLine("Transitions: {0}", TimeSpan.FromTicks(ticksTrans).TotalSeconds);
//}
public static string GetCombinedTab(ItemInfo itemInfo, string parTab)
{
string pTab = parTab == null ? "" : parTab;
@@ -1034,6 +1051,7 @@ namespace VEPROMS.CSLA.Library
if (itemInfo.HasParentTab) return thisTab.Trim(); // F2020-023: if tab includes parent tab already, don't concatenate it
return pTab + thisTab.Trim();
}
internal static void SetParentSectionAndDocVersion(ItemInfo itemInfo, IVEDrillDownReadOnly itemParent, SectionInfo sectionInfo, DocVersionInfo docVersionInfo, TransitionLookup tranLookup)
{
if (itemInfo == null) return;
@@ -1044,17 +1062,20 @@ namespace VEPROMS.CSLA.Library
itemInfo.ActiveSection = sectionInfo;
itemInfo.ActiveFormat = itemInfo.MyContent.MyFormat != null ? itemInfo.MyContent.MyFormat : sectionInfo == null ? itemParent.ActiveFormat : sectionInfo.ActiveFormat;
itemInfo.MyDocVersion = docVersionInfo;
if (itemInfo.IsStep)
{
ItemInfo ip = itemParent as ItemInfo;
itemInfo.CombinedTab = (ip == null) ? itemInfo.MyTab.CleanText.Trim() : GetCombinedTab(itemInfo, ip.CombinedTab);
}
if (docVersionInfo.DocVersionAssociationCount == 1)
{
string otherChildUnit = null;
ROFstInfo rofstinfo = docVersionInfo.DocVersionAssociations[0].MyROFst;
//rofstinfo.docVer = docVersionInfo;
string rawPrcNum = itemInfo.MyProcedure.MyContent.Number;
// C2022-001 see if we need to get the Other child info from ROLookUp
if (rawPrcNum.ToUpper().StartsWith("<U\\U8209?OTHER")) // proc number has <u-otherxxx> in its definiation (procedure property page)
{
@@ -1064,11 +1085,11 @@ namespace VEPROMS.CSLA.Library
}
ROFSTLookup lookup = rofstinfo.GetROFSTLookup(docVersionInfo, otherChildUnit);
lookup.MyDocVersionInfo = docVersionInfo;
lookup.MyItemInfo = itemInfo; // B2022-020 to pass information into error log if needed
//DateTime dts = DateTime.Now;
if (itemInfo.MyContent.ContentGridCount > 0)
itemInfo.MyContent.LoadNonCachedGrid();
if (itemInfo.MyContent.ContentRoUsageCount > 0)
{
foreach (RoUsageInfo rousage in itemInfo.MyContent.ContentRoUsages)
@@ -1087,39 +1108,27 @@ namespace VEPROMS.CSLA.Library
// Force Error Message
docVersionInfo.GetROFst(0);
}
//TimeSpan ts = DateTime.Now.Subtract(dts);
//ticksROUsage += ts.Ticks;
//dts = DateTime.Now;
if (itemInfo.MyContent.ContentPartCount > 0)
{
foreach (PartInfo pi in itemInfo.MyContent.ContentParts)
{
//ItemInfo il = null;
foreach (ItemInfo ii in pi.MyItems)
{
SetParentSectionAndDocVersion(ii, itemInfo, (itemInfo as SectionInfo) ?? sectionInfo, docVersionInfo, tranLookup);
//if(ii._MyPrevious == null)
// ii.MyPrevious = il;
//if (il != null) il.NextItem = ii;
//il = ii;
}
}
}
//ts = DateTime.Now.Subtract(dts);
//ticksItems += ts.Ticks;
//dts = DateTime.Now;
if (itemInfo.MyContent.ContentTransitionCount > 0)
{
//itemInfo.UpdateTransitionText();
foreach (TransitionInfo traninfo in itemInfo.MyContent.ContentTransitions)
{
//itemInfo.UpdateTransitionText();
itemInfo.MyContent.FixTransitionText(traninfo, tranLookup, itemInfo);
}
}
//ts = DateTime.Now.Subtract(dts);
//ticksTrans += ts.Ticks;
}
private int _PrintBias = 0;
public int PrintBias
{
@@ -7127,10 +7136,11 @@ namespace VEPROMS.CSLA.Library
if (tmp.MyDocVersion.DocVersionConfig.SelectedSlave <= 0)
MyRefreshTransitions(tmp, tmp.MyDocVersion, null, tmp, tmp.MyDocVersion, tranLookup);
}
public static void RefreshReferenceObjects(ProcedureInfo tmp)
// B2022-026 RO Memory Reduction code - added ROFstInfo parameter
public static void RefreshReferenceObjects(ProcedureInfo tmp, ROFstInfo origROFst)
{
if (tmp.MyDocVersion.DocVersionConfig.SelectedSlave <= 0)
MyRefreshReferenceObjects(tmp, tmp.MyDocVersion, null, tmp.MyDocVersion);
MyRefreshReferenceObjects(tmp, tmp.MyDocVersion, null, tmp.MyDocVersion, origROFst);
}
public static void RefreshPageNumTransitions(ProcedureInfo tmp)
{
@@ -16,6 +16,7 @@ namespace VEPROMS.CSLA.Library
Procedure = 0, Document = 1, DocVersion = 2, Folder = 3, Session = 4
}
#endregion
#region SessionInfoList stuff
public partial class SessionInfoList
{
@@ -67,6 +68,7 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
#region SessionInfo stuff
public partial class SessionInfo
{
@@ -750,6 +752,7 @@ namespace VEPROMS.CSLA.Library
#endregion
}
#endregion
#region OwnerInfo stuff
public partial class OwnerInfoList
{
@@ -1072,29 +1075,36 @@ namespace VEPROMS.CSLA.Library
}
}
#endregion
#region UserInfo stuff
public partial class UserInfo
{
public static bool CanEdit(UserInfo myUserInfo, DocVersionInfo myDVI)
{
return myUserInfo!=null && myDVI!=null && (myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI) || myUserInfo.IsWriter(myDVI));
}
public static bool CanEditROs(UserInfo myUserInfo, DocVersionInfo myDVI)
{
return myUserInfo != null && myDVI != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI) || myUserInfo.IsROEditor(myDVI);
}
public static bool CanCreateFolders(UserInfo myUserInfo, DocVersionInfo myDVI)
{
return myUserInfo != null && myDVI != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(myDVI);
}
public static bool CanCreateFolders(UserInfo myUserInfo, FolderInfo fi)
{
return myUserInfo != null && fi != null && myUserInfo.IsAdministrator() || myUserInfo.IsSetAdministrator(fi.MyParent); //B2020-111 allow if set amin controls parent
}
public bool IsAdministrator()
{
if (this.UserMembershipCount == 0)
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1108,6 +1118,7 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
//B2020-111, B2020-114, C2020-035 this was setting the passed in parameter, such that the first time this
// was called, the passed in parameter was set to the top node (VEPROMS). The check of other folders
// would then be skipped (from where is called)
@@ -1115,6 +1126,7 @@ namespace VEPROMS.CSLA.Library
{
if (this.UserMembershipCount == 0 || fldinf == null)
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1137,10 +1149,12 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public bool IsSetAdministrator(DocVersionInfo dv)
{
if (this.UserMembershipCount == 0)
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1162,10 +1176,12 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public bool IsWriter(DocVersionInfo dv)
{
if (this.UserMembershipCount == 0)
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1187,10 +1203,12 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public bool IsReviewer(DocVersionInfo dv)
{
if (this.UserMembershipCount == 0)
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1212,10 +1230,12 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
public bool IsROEditor(DocVersionInfo dv)
{
if (this.UserMembershipCount == 0)
if (this.UserMembershipCount == 0 || dv == null) // B2022-026 RO Memory reduction - check for null DocVersionInfo
return false;
foreach (MembershipInfo mi in this.UserMemberships)
{
if (mi.EndDate == string.Empty)
@@ -1237,6 +1257,7 @@ namespace VEPROMS.CSLA.Library
}
return false;
}
// B2018-112 added for easy check if user's PROMS Security allows making edits - used in StepTabRibbon - SetButtonAndMenuEnabling()
public bool IsAllowedToEdit(DocVersionInfo dvi)
{
@@ -1259,6 +1280,7 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on UserInfo.GetByUserID", ex);
}
}
[Serializable()]
protected class GetByUserIDCriteria
{
@@ -1270,6 +1292,7 @@ namespace VEPROMS.CSLA.Library
_UserID = userID;
}
}
private void DataPortal_Fetch(GetByUserIDCriteria criteria)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] UserInfo.DataPortal_Fetch", GetHashCode());
@@ -1307,5 +1330,6 @@ namespace VEPROMS.CSLA.Library
}
}
}
#endregion
}
File diff suppressed because it is too large Load Diff
@@ -435,7 +435,8 @@ namespace VEPROMS.CSLA.Library
_UserID = dr.GetString("UserID");
dr.GetBytes("LastChanged", 0, _LastChanged, 0, 8);
_ROFst_RODbID = dr.GetInt32("ROFst_RODbID");
_ROFst_ROLookup = (byte[])dr.GetValue("ROFst_ROLookup");
//_ROFst_ROLookup = (byte[])dr.GetValue("ROFst_ROLookup");
_ROFst_ROLookup = null; // B2022-026 RO Memory reduction - use ROlookup of null to know if we loaded the RO.FST file
_ROFst_Config = dr.GetString("ROFst_Config");
_ROFst_DTS = dr.GetDateTime("ROFst_DTS");
_ROFst_UserID = dr.GetString("ROFst_UserID");
+112 -26
View File
@@ -81,12 +81,20 @@ namespace VEPROMS.CSLA.Library
}
ClearRefreshList();
}
#endregion
#region Collection
private static List<ROFst> _CacheList = new List<ROFst>();
protected static void AddToCache(ROFst rOFst)
{
if (!_CacheList.Contains(rOFst)) _CacheList.Add(rOFst); // In AddToCache
if (!_CacheList.Contains(rOFst))
{
rOFst.ROLookup = null; // B2022-026 RO Memory reduction
_CacheList.Add(rOFst); // In AddToCache
}
}
protected static void RemoveFromCache(ROFst rOFst)
{
@@ -105,6 +113,7 @@ namespace VEPROMS.CSLA.Library
_CacheByPrimaryKey[pKey] = new List<ROFst>(); // Add new list for PrimaryKey
_CacheByRODbID_DTS[tmp.RODbID.ToString() + "_" + tmp.DTS.ToString()] = new List<ROFst>(); // Add new list for RODbID_DTS
}
tmp.ROLookup = null; // B2022-026 RO Memory reduction
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
_CacheByRODbID_DTS[tmp.RODbID.ToString() + "_" + tmp.DTS.ToString()].Add(tmp); // Unique Index
_CacheList.RemoveAt(0); // Remove the first ROFst
@@ -124,8 +133,11 @@ namespace VEPROMS.CSLA.Library
if (_CacheByRODbID_DTS.ContainsKey(key)) return _CacheByRODbID_DTS[key][0];
return null;
}
#endregion
#region Business Methods
private string _ErrorMessage = string.Empty;
public string ErrorMessage
{
@@ -180,14 +192,21 @@ namespace VEPROMS.CSLA.Library
}
}
}
private byte[] _ROLookup;
public byte[] ROLookup
{
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
get
{
CanReadProperty("ROLookup", true);
return _ROLookup;
return null; // B2022-026 RO Memory reduction
//if (_ROLookup == null)
//{
// _ROLookup = ROFSTLookup.GetRofstLookupBytes(_ROFstID);
//}
//return _ROLookup;
}
[System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)]
set
@@ -200,6 +219,7 @@ namespace VEPROMS.CSLA.Library
}
}
}
private string _Config = string.Empty;
public string Config
{
@@ -557,6 +577,7 @@ namespace VEPROMS.CSLA.Library
_Disposed = true;
RemoveFromDictionaries();
}
private void RemoveFromDictionaries()
{
RemoveFromCache(this);
@@ -580,6 +601,7 @@ namespace VEPROMS.CSLA.Library
_CacheByRODbID_DTS.Remove(myKey); // remove the list
}
}
public static ROFst New()
{
if (!CanAddObject())
@@ -593,6 +615,7 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on ROFst.New", ex);
}
}
public static ROFst New(RODb myRODb, byte[] rOLookup)
{
ROFst tmp = ROFst.New();
@@ -600,6 +623,7 @@ namespace VEPROMS.CSLA.Library
tmp.ROLookup = rOLookup;
return tmp;
}
public static ROFst New(RODb myRODb, byte[] rOLookup, string config, DateTime dts, string userID)
{
ROFst tmp = ROFst.New();
@@ -610,22 +634,7 @@ namespace VEPROMS.CSLA.Library
tmp.UserID = userID;
return tmp;
}
public static ROFst MakeROFst(RODb myRODb, byte[] rOLookup, string config, DateTime dts, string userID)
{
ROFst tmp = ROFst.New(myRODb, rOLookup, config, dts, userID);
if (tmp.IsSavable)
tmp = tmp.Save();
else
{
Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
tmp._ErrorMessage = "Failed Validation:";
foreach (Csla.Validation.BrokenRule br in brc)
{
tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
}
}
return tmp;
}
public static ROFst New(RODb myRODb, byte[] rOLookup, string config)
{
ROFst tmp = ROFst.New();
@@ -634,11 +643,23 @@ namespace VEPROMS.CSLA.Library
tmp.Config = config;
return tmp;
}
public static ROFst MakeROFst(RODb myRODb, byte[] rOLookup, string config)
public static ROFst MakeROFst(RODb myRODb, byte[] rOLookup, string config, DateTime dts, string userID)
{
ROFst tmp = ROFst.New(myRODb, rOLookup, config);
ROFst tmp = ROFst.New(myRODb, rOLookup, config, dts, userID);
if (tmp.IsSavable)
{
tmp = tmp.Save();
// B2022-026 RO Memory reduction
if (tmp.ROLookup != null && tmp.ROFstID > 0)
{
//Force Load the new Lookup Data
var RofstLookup = new ROFSTLookup(tmp.ROFstID);
tmp.ROLookup = null;
}
}
else
{
Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
@@ -648,8 +669,36 @@ namespace VEPROMS.CSLA.Library
tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
}
}
return tmp;
}
public static ROFst MakeROFst(RODb myRODb, byte[] rOLookup, string config)
{
ROFst tmp = ROFst.New(myRODb, rOLookup, config);
if (tmp.IsSavable)
{
tmp = tmp.Save();
// B2022-026 RO Memory reduction
//Force Load the new Lookup Data
var RofstLookup = new ROFSTLookup(tmp.ROFstID);
tmp.ROLookup = null;
}
else
{
Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules();
tmp._ErrorMessage = "Failed Validation:";
foreach (Csla.Validation.BrokenRule br in brc)
{
tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName;
}
}
return tmp;
}
public static ROFst Get(int rOFstID)
{
if (!CanGetObject())
@@ -662,11 +711,13 @@ namespace VEPROMS.CSLA.Library
tmp = DataPortal.Fetch<ROFst>(new PKCriteria(rOFstID));
AddToCache(tmp);
}
if (tmp.ErrorMessage == "No Record Found")
{
tmp.Dispose(); // Clean-up ROFst
tmp = null;
}
return tmp;
}
catch (Exception ex)
@@ -674,6 +725,7 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on ROFst.Get", ex);
}
}
public static ROFst GetByRODbID_DTS(int rODbID, DateTime dts)
{
if (!CanGetObject())
@@ -735,6 +787,7 @@ namespace VEPROMS.CSLA.Library
RemoveFromDictionaries(); // if save is successful remove the previous Folder from the cache
AddToCache(rOFst);//Refresh the item in AllList
ProcessRefreshList();
rOFst.ROLookup = null; // B2022-026 RO Memory reduction
return rOFst;
}
catch (Exception ex)
@@ -781,6 +834,7 @@ namespace VEPROMS.CSLA.Library
// CSLATODO: Add any defaults that are necessary
ValidationRules.CheckRules();
}
private void ReadData(SafeDataReader dr)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.ReadData", GetHashCode());
@@ -788,7 +842,8 @@ namespace VEPROMS.CSLA.Library
{
_ROFstID = dr.GetInt32("ROFstID");
_RODbID = dr.GetInt32("RODbID");
_ROLookup = (byte[])dr.GetValue("ROLookup");
//_ROLookup = (byte[])dr.GetValue("ROLookup");
_ROLookup = null; // B2022-026 RO Memory reduction
_Config = dr.GetString("Config");
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");
@@ -804,6 +859,7 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("ROFst.ReadData", ex);
}
}
private void DataPortal_Fetch(PKCriteria criteria)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.DataPortal_Fetch", GetHashCode());
@@ -846,6 +902,7 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("ROFst.DataPortal_Fetch", ex);
}
}
private void DataPortal_Fetch(RODbID_DTSCriteria criteria)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.DataPortal_Fetch", GetHashCode());
@@ -883,6 +940,7 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("ROFst.DataPortal_Fetch", ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Insert()
{
@@ -908,6 +966,7 @@ namespace VEPROMS.CSLA.Library
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.DataPortal_Insert", GetHashCode());
}
}
[Transactional(TransactionalTypes.TransactionScope)]
internal void SQLInsert()
{
@@ -921,12 +980,14 @@ namespace VEPROMS.CSLA.Library
cm.CommandType = CommandType.StoredProcedure;
cm.CommandTimeout = Database.SQLTimeout;
cm.CommandText = "addROFst";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@RODbID", RODbID);
cm.Parameters.AddWithValue("@ROLookup", _ROLookup);
cm.Parameters.AddWithValue("@Config", _Config);
if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
cm.Parameters.AddWithValue("@UserID", _UserID);
// Output Calculated Columns
SqlParameter param_ROFstID = new SqlParameter("@newROFstID", SqlDbType.Int);
param_ROFstID.Direction = ParameterDirection.Output;
@@ -934,11 +995,15 @@ namespace VEPROMS.CSLA.Library
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_LastChanged);
// CSLATODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_ROFstID = (int)cm.Parameters["@newROFstID"].Value;
_LastChanged = (byte[])cm.Parameters["@newLastChanged"].Value;
// Clear Out Any Rofst Binary (Bytes[]) - B2022-026 RO Memory reduction
_ROLookup = null;
}
MarkOld();
// update child objects
@@ -953,6 +1018,7 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("ROFst.SQLInsert", ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Add(SqlConnection cn, ref int rOFstID, RODb myRODb, byte[] rOLookup, string config, DateTime dts, string userID)
{
@@ -964,12 +1030,14 @@ namespace VEPROMS.CSLA.Library
cm.CommandType = CommandType.StoredProcedure;
cm.CommandTimeout = Database.SQLTimeout;
cm.CommandText = "addROFst";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@RODbID", myRODb.RODbID);
cm.Parameters.AddWithValue("@ROLookup", rOLookup);
cm.Parameters.AddWithValue("@Config", config);
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UserID", userID);
// Output Calculated Columns
SqlParameter param_ROFstID = new SqlParameter("@newROFstID", SqlDbType.Int);
param_ROFstID.Direction = ParameterDirection.Output;
@@ -977,8 +1045,12 @@ namespace VEPROMS.CSLA.Library
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_LastChanged);
// CSLATODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Clear Out Any Rofst Binary (Bytes[]) - B2022-026 RO Memory reduction
rOLookup = null;
// Save all values being returned from the Procedure
rOFstID = (int)cm.Parameters["@newROFstID"].Value;
return (byte[])cm.Parameters["@newLastChanged"].Value;
@@ -990,6 +1062,7 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("ROFst.Add", ex);
}
}
[Transactional(TransactionalTypes.TransactionScope)]
protected override void DataPortal_Update()
{
@@ -1013,6 +1086,7 @@ namespace VEPROMS.CSLA.Library
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
}
}
[Transactional(TransactionalTypes.TransactionScope)]
internal void SQLUpdate()
{
@@ -1029,20 +1103,23 @@ namespace VEPROMS.CSLA.Library
cm.CommandType = CommandType.StoredProcedure;
cm.CommandTimeout = Database.SQLTimeout;
cm.CommandText = "updateROFst";
// All Fields including Calculated Fields
cm.Parameters.AddWithValue("@ROFstID", _ROFstID);
cm.Parameters.AddWithValue("@RODbID", RODbID);
cm.Parameters.AddWithValue("@ROLookup", _ROLookup);
cm.Parameters.AddWithValue("@ROLookup", ROFSTLookup.GetRofstLookupBytes(_ROFstID)); // B2022-026 RO Memory reduction - new calls
cm.Parameters.AddWithValue("@Config", _Config);
if (_DTS.Year >= 1753 && _DTS.Year <= 9999) cm.Parameters.AddWithValue("@DTS", _DTS);
cm.Parameters.AddWithValue("@UserID", _UserID);
cm.Parameters.AddWithValue("@LastChanged", _LastChanged);
// Output Calculated Columns
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_LastChanged);
// CSLATODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
_LastChanged = (byte[])cm.Parameters["@newLastChanged"].Value;
}
@@ -1059,6 +1136,7 @@ namespace VEPROMS.CSLA.Library
if (!ex.Message.EndsWith("has been edited by another user.")) throw ex;
}
}
internal void Update()
{
if (!this.IsDirty) return;
@@ -1074,17 +1152,23 @@ namespace VEPROMS.CSLA.Library
if (_ROFstAssociations != null) _ROFstAssociations.Update(this);
if (_ROFstFigures != null) _ROFstFigures.Update(this);
}
[Transactional(TransactionalTypes.TransactionScope)]
public static byte[] Update(SqlConnection cn, ref int rOFstID, int rODbID, byte[] rOLookup, string config, DateTime dts, string userID, ref byte[] lastChanged)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFst.Update", 0);
try
{
// B2022-026 RO Memory reduction - check if we need to get the rOLookup
if (rOLookup == null)
rOLookup = ROFSTLookup.GetRofstLookupBytes(rOFstID);
using (SqlCommand cm = cn.CreateCommand())
{
cm.CommandType = CommandType.StoredProcedure;
cm.CommandTimeout = Database.SQLTimeout;
cm.CommandText = "updateROFst";
// Input All Fields - Except Calculated Columns
cm.Parameters.AddWithValue("@ROFstID", rOFstID);
cm.Parameters.AddWithValue("@RODbID", rODbID);
@@ -1093,12 +1177,14 @@ namespace VEPROMS.CSLA.Library
if (dts.Year >= 1753 && dts.Year <= 9999) cm.Parameters.AddWithValue("@DTS", dts);
cm.Parameters.AddWithValue("@UserID", userID);
cm.Parameters.AddWithValue("@LastChanged", lastChanged);
// Output Calculated Columns
SqlParameter param_LastChanged = new SqlParameter("@newLastChanged", SqlDbType.Timestamp);
param_LastChanged.Direction = ParameterDirection.Output;
cm.Parameters.Add(param_LastChanged);
// CSLATODO: Define any additional output parameters
cm.ExecuteNonQuery();
// Save all values being returned from the Procedure
return (byte[])cm.Parameters["@newLastChanged"].Value;
}
@@ -39,7 +39,11 @@ namespace VEPROMS.CSLA.Library
private static List<ROFstInfo> _CacheList = new List<ROFstInfo>();
protected static void AddToCache(ROFstInfo rOFstInfo)
{
if (!_CacheList.Contains(rOFstInfo)) _CacheList.Add(rOFstInfo); // In AddToCache
if (!_CacheList.Contains(rOFstInfo))
{
rOFstInfo.ClearROLookupBytes(); // B2022-026 RO Memory reduction
_CacheList.Add(rOFstInfo); // In AddToCache
}
}
protected static void RemoveFromCache(ROFstInfo rOFstInfo)
{
@@ -56,6 +60,7 @@ namespace VEPROMS.CSLA.Library
{
_CacheByPrimaryKey[pKey] = new List<ROFstInfo>(); // Add new list for PrimaryKey
}
tmp.ClearROLookupBytes(); // B2022-026 RO Memory reduction
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
_CacheList.RemoveAt(0); // Remove the first ROFstInfo
}
@@ -122,6 +127,7 @@ namespace VEPROMS.CSLA.Library
return _MyRODb;
}
}
private byte[] _ROLookup;
public byte[] ROLookup
{
@@ -129,9 +135,17 @@ namespace VEPROMS.CSLA.Library
get
{
CanReadProperty("ROLookup", true);
return _ROLookup;
//if (_ROLookup == null)
//{
// _ROLookup = ROFSTLookup.GetRofstLookupBytes(_ROFstID);
//}
//return _ROLookup;
// B2022-026 RO Memory reduction
return null;
}
}
private string _Config = string.Empty;
public string Config
{
@@ -238,16 +252,7 @@ namespace VEPROMS.CSLA.Library
foreach (ROFstInfo tmp in _CacheByPrimaryKey[_ROFstID.ToString()])
tmp._ROFstFigureCount = -1; // This will cause the data to be requeried
}
// CSLATODO: Replace base ROFstInfo.ToString function as necessary
/// <summary>
/// Overrides Base ToString
/// </summary>
/// <returns>A string representation of current ROFstInfo</returns>
//public override string ToString()
//{
// return base.ToString();
//}
// CSLATODO: Check ROFstInfo.GetIdValue to assure that the ID returned is unique
/// <summary>
/// Overrides Base GetIdValue - Used internally by CSLA to determine equality
/// </summary>
@@ -256,8 +261,11 @@ namespace VEPROMS.CSLA.Library
{
return MyROFstInfoUnique; // Absolutely Unique ID
}
#endregion
#region Factory Methods
private static int _ROFstInfoUnique = 0;
private static int ROFstInfoUnique
{ get { return ++_ROFstInfoUnique; } }
@@ -272,6 +280,7 @@ namespace VEPROMS.CSLA.Library
private static int _CountCreated = 0;
private static int _CountDisposed = 0;
private static int _CountFinalized = 0;
private static int IncrementCountCreated
{ get { return ++_CountCreated; } }
private int _CountWhenCreated = IncrementCountCreated;
@@ -309,6 +318,12 @@ namespace VEPROMS.CSLA.Library
foreach (ROFstInfo tmpInfo in _CacheByPrimaryKey[key])
tmpInfo.RefreshFields(tmp);
}
// B2022-026 RO Memory reduction
public void ClearROLookupBytes()
{
_ROLookup = null;
}
protected virtual void RefreshFields(ROFst tmp)
{
if (_RODbID != tmp.RODbID)
@@ -318,7 +333,8 @@ namespace VEPROMS.CSLA.Library
}
_MyRODb = null; // Reset list so that the next line gets a new list
if (MyRODb != null) MyRODb.RefreshRODbROFsts(); // Update List for new value
_ROLookup = tmp.ROLookup;
//_ROLookup = tmp.ROLookup;
_ROLookup = null; // B2022-026 RO Memory reduction
_Config = tmp.Config;
_DTS = tmp.DTS;
_UserID = tmp.UserID;
@@ -335,7 +351,8 @@ namespace VEPROMS.CSLA.Library
}
protected virtual void RefreshFields(RODbROFst tmp)
{
_ROLookup = tmp.ROLookup;
//_ROLookup = tmp.ROLookup;
_ROLookup = null; // B2022-026 RO Memory reduction
_Config = tmp.Config;
_DTS = tmp.DTS;
_UserID = tmp.UserID;
@@ -344,8 +361,6 @@ namespace VEPROMS.CSLA.Library
}
public static ROFstInfo Get(int rOFstID)
{
//if (!CanGetObject())
// throw new System.Security.SecurityException("User not authorized to view a ROFst");
try
{
ROFstInfo tmp = GetCachedByPrimaryKey(rOFstID);
@@ -354,11 +369,18 @@ namespace VEPROMS.CSLA.Library
tmp = DataPortal.Fetch<ROFstInfo>(new PKCriteria(rOFstID));
AddToCache(tmp);
}
if (tmp.ErrorMessage == "No Record Found")
{
tmp.Dispose(); // Clean-up ROFstInfo
tmp = null;
}
if (tmp != null)
{
tmp.ClearROLookupBytes(); // B2022-026 RO Memory reduction
}
return tmp;
}
catch (Exception ex)
@@ -366,8 +388,11 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("Error on ROFstInfo.Get", ex);
}
}
#endregion
#region Data Access Portal
internal ROFstInfo(SafeDataReader dr)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstInfo.Constructor", GetHashCode());
@@ -381,6 +406,7 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("ROFstInfo.Constructor", ex);
}
}
[Serializable()]
protected class PKCriteria
{
@@ -392,6 +418,7 @@ namespace VEPROMS.CSLA.Library
_ROFstID = rOFstID;
}
}
private void ReadData(SafeDataReader dr)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstInfo.ReadData", GetHashCode());
@@ -399,7 +426,8 @@ namespace VEPROMS.CSLA.Library
{
_ROFstID = dr.GetInt32("ROFstID");
_RODbID = dr.GetInt32("RODbID");
_ROLookup = (byte[])dr.GetValue("ROLookup");
//_ROLookup = (byte[])dr.GetValue("ROLookup");
_ROLookup = null; // B2022-026 RO Memory reduction
_Config = dr.GetString("Config");
_DTS = dr.GetDateTime("DTS");
_UserID = dr.GetString("UserID");
@@ -413,6 +441,7 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("ROFstInfo.ReadData", ex);
}
}
private void DataPortal_Fetch(PKCriteria criteria)
{
if (_MyLog.IsDebugEnabled) _MyLog.DebugFormat("[{0}] ROFstInfo.DataPortal_Fetch", GetHashCode());
@@ -449,7 +478,9 @@ namespace VEPROMS.CSLA.Library
throw new DbCslaException("ROFstInfo.DataPortal_Fetch", ex);
}
}
#endregion
// Standard Refresh
#region extension
ROFstInfoExtension _ROFstInfoExtension = new ROFstInfoExtension();
@@ -463,7 +494,9 @@ namespace VEPROMS.CSLA.Library
}
#endregion
} // Class
#region Converter
internal class ROFstInfoConverter : ExpandableObjectConverter
{
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destType)
@@ -476,5 +509,6 @@ namespace VEPROMS.CSLA.Library
return base.ConvertTo(context, culture, value, destType);
}
}
#endregion
} // Namespace
+48 -63
View File
@@ -28,17 +28,16 @@ namespace Volian.Controls.Library
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(DisplayRO));
this.tvROFST = new System.Windows.Forms.TreeView();
this.panelValue = new System.Windows.Forms.Panel();
this.lbROId = new DevComponents.DotNetBar.LabelX();
this.lblROID = new DevComponents.DotNetBar.LabelX();
this.pnlROButtons = new System.Windows.Forms.Panel();
this.btnFindDocRO = new DevComponents.DotNetBar.ButtonX();
this.btnGoToRO = new DevComponents.DotNetBar.ButtonX();
this.btnPreviewRO = new DevComponents.DotNetBar.ButtonX();
this.btnCancelRO = new DevComponents.DotNetBar.ButtonX();
this.btnSaveRO = new DevComponents.DotNetBar.ButtonX();
this.btnFindDocRO = new DevComponents.DotNetBar.ButtonX();
this.panelRoValue = new System.Windows.Forms.Panel();
this.tbROValue = new DevComponents.DotNetBar.Controls.TextBoxX();
this.lblROValue = new DevComponents.DotNetBar.LabelX();
@@ -53,10 +52,9 @@ namespace Volian.Controls.Library
//
this.tvROFST.Dock = System.Windows.Forms.DockStyle.Fill;
this.tvROFST.HideSelection = false;
this.tvROFST.Location = new System.Drawing.Point(0, 248);
this.tvROFST.Margin = new System.Windows.Forms.Padding(4);
this.tvROFST.Location = new System.Drawing.Point(0, 202);
this.tvROFST.Name = "tvROFST";
this.tvROFST.Size = new System.Drawing.Size(311, 376);
this.tvROFST.Size = new System.Drawing.Size(233, 305);
this.tvROFST.TabIndex = 5;
this.tvROFST.BeforeExpand += new System.Windows.Forms.TreeViewCancelEventHandler(this.tvROFST_BeforeExpand);
this.tvROFST.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvROFST_AfterSelect);
@@ -70,9 +68,8 @@ namespace Volian.Controls.Library
this.panelValue.Controls.Add(this.panelRoValue);
this.panelValue.Dock = System.Windows.Forms.DockStyle.Top;
this.panelValue.Location = new System.Drawing.Point(0, 0);
this.panelValue.Margin = new System.Windows.Forms.Padding(4);
this.panelValue.Name = "panelValue";
this.panelValue.Size = new System.Drawing.Size(311, 180);
this.panelValue.Size = new System.Drawing.Size(233, 146);
this.panelValue.TabIndex = 7;
//
// lbROId
@@ -83,10 +80,10 @@ namespace Volian.Controls.Library
this.lbROId.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lbROId.Dock = System.Windows.Forms.DockStyle.Left;
this.lbROId.ForeColor = System.Drawing.SystemColors.Highlight;
this.lbROId.Location = new System.Drawing.Point(61, 30);
this.lbROId.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.lbROId.Location = new System.Drawing.Point(48, 24);
this.lbROId.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.lbROId.Name = "lbROId";
this.lbROId.Size = new System.Drawing.Size(244, 40);
this.lbROId.Size = new System.Drawing.Size(183, 33);
this.superTooltip1.SetSuperTooltip(this.lbROId, new DevComponents.DotNetBar.SuperTooltipInfo("RO ID", "", "The RO ID for the selected RO Value will be displayed here. Double-Click to open" +
" the RO Editor.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(150, 80)));
this.lbROId.TabIndex = 11;
@@ -99,14 +96,13 @@ namespace Volian.Controls.Library
//
this.lblROID.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lblROID.Dock = System.Windows.Forms.DockStyle.Left;
this.lblROID.Location = new System.Drawing.Point(0, 30);
this.lblROID.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.lblROID.Location = new System.Drawing.Point(0, 24);
this.lblROID.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.lblROID.Name = "lblROID";
this.lblROID.Size = new System.Drawing.Size(61, 40);
this.lblROID.Size = new System.Drawing.Size(48, 33);
this.superTooltip1.SetSuperTooltip(this.lblROID, new DevComponents.DotNetBar.SuperTooltipInfo("RO ID", "", "The RO ID for the selected RO Value will be displayed here.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(150, 80)));
this.lblROID.TabIndex = 10;
this.lblROID.Text = "RO ID:";
this.lblROID.TextAlignment = System.Drawing.StringAlignment.Center;
//
// pnlROButtons
//
@@ -116,27 +112,41 @@ namespace Volian.Controls.Library
this.pnlROButtons.Controls.Add(this.btnCancelRO);
this.pnlROButtons.Controls.Add(this.btnSaveRO);
this.pnlROButtons.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pnlROButtons.Location = new System.Drawing.Point(0, 70);
this.pnlROButtons.Margin = new System.Windows.Forms.Padding(4);
this.pnlROButtons.Location = new System.Drawing.Point(0, 57);
this.pnlROButtons.Name = "pnlROButtons";
this.pnlROButtons.Size = new System.Drawing.Size(311, 110);
this.pnlROButtons.Size = new System.Drawing.Size(233, 89);
this.pnlROButtons.TabIndex = 9;
//
// btnFindDocRO
//
this.btnFindDocRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnFindDocRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnFindDocRO.Dock = System.Windows.Forms.DockStyle.Top;
this.btnFindDocRO.Enabled = false;
this.btnFindDocRO.Location = new System.Drawing.Point(0, 73);
this.btnFindDocRO.Name = "btnFindDocRO";
this.btnFindDocRO.Size = new System.Drawing.Size(233, 18);
this.superTooltip1.SetSuperTooltip(this.btnFindDocRO, new DevComponents.DotNetBar.SuperTooltipInfo("Find Doc RO", "", "Determine if there are any ROs for the selected text in a Word Document. If found" +
", the list of ROs is displayed.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.btnFindDocRO.TabIndex = 9;
this.btnFindDocRO.Text = "Find Doc RO";
this.btnFindDocRO.Click += new System.EventHandler(this.btnFindDocRO_Click);
//
// btnGoToRO
//
this.btnGoToRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnGoToRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnGoToRO.Dock = System.Windows.Forms.DockStyle.Top;
this.btnGoToRO.Enabled = false;
this.btnGoToRO.Location = new System.Drawing.Point(0, 89);
this.btnGoToRO.Location = new System.Drawing.Point(0, 55);
this.btnGoToRO.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnGoToRO.Name = "btnGoToRO";
this.btnGoToRO.Size = new System.Drawing.Size(311, 22);
this.btnGoToRO.Size = new System.Drawing.Size(233, 18);
this.btnGoToRO.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.superTooltip1.SetSuperTooltip(this.btnGoToRO, new DevComponents.DotNetBar.SuperTooltipInfo("Go To", "", "Opens the RO Editor and positions to the selected RO.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.btnGoToRO.TabIndex = 11;
this.btnGoToRO.Text = "Go To";
this.btnGoToRO.Click += new System.EventHandler(this.btnGoToRO_Click);
this.superTooltip1.SetSuperTooltip(this.btnGoToRO, new DevComponents.DotNetBar.SuperTooltipInfo("Go To", "", "Opens the RO Editor and positions to the selected RO.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); // C2020-020
//
// btnPreviewRO
//
@@ -144,10 +154,10 @@ namespace Volian.Controls.Library
this.btnPreviewRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnPreviewRO.Dock = System.Windows.Forms.DockStyle.Top;
this.btnPreviewRO.Enabled = false;
this.btnPreviewRO.Location = new System.Drawing.Point(0, 67);
this.btnPreviewRO.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.btnPreviewRO.Location = new System.Drawing.Point(0, 37);
this.btnPreviewRO.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.btnPreviewRO.Name = "btnPreviewRO";
this.btnPreviewRO.Size = new System.Drawing.Size(311, 22);
this.btnPreviewRO.Size = new System.Drawing.Size(233, 18);
this.superTooltip1.SetSuperTooltip(this.btnPreviewRO, new DevComponents.DotNetBar.SuperTooltipInfo("Preview", "", "This will Preview the selected RO Table, X/Y Plot, or Image.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(150, 80)));
this.btnPreviewRO.TabIndex = 10;
this.btnPreviewRO.Text = "Preview";
@@ -159,10 +169,9 @@ namespace Volian.Controls.Library
this.btnCancelRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnCancelRO.Dock = System.Windows.Forms.DockStyle.Top;
this.btnCancelRO.Enabled = false;
this.btnCancelRO.Location = new System.Drawing.Point(0, 44);
this.btnCancelRO.Margin = new System.Windows.Forms.Padding(4);
this.btnCancelRO.Location = new System.Drawing.Point(0, 18);
this.btnCancelRO.Name = "btnCancelRO";
this.btnCancelRO.Size = new System.Drawing.Size(311, 23);
this.btnCancelRO.Size = new System.Drawing.Size(233, 19);
this.superTooltip1.SetSuperTooltip(this.btnCancelRO, new DevComponents.DotNetBar.SuperTooltipInfo("Cancel", "", "This become active when you about to replace an existing RO link in you procedure" +
".\r\n\r\nNOTE: This willL NOT un-do after you select the Save RO button.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(195, 145)));
this.btnCancelRO.TabIndex = 9;
@@ -175,40 +184,22 @@ namespace Volian.Controls.Library
this.btnSaveRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnSaveRO.Dock = System.Windows.Forms.DockStyle.Top;
this.btnSaveRO.Enabled = false;
this.btnSaveRO.Location = new System.Drawing.Point(0, 22);
this.btnSaveRO.Margin = new System.Windows.Forms.Padding(4);
this.btnSaveRO.Location = new System.Drawing.Point(0, 0);
this.btnSaveRO.Name = "btnSaveRO";
this.btnSaveRO.Size = new System.Drawing.Size(311, 22);
this.superTooltip1.SetSuperTooltip(this.btnSaveRO, new DevComponents.DotNetBar.SuperTooltipInfo("Save RO", "", "Saves the RO at the cursor location in either a step or a Word document.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); // C2020-020
this.btnSaveRO.Size = new System.Drawing.Size(233, 18);
this.superTooltip1.SetSuperTooltip(this.btnSaveRO, new DevComponents.DotNetBar.SuperTooltipInfo("Save RO", "", "Saves the RO at the cursor location in either a step or a Word document.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.btnSaveRO.TabIndex = 8;
this.btnSaveRO.Text = "Save RO";
this.btnSaveRO.Click += new System.EventHandler(this.btnSaveRO_Click);
//
// btnFindDocRO
//
this.btnFindDocRO.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
this.btnFindDocRO.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
this.btnFindDocRO.Dock = System.Windows.Forms.DockStyle.Top;
this.btnFindDocRO.Enabled = false;
this.btnFindDocRO.Location = new System.Drawing.Point(0, 0);
this.btnFindDocRO.Margin = new System.Windows.Forms.Padding(4);
this.btnFindDocRO.Name = "btnFindDocRO";
this.btnFindDocRO.Size = new System.Drawing.Size(311, 22);
//see if there are any ro's for the selected text & if so, display in the lbFound li
this.superTooltip1.SetSuperTooltip(this.btnFindDocRO, new DevComponents.DotNetBar.SuperTooltipInfo("Find Doc RO", "", "Determine if there are any ROs for the selected text in a Word Document. If found, the list of ROs is displayed." , null, null, DevComponents.DotNetBar.eTooltipColor.Gray)); // C2020-020
this.btnFindDocRO.TabIndex = 9;
this.btnFindDocRO.Text = "Find Doc RO";
this.btnFindDocRO.Click += new System.EventHandler(this.btnFindDocRO_Click);
//
// panelRoValue
//
this.panelRoValue.Controls.Add(this.tbROValue);
this.panelRoValue.Controls.Add(this.lblROValue);
this.panelRoValue.Dock = System.Windows.Forms.DockStyle.Top;
this.panelRoValue.Location = new System.Drawing.Point(0, 0);
this.panelRoValue.Margin = new System.Windows.Forms.Padding(4);
this.panelRoValue.Name = "panelRoValue";
this.panelRoValue.Size = new System.Drawing.Size(311, 30);
this.panelRoValue.Size = new System.Drawing.Size(233, 24);
this.panelRoValue.TabIndex = 8;
//
// tbROValue
@@ -220,11 +211,10 @@ namespace Volian.Controls.Library
this.tbROValue.Border.Class = "TextBoxBorder";
this.tbROValue.Border.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.tbROValue.Dock = System.Windows.Forms.DockStyle.Top;
this.tbROValue.Location = new System.Drawing.Point(64, 0);
this.tbROValue.Margin = new System.Windows.Forms.Padding(4);
this.tbROValue.Location = new System.Drawing.Point(48, 0);
this.tbROValue.Name = "tbROValue";
this.tbROValue.ReadOnly = true;
this.tbROValue.Size = new System.Drawing.Size(247, 22);
this.tbROValue.Size = new System.Drawing.Size(185, 20);
this.superTooltip1.SetSuperTooltip(this.tbROValue, new DevComponents.DotNetBar.SuperTooltipInfo("RO Value", "", "The value of selected RO will be displayed here.\r\n\r\nExceptions:\r\n- Tables, X/Y Pl" +
"ots, and Images will state what they are. The Preview button will display the va" +
"lue.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(230, 135)));
@@ -239,17 +229,15 @@ namespace Volian.Controls.Library
//
this.lblROValue.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lblROValue.Dock = System.Windows.Forms.DockStyle.Left;
this.lblROValue.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblROValue.Font = new System.Drawing.Font("Microsoft Sans Serif", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblROValue.Location = new System.Drawing.Point(0, 0);
this.lblROValue.Margin = new System.Windows.Forms.Padding(4);
this.lblROValue.Name = "lblROValue";
this.lblROValue.Size = new System.Drawing.Size(64, 30);
this.lblROValue.Size = new System.Drawing.Size(48, 24);
this.superTooltip1.SetSuperTooltip(this.lblROValue, new DevComponents.DotNetBar.SuperTooltipInfo("RO Value", "", "The value of selected RO will be displayed here.\r\n\r\nExceptions:\r\n- Tables, X/Y Pl" +
"ots, and Images will state what they are. The Preview button will display the va" +
"lue.", null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(230, 135)));
this.lblROValue.TabIndex = 6;
this.lblROValue.Text = "RO Value:";
this.lblROValue.TextLineAlignment = System.Drawing.StringAlignment.Near;
//
// superTooltip1
//
@@ -260,11 +248,9 @@ namespace Volian.Controls.Library
//
this.lbFound.Dock = System.Windows.Forms.DockStyle.Top;
this.lbFound.FormattingEnabled = true;
this.lbFound.ItemHeight = 16;
this.lbFound.Location = new System.Drawing.Point(0, 180);
this.lbFound.Margin = new System.Windows.Forms.Padding(4);
this.lbFound.Location = new System.Drawing.Point(0, 146);
this.lbFound.Name = "lbFound";
this.lbFound.Size = new System.Drawing.Size(311, 68);
this.lbFound.Size = new System.Drawing.Size(233, 56);
this.superTooltip1.SetSuperTooltip(this.lbFound, new DevComponents.DotNetBar.SuperTooltipInfo("Available ROs", "", "ROs that are available are displayed in a tree view. ", null, null, DevComponents.DotNetBar.eTooltipColor.Gray));
this.lbFound.TabIndex = 8;
this.lbFound.Visible = false;
@@ -272,14 +258,13 @@ namespace Volian.Controls.Library
//
// DisplayRO
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.tvROFST);
this.Controls.Add(this.lbFound);
this.Controls.Add(this.panelValue);
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "DisplayRO";
this.Size = new System.Drawing.Size(311, 624);
this.Size = new System.Drawing.Size(233, 507);
this.panelValue.ResumeLayout(false);
this.pnlROButtons.ResumeLayout(false);
this.panelRoValue.ResumeLayout(false);
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -537,7 +537,8 @@ namespace Volian.Controls.Library
}
else
{
ActivateRemainingTab((Bar)sender);
if (!ShuttingDown) // B2022-026 RO Memory Reduction code - don't activate if shutting down PROMS
ActivateRemainingTab((Bar)sender);
}
}
#endregion
+15 -8
View File
@@ -3347,10 +3347,17 @@ namespace Volian.Controls.Library
using (DocVersion dv = DocVersion.Get(Mydvi.VersionID))
{
swROUpdate = new System.IO.StreamWriter(ROFstInfo.ROUpdateResultsPath(Mydvi));
// B2022-026 RO Memory Reduction code - first load the new ro.fst so that we can assign the ROTableUpdate event to the correct roFstInfo
if (dv.ROfstLoadingFigures || dv.NewerRoFst) // B2017-125 see if loading figures was completed
{
// only load the RO.fst
ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh);
roFstInfo = Mydvi.DocVersionAssociations[0].MyROFst;
}
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
swROUpdate = new System.IO.StreamWriter(ROFstInfo.ROUpdateResultsPath(Mydvi));// RO changes placed in file in the Documents\VEPROMS folder
ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file
ROFst newrofst = ROFstInfo.RefreshROFst(roFstInfo.MyRODb, dv.DocVersionAssociations[0], dv, roFstInfo, DoProgressBarRefresh, null);
ROFst newrofst = ROFstInfo.RefreshROFst(dv, roFstInfo, DoProgressBarRefresh, null);
swROUpdate.Close();
ContentInfo.StaticContentInfoChange -= ContentInfo_StaticContentInfoChange;
roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
@@ -3720,12 +3727,12 @@ namespace Volian.Controls.Library
}
private void btnRefObjRefresh_Click(object sender, System.EventArgs e)
{
// This code is disabled - Button is not visible
this.Cursor = Cursors.WaitCursor;
ProcedureInfo.ResetROCounters();
ProcedureInfo.RefreshReferenceObjects(MyItemInfo.MyProcedure as ProcedureInfo);
this.Cursor = Cursors.Default;
FlexibleMessageBox.Show(this, string.Format("Checked {0} referenced objects, fixed {1} referenced objects", ProcedureInfo.ROCheckCount, ProcedureInfo.ROFixCount), "Results of Refresh Referenced Objects", MessageBoxButtons.OK, MessageBoxIcon.Information);
//// This code is disabled - Button is not visible
//this.Cursor = Cursors.WaitCursor;
// ProcedureInfo.ResetROCounters();
// ProcedureInfo.RefreshReferenceObjects(MyItemInfo.MyProcedure as ProcedureInfo);
// this.Cursor = Cursors.Default;
//FlexibleMessageBox.Show(this, string.Format("Checked {0} referenced objects, fixed {1} referenced objects", ProcedureInfo.ROCheckCount, ProcedureInfo.ROFixCount), "Results of Refresh Referenced Objects", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
//private FindReplace dlgFindReplace = null;
private void btnFindRplDlg_Click(object sender, EventArgs e)
+9 -2
View File
@@ -1955,10 +1955,17 @@ namespace Volian.Controls.Library
int ownerid = MySessionInfo.CheckOutItem(MyDVI.VersionID, CheckOutType.DocVersion);
using (DocVersion dv = DocVersion.Get(MyDVI.VersionID))
{
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
swROUpdate = new System.IO.StreamWriter(ROFstInfo.ROUpdateResultsPath(MyDVI)); // RO changes placed in file in the Documents\VEPROMS folder
// B2022-026 RO Memory Reduction code - first load the new ro.fst so that we can assign the ROTableUpdate event to the correct roFstInfo
if (dv.ROfstLoadingFigures || dv.NewerRoFst) // B2017-125 see if loading figures was completed
{
// only load the RO.fst
ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh);
roFstInfo = MyDVI.DocVersionAssociations[0].MyROFst;
}
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file
ROFst newrofst = ROFstInfo.RefreshROFst(roFstInfo.MyRODb, dv.DocVersionAssociations[0], dv, roFstInfo, DoProgressBarRefresh, null);
ROFst newrofst = ROFstInfo.RefreshROFst(dv, roFstInfo, DoProgressBarRefresh, null);
swROUpdate.Close();
ContentInfo.StaticContentInfoChange -= ContentInfo_StaticContentInfoChange;
roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
File diff suppressed because it is too large Load Diff