📄 reader.cs
字号:
// btnFirst
//
this.btnFirst.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnFirst.Image = ((System.Drawing.Image)(resources.GetObject("btnFirst.Image")));
this.btnFirst.Location = new System.Drawing.Point(128, 136);
this.btnFirst.Name = "btnFirst";
this.btnFirst.Size = new System.Drawing.Size(32, 24);
this.btnFirst.TabIndex = 1;
this.btnFirst.Click += new System.EventHandler(this.btnFirst_Click);
//
// btnLast
//
this.btnLast.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLast.Image = ((System.Drawing.Image)(resources.GetObject("btnLast.Image")));
this.btnLast.Location = new System.Drawing.Point(272, 136);
this.btnLast.Name = "btnLast";
this.btnLast.Size = new System.Drawing.Size(32, 24);
this.btnLast.TabIndex = 2;
this.btnLast.Click += new System.EventHandler(this.btnLast_Click);
//
// btnNext
//
this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNext.Image = ((System.Drawing.Image)(resources.GetObject("btnNext.Image")));
this.btnNext.Location = new System.Drawing.Point(240, 136);
this.btnNext.Name = "btnNext";
this.btnNext.Size = new System.Drawing.Size(32, 24);
this.btnNext.TabIndex = 3;
this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
//
// btnPrevious
//
this.btnPrevious.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnPrevious.Image = ((System.Drawing.Image)(resources.GetObject("btnPrevious.Image")));
this.btnPrevious.Location = new System.Drawing.Point(160, 136);
this.btnPrevious.Name = "btnPrevious";
this.btnPrevious.Size = new System.Drawing.Size(32, 24);
this.btnPrevious.TabIndex = 4;
this.btnPrevious.Click += new System.EventHandler(this.btnPrevious_Click);
//
// lblDatasetPosition
//
this.lblDatasetPosition.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.lblDatasetPosition.BackColor = System.Drawing.Color.White;
this.lblDatasetPosition.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.lblDatasetPosition.Location = new System.Drawing.Point(192, 136);
this.lblDatasetPosition.Name = "lblDatasetPosition";
this.lblDatasetPosition.Size = new System.Drawing.Size(48, 24);
this.lblDatasetPosition.TabIndex = 9;
this.lblDatasetPosition.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(312, 16);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(56, 24);
this.btnCancel.TabIndex = 11;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnApply
//
this.btnApply.Location = new System.Drawing.Point(240, 16);
this.btnApply.Name = "btnApply";
this.btnApply.Size = new System.Drawing.Size(56, 24);
this.btnApply.TabIndex = 12;
this.btnApply.Text = "确定";
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=WJD;packet size=4096;integrated security=SSPI;data source=WJD;pers" +
"ist security info=False;initial catalog=BookManagement";
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Reader", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("ReaderID", "ReaderID"),
new System.Data.Common.DataColumnMapping("ReaderName", "ReaderName"),
new System.Data.Common.DataColumnMapping("ReaderPassword", "ReaderPassword"),
new System.Data.Common.DataColumnMapping("ReaderPhoneNo", "ReaderPhoneNo"),
new System.Data.Common.DataColumnMapping("ReaderEmail", "ReaderEmail"),
new System.Data.Common.DataColumnMapping("ReaderBorrowedbooks", "ReaderBorrowedbooks")})});
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM Reader WHERE (ReaderID = @Original_ReaderID) AND (ReaderBorrowedbooks = @Original_ReaderBorrowedbooks OR @Original_ReaderBorrowedbooks IS NULL AND ReaderBorrowedbooks IS NULL) AND (ReaderEmail = @Original_ReaderEmail OR @Original_ReaderEmail IS NULL AND ReaderEmail IS NULL) AND (ReaderName = @Original_ReaderName OR @Original_ReaderName IS NULL AND ReaderName IS NULL) AND (ReaderPassword = @Original_ReaderPassword OR @Original_ReaderPassword IS NULL AND ReaderPassword IS NULL) AND (ReaderPhoneNo = @Original_ReaderPhoneNo OR @Original_ReaderPhoneNo IS NULL AND ReaderPhoneNo IS NULL)";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ReaderID", System.Data.SqlDbType.NVarChar, 6, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ReaderID", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ReaderBorrowedbooks", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ReaderBorrowedbooks", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ReaderEmail", System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ReaderEmail", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ReaderName", System.Data.SqlDbType.NVarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ReaderName", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ReaderPassword", System.Data.SqlDbType.NVarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ReaderPassword", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ReaderPhoneNo", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ReaderPhoneNo", System.Data.DataRowVersion.Original, null));
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = @"INSERT INTO Reader(ReaderID, ReaderName, ReaderPassword, ReaderPhoneNo, ReaderEmail, ReaderBorrowedbooks) VALUES (@ReaderID, @ReaderName, @ReaderPassword, @ReaderPhoneNo, @ReaderEmail, @ReaderBorrowedbooks); SELECT ReaderID, ReaderName, ReaderPassword, ReaderPhoneNo, ReaderEmail, ReaderBorrowedbooks FROM Reader WHERE (ReaderID = @ReaderID)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ReaderID", System.Data.SqlDbType.NVarChar, 6, "ReaderID"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ReaderName", System.Data.SqlDbType.NVarChar, 20, "ReaderName"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ReaderPassword", System.Data.SqlDbType.NVarChar, 10, "ReaderPassword"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ReaderPhoneNo", System.Data.SqlDbType.NVarChar, 15, "ReaderPhoneNo"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ReaderEmail", System.Data.SqlDbType.NVarChar, 50, "ReaderEmail"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ReaderBorrowedbooks", System.Data.SqlDbType.Int, 4, "ReaderBorrowedbooks"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT ReaderID, ReaderName, ReaderPassword, ReaderPhoneNo, ReaderEmail, ReaderBo" +
"rrowedbooks FROM Reader";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE Reader SET ReaderID = @ReaderID, ReaderName = @ReaderName, ReaderPassword = @ReaderPassword, ReaderPhoneNo = @ReaderPhoneNo, ReaderEmail = @ReaderEmail, ReaderBorrowedbooks = @ReaderBorrowedbooks WHERE (ReaderID = @Original_ReaderID) AND (ReaderBorrowedbooks = @Original_ReaderBorrowedbooks OR @Original_ReaderBorrowedbooks IS NULL AND ReaderBorrowedbooks IS NULL) AND (ReaderEmail = @Original_ReaderEmail OR @Original_ReaderEmail IS NULL AND ReaderEmail IS NULL) AND (ReaderName = @Original_ReaderName OR @Original_ReaderName IS NULL AND ReaderName IS NULL) AND (ReaderPassword = @Original_ReaderPassword OR @Original_ReaderPassword IS NULL AND ReaderPassword IS NULL) AND (ReaderPhoneNo = @Original_ReaderPhoneNo OR @Original_ReaderPhoneNo IS NULL AND ReaderPhoneNo IS NULL); SELECT ReaderID, ReaderName, ReaderPassword, ReaderPhoneNo, ReaderEmail, ReaderBorrowedbooks FROM Reader WHERE (ReaderID = @ReaderID)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ReaderID", System.Data.SqlDbType.NVarChar, 6, "ReaderID"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ReaderName", System.Data.SqlDbType.NVarChar, 20, "ReaderName"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ReaderPassword", System.Data.SqlDbType.NVarChar, 10, "ReaderPassword"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ReaderPhoneNo", System.Data.SqlDbType.NVarChar, 15, "ReaderPhoneNo"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ReaderEmail", System.Data.SqlDbType.NVarChar, 50, "ReaderEmail"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ReaderBorrowedbooks", System.Data.SqlDbType.Int, 4, "ReaderBorrowedbooks"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ReaderID", System.Data.SqlDbType.NVarChar, 6, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ReaderID", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ReaderBorrowedbooks", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ReaderBorrowedbooks", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ReaderEmail", System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ReaderEmail", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ReaderName", System.Data.SqlDbType.NVarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ReaderName", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ReaderPassword", System.Data.SqlDbType.NVarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ReaderPassword", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ReaderPhoneNo", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ReaderPhoneNo", System.Data.DataRowVersion.Original, null));
//
// btnExit
//
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(192, 240);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(72, 32);
this.btnExit.TabIndex = 14;
this.btnExit.Text = "退出";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// btnAdd
//
this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdd.Location = new System.Drawing.Point(24, 16);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(56, 24);
this.btnAdd.TabIndex = 13;
this.btnAdd.Text = "添加";
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnModify
//
this.btnModify.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnModify.Location = new System.Drawing.Point(88, 16);
this.btnModify.Name = "btnModify";
this.btnModify.Size = new System.Drawing.Size(56, 24);
this.btnModify.TabIndex = 15;
this.btnModify.Text = "修改";
this.btnModify.Click += new System.EventHandler(this.btnModify_Click);
//
// btnDelete
//
this.btnDelete.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDelete.Location = new System.Drawing.Point(152, 16);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(56, 24);
this.btnDelete.TabIndex = 16;
this.btnDelete.Text = "删除";
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.btnAdd);
this.groupBox3.Controls.Add(this.btnModify);
this.groupBox3.Controls.Add(this.btnCancel);
this.groupBox3.Controls.Add(this.btnApply);
this.groupBox3.Controls.Add(this.btnDelete);
this.groupBox3.Location = new System.Drawing.Point(24, 184);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(376, 48);
this.groupBox3.TabIndex = 19;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "编辑记录";
//
// Reader
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.LightGray;
this.ClientSize = new System.Drawing.Size(442, 293);
this.Controls.Add(this.lblDatasetPosition);
this.Controls.Add(this.btnPrevious);
this.Controls.Add(this.btnNext);
this.Controls.Add(this.btnLast);
this.Controls.Add(this.btnFirst);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.groupBox3);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Reader";
this.Text = "客户信息管理";
this.Load += new System.EventHandler(this.Reader_Load);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.objDataSetReader)).EndInit();
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
public void ErrorHandle(System.Exception E)
{
MessageBox.Show(E.ToString());
}
private void ButtonPositonChange()
{
this.btnPrevious.Enabled=true;
this.btnNext.Enabled=true;
this.btnFirst.Enabled=true;
this.btnLast.Enabled=true;
if(this.BindingContext[this.objDataSetReader,"Reader"].Position==0)
{
this.btnFirst.Enabled=false;
this.btnPrevious.Enabled=false;
}
if(this.BindingContext[this.objDataSetReader,"Reader"].Position==this.BindingContext[this.objDataSetReader,"Reader"].Count-1)
{
this.btnNext.Enabled=false;
this.btnLast.Enabled=false;
}
}
private void DatasetPostionChange()
{
this.lblDatasetPosition.Text=(this.BindingContext[this.objDataSetReader,"Reader"].Position+1)+"的"+
(this.BindingContext[this.objDataSetReader,"Reader"].Count);
}
private void TextEnableControl(bool valid)
{
if(valid)
{
this.textId.Enabled=true;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -