C2023-002: When using RO Update Values feature, display message when other users are in Proms and don’t do update

This commit is contained in:
2023-01-18 16:31:35 +00:00
parent 7be346b6c8
commit 3661876626
6 changed files with 74 additions and 32 deletions

View File

@@ -201,6 +201,7 @@ namespace VEPROMS
private void UpdateROValues()
{
this.Cursor = Cursors.WaitCursor;
List<ProcedureInfo> pil = new List<ProcedureInfo>(); // C2023-002: list of checked out procedures, used in frmBatchRefreshCheckedOut dialog
List<DocVersionInfo> dvil = new List<DocVersionInfo>();
foreach (TreeNode tn in myDocVersions.Keys)
if (tn.Checked)
@@ -214,7 +215,8 @@ namespace VEPROMS
pbProcess.Minimum = 0;
pbProcess.Maximum = dvil.Count;
pbProcess.Step = 1;
while (dvil.Count > 0)
bool cancelledOut = false; // C2023-002: flags cancel out of frmBatchRefreshCheckedOut so that looping can end
while (dvil.Count > 0 && !cancelledOut)
{
StringBuilder sbDocVersions = new StringBuilder();
Queue<DocVersionInfo> dviq = new Queue<DocVersionInfo>();
@@ -231,6 +233,13 @@ namespace VEPROMS
if (!MySessionInfo.CanCheckOutItem(dq.VersionID, CheckOutType.DocVersion, ref msg))
{
dvil.Add(dq);
// C2023-002: Loop through the docversion's procedures to determine which cannot be open and add to
// list. The frmBatchRefreshCheckedOut dialog operates on procedures, not docversions.
string msgp = string.Empty;
foreach (ProcedureInfo pi in dq.Procedures)
{
if (!MySessionInfo.CanCheckOutItem(pi.ItemID, CheckOutType.Procedure, ref msgp)) pil.Add(pi);
}
sbDocVersions.AppendLine(msg);
}
else
@@ -242,8 +251,7 @@ namespace VEPROMS
Application.DoEvents();
}
}
DateTime pEnd = DateTime.Now;
txtProcess.AppendText(string.Format("Completed: {0} {1} Seconds Elapsed", pEnd.ToString("MM/dd/yyyy @ HH:mm"), TimeSpan.FromTicks(pEnd.Ticks - pStart.Ticks).TotalSeconds));
Application.DoEvents();
// when processing more than one procedure set, display only one completed message after all are processed
if (ROFstInfo.MessageList != null)
@@ -263,15 +271,29 @@ namespace VEPROMS
sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately.");
sb.AppendLine();
sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?");
frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut();
frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(1);
frmCO.MySessionInfo = MySessionInfo;
//frmCO.CheckedOutProcedures = dvil;
frmCO.CheckedOutProcedures = pil; // C2023-002: set list of checked out procedures
frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height);
frmCO.Show(this);
while (!this.Visible)
Application.DoEvents();
// C2023-002: Allow close of dialog that has list of procedures that are checked out
if (frmCO.ShowDialog(this) != DialogResult.Cancel)
{
while (!this.Visible)
Application.DoEvents();
}
else
cancelledOut = true;
}
}
DateTime pEnd = DateTime.Now;
// C2023-002: Message depending on whether ro.fst update is completed.
if (!cancelledOut)
txtProcess.AppendText(string.Format("Completed: {0} {1} Seconds Elapsed", pEnd.ToString("MM/dd/yyyy @ HH:mm"), TimeSpan.FromTicks(pEnd.Ticks - pStart.Ticks).TotalSeconds));
else
{
txtProcess.AppendText(string.Format("Could Not Complete: {0} {1} Seconds Elapsed", pEnd.ToString("MM/dd/yyyy @ HH:mm"), TimeSpan.FromTicks(pEnd.Ticks - pStart.Ticks).TotalSeconds));
pbProcess.Value = pbProcess.Maximum;
}
this.Cursor = Cursors.Default;
}
//C2022-028 check for Bad RO Links - we will check all of the RO links found in procedure step text
@@ -332,7 +354,7 @@ namespace VEPROMS
if (dvil.Count > 0)
{
frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut();
frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(0);
frmCO.MySessionInfo = MySessionInfo;
frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height);
frmCO.Show(this);
@@ -516,7 +538,7 @@ namespace VEPROMS
sb.AppendLine("Once this is complete you can continue the process otherwise you may terminate the process immediately.");
sb.AppendLine();
sb.AppendLine("Have you requested the users to close the procedures and do you want to continue the process?");
frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut();
frmBatchRefreshCheckedOut frmCO = new frmBatchRefreshCheckedOut(0);
frmCO.MySessionInfo = MySessionInfo;
frmCO.CheckedOutProcedures = pil;
frmCO.Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - frmCO.Width, Screen.PrimaryScreen.WorkingArea.Height - frmCO.Height);