?? user.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace Library
{
/// <summary>
/// User 的摘要說明。
/// </summary>
public class User : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.Label lblDatasetPosition;
private System.Windows.Forms.Button btnPrevious;
private System.Windows.Forms.Button btnNext;
private System.Windows.Forms.Button btnLast;
private System.Windows.Forms.Button btnFirst;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.TextBox textSort;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox textId;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Button btnModify;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnApply;
private System.Windows.Forms.TextBox textPassword;
private System.Data.SqlClient.SqlConnection sqlConnection1;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
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 Library.DataSetUser objDataSetUser;
/// <summary>
/// 必需的設計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public User()
{
//
// Windows 窗體設計器支持所必需的
//
InitializeComponent();
//
// 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(User));
this.btnDelete = new System.Windows.Forms.Button();
this.lblDatasetPosition = new System.Windows.Forms.Label();
this.btnPrevious = new System.Windows.Forms.Button();
this.btnNext = new System.Windows.Forms.Button();
this.btnLast = new System.Windows.Forms.Button();
this.btnFirst = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textPassword = new System.Windows.Forms.TextBox();
this.objDataSetUser = new Library.DataSetUser();
this.textSort = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.textId = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.btnExit = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.btnAdd = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnApply = new System.Windows.Forms.Button();
this.btnModify = new System.Windows.Forms.Button();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.objDataSetUser)).BeginInit();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// btnDelete
//
this.btnDelete.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDelete.Location = new System.Drawing.Point(16, 80);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(56, 24);
this.btnDelete.TabIndex = 28;
this.btnDelete.Text = "刪除";
this.btnDelete.Click += new System.EventHandler(this.btnDelete_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(120, 160);
this.lblDatasetPosition.Name = "lblDatasetPosition";
this.lblDatasetPosition.Size = new System.Drawing.Size(48, 24);
this.lblDatasetPosition.TabIndex = 25;
this.lblDatasetPosition.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// 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(88, 160);
this.btnPrevious.Name = "btnPrevious";
this.btnPrevious.Size = new System.Drawing.Size(32, 24);
this.btnPrevious.TabIndex = 24;
this.btnPrevious.Click += new System.EventHandler(this.btnPrevious_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(168, 160);
this.btnNext.Name = "btnNext";
this.btnNext.Size = new System.Drawing.Size(32, 24);
this.btnNext.TabIndex = 23;
this.btnNext.Click += new System.EventHandler(this.btnNext_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(200, 160);
this.btnLast.Name = "btnLast";
this.btnLast.Size = new System.Drawing.Size(32, 24);
this.btnLast.TabIndex = 22;
this.btnLast.Click += new System.EventHandler(this.btnLast_Click);
//
// 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(56, 160);
this.btnFirst.Name = "btnFirst";
this.btnFirst.Size = new System.Drawing.Size(32, 24);
this.btnFirst.TabIndex = 21;
this.btnFirst.Click += new System.EventHandler(this.btnFirst_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.textPassword);
this.groupBox1.Controls.Add(this.textSort);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.textId);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Font = new System.Drawing.Font("宋體", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(8, 32);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(256, 176);
this.groupBox1.TabIndex = 20;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "用戶信息維護";
//
// textPassword
//
this.textPassword.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetUser, "User.UserPassword"));
this.textPassword.Location = new System.Drawing.Point(104, 56);
this.textPassword.Name = "textPassword";
this.textPassword.Size = new System.Drawing.Size(128, 23);
this.textPassword.TabIndex = 14;
this.textPassword.Text = "";
//
// objDataSetUser
//
this.objDataSetUser.DataSetName = "DataSetUser";
this.objDataSetUser.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// textSort
//
this.textSort.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetUser, "User.UserSort"));
this.textSort.Location = new System.Drawing.Point(104, 88);
this.textSort.Name = "textSort";
this.textSort.Size = new System.Drawing.Size(128, 23);
this.textSort.TabIndex = 13;
this.textSort.Text = "";
//
// label7
//
this.label7.Location = new System.Drawing.Point(24, 88);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(72, 23);
this.label7.TabIndex = 12;
this.label7.Text = "用戶類別";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textId
//
this.textId.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetUser, "User.UserID"));
this.textId.Location = new System.Drawing.Point(104, 24);
this.textId.Name = "textId";
this.textId.Size = new System.Drawing.Size(130, 23);
this.textId.TabIndex = 7;
this.textId.Text = "";
//
// label2
//
this.label2.Location = new System.Drawing.Point(24, 56);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 23);
this.label2.TabIndex = 1;
this.label2.Text = "用戶密碼";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 23);
this.label1.TabIndex = 0;
this.label1.Text = "用戶號碼";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btnExit
//
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(320, 176);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(72, 32);
this.btnExit.TabIndex = 27;
this.btnExit.Text = "退出";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.btnAdd);
this.groupBox3.Controls.Add(this.btnCancel);
this.groupBox3.Controls.Add(this.btnApply);
this.groupBox3.Controls.Add(this.btnModify);
this.groupBox3.Controls.Add(this.btnDelete);
this.groupBox3.Location = new System.Drawing.Point(280, 32);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(144, 120);
this.groupBox3.TabIndex = 29;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "編輯記錄";
//
// btnAdd
//
this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdd.Location = new System.Drawing.Point(16, 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);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(80, 72);
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(80, 24);
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);
//
// btnModify
//
this.btnModify.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnModify.Location = new System.Drawing.Point(16, 48);
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);
//
// 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", "User", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("UserID", "UserID"),
new System.Data.Common.DataColumnMapping("UserPassword", "UserPassword"),
new System.Data.Common.DataColumnMapping("UserSort", "UserSort")})});
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = "DELETE FROM [User] WHERE (UserID = @Original_UserID) AND (UserPassword = @Origina" +
"l_UserPassword OR @Original_UserPassword IS NULL AND UserPassword IS NULL) AND (" +
"UserSort = @Original_UserSort OR @Original_UserSort IS NULL AND UserSort IS NULL" +
")";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_UserID", System.Data.SqlDbType.NVarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "UserID", System.Data.DataRowVersion.Original, null));
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -