B2019-140/B2022-099 After doing an Approval (final stage) of a procedure, the change bars do not reset on the screen.

Also, when change the “Showing Change bars” option, the screen does not refresh.
This commit is contained in:
2025-12-03 15:53:29 -05:00
parent a7a5df1991
commit 2783d2cc77
3 changed files with 103 additions and 0 deletions

View File

@@ -3819,6 +3819,51 @@ namespace VEPROMS.CSLA.Library
_Tables = null;
_SupInfos = null;
}
//B2019-140 Change bars do not get refreshed when approval is run.
// Reset a Procedure and sub items in the cache
public static ProcedureInfo ResetProcedure(int procID)
{
// The following lines reload the procedure info cache
ProcedureInfo newproc = ProcedureInfo.Get(procID, true);
newproc.RefreshConfig();
//the following is needed to force the ProcedureConfig to reload
#pragma warning disable S1656 // Variables should not be self-assigned
newproc.MyConfig = newproc.MyConfig;
#pragma warning restore S1656 // Variables should not be self-assigned
//reload the Content Cache for the procedure
ContentInfo.Refresh(Content.Get(newproc.MyContent.ContentID, true));
// The following line actually reloads the item info cache
ItemInfo newprocitem = Get(procID, true);
newprocitem.RefreshConfig();
//Reload all the child/sub items
#pragma warning disable S2971 // LINQ expressions should be simplified - need initial ToList to force enumeration
//otherwise will get a "Collection was modified; enumeration operation may not execute" error
List<int> itemIDs = _CacheByPrimaryKey.Values.ToList().SelectMany(y => y).Where(t => t?.ActiveParent != null && (t.ActiveParent is ItemInfo) && t.MyProcedure.ItemID == procID).Select(x => (x.ActiveParent as ItemInfo).ItemID).Distinct().ToList();
#pragma warning restore S2971 // LINQ expressions should be simplified
for (int index = 0; index < itemIDs.Count; index++)
{
ResetParts(itemIDs[index]);
}
//reset the procedure config for all items attached to current procedure
#pragma warning disable S2971 // LINQ expressions should be simplified - need initial ToList to force enumeration
//otherwise will get a "Collection was modified; enumeration operation may not execute" error
List<ItemInfo> pconfigrefresh_items = _CacheByPrimaryKey.Values.ToList().SelectMany(y => y).Where(t => t?.MyProcedure?.ItemID == procID).Distinct().ToList();
#pragma warning restore S2971 // LINQ expressions should be simplified
for (int index = 0; index < pconfigrefresh_items.Count; index++)
{
pconfigrefresh_items[index].MyProcedure = newproc;
}
//return the changed procedure info
return newproc;
}
private ItemInfoList _Procedures;
public ItemInfoList Procedures
{ get { return Lookup(E_FromType.Procedure, ref _Procedures); } }