/*********************************************************************************************
 * Copyright 2004 - Volian Enterprises, Inc. All rights reserved.
 * Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
 * ------------------------------------------------------------------------------
 * $Workfile: LockDlg.cs $     $Revision: 1 $
 * $Author: Kathy $   $Date: 7/27/04 8:44a $
 *
 * $History: LockDlg.cs $
 * 
 * *****************  Version 1  *****************
 * User: Kathy        Date: 7/27/04    Time: 8:44a
 * Created in $/LibSource/VENetwork
 *********************************************************************************************/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace VENetwork
{
	/// 
	/// Summary description for LockDlg.
	/// 
	public class LockDlg : System.Windows.Forms.Form
	{
		private System.Windows.Forms.TextBox tbLockReason;
		private System.Windows.Forms.Label lblLckMsg;
		private System.Windows.Forms.Button btnOK;
		private System.Windows.Forms.Button Cancel;
		/// 
		/// Required designer variable.
		/// 
		private System.ComponentModel.Container components = null;
		private string [] LckTypes = {"SYSTEM", "PLANT", "PROCEDURE"};
		private VELock vlk;
		public LockDlg(VELock alock)
		{
			vlk = alock;
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			this.lblLckMsg.Text = "Please enter PURPOSE and estimated DURATION of " + LckTypes[(int)vlk.LockType-1] + " Lock: ";
		}
		/// 
		/// Clean up any resources being used.
		/// 
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(LockDlg));
			this.tbLockReason = new System.Windows.Forms.TextBox();
			this.lblLckMsg = new System.Windows.Forms.Label();
			this.btnOK = new System.Windows.Forms.Button();
			this.Cancel = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// tbLockReason
			// 
			this.tbLockReason.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.tbLockReason.Location = new System.Drawing.Point(8, 40);
			this.tbLockReason.Name = "tbLockReason";
			this.tbLockReason.Size = new System.Drawing.Size(328, 21);
			this.tbLockReason.TabIndex = 0;
			this.tbLockReason.Text = "";
			this.tbLockReason.KeyUp += new System.Windows.Forms.KeyEventHandler(this.tbLockReason_KeyUp);
			// 
			// lblLckMsg
			// 
			this.lblLckMsg.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblLckMsg.Location = new System.Drawing.Point(0, 0);
			this.lblLckMsg.Name = "lblLckMsg";
			this.lblLckMsg.Size = new System.Drawing.Size(280, 32);
			this.lblLckMsg.TabIndex = 1;
			this.lblLckMsg.Text = "Please enter PURPOSE and estimated DURATION of Lock: ";
			// 
			// btnOK
			// 
			this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
			this.btnOK.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.btnOK.Location = new System.Drawing.Point(176, 72);
			this.btnOK.Name = "btnOK";
			this.btnOK.Size = new System.Drawing.Size(64, 24);
			this.btnOK.TabIndex = 2;
			this.btnOK.Text = "OK";
			this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
			// 
			// Cancel
			// 
			this.Cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.Cancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.Cancel.Location = new System.Drawing.Point(264, 72);
			this.Cancel.Name = "Cancel";
			this.Cancel.Size = new System.Drawing.Size(64, 24);
			this.Cancel.TabIndex = 3;
			this.Cancel.Text = "Cancel";
			// 
			// LockDlg
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(376, 102);
			this.Controls.Add(this.Cancel);
			this.Controls.Add(this.btnOK);
			this.Controls.Add(this.lblLckMsg);
			this.Controls.Add(this.tbLockReason);
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.Name = "LockDlg";
			this.Text = "VE-Proms Lock Purpose";
			this.ResumeLayout(false);
		}
		#endregion
		private void btnOK_Click(object sender, System.EventArgs e)
		{
			vlk.Why = this.tbLockReason.Text;
			vlk.WhyDT = System.DateTime.Now;
		}
		private void tbLockReason_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
		{
			// if key pressed was a return - treat as ok button.
			if (e.KeyCode == Keys.Return) this.btnOK.PerformClick();
		}
	}
}