📄 frmnewuser.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data;
namespace SupermarketProject
{
/// <summary>
/// Summary description for frmNewUser.
/// </summary>
public class frmNewUser : System.Windows.Forms.Form
{
private System.Windows.Forms.TextBox txtName;
private System.Windows.Forms.TextBox txtUid;
private System.Windows.Forms.TextBox txtPwd;
private System.Windows.Forms.TextBox txtVerPwd;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.GroupBox grpLine;
private System.ComponentModel.IContainer components;
public int[] arrPrior = new int[4];
public int cumPriorVal;
public string errorMsg;
//Variable for storing the Employee status CheckBox field
public bool EmpStatus;
private System.Windows.Forms.CheckBox chkEmpStat;
private System.Windows.Forms.CheckedListBox chlPrior;
private System.Windows.Forms.TextBox txtEmailId;
private System.Windows.Forms.HelpProvider hlpNewUser;
private System.Windows.Forms.ToolTip tipNewUser;
private System.Windows.Forms.ErrorProvider errNewUser;
private Settings settings;
//Structure variable
public stEmployee stEmp;
public frmNewUser()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
settings =new Settings();
this.hlpNewUser.HelpNamespace = settings.uiDirectory+ @"\HELP\SupermarketHelp.chm";
//
// TODO: Add any constructor code after InitializeComponent call
//
//Initializing a variable of Struct stEmployee
stEmp = new stEmployee();
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(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.components = new System.ComponentModel.Container();
this.txtName = new System.Windows.Forms.TextBox();
this.txtUid = new System.Windows.Forms.TextBox();
this.txtEmailId = new System.Windows.Forms.TextBox();
this.txtPwd = new System.Windows.Forms.TextBox();
this.txtVerPwd = new System.Windows.Forms.TextBox();
this.chlPrior = new System.Windows.Forms.CheckedListBox();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.grpLine = new System.Windows.Forms.GroupBox();
this.chkEmpStat = new System.Windows.Forms.CheckBox();
this.errNewUser = new System.Windows.Forms.ErrorProvider();
this.hlpNewUser = new System.Windows.Forms.HelpProvider();
this.tipNewUser = new System.Windows.Forms.ToolTip(this.components);
this.SuspendLayout();
//
// txtName
//
this.txtName.Location = new System.Drawing.Point(125, 17);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(182, 21);
this.txtName.TabIndex = 1;
this.txtName.Text = "";
this.txtName.MouseHover += new System.EventHandler(this.txtName_MouseHover);
this.txtName.TextChanged += new System.EventHandler(this.txtName_TextChanged_1);
this.txtName.Leave += new System.EventHandler(this.txtName_Leave);
//
// txtUid
//
this.txtUid.Location = new System.Drawing.Point(432, 17);
this.txtUid.Name = "txtUid";
this.txtUid.Size = new System.Drawing.Size(163, 21);
this.txtUid.TabIndex = 3;
this.txtUid.Text = "";
this.txtUid.MouseHover += new System.EventHandler(this.txtUid_MouseHover);
this.txtUid.Leave += new System.EventHandler(this.txtUid_Leave);
//
// txtEmailId
//
this.txtEmailId.Location = new System.Drawing.Point(125, 181);
this.txtEmailId.Name = "txtEmailId";
this.txtEmailId.Size = new System.Drawing.Size(182, 21);
this.txtEmailId.TabIndex = 8;
this.txtEmailId.Text = "";
this.txtEmailId.MouseHover += new System.EventHandler(this.txtEmailId_MouseHover);
this.txtEmailId.Leave += new System.EventHandler(this.txtEmailId_Leave);
//
// txtPwd
//
this.txtPwd.Location = new System.Drawing.Point(125, 224);
this.txtPwd.Name = "txtPwd";
this.txtPwd.PasswordChar = '*';
this.txtPwd.Size = new System.Drawing.Size(182, 21);
this.txtPwd.TabIndex = 10;
this.txtPwd.Text = "";
this.txtPwd.MouseHover += new System.EventHandler(this.txtPwd_MouseHover);
this.txtPwd.Leave += new System.EventHandler(this.txtPwd_Leave);
//
// txtVerPwd
//
this.txtVerPwd.Location = new System.Drawing.Point(125, 276);
this.txtVerPwd.Name = "txtVerPwd";
this.txtVerPwd.PasswordChar = '*';
this.txtVerPwd.Size = new System.Drawing.Size(182, 21);
this.txtVerPwd.TabIndex = 12;
this.txtVerPwd.Text = "";
this.txtVerPwd.MouseHover += new System.EventHandler(this.txtVerPwd_MouseHover);
this.txtVerPwd.Leave += new System.EventHandler(this.txtVerPwd_Leave);
//
// chlPrior
//
this.chlPrior.CheckOnClick = true;
this.chlPrior.Location = new System.Drawing.Point(125, 60);
this.chlPrior.Name = "chlPrior";
this.chlPrior.Size = new System.Drawing.Size(182, 84);
this.chlPrior.TabIndex = 5;
this.chlPrior.MouseHover += new System.EventHandler(this.chlPrior_MouseHover);
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(365, 336);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(90, 25);
this.btnOK.TabIndex = 13;
this.btnOK.Text = "确认";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(470, 336);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(90, 25);
this.btnCancel.TabIndex = 14;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(10, 17);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(105, 25);
this.label1.TabIndex = 0;
this.label1.Text = "职员姓名";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label2
//
this.label2.Location = new System.Drawing.Point(10, 60);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(105, 25);
this.label2.TabIndex = 4;
this.label2.Text = "优先级";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label3
//
this.label3.Location = new System.Drawing.Point(10, 181);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(105, 25);
this.label3.TabIndex = 7;
this.label3.Text = "电子邮件地址";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label4
//
this.label4.Location = new System.Drawing.Point(10, 224);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(105, 25);
this.label4.TabIndex = 9;
this.label4.Text = "密码";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label5
//
this.label5.Location = new System.Drawing.Point(10, 276);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(105, 24);
this.label5.TabIndex = 11;
this.label5.Text = "验证密码";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label6
//
this.label6.Location = new System.Drawing.Point(326, 17);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(106, 25);
this.label6.TabIndex = 2;
this.label6.Text = "用户标识";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// grpLine
//
this.grpLine.Location = new System.Drawing.Point(-106, 310);
this.grpLine.Name = "grpLine";
this.grpLine.Size = new System.Drawing.Size(864, 9);
this.grpLine.TabIndex = 14;
this.grpLine.TabStop = false;
//
// chkEmpStat
//
this.chkEmpStat.Location = new System.Drawing.Point(432, 60);
this.chkEmpStat.Name = "chkEmpStat";
this.chkEmpStat.Size = new System.Drawing.Size(106, 26);
this.chkEmpStat.TabIndex = 6;
this.chkEmpStat.Text = "活动";
this.chkEmpStat.MouseHover += new System.EventHandler(this.chkEmpStat_MouseHover);
this.chkEmpStat.CheckedChanged += new System.EventHandler(this.chkEmpStat_CheckedChanged);
//
// errNewUser
//
this.errNewUser.ContainerControl = this;
//
// tipNewUser
//
this.tipNewUser.AutomaticDelay = 150;
//
// frmNewUser
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(624, 384);
this.Controls.Add(this.chkEmpStat);
this.Controls.Add(this.grpLine);
this.Controls.Add(this.label6);
this.Controls.Add(this.label5);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.chlPrior);
this.Controls.Add(this.txtVerPwd);
this.Controls.Add(this.txtPwd);
this.Controls.Add(this.txtEmailId);
this.Controls.Add(this.txtUid);
this.Controls.Add(this.txtName);
this.Name = "frmNewUser";
this.Text = "新建用户";
this.Load += new System.EventHandler(this.frmNewUser_Load);
this.ResumeLayout(false);
}
#endregion
// [STAThread]
// static void Main()
// {
// Application.Run(new frmNewUser());
// }
private void frmNewUser_Load(object sender, System.EventArgs e)
{
//Disable And Enable
this.btnOK.Enabled = false;
// Loading the fields PriorityId and priority in a try-catch block to catch any error during data connection
int ctr =0;
DataConnection.load();
DataConnection.commnd.CommandText="select priorityid,priority from priority";
try
{
OleDbDataReader reader = DataConnection.commnd.ExecuteReader();
while(reader.Read())
{
//Loading the Priority Value to the CheckedListBox
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -