C2026-008 - Re-Architect RO.FST to include RO Modification date/time and use those when updating ROs from the RO.FST

--Fix for Blank popup box when completes updating ROs through Admin Tool & fix for updating ROs when fails part way through (if network error, etc…)
This commit is contained in:
2026-05-15 07:09:21 -04:00
parent f39aefd28f
commit 8f1bb45e42
6 changed files with 139 additions and 15 deletions
@@ -1066,6 +1066,26 @@ namespace VEPROMS
ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh); ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh);
roFstInfo = dq.DocVersionAssociations[0].MyROFst; roFstInfo = dq.DocVersionAssociations[0].MyROFst;
} }
else if (!dv.ROfstLastCompleted && origfstid == roFstInfo.ROFstID)
{
//Handle issue where load failed without completing update
//previous RO FST did not load, get last loaded ID
//if none, use -1 which will check all ROs in the Working Draft
string cfg = dv.DocVersionAssociations[0].Config;
AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg);
if (dv.DocVersionAssociations[0]?.MyROFst != null)
{
if (!int.TryParse(ac.ROUpdate_PrevROFSTID, out origfstid))
{
origfstid = -1;
}
}
else
{
origfstid = -1;
}
}
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, txtProcess, roFstInfo, origfstid, roFstInfo.ROFstID); ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, txtProcess, roFstInfo, origfstid, roFstInfo.ROFstID);
roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); roFstInfo.ROTableUpdate -= new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
@@ -1539,6 +1539,25 @@ namespace VEPROMS
ROFstInfo.UpdateRoFst(SelectedROFst.MyRODb, dv, SelectedROFst, DoProgressBarRefresh); ROFstInfo.UpdateRoFst(SelectedROFst.MyRODb, dv, SelectedROFst, DoProgressBarRefresh);
SelectedROFst = null; // set to null to force getting the updated ROfst SelectedROFst = null; // set to null to force getting the updated ROfst
} }
else if (!dv.ROfstLastCompleted && origfstid == SelectedROFst.ROFstID)
{
//Handle issue where load failed without completing update
//previous RO FST did not load, get last loaded ID
//if none, use -1 which will check all ROs in the Working Draft
string cfg = dv.DocVersionAssociations[0].Config;
AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg);
if (dv.DocVersionAssociations[0]?.MyROFst != null)
{
if (!int.TryParse(ac.ROUpdate_PrevROFSTID, out origfstid))
{
origfstid = -1;
}
}
else
{
origfstid = -1;
}
}
ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file
SelectedROFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); SelectedROFst.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
@@ -124,6 +124,23 @@ namespace VEPROMS.CSLA.Library
_Xp["ROUpdate", "LoadingFigures"] = value; // save selected value _Xp["ROUpdate", "LoadingFigures"] = value; // save selected value
} }
} }
[Category("RO Update")]
[DisplayName("Previous ROFSTID")]
[RefreshProperties(RefreshProperties.All)]
[Description("Previous ROFSTID")]
public string ROUpdate_PrevROFSTID
{
get
{
string s = _Xp["ROUpdate", "PrevROFSTID"];// get the saved value
return s;
}
set
{
_Xp["ROUpdate", "PrevROFSTID"] = value; // save selected value
}
}
#endregion // ROUpdate #endregion // ROUpdate
#region ToString #region ToString
public override string ToString() public override string ToString()
@@ -267,6 +267,14 @@ namespace VEPROMS.CSLA.Library
} }
} }
// pop up a message window telling the user the RO Update has completed and how many ROs were updated
// If we are updating RO from the Admin Tools (from the V button) and we are updating more than on procedure set, then just append the "RO Update Complete" text
// To the MessageList. Once completed will all procedure sets, Admin Tools will display one message box with all the results in it.
if (MessageList == null)
FlexibleMessageBox.Show(fixedROs == 0 ? "No ROs Required Updating" : string.Format("{0} ROs Updated for {1}", fixedROs, dvi.MyFolder.Name), "RO Update Complete");
else
MessageList.AppendLine((fixedROs == 0 ? "No ROs Required Updating for " : string.Format("{0} ROs Updated for ", fixedROs)) + dvi.MyFolder.Name);
return fixedROs; return fixedROs;
} }
@@ -320,6 +328,8 @@ namespace VEPROMS.CSLA.Library
{ {
if (myProgressBarRefresh != null) myProgressBarRefresh(0, 100, "Starting Update"); if (myProgressBarRefresh != null) myProgressBarRefresh(0, 100, "Starting Update");
int origFSTid = origROFst.ROFstID;
DirectoryInfo di = new DirectoryInfo(rdi.FolderPath); DirectoryInfo di = new DirectoryInfo(rdi.FolderPath);
string rofstfilepath = rdi.FolderPath + @"\ro.fst"; string rofstfilepath = rdi.FolderPath + @"\ro.fst";
FileStream fsIn = new FileStream(rofstfilepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); FileStream fsIn = new FileStream(rofstfilepath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
@@ -346,6 +356,7 @@ namespace VEPROMS.CSLA.Library
docver.DocVersionAssociations[0].MyROFst = rofst; docver.DocVersionAssociations[0].MyROFst = rofst;
SetAssociationLastCompleted(docver, string.Empty); SetAssociationLastCompleted(docver, string.Empty);
SetPrevFSTID(docver, origFSTid); // //C2026-008 Re-Architect RO.FST to include RO Modification date/time
return rofst; return rofst;
} }
@@ -369,6 +380,9 @@ namespace VEPROMS.CSLA.Library
// Keep a list of ROIDs for Images that have changed. // Keep a list of ROIDs for Images that have changed.
List<string> MyChangedFigureROIDs = UpdateROFigures(rdi, myProgressBarRefresh, rofst, rodb, myLookup, docver); List<string> MyChangedFigureROIDs = UpdateROFigures(rdi, myProgressBarRefresh, rofst, rodb, myLookup, docver);
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
SetPrevFSTID(docver, origFSTid);
return rofst; return rofst;
} }
} }
@@ -469,6 +483,20 @@ namespace VEPROMS.CSLA.Library
docver.Save(); docver.Save();
} }
//C2026-008 Re-Architect RO.FST to include RO Modification date/time
// Place the previous ROFSTID in the config in case network error or computer crashes while updating RO Values
private static void SetPrevFSTID(DocVersion docver, int value)
{
if (docver.DocVersionAssociations[0]?.MyROFst != null && value != -1)
{
string cfg = docver.DocVersionAssociations[0].Config;
AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg);
ac.ROUpdate_PrevROFSTID = value.ToString();
docver.DocVersionAssociations[0].Config = ac.ToString();
docver.Save();
}
}
// Place the status of loading the RO Figures when updating RO Values // Place the status of loading the RO Figures when updating RO Values
private static void SetAssociationROFiguresLoading(DocVersion docver, string value) private static void SetAssociationROFiguresLoading(DocVersion docver, string value)
{ {
@@ -3567,6 +3567,26 @@ namespace Volian.Controls.Library
ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh); ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh);
roFstInfo = Mydvi.DocVersionAssociations[0].MyROFst; roFstInfo = Mydvi.DocVersionAssociations[0].MyROFst;
} }
else if (!dv.ROfstLastCompleted && origfstid == roFstInfo.ROFstID)
{
//Handle issue where load failed without completing update
//previous RO FST did not load, get last loaded ID
//if none, use -1 which will check all ROs in the Working Draft
string cfg = dv.DocVersionAssociations[0].Config;
AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg);
if (dv.DocVersionAssociations[0]?.MyROFst != null)
{
if (!int.TryParse(ac.ROUpdate_PrevROFSTID, out origfstid))
{
origfstid = -1;
}
}
else
{
origfstid = -1;
}
}
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file
ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, null, roFstInfo, origfstid, roFstInfo.ROFstID); ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, null, roFstInfo, origfstid, roFstInfo.ROFstID);
@@ -2479,6 +2479,26 @@ namespace Volian.Controls.Library
ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh); ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv, roFstInfo, DoProgressBarRefresh);
roFstInfo = MyDVI.DocVersionAssociations[0].MyROFst; roFstInfo = MyDVI.DocVersionAssociations[0].MyROFst;
} }
else if (!dv.ROfstLastCompleted && origfstid == roFstInfo.ROFstID)
{
//Handle issue where load failed without completing update
//previous RO FST did not load, get last loaded ID
//if none, use -1 which will check all ROs in the Working Draft
string cfg = dv.DocVersionAssociations[0].Config;
AssociationConfig ac = new AssociationConfig((cfg == null || cfg.Length == 0) ? "<Config />" : cfg);
if (dv.DocVersionAssociations[0]?.MyROFst != null)
{
if (!int.TryParse(ac.ROUpdate_PrevROFSTID, out origfstid))
{
origfstid = -1;
}
}
else
{
origfstid = -1;
}
}
roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate); roFstInfo.ROTableUpdate += new ROFstInfoROTableUpdateEvent(roFstInfo_ROTableUpdate);
ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file ContentInfo.StaticContentInfoChange += ContentInfo_StaticContentInfoChange; // write changes to a text file
ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, null, roFstInfo, origfstid, roFstInfo.ROFstID); ROFstInfo.RefreshROFstAtItemLevel(DocVersionInfo.Get(dv.VersionID), DoProgressBarRefresh, null, roFstInfo, origfstid, roFstInfo.ROFstID);