📄 book.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Library.UserInterface;
using Library.DataLevel;
namespace Library.UserInterface
{
/// <summary>
/// Book 的摘要说明。
/// </summary>
public class Book : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox textName;
private System.Windows.Forms.TextBox textId;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnApply;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.TextBox textWriter;
private System.Windows.Forms.TextBox textPublish;
private System.Windows.Forms.TextBox textPublishDate;
private System.Windows.Forms.TextBox textSort;
private System.Windows.Forms.TextBox textRemain;
private System.Windows.Forms.TextBox textPrice;
private System.Windows.Forms.TextBox textAmount;
private Library.UserInterface.DataSetBook objDataSetBook;
private string sqlQuery="";
private string userSort;
private string userName;
//private Library.DataSetBook objDataSetBook;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
private System.Data.SqlClient.SqlConnection conn;
private System.Data.SqlClient.SqlDataAdapter da;
private System.Data.SqlClient.SqlCommand delComm;
private System.Data.SqlClient.SqlCommand insertComm;
private System.Data.SqlClient.SqlCommand selectComm;
private System.Data.SqlClient.SqlCommand updateComm;
DataBaseConnection dbc=new DataBaseConnection();
public Book(string Query,string username,string usersort)
{
//
// Windows 窗体设计器支持所必需的
//
this.userName=username;
this.userSort=usersort;
sqlQuery="select * from Book where BookID='"+Query+"'";
InitializeComponent();
conn.ConnectionString=dbc.databaseConnection;
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
public Book(string username,string usersort)
{
this.userName=username;
this.userSort=usersort;
InitializeComponent();
conn.ConnectionString=dbc.databaseConnection;
}
/// <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(Book));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textAmount = new System.Windows.Forms.TextBox();
this.objDataSetBook = new Library.UserInterface.DataSetBook();
this.label9 = new System.Windows.Forms.Label();
this.textPrice = new System.Windows.Forms.TextBox();
this.textRemain = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.textWriter = new System.Windows.Forms.TextBox();
this.label7 = new System.Windows.Forms.Label();
this.textPublish = new System.Windows.Forms.TextBox();
this.textName = new System.Windows.Forms.TextBox();
this.textId = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.textPublishDate = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.textSort = new System.Windows.Forms.TextBox();
this.btnExit = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.btnCancel = new System.Windows.Forms.Button();
this.btnApply = new System.Windows.Forms.Button();
this.conn = new System.Data.SqlClient.SqlConnection();
this.da = new System.Data.SqlClient.SqlDataAdapter();
this.delComm = new System.Data.SqlClient.SqlCommand();
this.insertComm = new System.Data.SqlClient.SqlCommand();
this.selectComm = new System.Data.SqlClient.SqlCommand();
this.updateComm = new System.Data.SqlClient.SqlCommand();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.objDataSetBook)).BeginInit();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.textAmount);
this.groupBox1.Controls.Add(this.label9);
this.groupBox1.Controls.Add(this.textPrice);
this.groupBox1.Controls.Add(this.textRemain);
this.groupBox1.Controls.Add(this.label8);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.textWriter);
this.groupBox1.Controls.Add(this.label7);
this.groupBox1.Controls.Add(this.textPublish);
this.groupBox1.Controls.Add(this.textName);
this.groupBox1.Controls.Add(this.textId);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.textPublishDate);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.textSort);
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(24, 24);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(464, 216);
this.groupBox1.TabIndex = 20;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "图书信息维护";
//
// textAmount
//
this.textAmount.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetBook, "Book.BookAmount"));
this.textAmount.Location = new System.Drawing.Point(336, 144);
this.textAmount.Name = "textAmount";
this.textAmount.Size = new System.Drawing.Size(104, 23);
this.textAmount.TabIndex = 31;
this.textAmount.Text = "";
//
// objDataSetBook
//
this.objDataSetBook.DataSetName = "DataSetBook";
this.objDataSetBook.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// label9
//
this.label9.Location = new System.Drawing.Point(256, 144);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(48, 23);
this.label9.TabIndex = 30;
this.label9.Text = "总册数";
//
// textPrice
//
this.textPrice.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetBook, "Book.BookPrice"));
this.textPrice.Location = new System.Drawing.Point(96, 174);
this.textPrice.Name = "textPrice";
this.textPrice.Size = new System.Drawing.Size(104, 23);
this.textPrice.TabIndex = 29;
this.textPrice.Text = "";
//
// textRemain
//
this.textRemain.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetBook, "Book.BookRemain"));
this.textRemain.Location = new System.Drawing.Point(336, 176);
this.textRemain.Name = "textRemain";
this.textRemain.Size = new System.Drawing.Size(104, 23);
this.textRemain.TabIndex = 28;
this.textRemain.Text = "";
//
// label8
//
this.label8.Location = new System.Drawing.Point(24, 176);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(72, 23);
this.label8.TabIndex = 27;
this.label8.Text = "图书单价";
//
// label6
//
this.label6.Location = new System.Drawing.Point(256, 176);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(48, 23);
this.label6.TabIndex = 26;
this.label6.Text = "库存量";
//
// textWriter
//
this.textWriter.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetBook, "Book.BookWriter"));
this.textWriter.Location = new System.Drawing.Point(96, 140);
this.textWriter.Name = "textWriter";
this.textWriter.Size = new System.Drawing.Size(104, 23);
this.textWriter.TabIndex = 13;
this.textWriter.Text = "";
//
// label7
//
this.label7.Location = new System.Drawing.Point(24, 144);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(72, 23);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -