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.

This commit is contained in:
Rich 2013-11-20 23:03:04 +00:00
parent b634967817
commit 4b71f7188c
2 changed files with 172 additions and 0 deletions

View File

@ -0,0 +1,92 @@
namespace VEPROMS
{
partial class dlgCheckedOutProcedure
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
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;
}
}

View File

@ -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;
}
}
}