From 36618766266e6e2dbf191c7492edb423b055aaab Mon Sep 17 00:00:00 2001 From: Kathy Date: Wed, 18 Jan 2023 16:31:35 +0000 Subject: [PATCH] =?UTF-8?q?C2023-002:=20When=20using=20RO=20Update=20Value?= =?UTF-8?q?s=20feature,=20display=20message=20when=20other=20users=20are?= =?UTF-8?q?=20in=20Proms=20and=20don=E2=80=99t=20do=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VEPROMS User Interface/frmBatchRefresh.cs | 42 ++++++++++++++----- .../frmBatchRefreshCheckedOut.Designer.cs | 2 +- .../frmBatchRefreshCheckedOut.cs | 36 +++++++++------- .../frmBatchRefreshCheckedOut.resx | 8 ++-- PROMS/VEPROMS User Interface/frmVEPROMS.cs | 1 + .../Volian.Controls.Library/StepTabRibbon.cs | 17 +++++++- 6 files changed, 74 insertions(+), 32 deletions(-) diff --git a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs index d9808096..c6218f58 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefresh.cs +++ b/PROMS/VEPROMS User Interface/frmBatchRefresh.cs @@ -201,6 +201,7 @@ namespace VEPROMS private void UpdateROValues() { this.Cursor = Cursors.WaitCursor; + List pil = new List(); // C2023-002: list of checked out procedures, used in frmBatchRefreshCheckedOut dialog List dvil = new List(); 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 dviq = new Queue(); @@ -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); diff --git a/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.Designer.cs b/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.Designer.cs index 69e6d171..db30ef0a 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.Designer.cs +++ b/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.Designer.cs @@ -89,8 +89,8 @@ namespace VEPROMS this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.Text = "Procedures Currently Checked Out"; this.TopMost = true; - this.Load += new System.EventHandler(this.frmBatchRefreshCheckedOut_Load); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.frmBatchRefreshCheckedOut_FormClosing); + this.Load += new System.EventHandler(this.frmBatchRefreshCheckedOut_Load); this.ResumeLayout(false); } diff --git a/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.cs b/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.cs index e5e335af..7da971fd 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.cs +++ b/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.cs @@ -29,13 +29,16 @@ namespace VEPROMS get { return _CheckedOutProcedures; } set { _CheckedOutProcedures = value; } } - public frmBatchRefreshCheckedOut() + private int RType = -1; // C2023-002: Flag type of checkout, docversion -1 or procedures 0 + public frmBatchRefreshCheckedOut(int type) { + RType = type; InitializeComponent(); } private void frmBatchRefreshCheckedOut_FormClosing(object sender, FormClosingEventArgs e) { Owner.Show(); + DialogResult = DialogResult.Cancel; } private void frmBatchRefreshCheckedOut_Load(object sender, EventArgs e) { @@ -50,20 +53,23 @@ namespace VEPROMS p.BorderStyle = BorderStyle.FixedSingle; p.Dock = DockStyle.Top; p.Height = 28; - Button b = new Button(); - //b.FlatStyle = FlatStyle.Popup; - b.Dock = DockStyle.Right; - b.Text = "Force Check In"; - b.Tag = pi; - b.Click += new EventHandler(ForceCheckIn_Click); - p.Controls.Add(b); - b = new Button(); - //b.FlatStyle = FlatStyle.Popup; - b.Dock = DockStyle.Right; - b.Text = "Send Email"; - b.Tag = pi; - b.Click += new EventHandler(SendEmail_Click); - p.Controls.Add(b); + if (RType != 1) // C2023-002: only put out ForceCheckin & sendemail buttons if on procedures (can't check in a docversion) + { + Button b = new Button(); + //b.FlatStyle = FlatStyle.Popup; + b.Dock = DockStyle.Right; + b.Text = "Force Check In"; + b.Tag = pi; + b.Click += new EventHandler(ForceCheckIn_Click); + p.Controls.Add(b); + b = new Button(); + //b.FlatStyle = FlatStyle.Popup; + b.Dock = DockStyle.Right; + b.Text = "Send Email"; + b.Tag = pi; + b.Click += new EventHandler(SendEmail_Click); + p.Controls.Add(b); + } Label l = new Label(); l.Dock = DockStyle.Fill; l.TextAlign = ContentAlignment.MiddleLeft; diff --git a/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.resx b/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.resx index 622f01e9..53d52057 100644 --- a/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.resx +++ b/PROMS/VEPROMS User Interface/frmBatchRefreshCheckedOut.resx @@ -112,16 +112,16 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 - While this form is visible, there is a timer running that checks every 30 seconds to see if any of the above procedures have been checked in. You have the option of sending an email to the user asking them to close the procedure so you can finish the batch refresh process or you can force check in the procedure. + For Ro Value Updates, this form shows users in procedures but does not update ro values for associated sets, even if user exits. It also does not send email or allow Forced Check In. For transitions, while this form is visible, there is a timer running that checks every 30 seconds to see if any of the above procedures have been checked in. You have the option of sending an email to the user asking them to close the procedure so you can finish the batch refresh process or you can force check in the procedure. The recommended practice would be to send an email and wait to see if the user closes the procedure. If after an acceptable period of time, the procedure is still checked out, the forced check in step can be taken. When you select forced check in, an email will be sent to the user stating that the procedure was forced checked in. diff --git a/PROMS/VEPROMS User Interface/frmVEPROMS.cs b/PROMS/VEPROMS User Interface/frmVEPROMS.cs index b29834b0..efcf6096 100644 --- a/PROMS/VEPROMS User Interface/frmVEPROMS.cs +++ b/PROMS/VEPROMS User Interface/frmVEPROMS.cs @@ -2031,6 +2031,7 @@ namespace VEPROMS tc.MySessionInfo = MySessionInfo; tv.MySessionInfo = MySessionInfo; tv.MyUserInfo = MyUserInfo; + StepTabRibbon.MySessionInfo = MySessionInfo; // Initialize Caption with Server name and Database name. SetCaption(tv.TopNode as VETreeNode); diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index 0aa57477..fcf86e28 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -126,7 +126,12 @@ namespace Volian.Controls.Library get { return _MyUserInfo; } set { _MyUserInfo = value; } } - + private static SessionInfo _MySessionInfo; + public static SessionInfo MySessionInfo + { + get { return _MySessionInfo; } + set { _MySessionInfo = value; } + } private DevComponents.DotNetBar.ButtonItem _DefaultContextMenu; public void ClearContextMenu() @@ -3378,7 +3383,15 @@ namespace Volian.Controls.Library // return; //} Cursor = Cursors.WaitCursor; - + // C2023-001: Check whether docversion can be checked out before continuing with update of ro.fst + string message = string.Empty; + if (!MySessionInfo.CanCheckOutItem(Mydvi.VersionID, CheckOutType.DocVersion, ref message)) + { + FlexibleMessageBox.Show(this, message, "Working Draft Has Items Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning); + FinalProgressBarMessage = "Cannot check-out Working Draft"; + Cursor = Cursors.Default; + return; + } using (DocVersion dv = DocVersion.Get(Mydvi.VersionID)) { swROUpdate = new System.IO.StreamWriter(ROFstInfo.ROUpdateResultsPath(Mydvi));