From 83f88b6df3f5af3e451e0b7847b1bd3c203ff7a8 Mon Sep 17 00:00:00 2001 From: mschill Date: Thu, 12 Mar 2026 11:10:04 -0400 Subject: [PATCH 1/4] B2026-031 PROMS Crash in Admin Tools Maintenance - Purge Change History --- PROMS/VEPROMS User Interface/PROMSFixes.Sql | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PROMS/VEPROMS User Interface/PROMSFixes.Sql b/PROMS/VEPROMS User Interface/PROMSFixes.Sql index 4d6b672e..81fa98e6 100644 --- a/PROMS/VEPROMS User Interface/PROMSFixes.Sql +++ b/PROMS/VEPROMS User Interface/PROMSFixes.Sql @@ -24329,8 +24329,10 @@ BEGIN OR FromID in (Select ContentID from tblContents where deletestatus != 0 and ActionDTS < @dte) ) PRINT 'Deleting Items and Parts' + alter table tblParts nocheck constraint FK_Parts_Items delete from tblItems where deletestatus != 0 and DTS < @dte delete from tblParts where deletestatus != 0 and ItemID Not IN (Select ItemID from Items) and DTS < @dte + alter table tblParts check constraint FK_Parts_Items PRINT 'Purging Parts with deleted Contents' DELETE from Child FROM tblParts AS Child @@ -24355,7 +24357,9 @@ BEGIN ON Itms.ItemID = tblItems.ItemID AND Itms.deletestatus = tblItems.deletestatus alter table tblItems check constraint FK_Items_Items PRINT 'Purging Contents' + alter table tblEntries nocheck constraint FK_Entries_Contents delete from tblContents where deletestatus != 0 and ActionDTS < @dte + alter table tblEntries check constraint FK_Entries_Contents PRINT 'Phase 3' delete from AnnotationAudits where DTS < @dte delete from ContentAudits where DTS < @dte @@ -24766,8 +24770,8 @@ BEGIN TRY -- Try Block DECLARE @RevDate varchar(255) DECLARE @RevDescription varchar(255) - set @RevDate = '02/18/2026 7:00 AM' - set @RevDescription = 'Added Audit Ability for ChangeBars' + set @RevDate = '03/12/2026 11:00 AM' + set @RevDescription = 'Update to Purge Change History Tool' Select cast(@RevDate as datetime) RevDate, @RevDescription RevDescription PRINT 'SQL Code Revision ' + @RevDate + ' - ' + @RevDescription From c2a5a8ec7dc98c73280a6a9542d4b6c05cb4583c Mon Sep 17 00:00:00 2001 From: mschill Date: Thu, 12 Mar 2026 14:35:32 -0400 Subject: [PATCH 2/4] Revert Clipboard B2025-064 --- PROMS/Volian.Controls.Library/StepTabRibbon.cs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index 06f8474e..1b3ec4c0 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -1668,20 +1668,8 @@ namespace Volian.Controls.Library } Clipboard.Clear(); - //Try to update the data object to persist beyond PROMS life - //if can't, log it and use old method of scoping clipboard to PROMS life - try - { - // noticed that sometimes the clipboard will get stuck - so set it to retry twice - // and if it fails, scope the clipboard to within PROMS - Clipboard.SetDataObject(myDO, true, 2, 100); // this saves the cleaned up information to the Windows clipboard - } - catch (System.Runtime.InteropServices.ExternalException ex) - { - _MyLog.Warn($"Error Setting Clipboard Object to Persist beyond PROMS. Clipboard will be scoped to PROMS. Error:{ex.Message}"); - Clipboard.SetDataObject(myDO); // this saves the cleaned up information to the Windows clipboard - } - } + Clipboard.SetDataObject(myDO); // this saves the cleaned up information to the Windows clipboard + } iData = Clipboard.GetDataObject(); bool noEquationData = true; // part of bug B2017-117 we were running out of window handles when printing, found this similar use of From 294d19e9d1809c46201bd05be8fdeb2a2a7ea2cb Mon Sep 17 00:00:00 2001 From: John Jenko Date: Mon, 16 Mar 2026 14:32:57 -0400 Subject: [PATCH 3/4] C2026-030 Barakah asked that the white space between the procedure number and procedure title be reduced when the KEPCO number is not printed --- PROMS/Formats/fmtall/BNPP1Newall.xml | Bin 243444 -> 243848 bytes PROMS/Formats/fmtall/BNPP1all.xml | Bin 184806 -> 185210 bytes PROMS/Formats/fmtall/BNPP2all.xml | Bin 199004 -> 199362 bytes PROMS/Formats/fmtall/BNPPalrall.xml | Bin 236928 -> 237646 bytes PROMS/Formats/fmtall/BNPPbckall.xml | Bin 163138 -> 163542 bytes 5 files changed, 0 insertions(+), 0 deletions(-) diff --git a/PROMS/Formats/fmtall/BNPP1Newall.xml b/PROMS/Formats/fmtall/BNPP1Newall.xml index 95276f4217c984caebcdebd59c33df3208539663..c58da4beead2cd33a138339f7530782688a0fb57 100644 GIT binary patch delta 170 zcmezJmapR@UqcIH3)2*4mFWgT%sSKk!kK4HuaaZdn110ulg;D=WuEB@!pwFcaVh2+ zhUn?F5zMl}u?)2gN(>4NK@9l}he g9+*lkrVIEoYi-{U$^49C`UQDrh3%WTnVnVx07)G)^Z)<= delta 46 zcmV+}0MY-5@ecIu4uFIKgaVWUB$u!^11Oi=0s|PA@aO_Kw=`J;_6nEqTLU7uNDTu( EtGs{_=Kufz diff --git a/PROMS/Formats/fmtall/BNPP1all.xml b/PROMS/Formats/fmtall/BNPP1all.xml index 8a25a67ff401e2e7e30ce89cd69df32d0405312d..1e852979510272e5696d8a6c97d147e1b5255cdf 100644 GIT binary patch delta 229 zcmaF1nETf1Th2vu|JR>!r%$SK0vWphFS(C1_hvaK0`T!Es$+A tU2qDM@U&@6EYtNunGEn6FHgYm>5k4!!qXMPu)ET)nMrHAS~$~zDge-@Iu-x` delta 94 zcmeyhjQiPQ?uHh|Ell%5rYpEGX-q#8!Zc&L!wW`^=@T58B&G{QFxgCRIKjj<{eUBr e!E}Q#CYk9D)l34@7lbo;;8LfzeL@7&t119oCLvV- diff --git a/PROMS/Formats/fmtall/BNPP2all.xml b/PROMS/Formats/fmtall/BNPP2all.xml index 44e5776885634668ca497557c74a0ceb46c4a554..f7193fd06bab7f9443c02a6111415adb9bf70535 100644 GIT binary patch delta 91 zcmcaJiRaK%o`x32Eldl7rVD5=u}zN)WRhU6VThhSKZr?IJeHxBL5V?uA&4QLp`5`M o$TngyWiXw7F^K8)^a&139ANc~5Y>#a(!mFLbRo`x32Eldl7rXLDol9^uT$|SJeD1>RkHUPA+3q=3` diff --git a/PROMS/Formats/fmtall/BNPPalrall.xml b/PROMS/Formats/fmtall/BNPPalrall.xml index f0c58c99d1c7222cab4959c585f5669f7b7ee825..58b11ba9d32e29e7dbed94e42cc9ce01b0ec172c 100644 GIT binary patch delta 198 zcmZqJ&3EnqUqcJy7ACU=(-$0IVw=81n^}OP(`BCGZr%KncmRPqz5*M8)i}s)GYB>hFS(C1_g#7hJ1!{23sK8h{24( rVtSxHbMEvB(#%Z=8&EVu?eJZ|6g@q_g?YtvJ~n2p?Rkrsgnk16Ql2^H delta 74 zcmX?ifUjXUUqcJy7ACU=(;vt&7ft_nkV#?sf%!~j(+xP7#ilz{F$qoo;Lhv?mnfP3 W!H~HG#8sN!;K{79{lZeFx?cc_+8>Po diff --git a/PROMS/Formats/fmtall/BNPPbckall.xml b/PROMS/Formats/fmtall/BNPPbckall.xml index 5c1811e0b91a3744e75ebffd2caaef34960139b2..073abde92f5c93e4c0abf61a33abd310f339a743 100644 GIT binary patch delta 208 zcmX@~i}TuF&W0AoEld>}(^s5i1IJpe5lGKm}?lKr=Qhik`<3-sAW)MP+$mR$Y&^Lum!S>7)%*Vryo>jawgI+Mu<_2 cvC|XnnS@!57%UhJh|qt;m&s|HHj`5j0RF#0Z~y=R delta 85 zcmccim-Ems&W0AoEld>}(;FO^G^QJ9Gf7O}r@_=P{htw&!t__#Og7UKG=O3OW=u-c oxwM#MrXP@H5@0oAuw*cveo&oh`*a6gph5#VCavvLbeNoi0P#Z_WB>pF From bc3c14589ec34b2b162c13ab5f304abd1ee6099d Mon Sep 17 00:00:00 2001 From: mschill Date: Mon, 16 Mar 2026 14:45:04 -0400 Subject: [PATCH 4/4] 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+8AFM5hLBzaciennKcFXUCgI7o7ENQWSfRcWmmPgPEW5tNJIj8QxM9hkDthY - FthAGlh/SvAPXC7fjOrjmyC+Sl5TsCpfdzYEK92llUbllDiaD3HEDPG9CaLDCGnI9IdEhwnioBHiOwMC - dj38fYbVglHy1FGJt57uL9ZS10IN9cxfJPvXCzTgqSKH5xwNzVXSkFBBDsFKA4KV7IKVegQrda2e7j5N - ud8AKwnMnBpmYFAAAAAASUVORK5CYII= - - - - - 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+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. - - + 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+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+8AFM5hLBzaciennKcFXUCgI7o7ENQWSfRcWmmPgPEW5tNJIj8QxM9hkDthY + FthAGlh/SvAPXC7fjOrjmyC+Sl5TsCpfdzYEK92llUbllDiaD3HEDPG9CaLDCGnI9IdEhwnioBHiOwMC + dj38fYbVglHy1FGJt57uL9ZS10IN9cxfJPvXCzTgqSKH5xwNzVXSkFBBDsFKA4KV7IKVegQrda2e7j5N + ud8AKwnMnBpmYFAAAAAASUVORK5CYII= + + + + + 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+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 + } }