📄 zhucheframe.cs
字号:
//
// btnAddUser
//
this.btnAddUser.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAddUser.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.btnAddUser.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnAddUser.ImageIndex = 1;
this.btnAddUser.ImageList = this.imageList1;
this.btnAddUser.Location = new System.Drawing.Point(416, 88);
this.btnAddUser.Name = "btnAddUser";
this.btnAddUser.Size = new System.Drawing.Size(80, 24);
this.btnAddUser.TabIndex = 13;
this.btnAddUser.Text = "添加(&A)";
this.btnAddUser.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnAddUser.Click += new System.EventHandler(this.btnAddUser_Click);
this.btnAddUser.MouseEnter += new System.EventHandler(this.btnRead_MouseEnter);
this.btnAddUser.MouseLeave += new System.EventHandler(this.btnRead_MouseLeave);
//
// btnModifyUser
//
this.btnModifyUser.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnModifyUser.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.btnModifyUser.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnModifyUser.ImageIndex = 2;
this.btnModifyUser.ImageList = this.imageList1;
this.btnModifyUser.Location = new System.Drawing.Point(416, 128);
this.btnModifyUser.Name = "btnModifyUser";
this.btnModifyUser.Size = new System.Drawing.Size(80, 24);
this.btnModifyUser.TabIndex = 14;
this.btnModifyUser.Text = "修改(&M)";
this.btnModifyUser.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnModifyUser.Click += new System.EventHandler(this.btnModifyUser_Click);
this.btnModifyUser.MouseEnter += new System.EventHandler(this.btnRead_MouseEnter);
this.btnModifyUser.MouseLeave += new System.EventHandler(this.btnRead_MouseLeave);
//
// btnDelete
//
this.btnDelete.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDelete.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.btnDelete.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnDelete.ImageIndex = 5;
this.btnDelete.ImageList = this.imageList1;
this.btnDelete.Location = new System.Drawing.Point(416, 168);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(80, 24);
this.btnDelete.TabIndex = 15;
this.btnDelete.Text = "删除(&D)";
this.btnDelete.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
this.btnDelete.MouseEnter += new System.EventHandler(this.btnRead_MouseEnter);
this.btnDelete.MouseLeave += new System.EventHandler(this.btnRead_MouseLeave);
//
// btnCancel
//
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.ForeColor = System.Drawing.SystemColors.ActiveCaption;
this.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnCancel.ImageIndex = 3;
this.btnCancel.ImageList = this.imageList1;
this.btnCancel.Location = new System.Drawing.Point(416, 208);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(80, 24);
this.btnCancel.TabIndex = 16;
this.btnCancel.Text = "取消(&C)";
this.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
this.btnCancel.MouseEnter += new System.EventHandler(this.btnRead_MouseEnter);
this.btnCancel.MouseLeave += new System.EventHandler(this.btnRead_MouseLeave);
//
// label1
//
this.label1.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.label1.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.label1.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.label1.Location = new System.Drawing.Point(0, 248);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(528, 32);
this.label1.TabIndex = 17;
this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
// userLabel
//
this.userLabel.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.userLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.userLabel.Location = new System.Drawing.Point(48, 256);
this.userLabel.Name = "userLabel";
this.userLabel.Size = new System.Drawing.Size(176, 23);
this.userLabel.TabIndex = 18;
this.userLabel.Text = "用户名:";
this.userLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// dateLabel
//
this.dateLabel.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.dateLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.dateLabel.Location = new System.Drawing.Point(192, 256);
this.dateLabel.Name = "dateLabel";
this.dateLabel.Size = new System.Drawing.Size(144, 23);
this.dateLabel.TabIndex = 19;
this.dateLabel.Text = "日期:";
this.dateLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// PasswordLabel
//
this.PasswordLabel.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(128)), ((System.Byte)(255)));
this.PasswordLabel.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
this.PasswordLabel.Location = new System.Drawing.Point(344, 256);
this.PasswordLabel.Name = "PasswordLabel";
this.PasswordLabel.Size = new System.Drawing.Size(144, 23);
this.PasswordLabel.TabIndex = 20;
this.PasswordLabel.Text = "密码:";
this.PasswordLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// sqlDataAdapter
//
this.sqlDataAdapter.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "UserZheCheHistory", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("编号", "编号"),
new System.Data.Common.DataColumnMapping("日期", "日期"),
new System.Data.Common.DataColumnMapping("时间", "时间"),
new System.Data.Common.DataColumnMapping("用户名", "用户名"),
new System.Data.Common.DataColumnMapping("密码", "密码"),
new System.Data.Common.DataColumnMapping("添加", "添加"),
new System.Data.Common.DataColumnMapping("删除", "删除"),
new System.Data.Common.DataColumnMapping("修改", "修改")})});
this.sqlDataAdapter.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlConnection
//
this.sqlConnection.ConnectionString = "workstation id=XHY11;packet size=4096;integrated security=SSPI;data source=XHY11;" +
"persist security info=False;initial catalog=SystemODBC";
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 编号, 日期, 时间, 用户名, 密码, 添加, 删除, 修改 FROM UserZheCheHistory";
this.sqlSelectCommand1.Connection = this.sqlConnection;
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO UserZheCheHistory(日期, 时间, 用户名, 密码, 添加, 删除, 修改) VALUES (@日期, @时间, @用户名" +
", @密码, @添加, @删除, @修改); SELECT 编号, 日期, 时间, 用户名, 密码, 添加, 删除, 修改 FROM UserZheCheHis" +
"tory WHERE (编号 = @@IDENTITY)";
this.sqlInsertCommand1.Connection = this.sqlConnection;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@日期", System.Data.SqlDbType.DateTime, 8, "日期"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@时间", System.Data.SqlDbType.VarChar, 50, "时间"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@用户名", System.Data.SqlDbType.VarChar, 50, "用户名"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@密码", System.Data.SqlDbType.VarChar, 50, "密码"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@添加", System.Data.SqlDbType.VarChar, 50, "添加"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@删除", System.Data.SqlDbType.VarChar, 50, "删除"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@修改", System.Data.SqlDbType.VarChar, 50, "修改"));
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE UserZheCheHistory SET 日期 = @日期, 时间 = @时间, 用户名 = @用户名, 密码 = @密码, 添加 = @添加, 删除 = @删除, 修改 = @修改 WHERE (编号 = @Original_编号) AND (修改 = @Original_修改 OR @Original_修改 IS NULL AND 修改 IS NULL) AND (删除 = @Original_删除 OR @Original_删除 IS NULL AND 删除 IS NULL) AND (密码 = @Original_密码 OR @Original_密码 IS NULL AND 密码 IS NULL) AND (日期 = @Original_日期 OR @Original_日期 IS NULL AND 日期 IS NULL) AND (时间 = @Original_时间 OR @Original_时间 IS NULL AND 时间 IS NULL) AND (添加 = @Original_添加 OR @Original_添加 IS NULL AND 添加 IS NULL) AND (用户名 = @Original_用户名 OR @Original_用户名 IS NULL AND 用户名 IS NULL); SELECT 编号, 日期, 时间, 用户名, 密码, 添加, 删除, 修改 FROM UserZheCheHistory WHERE (编号 = @编号)";
this.sqlUpdateCommand1.Connection = this.sqlConnection;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@日期", System.Data.SqlDbType.DateTime, 8, "日期"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@时间", System.Data.SqlDbType.VarChar, 50, "时间"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@用户名", System.Data.SqlDbType.VarChar, 50, "用户名"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@密码", System.Data.SqlDbType.VarChar, 50, "密码"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@添加", System.Data.SqlDbType.VarChar, 50, "添加"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@删除", System.Data.SqlDbType.VarChar, 50, "删除"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@修改", System.Data.SqlDbType.VarChar, 50, "修改"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "编号", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_修改", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "修改", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_删除", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "删除", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_密码", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "密码", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_日期", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "日期", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_时间", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "时间", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_添加", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "添加", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_用户名", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "用户名", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@编号", System.Data.SqlDbType.Int, 4, "编号"));
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM UserZheCheHistory WHERE (编号 = @Original_编号) AND (修改 = @Original_修改 OR @Original_修改 IS NULL AND 修改 IS NULL) AND (删除 = @Original_删除 OR @Original_删除 IS NULL AND 删除 IS NULL) AND (密码 = @Original_密码 OR @Original_密码 IS NULL AND 密码 IS NULL) AND (日期 = @Original_日期 OR @Original_日期 IS NULL AND 日期 IS NULL) AND (时间 = @Original_时间 OR @Original_时间 IS NULL AND 时间 IS NULL) AND (添加 = @Original_添加 OR @Original_添加 IS NULL AND 添加 IS NULL) AND (用户名 = @Original_用户名 OR @Original_用户名 IS NULL AND 用户名 IS NULL)";
this.sqlDeleteCommand1.Connection = this.sqlConnection;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "编号", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_修改", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "修改", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_删除", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "删除", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_密码", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "密码", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_日期", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "日期", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_时间", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "时间", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_添加", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "添加", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_用户名", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "用户名", System.Data.DataRowVersion.Original, null));
//
// ZhuCheFrame
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.ClientSize = new System.Drawing.Size(522, 280);
this.Controls.Add(this.PasswordLabel);
this.Controls.Add(this.dateLabel);
this.Controls.Add(this.userLabel);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnDelete);
this.Controls.Add(this.btnModifyUser);
this.Controls.Add(this.btnAddUser);
this.Controls.Add(this.btnRead);
this.Controls.Add(this.QuanXianHaoCombo);
this.Controls.Add(this.label6);
this.Controls.Add(this.textUserRepassword);
this.Controls.Add(this.label5);
this.Controls.Add(this.textUserPassword);
this.Controls.Add(this.label4);
this.Controls.Add(this.textUserName);
this.Controls.Add(this.label3);
this.Controls.Add(this.textUserHao);
this.Controls.Add(this.label2);
this.Controls.Add(this.LeftImage);
this.Controls.Add(this.titleLabel);
this.Cursor = System.Windows.Forms.Cursors.Hand;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ZhuCheFrame";
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "ZhuCheFrame";
this.Load += new System.EventHandler(this.ZhuCheFrame_Load);
this.ResumeLayout(false);
}
#endregion
#region 数据库变量...
private ConnectionData conn=new ConnectionData();
#endregion
#region 变量声明...
private string userTypeSql="select distinct 用户类型 from System_UserTable where 用户类型<>'管理员'";
private static bool blMove=false;
private int MouseX=0,MouseY=0;
private static string password="";
#endregion
#region 添加用户函数,修改用户函数,删除用户函数,退出用户注册函数,控件是否为空函数...
private bool CheckNull()
{
if(this.textUserHao.Text=="")
{
MessageBox.Show(this,"用户号不能为空!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.textUserHao.Focus();
return false;
}
else if(this.textUserName.Text=="")
{
MessageBox.Show(this,"用户名不能为空!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.textUserName.Focus();
return false;
}
else if(this.textUserPassword.Text=="")
{
MessageBox.Show(this,"密码不能为空!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.textUserPassword.Focus();
return false;
}
else if(this.textUserRepassword.Text.Equals(""))
{
MessageBox.Show(this,"确认码不能为空!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.textUserRepassword.Focus();
return false;
}
else if(!(this.textUserRepassword.Text.Equals(this.textUserPassword.Text)))
{
MessageBox.Show(this,"密码不一致的原因!!!","提示信息",MessageBoxButtons.OK,MessageBoxIcon.Information);
this.textUserPassword.Focus();
this.textUserPassword.Text="";
this.textUserRepassword.Text="";
return false;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -