Merge pull request 'B2022-144 added logic to process individual procedures to check for bad RO Links' (#7) from B2022-144_CheckROLinks into Development

Merging changes to test executable for generic purposes relating to the Administrative Tools.
This commit is contained in:
2023-06-28 11:41:14 -04:00
4 changed files with 59 additions and 141 deletions

View File

@@ -256,53 +256,29 @@ namespace VEPROMS.CSLA.Library
return fixedROs;
}
//C2022-028 for Admin tool to check for bad RO links
public static int DoCheckROLinksInProcedures(DocVersion docver, ROFstInfoProgressBarRefresh myProgressBarRefresh, System.Windows.Forms.TextBox tbStatus)
{
/**** commented out for now - keep in case we decide to try to fix some of the RO links
//ROFst rofst = null;
//rofst = docver.DocVersionAssociations[0].MyROFst;
***/
DocVersionInfo dvi = DocVersionInfo.Get(docver.VersionID);
int badROLinks = CheckROLinksInProcedures(dvi, myProgressBarRefresh, tbStatus);
myProgressBarRefresh(100, 100, "Check RO Links Complete"); // update the progress bar
System.Windows.Forms.Application.DoEvents();
// pop up a message window telling the user the RO Check has completed and how many bad ROs were found
// if MessageList is not null, then append the results message to it. We are running via Admin tools and doing more than one procedure set
// and will diplay the messages once after all processing is completed
if (MessageList != null)
MessageList.AppendLine((badROLinks == 0 ? "No Bad RO Links Found for " : string.Format("{0} Bad RO Links Found in ", badROLinks)) + dvi.MyFolder.Name);
return badROLinks;
}
public static int CheckROLinksInProcedures(DocVersionInfo dvi, ROFstInfoProgressBarRefresh myProgressBarRefresh, System.Windows.Forms.TextBox tbStatus)
//B2022-144 we now loop through checked procedures list from Admin Tools and call this method for each procedure we want to process
public static int CheckROLinksInThisProcedure(ProcedureInfo proc, System.Windows.Forms.TextBox tbStatus)
{
int FoundBadROLinks = 0;
DocVersionInfo dvi = DocVersionInfo.Get(proc.MyDocVersion.VersionID);
if (dvi.DocVersionConfig.SelectedSlave <= 0)
{
int i = 0;
foreach (ProcedureInfo proc in dvi.Procedures)
{
DateTime start = DateTime.Now;
DateTime start = DateTime.Now;
ProcedureInfo.ResetCheckROLinkCounters();
myProgressBarRefresh(++i, dvi.Procedures.Count, string.Format("{0} ({1}/{2} ROs)", proc.DisplayNumber, i, dvi.Procedures.Count));
ProcedureInfo.CheckReferenceObjectsLinks(proc);
FoundBadROLinks += ProcedureInfo.BadROLinksCount;
ProcedureInfo.ResetCheckROLinkCounters();
ProcedureInfo.CheckReferenceObjectsLinks(proc);
FoundBadROLinks += ProcedureInfo.BadROLinksCount;
TimeSpan ts = DateTime.Now - start;
TimeSpan ts = DateTime.Now - start;
if (tbStatus != null)
tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects Links{0}, Found {3} Bad RO Links{0} Elapsed Seconds:{5}{0}{0}", Environment.NewLine, proc.DisplayNumber, ProcedureInfo.CheckROLinksCount, ProcedureInfo.BadROLinksCount, ProcedureInfo.FixedROLinksCount, ts.TotalSeconds));
/*** keep for now - incase we decide to fix RO links later on, this will show the number of RO Links that we fixed
//tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects Links{0}, Found {3} Bad RO Links{0}, Fixed {4} Bad RO Links{0} Elapsed Seconds:{5}{0}{0}", Environment.NewLine, proc.DisplayNumber, ProcedureInfo.CheckROLinksCount, ProcedureInfo.BadROLinksCount, ProcedureInfo.FixedROLinksCount, ts.TotalSeconds));
***/
}
if (tbStatus != null)
tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects Links{0}, Found {3} Bad RO Links{0} Elapsed Seconds:{5}{0}{0}", Environment.NewLine, proc.DisplayNumber, ProcedureInfo.CheckROLinksCount, ProcedureInfo.BadROLinksCount, ProcedureInfo.FixedROLinksCount, ts.TotalSeconds));
/*** keep for now - incase we decide to fix RO links later on, this will show the number of RO Links that we fixed
//tbStatus.AppendText(string.Format("Procedure: {1}{0}, Checked {2} Referenced Objects Links{0}, Found {3} Bad RO Links{0}, Fixed {4} Bad RO Links{0} Elapsed Seconds:{5}{0}{0}", Environment.NewLine, proc.DisplayNumber, ProcedureInfo.CheckROLinksCount, ProcedureInfo.BadROLinksCount, ProcedureInfo.FixedROLinksCount, ts.TotalSeconds));
***/
}
return FoundBadROLinks; // return the total number of bad RO links (in step text only) for the entire procedure set