From dab06c411e303bcafb6cc32dd522db2c2fd32930 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 5 Oct 2022 20:28:22 +0000 Subject: [PATCH] C2022-028 Functions to spin through the step text calling the function that looks for bad RO links --- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 51 +++++++++++++++++-- 1 file changed, 48 insertions(+), 3 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 8581424a..21595bd2 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -855,6 +855,17 @@ namespace VEPROMS.CSLA.Library ROFixCount = 0; } + //C2022-028 used during check of RO links in procedure text + public static int CheckROLinksCount = 0; + public static int BadROLinksCount = 0; + public static int FixedROLinksCount = 0; + public static void ResetCheckROLinkCounters() + { + CheckROLinksCount = 0; + BadROLinksCount = 0; + FixedROLinksCount = 0; + } + public static int ROCheckCount = 0; public static int ROFixCount = 0; private static AnnotationType _VolianCommentType = null; // Using this to flag ro value issues with byron to braidwood @@ -932,7 +943,6 @@ namespace VEPROMS.CSLA.Library } } } - // B2022-026 RO Memory Reduction code - get ROLookup from passed in ROFstInfo ROFSTLookup lookup = origROFst.GetROFSTLookup(docVersionInfo); lookup.MyItemInfo = itemInfo; // B2022-020 to pass information into error log if needed @@ -952,7 +962,7 @@ namespace VEPROMS.CSLA.Library itemInfo.MyContent.FixContentText(rousage, roval, roch.type, origROFst, itemInfo); string newText = itemInfo.MyContent.Text; - if (DifferentROtext(newText,oldText)) + if (DifferentROtext(newText, oldText)) { //ShowDifference(oldText, newText); // debug - display in Visual Studio Output window ROFixCount++; @@ -979,8 +989,37 @@ namespace VEPROMS.CSLA.Library } } } + //C2022-028 check the RO link text - compare with RO Usage information, annotate RO links that are bad + internal static void MyCheckROLinks(ItemInfo itemInfo) + { + // spin through all of the parts of this IntemInfo + if (itemInfo.MyContent.ContentPartCount > 0) + { + foreach (PartInfo pi in itemInfo.MyContent.ContentParts) + { + foreach (ItemInfo ii in pi.MyItems) + { + MyCheckROLinks(ii); + } + } + } - private static bool DifferentROtext(string newText, string oldText) + using (Content content = Content.Get(itemInfo.MyContent.ContentID)) + { + content.CheckROLinkTextandUsage(ref BadROLinksCount, ref CheckROLinksCount, ref FixedROLinksCount); + } + /*** comment out for now incase we decide to fix bad RO links + Content content = Content.Get(itemInfo.MyContent.ContentID); + if (content.CheckROLinkTextandUsage(ref BadROLinksCount, ref CheckROLinksCount, ref FixedROLinksCount)) + { + content.UserID = Volian.Base.Library.VlnSettings.UserID; + content.DTS = DateTime.Now; + content.Save(); + } + ***/ + + } + private static bool DifferentROtext(string newText, string oldText) { string nt = newText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " "); string ot = oldText.Replace(@"\u8209?", "-").Replace(@"\u160?", " ").Replace("\xA0", " "); @@ -7332,6 +7371,12 @@ namespace VEPROMS.CSLA.Library if (tmp.MyDocVersion.DocVersionConfig.SelectedSlave <= 0) MyRefreshReferenceObjects(tmp, tmp.MyDocVersion, null, tmp.MyDocVersion, origROFst); } + //C2022-028 check the RO link text - compare with RO Usage information, annotate RO links that are bad + public static void CheckReferenceObjectsLinks(ProcedureInfo tmp) + { + if (tmp.MyDocVersion.DocVersionConfig.SelectedSlave <= 0) + MyCheckROLinks(tmp); + } public static void RefreshPageNumTransitions(ProcedureInfo tmp) { TransitionLookup tranLookup = new TransitionLookup(0, tmp.ItemID, tmp.MyLookup);