using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using EM.IEMDataOpretion;
using EM.IEMCommon;
using System.Data;
namespace EM.EquipmentManage.frm
{
/// <summary>
/// frmAddSchool 的摘要说明。
/// </summary>
public class frmAddUser: System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox txtName;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private System.Windows.Forms.TextBox txtUserID;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label labParent;
DataRow curRow;
public frmAddUser(DataRow row,string parent)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
curRow=row;
labParent.Text=parent;
 
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
} /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
} #region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmAddUser));
this.label1 = new System.Windows.Forms.Label();
this.txtName = new System.Windows.Forms.TextBox();
this.labParent = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.txtUserID = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
// 
// label1
// 
this.label1.Location = new System.Drawing.Point(12, 64);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(80, 16);
this.label1.TabIndex = 0;
this.label1.Text = "  用户名称:";
// 
// txtName
// 
this.txtName.Location = new System.Drawing.Point(96, 60);
this.txtName.MaxLength = 30;
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(188, 21);
this.txtName.TabIndex = 1;
this.txtName.Text = "";
this.txtName.TextChanged += new System.EventHandler(this.txtName_TextChanged);
// 
// labParent
// 
this.labParent.Location = new System.Drawing.Point(92, 8);
this.labParent.Name = "labParent";
this.labParent.Size = new System.Drawing.Size(192, 16);
this.labParent.TabIndex = 0;
// 
// label7
// 
this.label7.Location = new System.Drawing.Point(12, 8);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(80, 16);
this.label7.TabIndex = 0;
this.label7.Text = "该用户属于:";
// 
// btnOK
// 
this.btnOK.Location = new System.Drawing.Point(40, 92);
this.btnOK.Name = "btnOK";
this.btnOK.TabIndex = 2;
this.btnOK.Text = "确定";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
// 
// btnCancel
// 
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(132, 92);
this.btnCancel.Name = "btnCancel";
this.btnCancel.TabIndex = 3;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
// 
// txtUserID
// 
this.txtUserID.Location = new System.Drawing.Point(96, 32);
this.txtUserID.MaxLength = 20;
this.txtUserID.Name = "txtUserID";
this.txtUserID.Size = new System.Drawing.Size(188, 21);
this.txtUserID.TabIndex = 0;
this.txtUserID.Text = "";
this.txtUserID.TextChanged += new System.EventHandler(this.txtUserID_TextChanged);
// 
// label2
// 
this.label2.Location = new System.Drawing.Point(12, 36);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(80, 16);
this.label2.TabIndex = 0;
this.label2.Text = "用户登录名:";
// 
// frmAddUser
// 
this.AcceptButton = this.btnOK;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(294, 127);
this.Controls.Add(this.labParent);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.txtName);
this.Controls.Add(this.label1);
this.Controls.Add(this.label7);
this.Controls.Add(this.txtUserID);
this.Controls.Add(this.label2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmAddUser";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "添加用户";
this.ResumeLayout(false); }
#endregion private bool checkField()
{
if(txtName.Text.Trim()=="")
{
MessageBox.Show("请录入名称!","Message");
txtName.Focus();
return false;
}
if(txtUserID.Text.Trim()=="")
{
MessageBox.Show("请录入用户登录名!","Message");
txtUserID.Focus();
return false;
}
return true;
}
private void btnOK_Click(object sender, System.EventArgs e)
{
if(!checkField())
return;
this.Tag="OK";
this.Close();
} private void btnCancel_Click(object sender, System.EventArgs e)
{
this.Tag="";
this.Close();
} private void txtUserID_TextChanged(object sender, System.EventArgs e)
{
curRow[UserData.PKID_FIELD]=txtUserID.Text.ToUpper();
} private void txtName_TextChanged(object sender, System.EventArgs e)
{
curRow[UserData.NAME_FIELD]=txtName.Text.ToUpper();
}
 
}
}