B2022-026 RO Memory reduction coding
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user