C2026-007 Upgrade - Generate Missing Word Attachments/B2026-027 Update Refresh Tables For Search Tooltip
This commit is contained in:
@@ -62,6 +62,8 @@ namespace VEPROMS
|
||||
swRmObsoleteROData.Enabled = false;
|
||||
swRmOrphanDataRecs.Enabled = false;
|
||||
swRefreshWordAttmts.Enabled = false;
|
||||
swRegenWordAttmts.Enabled = false;
|
||||
swRefreshTblsForSrch.Enabled = false;
|
||||
swStandardHypenChars.Enabled = false;
|
||||
|
||||
//if not full admin, disable Purge Change History
|
||||
@@ -648,11 +650,111 @@ namespace VEPROMS
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
|
||||
// B2022-047 - refresh the Content/Text field for table, i.e. Grid, Data so that search will find text in the Grid
|
||||
// NOTE that an out of memeory error occurs when having to process alot of tables. A config flag is used on the
|
||||
// grid record to flag that this operation has been run. And a message is placed in the result window stating to
|
||||
// rerun until all tables/text fields are completed.
|
||||
private void RefreshTablesForSearch()
|
||||
private int RegenCounter = 0;
|
||||
private int RegenTotal = 0;
|
||||
private const int TicksToupdate = 300000; //5 minutes(300 seconds).
|
||||
|
||||
// C2026-007 - Generate Missing PDFs
|
||||
// regenerates the saved attachment PDFs from the database
|
||||
// so that this is not needed the next time the procedures are printed. This also forces ROs to be refreshed in the attachments
|
||||
private void RegenPDFs()
|
||||
{
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
DateTime pStart = DateTime.Now;
|
||||
txtProcess.AppendText("Generating missing Word Attachments");
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText(string.Format("Started: {0}", pStart.ToString("MM/dd/yyyy @ HH:mm")));
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText("Gathering data for Word Attachments that need generated.");
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
Application.DoEvents();
|
||||
|
||||
//get data of missing Docs by Unit that will need regenerated
|
||||
DataTable dt = Maintenance.GetMissingDocsByUnit();
|
||||
RegenCounter = 0;
|
||||
RegenTotal = dt.Rows.Count;
|
||||
txtProcess.AppendText($"Word Attachments to be generated: {RegenTotal}");
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText($"Note that this will provide updates approximately every {TicksToupdate/60000} minutes. Some attachments may take longer than others due to size/number of pages/number of ROs. If PROMS is in the middle of generating a large attachment, it may delay the update message until generation of that attachment completes (in that case taking more than 5 minutes between updates).");
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtResults.AppendText($"{RegenTotal} Word Attachments to be generated.");
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
|
||||
//generate as if not debug
|
||||
int debugstatus = MSWordToPDF.DebugStatus;
|
||||
MSWordToPDF.DebugStatus = 0;
|
||||
MSWordToPDF.OverrideColor = Color.Transparent;
|
||||
|
||||
Timer timer1 = new Timer();
|
||||
timer1.Tick += new EventHandler(UpdateRegenProgress);
|
||||
timer1.Interval = TicksToupdate;
|
||||
timer1.Start();
|
||||
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
//Do Generation
|
||||
using (Section sect = Section.Get((int)dr["SectionID"]))
|
||||
{
|
||||
using (DocumentInfo docInfo = DocumentInfo.Get((int)dr["DocID"]))
|
||||
{
|
||||
if (!dr.IsNull("UnitID")) sect.MyItemInfo.MyDocVersion.DocVersionConfig.SelectedSlave = (int)dr["UnitID"];
|
||||
MSWordToPDF.SetDocPdf(docInfo, sect.MyItemInfo);
|
||||
}
|
||||
}
|
||||
|
||||
//Increment - message every _ minutes
|
||||
RegenCounter++;
|
||||
}
|
||||
|
||||
//done with loop - stop timer and destroy it
|
||||
timer1.Stop();
|
||||
timer1.Dispose();
|
||||
|
||||
//Change DebugStatus Back to what it was
|
||||
if (debugstatus == 1)
|
||||
{
|
||||
MSWordToPDF.DebugStatus = 1;
|
||||
MSWordToPDF.OverrideColor = Color.Red;
|
||||
}
|
||||
else
|
||||
{
|
||||
MSWordToPDF.DebugStatus = 0;
|
||||
MSWordToPDF.OverrideColor = Color.Transparent;
|
||||
}
|
||||
|
||||
//end messaging
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText($"Word Attachments Generated: {RegenTotal}");
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
txtResults.AppendText($"{RegenTotal} Word Attachments generated.");
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText($"Completed: {DateTime.Now:G}");
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
Application.DoEvents();
|
||||
this.Cursor = Cursors.Default;
|
||||
}
|
||||
|
||||
//Outputs the Progress of Regenerating the PDFs every __ minutes
|
||||
private void UpdateRegenProgress(Object myObject, EventArgs myEventArgs)
|
||||
{
|
||||
string progress_str = $"Generated {RegenCounter} of {RegenTotal} ({(decimal)RegenCounter / RegenTotal * 100M:F2}%): {DateTime.Now:G}";
|
||||
txtProcess.AppendText(progress_str);
|
||||
txtProcess.AppendText(Environment.NewLine);
|
||||
txtResults.AppendText(progress_str);
|
||||
txtResults.AppendText(Environment.NewLine);
|
||||
}
|
||||
|
||||
// B2022-047 - refresh the Content/Text field for table, i.e. Grid, Data so that search will find text in the Grid
|
||||
// NOTE that an out of memeory error occurs when having to process alot of tables. A config flag is used on the
|
||||
// grid record to flag that this operation has been run. And a message is placed in the result window stating to
|
||||
// rerun until all tables/text fields are completed.
|
||||
private void RefreshTablesForSearch()
|
||||
{
|
||||
this.Cursor = Cursors.WaitCursor;
|
||||
DateTime pStart = DateTime.Now;
|
||||
@@ -1305,7 +1407,8 @@ namespace VEPROMS
|
||||
DevComponents.DotNetBar.StepItem siObsoleteROData = new DevComponents.DotNetBar.StepItem("siObsoleteROData", "Obsolete RO Data");
|
||||
DevComponents.DotNetBar.StepItem siStandardHyphens = new DevComponents.DotNetBar.StepItem("siStandardHyphens", "Standardize Hyphens");
|
||||
DevComponents.DotNetBar.StepItem siRefreshAttmts = new DevComponents.DotNetBar.StepItem("siRefreshAttmts", "Refresh Word Attachments");
|
||||
DevComponents.DotNetBar.StepItem siRefreshTblsSrchTxt = new DevComponents.DotNetBar.StepItem("siRefreshTblsSrchTxt", "Refresh Tables For Search");
|
||||
DevComponents.DotNetBar.StepItem siRegenAttmts = new DevComponents.DotNetBar.StepItem("siRegenAttmts", "Regenerate Word Attachments");
|
||||
DevComponents.DotNetBar.StepItem siRefreshTblsSrchTxt = new DevComponents.DotNetBar.StepItem("siRefreshTblsSrchTxt", "Refresh Tables For Search");
|
||||
// this will update/rebuild the progress bar in the bottom panel of Admin Tools
|
||||
private void setupProgessSteps1()
|
||||
{
|
||||
@@ -1323,7 +1426,9 @@ namespace VEPROMS
|
||||
progressSteps1.Items.Add(siStandardHyphens);
|
||||
if (swRefreshWordAttmts.Value)
|
||||
progressSteps1.Items.Add(siRefreshAttmts);
|
||||
if (swRefreshTblsForSrch.Value)
|
||||
if (swRegenWordAttmts.Value)
|
||||
progressSteps1.Items.Add(siRegenAttmts);
|
||||
if (swRefreshTblsForSrch.Value)
|
||||
progressSteps1.Items.Add(siRefreshTblsSrchTxt);
|
||||
splitContainer3.Panel2Collapsed = false;
|
||||
progressSteps1.Visible = true;
|
||||
@@ -1487,7 +1592,13 @@ namespace VEPROMS
|
||||
DeletePDFs(); // refresh word attachments
|
||||
StepProgress(prgStpIdx, 100);
|
||||
}
|
||||
if (swRefreshTblsForSrch.Value)
|
||||
if (swRegenWordAttmts.Value)
|
||||
{
|
||||
StepProgress(++prgStpIdx, 50);
|
||||
RegenPDFs(); // generate missing pdfs
|
||||
StepProgress(prgStpIdx, 100);
|
||||
}
|
||||
if (swRefreshTblsForSrch.Value)
|
||||
{
|
||||
StepProgress(++prgStpIdx, 50);
|
||||
RefreshTablesForSearch();
|
||||
|
||||
Reference in New Issue
Block a user