usermanager.cs

来自「独立完成考勤管理软件加打卡系统(C#) 是打卡加管理系统软件 」· CS 代码 · 共 981 行 · 第 1/3 页

CS
981
字号
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace WindowsApplication
{
	public class UserManager : WindowsApplication.ModifyPasswordFrame
	{
		#region ControlCollection  Statement
		public System.Windows.Forms.PictureBox pictureBox1;
		protected System.Windows.Forms.DataGrid dataGrid;
		protected System.Windows.Forms.Button btnExit;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TextBox textUserID;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.ComboBox userTypeComBox;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.Label label7;
		protected System.Windows.Forms.Button btnEnd;
		protected System.Windows.Forms.Button btnFirst;
		protected System.Windows.Forms.Button btnNext;
		protected System.Windows.Forms.Button btnLast;
		protected System.Windows.Forms.Button btnModify;
		protected System.Windows.Forms.Button btnSave;
		protected System.Windows.Forms.Button btnDelete;
		protected System.Windows.Forms.Button btnAdd;
		private System.Windows.Forms.TextBox textpassword;
		private System.Windows.Forms.TextBox userName;
		private System.Windows.Forms.ToolTip tool;
		private System.Data.SqlClient.SqlDataAdapter sqlUserDataAdaper;
		private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
		private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
		private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
		private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
		private System.Data.SqlClient.SqlConnection sqlConnection;
		private WindowsApplication.UserTableSet userTableSet;
		private System.Windows.Forms.TextBox textBox1;
		private System.ComponentModel.IContainer components;
		#endregion
		#region Conformation Function
		public UserManager()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}
		#endregion
		#region Variable Statement
        private string searchUserSql="select * from System_UserTable where 用户号<>'101'";
		public static bool blModify=false;//修改标志
		public static bool blAdd=false;//添加标志
		private System.Windows.Forms.CurrencyManager cmOrders=null;
		#endregion
		#region DataBaseLibrary Variable Statement
		private ConnectionData conn=new ConnectionData();
        private DataSet userSet=new DataSet();
		private DataTable userTable=new DataTable();
		private DataTable tempTable=new DataTable();
		#endregion
		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(UserManager));
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.dataGrid = new System.Windows.Forms.DataGrid();
			this.btnEnd = new System.Windows.Forms.Button();
			this.btnFirst = new System.Windows.Forms.Button();
			this.btnNext = new System.Windows.Forms.Button();
			this.btnLast = new System.Windows.Forms.Button();
			this.btnModify = new System.Windows.Forms.Button();
			this.btnSave = new System.Windows.Forms.Button();
			this.btnDelete = new System.Windows.Forms.Button();
			this.btnAdd = new System.Windows.Forms.Button();
			this.btnExit = new System.Windows.Forms.Button();
			this.label4 = new System.Windows.Forms.Label();
			this.textUserID = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.userTypeComBox = new System.Windows.Forms.ComboBox();
			this.label6 = new System.Windows.Forms.Label();
			this.label7 = new System.Windows.Forms.Label();
			this.textpassword = new System.Windows.Forms.TextBox();
			this.userName = new System.Windows.Forms.TextBox();
			this.tool = new System.Windows.Forms.ToolTip(this.components);
			this.sqlUserDataAdaper = new System.Data.SqlClient.SqlDataAdapter();
			this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlConnection = new System.Data.SqlClient.SqlConnection();
			this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
			this.userTableSet = new WindowsApplication.UserTableSet();
			this.textBox1 = new System.Windows.Forms.TextBox();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.userTableSet)).BeginInit();
			this.SuspendLayout();
			// 
			// titleLabel
			// 
			this.titleLabel.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.titleLabel.Name = "titleLabel";
			this.titleLabel.Size = new System.Drawing.Size(800, 40);
			this.titleLabel.Text = "用户管理";
			// 
			// pictureBox1
			// 
			this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.pictureBox1.BackColor = System.Drawing.SystemColors.Highlight;
			this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
			this.pictureBox1.Location = new System.Drawing.Point(768, 8);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(24, 24);
			this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
			this.pictureBox1.TabIndex = 2;
			this.pictureBox1.TabStop = false;
			// 
			// dataGrid
			// 
			this.dataGrid.AlternatingBackColor = System.Drawing.Color.GhostWhite;
			this.dataGrid.BackColor = System.Drawing.Color.GhostWhite;
			this.dataGrid.BackgroundColor = System.Drawing.Color.Lavender;
			this.dataGrid.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.dataGrid.CaptionBackColor = System.Drawing.Color.RoyalBlue;
			this.dataGrid.CaptionForeColor = System.Drawing.Color.White;
			this.dataGrid.CaptionVisible = false;
			this.dataGrid.DataMember = "";
			this.dataGrid.FlatMode = true;
			this.dataGrid.Font = new System.Drawing.Font("Tahoma", 8F);
			this.dataGrid.ForeColor = System.Drawing.Color.MidnightBlue;
			this.dataGrid.GridLineColor = System.Drawing.Color.RoyalBlue;
			this.dataGrid.HeaderBackColor = System.Drawing.Color.MidnightBlue;
			this.dataGrid.HeaderFont = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Bold);
			this.dataGrid.HeaderForeColor = System.Drawing.Color.Lavender;
			this.dataGrid.LinkColor = System.Drawing.Color.Teal;
			this.dataGrid.Location = new System.Drawing.Point(0, 72);
			this.dataGrid.Name = "dataGrid";
			this.dataGrid.ParentRowsBackColor = System.Drawing.Color.Lavender;
			this.dataGrid.ParentRowsForeColor = System.Drawing.Color.MidnightBlue;
			this.dataGrid.ReadOnly = true;
			this.dataGrid.SelectionBackColor = System.Drawing.Color.Teal;
			this.dataGrid.SelectionForeColor = System.Drawing.Color.PaleGreen;
			this.dataGrid.Size = new System.Drawing.Size(800, 248);
			this.dataGrid.TabIndex = 3;
			// 
			// btnEnd
			// 
			this.btnEnd.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.btnEnd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnEnd.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnEnd.ForeColor = System.Drawing.SystemColors.Highlight;
			this.btnEnd.Location = new System.Drawing.Point(264, 40);
			this.btnEnd.Name = "btnEnd";
			this.btnEnd.Size = new System.Drawing.Size(80, 32);
			this.btnEnd.TabIndex = 36;
			this.btnEnd.Text = "尾记录(&E)";
			this.tool.SetToolTip(this.btnEnd, "尾记录");
			this.btnEnd.Click += new System.EventHandler(this.btnEnd_Click);
			this.btnEnd.MouseEnter += new System.EventHandler(this.btnExit_MouseEnter);
			this.btnEnd.MouseLeave += new System.EventHandler(this.btnExit_MouseLeave);
			// 
			// btnFirst
			// 
			this.btnFirst.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.btnFirst.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnFirst.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnFirst.ForeColor = System.Drawing.SystemColors.Highlight;
			this.btnFirst.Location = new System.Drawing.Point(176, 40);
			this.btnFirst.Name = "btnFirst";
			this.btnFirst.Size = new System.Drawing.Size(96, 32);
			this.btnFirst.TabIndex = 35;
			this.btnFirst.Text = "首记录(&F)";
			this.tool.SetToolTip(this.btnFirst, "首记录");
			this.btnFirst.Click += new System.EventHandler(this.btnFirst_Click);
			this.btnFirst.MouseEnter += new System.EventHandler(this.btnExit_MouseEnter);
			this.btnFirst.MouseLeave += new System.EventHandler(this.btnExit_MouseLeave);
			// 
			// btnNext
			// 
			this.btnNext.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnNext.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnNext.ForeColor = System.Drawing.SystemColors.Highlight;
			this.btnNext.Location = new System.Drawing.Point(88, 40);
			this.btnNext.Name = "btnNext";
			this.btnNext.Size = new System.Drawing.Size(96, 32);
			this.btnNext.TabIndex = 34;
			this.btnNext.Text = "下一记录(&N)";
			this.tool.SetToolTip(this.btnNext, "下一记录");
			this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
			this.btnNext.MouseEnter += new System.EventHandler(this.btnExit_MouseEnter);
			this.btnNext.MouseLeave += new System.EventHandler(this.btnExit_MouseLeave);
			// 
			// btnLast
			// 
			this.btnLast.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.btnLast.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnLast.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnLast.ForeColor = System.Drawing.SystemColors.Highlight;
			this.btnLast.Location = new System.Drawing.Point(0, 40);
			this.btnLast.Name = "btnLast";
			this.btnLast.Size = new System.Drawing.Size(96, 32);
			this.btnLast.TabIndex = 33;
			this.btnLast.Text = "上一记录(&S)";
			this.tool.SetToolTip(this.btnLast, "上一记录");
			this.btnLast.Click += new System.EventHandler(this.btnLast_Click);
			this.btnLast.MouseEnter += new System.EventHandler(this.btnExit_MouseEnter);
			this.btnLast.MouseLeave += new System.EventHandler(this.btnExit_MouseLeave);
			// 
			// btnModify
			// 
			this.btnModify.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.btnModify.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnModify.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnModify.ForeColor = System.Drawing.SystemColors.Highlight;
			this.btnModify.Location = new System.Drawing.Point(424, 40);
			this.btnModify.Name = "btnModify";
			this.btnModify.Size = new System.Drawing.Size(96, 32);
			this.btnModify.TabIndex = 30;
			this.btnModify.Text = "修改(&M)";
			this.tool.SetToolTip(this.btnModify, "修改");
			this.btnModify.Click += new System.EventHandler(this.btnModify_Click);
			this.btnModify.MouseEnter += new System.EventHandler(this.btnExit_MouseEnter);
			this.btnModify.MouseLeave += new System.EventHandler(this.btnExit_MouseLeave);
			// 
			// btnSave
			// 
			this.btnSave.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnSave.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnSave.ForeColor = System.Drawing.SystemColors.Highlight;
			this.btnSave.Location = new System.Drawing.Point(600, 40);
			this.btnSave.Name = "btnSave";
			this.btnSave.Size = new System.Drawing.Size(80, 32);
			this.btnSave.TabIndex = 32;
			this.btnSave.Text = "保存(&S)";
			this.tool.SetToolTip(this.btnSave, "保存");
			this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
			this.btnSave.MouseEnter += new System.EventHandler(this.btnExit_MouseEnter);
			this.btnSave.MouseLeave += new System.EventHandler(this.btnExit_MouseLeave);
			// 
			// btnDelete
			// 
			this.btnDelete.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.btnDelete.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnDelete.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnDelete.ForeColor = System.Drawing.SystemColors.Highlight;
			this.btnDelete.Location = new System.Drawing.Point(512, 40);
			this.btnDelete.Name = "btnDelete";
			this.btnDelete.Size = new System.Drawing.Size(96, 32);
			this.btnDelete.TabIndex = 31;
			this.btnDelete.Text = "删除(&D)";
			this.tool.SetToolTip(this.btnDelete, "删除");
			this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
			this.btnDelete.MouseEnter += new System.EventHandler(this.btnExit_MouseEnter);
			this.btnDelete.MouseLeave += new System.EventHandler(this.btnExit_MouseLeave);
			// 
			// btnAdd
			// 
			this.btnAdd.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnAdd.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnAdd.ForeColor = System.Drawing.SystemColors.Highlight;
			this.btnAdd.Location = new System.Drawing.Point(336, 40);
			this.btnAdd.Name = "btnAdd";
			this.btnAdd.Size = new System.Drawing.Size(96, 32);
			this.btnAdd.TabIndex = 29;
			this.btnAdd.Text = "添加(&A)";
			this.tool.SetToolTip(this.btnAdd, "添加");
			this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
			this.btnAdd.MouseEnter += new System.EventHandler(this.btnExit_MouseEnter);
			this.btnAdd.MouseLeave += new System.EventHandler(this.btnExit_MouseLeave);
			// 
			// btnExit
			// 
			this.btnExit.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(192)), ((System.Byte)(192)), ((System.Byte)(255)));
			this.btnExit.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnExit.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.btnExit.ForeColor = System.Drawing.SystemColors.Highlight;
			this.btnExit.Location = new System.Drawing.Point(680, 40);
			this.btnExit.Name = "btnExit";
			this.btnExit.Size = new System.Drawing.Size(80, 32);
			this.btnExit.TabIndex = 38;
			this.btnExit.Text = "退出 (&E)";
			this.tool.SetToolTip(this.btnExit, "退出");
			this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
			this.btnExit.MouseEnter += new System.EventHandler(this.btnExit_MouseEnter);
			this.btnExit.MouseLeave += new System.EventHandler(this.btnExit_MouseLeave);
			// 
			// label4
			// 
			this.label4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label4.Location = new System.Drawing.Point(8, 336);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(72, 23);
			this.label4.TabIndex = 39;
			this.label4.Text = "用户号:";
			this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// textUserID
			// 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?