Added logic to prevent the selection of a procedure that is open by a different user

This commit is contained in:
John Jenko 2016-03-04 02:59:46 +00:00
parent 78d9affc00
commit e609d8b974
2 changed files with 45 additions and 35 deletions

View File

@ -44,6 +44,7 @@ namespace VEPROMS
this.btnCheck2 = new DevComponents.DotNetBar.ButtonX(); this.btnCheck2 = new DevComponents.DotNetBar.ButtonX();
this.ssMsg2 = new System.Windows.Forms.StatusStrip(); this.ssMsg2 = new System.Windows.Forms.StatusStrip();
this.tsslMsg2 = new System.Windows.Forms.ToolStripStatusLabel(); this.tsslMsg2 = new System.Windows.Forms.ToolStripStatusLabel();
this.tsslStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.btnApprove2 = new DevComponents.DotNetBar.ButtonX(); this.btnApprove2 = new DevComponents.DotNetBar.ButtonX();
this.btnCancel2 = new DevComponents.DotNetBar.ButtonX(); this.btnCancel2 = new DevComponents.DotNetBar.ButtonX();
this.labelX14 = new DevComponents.DotNetBar.LabelX(); this.labelX14 = new DevComponents.DotNetBar.LabelX();
@ -66,7 +67,6 @@ namespace VEPROMS
this.lblMore = new DevComponents.DotNetBar.LabelX(); this.lblMore = new DevComponents.DotNetBar.LabelX();
this.sttMore = new DevComponents.DotNetBar.SuperTooltip(); this.sttMore = new DevComponents.DotNetBar.SuperTooltip();
this.pnlRogue = new System.Windows.Forms.Panel(); this.pnlRogue = new System.Windows.Forms.Panel();
this.tsslStatus = new System.Windows.Forms.ToolStripStatusLabel();
((System.ComponentModel.ISupportInitialize)(this.approvalInfoBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.approvalInfoBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.stageInfoBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.stageInfoBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.revTypeBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.revTypeBindingSource)).BeginInit();
@ -95,7 +95,6 @@ namespace VEPROMS
// //
// //
// //
this.chkViewPDF.BackgroundStyle.Class = "";
this.chkViewPDF.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.chkViewPDF.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.chkViewPDF.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.approvalInfoBindingSource, "ViewPDF", true)); this.chkViewPDF.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.approvalInfoBindingSource, "ViewPDF", true));
this.chkViewPDF.Location = new System.Drawing.Point(279, 150); this.chkViewPDF.Location = new System.Drawing.Point(279, 150);
@ -150,7 +149,6 @@ namespace VEPROMS
// //
// //
// //
this.chkSetAllDates.BackgroundStyle.Class = "";
this.chkSetAllDates.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.chkSetAllDates.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.chkSetAllDates.Location = new System.Drawing.Point(11, 150); this.chkSetAllDates.Location = new System.Drawing.Point(11, 150);
this.chkSetAllDates.Name = "chkSetAllDates"; this.chkSetAllDates.Name = "chkSetAllDates";
@ -175,9 +173,9 @@ namespace VEPROMS
// //
// fgProcs // fgProcs
// //
this.fgProcs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.fgProcs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.fgProcs.AutoGenerateColumns = false; this.fgProcs.AutoGenerateColumns = false;
this.fgProcs.ColumnInfo = resources.GetString("fgProcs.ColumnInfo"); this.fgProcs.ColumnInfo = resources.GetString("fgProcs.ColumnInfo");
this.fgProcs.DataSource = this.approvalProcedureBindingSource; this.fgProcs.DataSource = this.approvalProcedureBindingSource;
@ -190,8 +188,8 @@ namespace VEPROMS
this.fgProcs.SelectionMode = C1.Win.C1FlexGrid.SelectionModeEnum.Cell; this.fgProcs.SelectionMode = C1.Win.C1FlexGrid.SelectionModeEnum.Cell;
this.fgProcs.Size = new System.Drawing.Size(425, 341); this.fgProcs.Size = new System.Drawing.Size(425, 341);
this.fgProcs.TabIndex = 30; this.fgProcs.TabIndex = 30;
this.fgProcs.ComboCloseUp += new C1.Win.C1FlexGrid.RowColEventHandler(this.fgProcs_AfterEdit);
this.fgProcs.AfterEdit += new C1.Win.C1FlexGrid.RowColEventHandler(this.fgProcs_AfterEdit); this.fgProcs.AfterEdit += new C1.Win.C1FlexGrid.RowColEventHandler(this.fgProcs_AfterEdit);
this.fgProcs.ComboCloseUp += new C1.Win.C1FlexGrid.RowColEventHandler(this.fgProcs_AfterEdit);
// //
// approvalProcedureBindingSource // approvalProcedureBindingSource
// //
@ -202,7 +200,6 @@ namespace VEPROMS
// //
// //
// //
this.chkCascade2.BackgroundStyle.Class = "";
this.chkCascade2.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.chkCascade2.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.chkCascade2.Location = new System.Drawing.Point(147, 150); this.chkCascade2.Location = new System.Drawing.Point(147, 150);
this.chkCascade2.Name = "chkCascade2"; this.chkCascade2.Name = "chkCascade2";
@ -241,6 +238,11 @@ namespace VEPROMS
this.tsslMsg2.Name = "tsslMsg2"; this.tsslMsg2.Name = "tsslMsg2";
this.tsslMsg2.Size = new System.Drawing.Size(0, 17); this.tsslMsg2.Size = new System.Drawing.Size(0, 17);
// //
// tsslStatus
//
this.tsslStatus.Name = "tsslStatus";
this.tsslStatus.Size = new System.Drawing.Size(0, 17);
//
// btnApprove2 // btnApprove2
// //
this.btnApprove2.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.btnApprove2.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
@ -278,7 +280,6 @@ namespace VEPROMS
// //
// //
// //
this.labelX14.BackgroundStyle.Class = "";
this.labelX14.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.labelX14.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.labelX14.Location = new System.Drawing.Point(21, 64); this.labelX14.Location = new System.Drawing.Point(21, 64);
this.labelX14.Name = "labelX14"; this.labelX14.Name = "labelX14";
@ -288,8 +289,8 @@ namespace VEPROMS
// //
// txtRevisionNotes2 // txtRevisionNotes2
// //
this.txtRevisionNotes2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.txtRevisionNotes2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
// //
// //
// //
@ -309,7 +310,6 @@ namespace VEPROMS
// //
// //
// //
this.labelX16.BackgroundStyle.Class = "";
this.labelX16.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.labelX16.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.labelX16.Location = new System.Drawing.Point(21, 38); this.labelX16.Location = new System.Drawing.Point(21, 38);
this.labelX16.Name = "labelX16"; this.labelX16.Name = "labelX16";
@ -319,8 +319,8 @@ namespace VEPROMS
// //
// cmbRevisionType2 // cmbRevisionType2
// //
this.cmbRevisionType2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.cmbRevisionType2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.cmbRevisionType2.DataSource = this.revTypeBindingSource; this.cmbRevisionType2.DataSource = this.revTypeBindingSource;
this.cmbRevisionType2.DisplayMember = "TypeName"; this.cmbRevisionType2.DisplayMember = "TypeName";
this.cmbRevisionType2.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.cmbRevisionType2.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
@ -338,8 +338,8 @@ namespace VEPROMS
// //
// cmbRevisionStage2 // cmbRevisionStage2
// //
this.cmbRevisionStage2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.cmbRevisionStage2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.cmbRevisionStage2.DataSource = this.stageInfoBindingSource; this.cmbRevisionStage2.DataSource = this.stageInfoBindingSource;
this.cmbRevisionStage2.DisplayMember = "Name"; this.cmbRevisionStage2.DisplayMember = "Name";
this.cmbRevisionStage2.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; this.cmbRevisionStage2.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
@ -361,7 +361,6 @@ namespace VEPROMS
// //
// //
// //
this.labelX17.BackgroundStyle.Class = "";
this.labelX17.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.labelX17.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.labelX17.Location = new System.Drawing.Point(21, 12); this.labelX17.Location = new System.Drawing.Point(21, 12);
this.labelX17.Name = "labelX17"; this.labelX17.Name = "labelX17";
@ -395,7 +394,6 @@ namespace VEPROMS
// //
// //
// //
this.lblPhase.BackgroundStyle.Class = "";
this.lblPhase.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.lblPhase.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lblPhase.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblPhase.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblPhase.Location = new System.Drawing.Point(300, 20); this.lblPhase.Location = new System.Drawing.Point(300, 20);
@ -410,7 +408,6 @@ namespace VEPROMS
// //
// //
// //
this.chkCascadeMore.BackgroundStyle.Class = "";
this.chkCascadeMore.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.chkCascadeMore.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.chkCascadeMore.Location = new System.Drawing.Point(131, 510); this.chkCascadeMore.Location = new System.Drawing.Point(131, 510);
this.chkCascadeMore.Name = "chkCascadeMore"; this.chkCascadeMore.Name = "chkCascadeMore";
@ -437,8 +434,8 @@ namespace VEPROMS
// //
// pbMore // pbMore
// //
this.pbMore.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.pbMore.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.pbMore.Location = new System.Drawing.Point(15, 35); this.pbMore.Location = new System.Drawing.Point(15, 35);
this.pbMore.Name = "pbMore"; this.pbMore.Name = "pbMore";
this.pbMore.Size = new System.Drawing.Size(279, 23); this.pbMore.Size = new System.Drawing.Size(279, 23);
@ -490,9 +487,9 @@ namespace VEPROMS
// //
// clbMore // clbMore
// //
this.clbMore.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.clbMore.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.clbMore.CheckOnClick = true; this.clbMore.CheckOnClick = true;
this.clbMore.FormattingEnabled = true; this.clbMore.FormattingEnabled = true;
this.clbMore.HorizontalScrollbar = true; this.clbMore.HorizontalScrollbar = true;
@ -516,7 +513,7 @@ namespace VEPROMS
this.btnOkay.Size = new System.Drawing.Size(75, 23); this.btnOkay.Size = new System.Drawing.Size(75, 23);
this.btnOkay.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.btnOkay.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnOkay.TabIndex = 14; this.btnOkay.TabIndex = 14;
this.btnOkay.Text = "OK";//Fixed Code Change Request C2015-056 this.btnOkay.Text = "OK";
this.btnOkay.Click += new System.EventHandler(this.btnOkay_Click); this.btnOkay.Click += new System.EventHandler(this.btnOkay_Click);
// //
// btnCancelMore // btnCancelMore
@ -535,13 +532,12 @@ namespace VEPROMS
// //
// lblMore // lblMore
// //
this.lblMore.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.lblMore.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.lblMore.AutoSize = true; this.lblMore.AutoSize = true;
// //
// //
// //
this.lblMore.BackgroundStyle.Class = "";
this.lblMore.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square; this.lblMore.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
this.lblMore.Location = new System.Drawing.Point(15, 12); this.lblMore.Location = new System.Drawing.Point(15, 12);
this.lblMore.Name = "lblMore"; this.lblMore.Name = "lblMore";
@ -552,6 +548,7 @@ namespace VEPROMS
// sttMore // sttMore
// //
this.sttMore.CheckTooltipPosition = false; this.sttMore.CheckTooltipPosition = false;
this.sttMore.DefaultTooltipSettings = new DevComponents.DotNetBar.SuperTooltipInfo("", "", "", null, null, DevComponents.DotNetBar.eTooltipColor.Gray);
this.sttMore.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F"; this.sttMore.LicenseKey = "F962CEC7-CD8F-4911-A9E9-CAB39962FC1F";
this.sttMore.PositionBelowControl = false; this.sttMore.PositionBelowControl = false;
// //
@ -563,11 +560,6 @@ namespace VEPROMS
this.pnlRogue.Size = new System.Drawing.Size(72, 574); this.pnlRogue.Size = new System.Drawing.Size(72, 574);
this.pnlRogue.TabIndex = 25; this.pnlRogue.TabIndex = 25;
// //
// tsslStatus
//
this.tsslStatus.Name = "tsslStatus";
this.tsslStatus.Size = new System.Drawing.Size(0, 17);
//
// dlgApproveProcedure // dlgApproveProcedure
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@ -182,8 +182,15 @@ namespace VEPROMS
{ {
foreach (ProcedureInfo pi in _MyDocVersion.Procedures) foreach (ProcedureInfo pi in _MyDocVersion.Procedures)
{ {
OwnerInfo oi = OwnerInfo.GetByItemID(pi.ItemID, CheckOutType.Procedure);
pi.MyDocVersion.DocVersionConfig.SelectedSlave = _MyDocVersion.DocVersionConfig.SelectedSlave; pi.MyDocVersion.DocVersionConfig.SelectedSlave = _MyDocVersion.DocVersionConfig.SelectedSlave;
clbMore.Items.Add(pi.DisplayNumber); if (oi != null && oi.SessionID != MySessionInfo.SessionID)
{
string prcNumber = pi.DisplayNumber + string.Format(" Checked out to {0}", oi.SessionUserID);
clbMore.Items.Add(prcNumber);
}
else
clbMore.Items.Add(pi.DisplayNumber);
tmpProcedures.Add(pi.DisplayNumber, pi); tmpProcedures.Add(pi.DisplayNumber, pi);
} }
} }
@ -200,7 +207,9 @@ namespace VEPROMS
private Dictionary<string, ProcedureInfo> tmpProcedures = new Dictionary<string, ProcedureInfo>(); private Dictionary<string, ProcedureInfo> tmpProcedures = new Dictionary<string, ProcedureInfo>();
private ProcedureInfo GetProcedureInfoByKey(string key) private ProcedureInfo GetProcedureInfoByKey(string key)
{ {
if (tmpProcedures.ContainsKey(key)) if (key.Contains(" Checked out to "))
key = key.Substring(0, key.IndexOf(" Checked out to "));
if (tmpProcedures.ContainsKey(key))
return tmpProcedures[key]; return tmpProcedures[key];
else else
return tmpProcedures[GetDisplayNumberOnly(key)]; return tmpProcedures[GetDisplayNumberOnly(key)];
@ -300,6 +309,15 @@ namespace VEPROMS
} }
private void clbMore_ItemCheck(object sender, ItemCheckEventArgs e) private void clbMore_ItemCheck(object sender, ItemCheckEventArgs e)
{ {
ProcedureInfo pi = GetProcedureInfoByKey(clbMore.Items[e.Index].ToString());
OwnerInfo oi = OwnerInfo.GetByItemID(pi.ItemID, CheckOutType.Procedure);
if (oi != null && oi.SessionID != MySessionInfo.SessionID)
{
string msg = string.Format("Cannot select this procedure for approval.\n\n It is checked out to {0}", oi.SessionUserID);
MessageBox.Show(msg,pi.DisplayNumber);
e.NewValue = CheckState.Unchecked;
return;
}
if (e.NewValue == CheckState.Checked) if (e.NewValue == CheckState.Checked)
btnOkay.Enabled = true; btnOkay.Enabled = true;
else else