From bc3c14589ec34b2b162c13ab5f304abd1ee6099d Mon Sep 17 00:00:00 2001 From: mschill Date: Mon, 16 Mar 2026 14:45:04 -0400 Subject: [PATCH] C2026-007 Upgrade - Generate Missing Word Attachments/B2026-027 Update Refresh Tables For Search Tooltip --- PROMS/VEPROMS User Interface/PROMSFixes.Sql | 44 +++- .../frmBatchRefresh.Designer.cs | 53 ++++- .../VEPROMS User Interface/frmBatchRefresh.cs | 127 +++++++++++- .../frmBatchRefresh.resx | 191 +++++++++--------- .../Extension/DocumentExt.cs | 72 +++---- PROMS/VEPROMS.CSLA.Library/Generated/Pdf.cs | 21 +- .../Minimal/Maintenance.cs | 35 +++- 7 files changed, 388 insertions(+), 155 deletions(-) diff --git a/PROMS/VEPROMS User Interface/PROMSFixes.Sql b/PROMS/VEPROMS User Interface/PROMSFixes.Sql index 81fa98e6..0cbd1891 100644 --- a/PROMS/VEPROMS User Interface/PROMSFixes.Sql +++ b/PROMS/VEPROMS User Interface/PROMSFixes.Sql @@ -24736,6 +24736,46 @@ GO ========================================================================================================== */ +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[GetMissingDocsByUnit]') AND OBJECTPROPERTY(id,N'IsProcedure') = 1) + DROP PROCEDURE [GetMissingDocsByUnit]; + +GO + +-- ============================================= +-- Author: Matthew Schill +-- Create date: 02/27/2026 +-- Description: Get Missing Docs by Unit for Generating Pdf table +-- ============================================= +CREATE PROCEDURE [dbo].[GetMissingDocsByUnit] +AS +BEGIN + + select Docs.DocID, UnitID, SectionID = MIN(SectionID) + FROM + (SELECT DISTINCT [DocID] + FROM [VEPROMS_Barakah].[dbo].[tblDocuments]) Docs + INNER JOIN Entries on Docs.DocID = Entries.DocID + INNER JOIN Contents on Entries.ContentID = Contents.ContentID + inner join Items on Items.ContentID = Contents.ContentID + outer apply + (Select UnitID = ID FROM dbo.vefn_SplitInt([dbo].[ve_GetItemDerivedApplicability](Items.ItemID),',')) Unit + outer apply + (Select TOP 1 SectionID = ItemID FROM Contents SecC where SecC.ContentID = Contents.ContentID + AND (SecC.Type / 10000) = 1 + AND dbo.vefn_GetVersionIDByItemID(ItemID) IS NOT NULL + ) Section + left outer join Pdfs on Pdfs.DocID = Docs.DocID AND Pdfs.DebugStatus = CASE WHEN UNITID IS NULL THEN 0 ELSE UnitID * 10 END + WHERE Pdfs.DocID IS NULL + AND SectionID IS NOT NULL + Group by Docs.DocID, UnitID + order by Docs.DocID, UnitID + + RETURN +END + +IF (@@Error = 0) PRINT 'Procedure Creation: [GetMissingDocsByUnit] Succeeded' +ELSE PRINT 'Procedure Creation: [GetMissingDocsByUnit] Error on Creation' +GO /* --------------------------------------------------------------------------- @@ -24770,8 +24810,8 @@ BEGIN TRY -- Try Block DECLARE @RevDate varchar(255) DECLARE @RevDescription varchar(255) - set @RevDate = '03/12/2026 11:00 AM' - set @RevDescription = 'Update to Purge Change History Tool' + set @RevDate = '03/13/2026 7:00 AM' + set @RevDescription = 'Added Get Missing Docs by Unit for Generating Pdf table' Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription diff --git a/PROMS/VEPROMS User Interface/frmBatchRefresh.Designer.cs b/PROMS/VEPROMS User Interface/frmBatchRefresh.Designer.cs index 7cc148dd..41c381d5 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefresh.Designer.cs +++ b/PROMS/VEPROMS User Interface/frmBatchRefresh.Designer.cs @@ -113,6 +113,8 @@ this.lblAdmToolProgressType = new DevComponents.DotNetBar.LabelX(); this.buttonItem1 = new DevComponents.DotNetBar.ButtonItem(); this.superTooltip1 = new DevComponents.DotNetBar.SuperTooltip(); + this.swRegenWordAttmts = new DevComponents.DotNetBar.Controls.SwitchButton(); + this.labelX1 = new DevComponents.DotNetBar.LabelX(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit(); this.splitContainer3.Panel1.SuspendLayout(); this.splitContainer3.Panel2.SuspendLayout(); @@ -902,6 +904,8 @@ // // sideNavPanel2 // + this.sideNavPanel2.Controls.Add(this.swRegenWordAttmts); + this.sideNavPanel2.Controls.Add(this.labelX1); this.sideNavPanel2.Controls.Add(this.swRefreshTblsForSrch); this.sideNavPanel2.Controls.Add(this.lblRefreshTblForSrch); this.sideNavPanel2.Controls.Add(this.warningBox4); @@ -930,11 +934,11 @@ // // this.swRefreshTblsForSrch.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; - this.swRefreshTblsForSrch.Location = new System.Drawing.Point(10, 153); + this.swRefreshTblsForSrch.Location = new System.Drawing.Point(10, 178); this.swRefreshTblsForSrch.Name = "swRefreshTblsForSrch"; this.swRefreshTblsForSrch.Size = new System.Drawing.Size(91, 22); this.swRefreshTblsForSrch.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.superTooltip1.SetSuperTooltip(this.swRefreshTblsForSrch, new DevComponents.DotNetBar.SuperTooltipInfo("Refresh Word Attachments", "", resources.GetString("swRefreshTblsForSrch.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(300, 200))); + this.superTooltip1.SetSuperTooltip(this.swRefreshTblsForSrch, new DevComponents.DotNetBar.SuperTooltipInfo("Refesh Tables For Search", "", resources.GetString("swRefreshTblsForSrch.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(300, 125))); this.swRefreshTblsForSrch.SwitchClickTogglesValue = true; this.swRefreshTblsForSrch.TabIndex = 32; this.swRefreshTblsForSrch.Value = true; @@ -949,10 +953,10 @@ // this.lblRefreshTblForSrch.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.lblRefreshTblForSrch.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblRefreshTblForSrch.Location = new System.Drawing.Point(107, 153); + this.lblRefreshTblForSrch.Location = new System.Drawing.Point(107, 178); this.lblRefreshTblForSrch.Name = "lblRefreshTblForSrch"; this.lblRefreshTblForSrch.Size = new System.Drawing.Size(186, 22); - this.superTooltip1.SetSuperTooltip(this.lblRefreshTblForSrch, new DevComponents.DotNetBar.SuperTooltipInfo("Refresh Word Attachments", "", resources.GetString("lblRefreshTblForSrch.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(300, 200))); + this.superTooltip1.SetSuperTooltip(this.lblRefreshTblForSrch, new DevComponents.DotNetBar.SuperTooltipInfo("Refresh Tables For Search", "", resources.GetString("lblRefreshTblForSrch.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(300, 125))); this.lblRefreshTblForSrch.TabIndex = 31; this.lblRefreshTblForSrch.Text = "Refresh Tables For Search"; // @@ -961,7 +965,7 @@ this.warningBox4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(196)))), ((int)(((byte)(219)))), ((int)(((byte)(249))))); this.warningBox4.CloseButtonVisible = false; this.warningBox4.Image = ((System.Drawing.Image)(resources.GetObject("warningBox4.Image"))); - this.warningBox4.Location = new System.Drawing.Point(12, 264); + this.warningBox4.Location = new System.Drawing.Point(12, 287); this.warningBox4.Margin = new System.Windows.Forms.Padding(4); this.warningBox4.Name = "warningBox4"; this.warningBox4.OptionsButtonVisible = false; @@ -974,7 +978,7 @@ this.warningBox2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(196)))), ((int)(((byte)(219)))), ((int)(((byte)(249))))); this.warningBox2.CloseButtonVisible = false; this.warningBox2.Image = ((System.Drawing.Image)(resources.GetObject("warningBox2.Image"))); - this.warningBox2.Location = new System.Drawing.Point(12, 302); + this.warningBox2.Location = new System.Drawing.Point(12, 325); this.warningBox2.Margin = new System.Windows.Forms.Padding(4); this.warningBox2.Name = "warningBox2"; this.warningBox2.OptionsButtonVisible = false; @@ -1128,7 +1132,7 @@ // line2 // this.line2.BackColor = System.Drawing.Color.Transparent; - this.line2.Location = new System.Drawing.Point(4, 237); + this.line2.Location = new System.Drawing.Point(4, 260); this.line2.Name = "line2"; this.line2.Size = new System.Drawing.Size(281, 12); this.line2.TabIndex = 20; @@ -1140,7 +1144,7 @@ this.btnRunRepair.Checked = true; this.btnRunRepair.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; this.btnRunRepair.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnRunRepair.Location = new System.Drawing.Point(5, 198); + this.btnRunRepair.Location = new System.Drawing.Point(5, 221); this.btnRunRepair.Name = "btnRunRepair"; this.btnRunRepair.Size = new System.Drawing.Size(280, 23); this.btnRunRepair.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; @@ -1303,6 +1307,37 @@ this.superTooltip1.DefaultTooltipSettings = new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray); this.superTooltip1.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; // + // swRegenWordAttmts + // + // + // + // + this.swRegenWordAttmts.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.swRegenWordAttmts.Location = new System.Drawing.Point(10, 150); + this.swRegenWordAttmts.Name = "swRegenWordAttmts"; + this.swRegenWordAttmts.Size = new System.Drawing.Size(91, 22); + this.swRegenWordAttmts.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.superTooltip1.SetSuperTooltip(this.swRegenWordAttmts, new DevComponents.DotNetBar.SuperTooltipInfo("Generate Word Attachments", "", resources.GetString("swRegenWordAttmts.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(300, 200))); + this.swRegenWordAttmts.SwitchClickTogglesValue = true; + this.swRegenWordAttmts.TabIndex = 34; + this.swRegenWordAttmts.Value = true; + this.swRegenWordAttmts.ValueObject = "Y"; + // + // labelX1 + // + this.labelX1.BackColor = System.Drawing.Color.Transparent; + // + // + // + this.labelX1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; + this.labelX1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelX1.Location = new System.Drawing.Point(107, 150); + this.labelX1.Name = "labelX1"; + this.labelX1.Size = new System.Drawing.Size(186, 22); + this.superTooltip1.SetSuperTooltip(this.labelX1, new DevComponents.DotNetBar.SuperTooltipInfo("Generate Word Attachments", "", resources.GetString("labelX1.SuperTooltip"), null, null, DevComponents.DotNetBar.eTooltipColor.Gray, true, true, new System.Drawing.Size(300, 200))); + this.labelX1.TabIndex = 33; + this.labelX1.Text = "Generate Missing Word Attachments"; + // // frmBatchRefresh // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1430,6 +1465,8 @@ private DevComponents.DotNetBar.PanelEx itemPanel2; private DevComponents.DotNetBar.PanelEx itemPanel3; private DevComponents.DotNetBar.ButtonX btnROsNotUsed; + private DevComponents.DotNetBar.Controls.SwitchButton swRegenWordAttmts; + private DevComponents.DotNetBar.LabelX labelX1; } } diff --git a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs index 249ddb19..0af71439 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs +++ b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs @@ -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(); diff --git a/PROMS/VEPROMS User Interface/frmBatchRefresh.resx b/PROMS/VEPROMS User Interface/frmBatchRefresh.resx index 7e66d1f3..15533721 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefresh.resx +++ b/PROMS/VEPROMS User Interface/frmBatchRefresh.resx @@ -117,108 +117,30 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - Purges all audit information and change history older than the above date. -It is recommended that you perform a database backup before performing this action. -Note after purging the information, this will automatically perform the Index -Maintenance function to realign indexes with the cut down audit data. -Only Full PROMS Administrator Users can perform this action. - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAp5JREFUOE+F - k11Ik1Ecxv9zouJ2E4TWnR8V5tAppJmYsLnNlaLTxAoiKIQiibpYSmEEmSSa0IVGISMUw7rpE+yiQiuk - /IhROssPyjanpL4udeq29z3nCdcH+Wb1g+fq/zzP+R8Oh+gvPK4kNWujp1IrPek8S5Hy+X9hbXSN9aVC - eq1FwEYN8vk/mWqiDPZwI+NOHbhLj8CdDaK7npLlvnWpO0AKqZV62YgO/GMquDMN0rAevkbqlHvXZdlG - h6Rn8eATu4GJncB0Fvh8HnwPYuGpJ4vcvwZbGYWJrcpPzGXG8ngGtsZFQJOggrS0B9J0MbwNIR9uHqRQ - ee4XPhuVSy814IIB/lk9QkIIanUomFgIzkux0qHB/CUqk+eCtB2jCLEl1M1mLcBSLthKHlQqJaKjw8FZ - Mbi/ENKXEizUKD/f2k9h8jz5mumk2K0F9xUAUgE4K0JUVDji4yLBvflgMyYwlxFL9zSYq6ITa8I3DlNY - wKZ0soVSgFkAXgwuFSEmJhJJiWqwCR3YSCbY2x0QB4zwnFc6W4p+22KxiY4EXiQF74kf6/L5vdi+TYV0 - rRpsMB2sPxWsRwvpTTq87QmYOUNHg+HqQlL4ryscbK4UPGD5vu60CWw8G7evbkN7bSykXm0w/FMBew6E - CsXQFQMpaLKezP6OLeDL+8AFM5hLBzaciennKcFXUCgI7o7ENQWSfRcWmmPgPEW5tNJIj8QxM9hk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GnI9IdEhwnioBHiOwMC - dj38fYbVglHy1FGJt57uL9ZS10IN9cxfJPvXCzTgqSKH5xwNzVXSkFBBDsFKA4KV7IKVegQrda2e7j5N - ud8AKwnMnBpmYFAAAAAASUVORK5CYII= - - - - This will perform Index Maintenance to realign indexes to optimize performance. -This function will cause no change to data or records in PROMS. -It should however be performed when other users are not in PROMS, as it could -cause slowdown or errors for other users while it is running. - - + 17, 17 - - - This allows the user to remove folders and sub folders as well as their contents. - -Be sure a current backup of the database exists prior performing this function. - -It is recommended that this be done during off hours. + + + When Word attachments are modified and saved, PROMS will create a PDF of the attachment contents and save it in the database. When this is done, all the of the RO references are resolved as well as pagination of the attachment. This speeds up the overall printing of the procedure in that PROMS simply inserts the attachment contents. Certain actions like loading a new RO.FST require that these PDFs be regenerated which is normally done at print time. +This function will generate (and save) any missing saved attachment PDFS stored in the database (not the PDFs of the entire procedure that you had previous printed). This will cause printing to be faster when you print after this as the PDFs will be pre-genrated in those cases (and thus not require regeneration unless changes were made to the Word Sections or ROs after running this). - - This allows the user to remove folders and sub folders as well as their contents. - -Be sure a current backup of the database exists prior performing this function. - -It is recommended that this be done during off hours. + + When Word attachments are modified and saved, PROMS will create a PDF of the attachment contents and save it in the database. When this is done, all the of the RO references are resolved as well as pagination of the attachment. This speeds up the overall printing of the procedure in that PROMS simply inserts the attachment contents. Certain actions like loading a new RO.FST require that these PDFs be regenerated which is normally done at print time. +This function will generate (and save) any missing saved attachment PDFS stored in the database (not the PDFs of the entire procedure that you had previous printed). This will cause printing to be faster when you print after this as the PDFs will be pre-genrated in those cases (and thus not require regeneration unless changes were made to the Word Sections or ROs after running this). - - - This function will allow the user to remove annotations from the selected working drafts. - -Be sure a current backup of the database exists prior to running this function. - -If more than one working draft is selected, it is recommended that this be performed during off hours. - - - This function will allow the user to remove annotations from the selected working drafts. - -Be sure a current backup of the database exists prior to running this function. - -If more than one working draft is selected, it is recommended that this be performed during off hours. - - - This will allow for the deletion of groups of annotations and allow for deleting entire folders within PROMS. Use the tree nodes to select which items to delete. - -Click on the on/off switches to turn on/off each tool. - -Note that only one of these tools can be run at a time. - When Word attachments are modified and saved, PROMS will create a PDF of the attachment contents and save it in the database. When this is done, all the of the RO references are resolved as well as pagination of the attachment. This speeds up the overall printing of the procedure in that PROMS simply inserts the attachment contents. - -This function will remove all of the saved attachment PDFS stored in the database (not the PDFs of the entire procedure that you had previous printed). This will force PROMS to regenerate (and save) the word attachment PDFs the next time the procedure is printed. + To allow for a quicker search of the contents within a PROMS Step editor table, a text version of the table is stored separately. If the PROMS Search function is not finding something in a table, this tool will refresh the content of that separately stored table text. Another search should then be performed for the content that was not originally found. - When Word attachments are modified and saved, PROMS will create a PDF of the attachment contents and save it in the database. When this is done, all the of the RO references are resolved as well as pagination of the attachment. This speeds up the overall printing of the procedure in that PROMS simply inserts the attachment contents. - -This function will remove all of the saved attachment PDFS stored in the database (not the PDFs of the entire procedure that you had previous printed). This will force PROMS to regenerate (and save) the word attachment PDFs the next time the procedure is printed. + To allow for a quicker search of the contents within a PROMS Step editor table, a text version of the table is stored separately. If the PROMS Search function is not finding something in a table, this tool will refresh the content of that separately stored table text. Another search should then be performed for the content that was not originally found. + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAp5JREFUOE+F @@ -302,6 +224,53 @@ Should an item become orphaned (disconnected) from the rest of the data, it will Should an item become orphaned (disconnected) from the rest of the data, it will no longer be accessible. This tool removes any orphaned items from the database. + + + Purges all audit information and change history older than the above date. +It is recommended that you perform a database backup before performing this action. +Note after purging the information, this will automatically perform the Index +Maintenance function to realign indexes with the cut down audit data. +Only Full PROMS Administrator Users can perform this action. + + + + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAp5JREFUOE+F + k11Ik1Ecxv9zouJ2E4TWnR8V5tAppJmYsLnNlaLTxAoiKIQiibpYSmEEmSSa0IVGISMUw7rpE+yiQ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8S5Hy+X9hbXSN9aVC + eq1FwEYN8vk/mWqiDPZwI+NOHbhLj8CdDaK7npLlvnWpO0AKqZV62YgO/GMquDMN0rAevkbqlHvXZdlG + h6Rn8eATu4GJncB0Fvh8HnwPYuGpJ4vcvwZbGYWJrcpPzGXG8ngGtsZFQJOggrS0B9J0MbwNIR9uHqRQ + ee4XPhuVSy814IIB/lk9QkIIanUomFgIzkux0qHB/CUqk+eCtB2jCLEl1M1mLcBSLthKHlQqJaKjw8FZ + Mbi/ENKXEizUKD/f2k9h8jz5mumk2K0F9xUAUgE4K0JUVDji4yLBvflgMyYwlxFL9zSYq6ITa8I3DlNY + wKZ0soVSgFkAXgwuFSEmJhJJiWqwCR3YSCbY2x0QB4zwnFc6W4p+22KxiY4EXiQF74kf6/L5vdi+TYV0 + rRpsMB2sPxWsRwvpTTq87QmYOUNHg+HqQlL4ryscbK4UPGD5vu60CWw8G7evbkN7bSykXm0w/FMBew6E + CsXQFQMpaLKezP6OLeDL+8AFM5hLBzaciennKcFXUCgI7o7ENQWSfRcWmmPgPEW5tNJIj8QxM9hkDthY + FthAGlh/SvAPXC7fjOrjmyC+Sl5TsCpfdzYEK92llUbllDiaD3HEDPG9CaLDCGnI9IdEhwnioBHiOwMC + dj38fYbVglHy1FGJt57uL9ZS10IN9cxfJPvXCzTgqSKH5xwNzVXSkFBBDsFKA4KV7IKVegQrda2e7j5N + ud8AKwnMnBpmYFAAAAAASUVORK5CYII= + + + + This will perform Index Maintenance to realign indexes to optimize performance. +This function will cause no change to data or records in PROMS. +It should however be performed when other users are not in PROMS, as it could +cause slowdown or errors for other users while it is running. This allows the user to check referenced object links in procedure step data for multiple working drafts in a batch mode. @@ -388,8 +357,46 @@ If more than one procedure is selected, it is recommended that this be performed ud8AKwnMnBpmYFAAAAAASUVORK5CYII= - - - 25 + + This allows the user to remove folders and sub folders as well as their contents. + +Be sure a current backup of the database exists prior performing this function. + +It is recommended that this be done during off hours. + + + + This allows the user to remove folders and sub folders as well as their contents. + +Be sure a current backup of the database exists prior performing this function. + +It is recommended that this be done during off hours. + + + + + This function will allow the user to remove annotations from the selected working drafts. + +Be sure a current backup of the database exists prior to running this function. + +If more than one working draft is selected, it is recommended that this be performed during off hours. + + + This function will allow the user to remove annotations from the selected working drafts. + +Be sure a current backup of the database exists prior to running this function. + +If more than one working draft is selected, it is recommended that this be performed during off hours. + + + This will allow for the deletion of groups of annotations and allow for deleting entire folders within PROMS. Use the tree nodes to select which items to delete. + +Click on the on/off switches to turn on/off each tool. + +Note that only one of these tools can be run at a time. + + + 25 + \ No newline at end of file diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index aebad38d..2dec2bda 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -1003,40 +1003,34 @@ namespace VEPROMS.CSLA.Library if (pdfTmp == null) return false; FileInfo pdfFile = new FileInfo(pdfTmp); - FileStream fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite); - Byte[] buf = new byte[pdfFile.Length]; - fs.Read(buf, 0, buf.Length); - fs.Close(); + Byte[] buf = new byte[pdfFile.Length]; - // B2023-022 & B2023-023 commented out the deletion of the temporary Word section PDF file - // These files are deleted when the procedure pdf file is closed after being generated. - // PROMS was crashing because it could not find these temporary files to delete. - //try - //{ - // pdfFile.Delete(); - //} - //catch { } - - using (Document doc = docInfo.Get()) + using (FileStream fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { - DocStyle myDocStyle = sect.ActiveSection.MyDocStyle; - SectionConfig sc = sect.ActiveSection.MyConfig as SectionConfig; - int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave; - - if (sc != null && sc.Section_WordMargin == "Y") - { - using (Pdf myPdf = Pdf.MakePdf(doc, ss * 10 + MSWordToPDF.DebugStatus, 0, 0, 0, 0, (double)sect.MSWordPageCount, buf)) {; } - } - else - { - using (Pdf myPdf1 = Pdf.MakePdf(doc, ss * 10 + MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength, - (int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)sect.MSWordPageCount, buf)) {; } - } - - doc.UpdateDRoUsages(roids); - doc.Save(); + fs.Read(buf, 0, buf.Length); + fs.Close(); } + using (Document doc = docInfo.Get()) + { + DocStyle myDocStyle = sect.ActiveSection.MyDocStyle; + SectionConfig sc = sect.ActiveSection.MyConfig as SectionConfig; + int ss = sect.MyDocVersion.DocVersionConfig.SelectedSlave; + + if (sc != null && sc.Section_WordMargin == "Y") + { + using (Pdf myPdf = Pdf.MakePdf(doc, ss * 10 + MSWordToPDF.DebugStatus, 0, 0, 0, 0, (double)sect.MSWordPageCount, buf)) {; } + } + else + { + using (Pdf myPdf1 = Pdf.MakePdf(doc, ss * 10 + MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength, + (int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)sect.MSWordPageCount, buf)) {; } + } + + doc.UpdateDRoUsages(roids); + doc.Save(); + } + docInfo.RefreshConfig(); return true; @@ -1482,12 +1476,22 @@ namespace VEPROMS.CSLA.Library } catch { } - if (CloseWordWhenDone) + try + { + if (CloseWordWhenDone) + { + CloseAppAfterWait(); + } + } + catch (Exception ex) { - CloseAppAfterWait(); - } + System.Windows.Forms.Application.DoEvents(); + _MyLog.Error("Failed to close Microsoft Word. Collecting reclaimable memory.", ex); + GC.Collect(); + _MyLog.Warn("Finished collecting reclaimable memory."); + } - if (statusChange != null) statusChange(VolianStatusType.Complete, 0, string.Empty); + if (statusChange != null) statusChange(VolianStatusType.Complete, 0, string.Empty); if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) Volian.Base.Library.BaselineMetaFile.WriteLine("++EndTxt++"); // [jpr 2022.07.26] - For memory optimization diff --git a/PROMS/VEPROMS.CSLA.Library/Generated/Pdf.cs b/PROMS/VEPROMS.CSLA.Library/Generated/Pdf.cs index 699521a0..9bd0d5d8 100644 --- a/PROMS/VEPROMS.CSLA.Library/Generated/Pdf.cs +++ b/PROMS/VEPROMS.CSLA.Library/Generated/Pdf.cs @@ -522,19 +522,22 @@ namespace VEPROMS.CSLA.Library } public static Pdf MakePdf(Document myDocument, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth, double pageCount, byte[] docPdf) { - Pdf tmp = Pdf.New(myDocument, debugStatus, topRow, pageLength, leftMargin, pageWidth, pageCount, docPdf); - if (tmp.IsSavable) - tmp = tmp.Save(); - else + using (Pdf tmp = Pdf.New(myDocument, debugStatus, topRow, pageLength, leftMargin, pageWidth, pageCount, docPdf)) { - Csla.Validation.BrokenRulesCollection brc = tmp.ValidationRules.GetBrokenRules(); - tmp._ErrorMessage = "Failed Validation:"; - foreach (Csla.Validation.BrokenRule br in brc) + if (tmp.IsSavable) + return tmp.Save(); + else { - tmp._ErrorMessage += "\r\n\tFailure: " + br.RuleName; + 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; } } - return tmp; + } public static Pdf Get(int docID, int debugStatus, int topRow, int pageLength, int leftMargin, int pageWidth) { diff --git a/PROMS/VEPROMS.CSLA.Library/Minimal/Maintenance.cs b/PROMS/VEPROMS.CSLA.Library/Minimal/Maintenance.cs index a4ef77e1..e1c2cb0b 100644 --- a/PROMS/VEPROMS.CSLA.Library/Minimal/Maintenance.cs +++ b/PROMS/VEPROMS.CSLA.Library/Minimal/Maintenance.cs @@ -86,7 +86,38 @@ namespace VEPROMS.CSLA.Library throw new DbCslaException("Error in vesp_GetOtherActiveSessions: retrieving data failed", ex); } } - #endregion + #endregion - } + #region Get Docs by Unit + //C2026-007 Get Missing Docs by Unit + // for Generating/Regenerating Pdf table + // can be ran overnight to assist with Printing when RO Updates + // and large Word Sections conatining ROs + public static DataTable GetMissingDocsByUnit() + { + try + { + using (SqlConnection cn = Database.VEPROMS_SqlConnection) + { + using (SqlCommand cm = cn.CreateCommand()) + { + cm.CommandType = CommandType.StoredProcedure; + cm.CommandText = "GetMissingDocsByUnit"; + cm.CommandTimeout = Database.DefaultTimeout; + using (SqlDataAdapter da = new SqlDataAdapter(cm)) + { + DataTable dt = new DataTable(); + da.Fill(dt); + return dt; + } + } + } + } + catch (Exception ex) + { + throw new DbCslaException("Error in GetMissingDocsByUnit: retrieving data failed", ex); + } + } + #endregion + } }