From 4b71f7188ccb168fa7c691a0c1ff72e6276a22ac Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 20 Nov 2013 23:03:04 +0000 Subject: [PATCH] Added dialog box so user can get additional information regarding user that has object checked out. In addition, allows administrators to force check in open objects by other users. --- .../dlgCheckedOutProcedure.Designer.cs | 92 +++++++++++++++++++ .../dlgCheckedOutProcedure.cs | 80 ++++++++++++++++ 2 files changed, 172 insertions(+) create mode 100644 PROMS/VEPROMS User Interface/dlgCheckedOutProcedure.Designer.cs create mode 100644 PROMS/VEPROMS User Interface/dlgCheckedOutProcedure.cs diff --git a/PROMS/VEPROMS User Interface/dlgCheckedOutProcedure.Designer.cs b/PROMS/VEPROMS User Interface/dlgCheckedOutProcedure.Designer.cs new file mode 100644 index 00000000..f465e240 --- /dev/null +++ b/PROMS/VEPROMS User Interface/dlgCheckedOutProcedure.Designer.cs @@ -0,0 +1,92 @@ +namespace VEPROMS +{ + partial class dlgCheckedOutProcedure + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lblInfo = new System.Windows.Forms.Label(); + this.btnOkay = new System.Windows.Forms.Button(); + this.btnForce = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // lblInfo + // + this.lblInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblInfo.Location = new System.Drawing.Point(12, 9); + this.lblInfo.Name = "lblInfo"; + this.lblInfo.Size = new System.Drawing.Size(610, 149); + this.lblInfo.TabIndex = 0; + this.lblInfo.Text = "label1"; + // + // btnOkay + // + this.btnOkay.DialogResult = System.Windows.Forms.DialogResult.OK; + this.btnOkay.Location = new System.Drawing.Point(547, 172); + this.btnOkay.Name = "btnOkay"; + this.btnOkay.Size = new System.Drawing.Size(75, 30); + this.btnOkay.TabIndex = 1; + this.btnOkay.Text = "Okay"; + this.btnOkay.UseVisualStyleBackColor = true; + // + // btnForce + // + this.btnForce.Location = new System.Drawing.Point(418, 172); + this.btnForce.Name = "btnForce"; + this.btnForce.Size = new System.Drawing.Size(123, 30); + this.btnForce.TabIndex = 2; + this.btnForce.Text = "Force Check In"; + this.btnForce.UseVisualStyleBackColor = true; + this.btnForce.Click += new System.EventHandler(this.btnForce_Click); + // + // dlgCheckedOutProcedure + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(634, 214); + this.Controls.Add(this.btnForce); + this.Controls.Add(this.btnOkay); + this.Controls.Add(this.lblInfo); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "dlgCheckedOutProcedure"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Checked Out Procedure"; + this.Load += new System.EventHandler(this.dlgCheckedOutProcedure_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label lblInfo; + private System.Windows.Forms.Button btnOkay; + private System.Windows.Forms.Button btnForce; + } +} \ No newline at end of file diff --git a/PROMS/VEPROMS User Interface/dlgCheckedOutProcedure.cs b/PROMS/VEPROMS User Interface/dlgCheckedOutProcedure.cs new file mode 100644 index 00000000..e99627b9 --- /dev/null +++ b/PROMS/VEPROMS User Interface/dlgCheckedOutProcedure.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; +using VEPROMS.CSLA.Library; + +namespace VEPROMS +{ + public partial class dlgCheckedOutProcedure : Form + { + public dlgCheckedOutProcedure(ProcedureInfo pi, SectionInfo si, UserInfo ui) + { + InitializeComponent(); + _MyProcedureInfo = pi; + _MySectionInfo = si; + if (_MyProcedureInfo != null) + _MyOwnerInfo = OwnerInfo.GetByItemID(pi.ItemID, CheckOutType.Procedure); + else + _MyOwnerInfo = OwnerInfo.GetByItemID(si.MyContent.MyEntry.DocID, CheckOutType.Document); + _MySessionInfo = SessionInfo.Get(_MyOwnerInfo.SessionID); + _MyUserInfo = ui; + } + private ProcedureInfo _MyProcedureInfo; + public ProcedureInfo MyProcedureInfo + { + get { return _MyProcedureInfo; } + } + private SectionInfo _MySectionInfo; + public SectionInfo MySectionInfo + { + get { return _MySectionInfo; } + } + private OwnerInfo _MyOwnerInfo; + public OwnerInfo MyOwnerInfo + { + get { return _MyOwnerInfo; } + } + private SessionInfo _MySessionInfo; + public SessionInfo MySessionInfo + { + get { return _MySessionInfo; } + } + private UserInfo _MyUserInfo; + public UserInfo MyUserInfo + { + get { return _MyUserInfo; } + } + StringBuilder sb = new StringBuilder(); + + private void dlgCheckedOutProcedure_Load(object sender, EventArgs e) + { + if (MyProcedureInfo != null) + sb.AppendLine(string.Format("The procedure {0} - {1}", MyProcedureInfo.DisplayNumber, MyProcedureInfo.DisplayText)); + else + sb.AppendLine(string.Format("The document {0}", MySectionInfo.DisplayText)); + sb.AppendLine(); + sb.AppendLine(string.Format("is currently checked out by {0} starting on {1}", MySessionInfo.UserID, MyOwnerInfo.DTSStart.ToString("MM/dd/yyyy @ HH:mm:ss"))); + sb.AppendLine(); + sb.AppendLine(string.Format("in a VEPROMS session on computer {0} that was started on {1}", MySessionInfo.MachineName, MySessionInfo.DTSDtart.ToString("MM/dd/yyyy @ HH:mm:ss"))); + lblInfo.Text = sb.ToString(); + if(MyProcedureInfo != null) + btnForce.Visible = MyUserInfo.IsAdministrator() || MyUserInfo.IsSetAdministrator(MyProcedureInfo.MyDocVersion); + else + btnForce.Visible = MyUserInfo.IsAdministrator() || MyUserInfo.IsSetAdministrator(MySectionInfo.MyProcedure.MyDocVersion); + } + + private void btnForce_Click(object sender, EventArgs e) + { + MySessionInfo.CheckInItem(MyOwnerInfo.OwnerID); + sb.AppendLine(); + sb.AppendLine("Forced Check In has been completed"); + lblInfo.Text = sb.ToString(); + btnForce.Enabled = false; + } + + } +} \ No newline at end of file