From 4f4402b0d0bbd7c9ef41641a4220b42810020a2b Mon Sep 17 00:00:00 2001 From: Kathy Date: Thu, 21 Jan 2021 14:36:48 +0000 Subject: [PATCH] =?UTF-8?q?B2021-008:=20Refresh=20Transition=20Links=20del?= =?UTF-8?q?ete=20transition=20record=20when=20no=20link=20in=20text=20B202?= =?UTF-8?q?1-010:=20Incoming=20Transitions=20=E2=80=93=20Find=20&=20conver?= =?UTF-8?q?t=20to=20text=20all=20including=20at=20selected=20item?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 11 ++ .../Volian.Controls.Library/DisplaySearch.cs | 136 ++++++++++-------- 2 files changed, 90 insertions(+), 57 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 278cf368..02a9ed87 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -759,6 +759,17 @@ namespace VEPROMS.CSLA.Library } } } + // B2021-008: Delete the transition record if there is no link in the text + if (mc.Count == 0 && itemInfo.MyContent.ContentTransitionCount > 0) + { + TranCheckCount++; + TranFixCount++; + if (itemInfo.MyContent.ContentTransitions != null) + foreach (TransitionInfo ct in itemInfo.MyContent.ContentTransitions) + Transition.Delete(ct.TransitionID); + itemInfo.MyContent.RefreshContentTransitions(); + } + return retval; } diff --git a/PROMS/Volian.Controls.Library/DisplaySearch.cs b/PROMS/Volian.Controls.Library/DisplaySearch.cs index c2d311b2..53671277 100644 --- a/PROMS/Volian.Controls.Library/DisplaySearch.cs +++ b/PROMS/Volian.Controls.Library/DisplaySearch.cs @@ -1629,38 +1629,14 @@ namespace Volian.Controls.Library { // C2020-033: Incoming Transitions: Make an iteminfolist from the list returned from // GetExternalTransitionsToChildren (also gets transitions to the item itself) - ItemInfo trII = SearchIncTransII; - if (trII != null) + // B2021-010: Use IncomingTranGetMergedTranList to get a complete list of incoming transitions (transitions to procedure + // were only included if there were NO transitions to items within procedure) + ReportTitle = string.Format("Search For Incoming Transitions to {0}: ", SearchIncTransII.Path); + SearchResults = IncomingTranGetMergedTranList(); + cmbResultsStyleIndex = 1; //display step locations in results + if (SearchResults == null || SearchResults.Count == 0) { - ReportTitle = string.Format("Search For Incoming Transitions to {0}: ", trII.Path); - TypesSelected = "Filtered By: " + typstr; - using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(trII.ItemID)) - { - ItemInfoList iil = null; - bool first = true; - foreach (TransitionInfo ti in exTrans) - { - if (first) - { - ContentInfo ci = ContentInfo.Get(ti.FromID); - ItemInfo tmp = ci.ContentItems[0]; - iil = new ItemInfoList(tmp); - first = false; - } - else - { - ContentInfo ci = ContentInfo.Get(ti.FromID); - ItemInfo tmp = ci.ContentItems[0]; - iil.AddItem(tmp); - } - } - SearchResults = iil; - if (SearchResults == null || SearchResults.Count == 0) - { - FlexibleMessageBox.Show("No Matches Found.", "Search"); - } - cmbResultsStyleIndex = 1; //display step locations in results - } + FlexibleMessageBox.Show("No Matches Found.", "Search"); } } if (SearchResults != null) @@ -2760,33 +2736,12 @@ namespace Volian.Controls.Library lbSrchResultsIncTrans.DataSource = null; lbSrchResultsIncTrans.Items.Clear(); // Get item to do search for, either from tree or from editor - ItemInfo trII = SearchIncTransII; - if (trII != null) + if (SearchIncTransII != null) { - ReportTitle = string.Format("Search For Incoming Transitions to {0}: ", trII.Path); - - using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(trII.ItemID)) - { - ItemInfoList iil = null; - bool first = true; - foreach (TransitionInfo ti in exTrans) - { - if (first) - { - ContentInfo ci = ContentInfo.Get(ti.FromID); - ItemInfo tmp = ci.ContentItems[0]; - iil = new ItemInfoList(tmp); - first = false; - } - else - { - ContentInfo ci = ContentInfo.Get(ti.FromID); - ItemInfo tmp = ci.ContentItems[0]; - iil.AddItem(tmp); - } - } - SearchResults = iil; - } + // B2021-010: Use IncomingTranGetMergedTranList to get a complete list of incoming transitions (transitions to procedure + // were only included if there were NO transitions to items within procedure) + SearchResults = IncomingTranGetMergedTranList(); + ReportTitle = string.Format("Search For Incoming Transitions to {0}: ", SearchIncTransII.Path); } if (SearchResults != null && SearchResults.Count > 0) { @@ -2875,6 +2830,53 @@ namespace Volian.Controls.Library UpdateSearchIncTransResults(); // B2021-009: Research after convert transitions to text fromTranCvtBtn = false; } + // B2021-010: IncomingTranGetMergedTranList gets a complete list of incoming transitions (before fix transitions to procedure + // were only included if there were NO transitions to items within procedure, the GetExternalTransitionsToChildren query + // did not get transitions 'incoming to' the item itself) + private ItemInfoList IncomingTranGetMergedTranList() + { + ItemInfoList iil = null; + bool first = true; + using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitionsToChildren(SearchIncTransII.ItemID)) + { + foreach (TransitionInfo ti in exTrans) + { + if (first) + { + ContentInfo ci = ContentInfo.Get(ti.FromID); + ItemInfo tmp = ci.ContentItems[0]; + iil = new ItemInfoList(tmp); + first = false; + } + else + { + ContentInfo ci = ContentInfo.Get(ti.FromID); + ItemInfo tmp = ci.ContentItems[0]; + iil.AddItem(tmp); + } + } + } + using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitions(SearchIncTransII.ItemID)) + { + foreach (TransitionInfo ti in exTrans) + { + if (first) + { + ContentInfo ci = ContentInfo.Get(ti.FromID); + ItemInfo tmp = ci.ContentItems[0]; + iil = new ItemInfoList(tmp); + first = false; + } + else + { + ContentInfo ci = ContentInfo.Get(ti.FromID); + ItemInfo tmp = ci.ContentItems[0]; + iil.AddItem(tmp); + } + } + } + return iil; + } // C2020-033: For items in list, do the actual conversion of the Incoming Transition to text private void TranCvtToTxt(List itmsEditable) { @@ -2900,6 +2902,26 @@ namespace Volian.Controls.Library } } + // B2021-010: Convert the text of transitions pointing (incoming) to the item itself + using (TransitionInfoList exTrans = TransitionInfoList.GetExternalTransitions(trII.ItemID)) + { + foreach (TransitionInfo ti in exTrans) + { + // See if the 'item to' id is to be converted and if so do it. To figure this out, + // see if it is in the list itmsEditable. + if (itmsEditable.Contains(ti.FromID)) + { + ContentInfo ci = ContentInfo.Get(ti.FromID); + ItemInfo tmp = ci.ContentItems[0]; + using (Content content = Content.Get(tmp.ContentID)) + { + content.FixTransitionText(ti, true); + content.Save(); + } + } + } + + } } } }