Form_Storage.cs
上传用户:chinapurv
上传日期:2014-03-12
资源大小:4870k
文件大小:16k
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- namespace 图书管理系统
- {
- /// <summary>
- /// Form_Storage 的摘要说明。
- /// </summary>
- public class Form_Storage : System.Windows.Forms.Form
- {
- private System.Windows.Forms.Label label7;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Button butLast;
- private System.Windows.Forms.Button butFirst;
- private System.Windows.Forms.Button butNext;
- private System.Windows.Forms.Button butPrev;
- private System.Windows.Forms.TextBox pressname;
- private System.Windows.Forms.TextBox bookquantity;
- private System.Windows.Forms.TextBox bookname;
- private System.Windows.Forms.TextBox bookISBN;
- private System.Windows.Forms.TextBox bookinfo;
- private System.Windows.Forms.TextBox bookoutprice;
- private System.Windows.Forms.Button butSearch;
- private System.Windows.Forms.TextBox textForSearch;
- private System.Windows.Forms.Label label8;
- private System.Windows.Forms.ComboBox comboBox1;
- private System.Windows.Forms.ComboBox comboBox2;
- private System.Windows.Forms.TextBox bookinprice;
- private System.Windows.Forms.TextBox bookpublishdate;
- private System.Windows.Forms.Label label9;
- private System.Windows.Forms.Button butShowAll;
- /// <summary>
- /// 必需的设计器变量。
- /// </summary>
- private System.ComponentModel.Container components = null;
- public Form_Storage()
- {
- //
- // 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(Form_Storage));
- this.pressname = new System.Windows.Forms.TextBox();
- this.bookinprice = new System.Windows.Forms.TextBox();
- this.bookquantity = new System.Windows.Forms.TextBox();
- this.bookname = new System.Windows.Forms.TextBox();
- this.bookISBN = new System.Windows.Forms.TextBox();
- this.bookinfo = new System.Windows.Forms.TextBox();
- this.bookoutprice = new System.Windows.Forms.TextBox();
- this.label7 = new System.Windows.Forms.Label();
- this.label6 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.label4 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.butSearch = new System.Windows.Forms.Button();
- this.butLast = new System.Windows.Forms.Button();
- this.butFirst = new System.Windows.Forms.Button();
- this.butNext = new System.Windows.Forms.Button();
- this.butPrev = new System.Windows.Forms.Button();
- this.textForSearch = new System.Windows.Forms.TextBox();
- this.label8 = new System.Windows.Forms.Label();
- this.comboBox1 = new System.Windows.Forms.ComboBox();
- this.comboBox2 = new System.Windows.Forms.ComboBox();
- this.bookpublishdate = new System.Windows.Forms.TextBox();
- this.label9 = new System.Windows.Forms.Label();
- this.butShowAll = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // pressname
- //
- this.pressname.Location = new System.Drawing.Point(164, 119);
- this.pressname.Name = "pressname";
- this.pressname.ReadOnly = true;
- this.pressname.Size = new System.Drawing.Size(248, 21);
- this.pressname.TabIndex = 30;
- this.pressname.Text = "pressname";
- //
- // bookinprice
- //
- this.bookinprice.Location = new System.Drawing.Point(164, 183);
- this.bookinprice.Name = "bookinprice";
- this.bookinprice.ReadOnly = true;
- this.bookinprice.Size = new System.Drawing.Size(248, 21);
- this.bookinprice.TabIndex = 28;
- this.bookinprice.Text = "bookinprice";
- //
- // bookquantity
- //
- this.bookquantity.Location = new System.Drawing.Point(164, 247);
- this.bookquantity.Name = "bookquantity";
- this.bookquantity.ReadOnly = true;
- this.bookquantity.Size = new System.Drawing.Size(248, 21);
- this.bookquantity.TabIndex = 26;
- this.bookquantity.Text = "bookquantity";
- //
- // bookname
- //
- this.bookname.Location = new System.Drawing.Point(164, 55);
- this.bookname.Name = "bookname";
- this.bookname.ReadOnly = true;
- this.bookname.Size = new System.Drawing.Size(248, 21);
- this.bookname.TabIndex = 25;
- this.bookname.Text = "bookname";
- //
- // bookISBN
- //
- this.bookISBN.Location = new System.Drawing.Point(164, 23);
- this.bookISBN.Name = "bookISBN";
- this.bookISBN.ReadOnly = true;
- this.bookISBN.Size = new System.Drawing.Size(248, 21);
- this.bookISBN.TabIndex = 24;
- this.bookISBN.Text = "bookISBN";
- //
- // bookinfo
- //
- this.bookinfo.Location = new System.Drawing.Point(164, 87);
- this.bookinfo.Name = "bookinfo";
- this.bookinfo.ReadOnly = true;
- this.bookinfo.Size = new System.Drawing.Size(248, 21);
- this.bookinfo.TabIndex = 27;
- this.bookinfo.Text = "bookinfo";
- //
- // bookoutprice
- //
- this.bookoutprice.Location = new System.Drawing.Point(164, 215);
- this.bookoutprice.Name = "bookoutprice";
- this.bookoutprice.ReadOnly = true;
- this.bookoutprice.Size = new System.Drawing.Size(248, 21);
- this.bookoutprice.TabIndex = 29;
- this.bookoutprice.Text = "bookoutprice";
- //
- // label7
- //
- this.label7.BackColor = System.Drawing.Color.Transparent;
- this.label7.Location = new System.Drawing.Point(60, 247);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(72, 16);
- this.label7.TabIndex = 23;
- this.label7.Text = "存货量";
- //
- // label6
- //
- this.label6.BackColor = System.Drawing.Color.Transparent;
- this.label6.Location = new System.Drawing.Point(60, 215);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(72, 16);
- this.label6.TabIndex = 22;
- this.label6.Text = "预定售价";
- //
- // label5
- //
- this.label5.BackColor = System.Drawing.Color.Transparent;
- this.label5.Location = new System.Drawing.Point(60, 183);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(72, 16);
- this.label5.TabIndex = 21;
- this.label5.Text = "进价";
- //
- // label4
- //
- this.label4.BackColor = System.Drawing.Color.Transparent;
- this.label4.Location = new System.Drawing.Point(60, 119);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(72, 16);
- this.label4.TabIndex = 20;
- this.label4.Text = "出版社";
- //
- // label3
- //
- this.label3.BackColor = System.Drawing.Color.Transparent;
- this.label3.Location = new System.Drawing.Point(60, 87);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(72, 16);
- this.label3.TabIndex = 19;
- this.label3.Text = "图书简介";
- //
- // label2
- //
- this.label2.BackColor = System.Drawing.Color.Transparent;
- this.label2.Location = new System.Drawing.Point(60, 55);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(72, 16);
- this.label2.TabIndex = 18;
- this.label2.Text = "图书名称";
- //
- // label1
- //
- this.label1.BackColor = System.Drawing.Color.Transparent;
- this.label1.Location = new System.Drawing.Point(60, 23);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(72, 16);
- this.label1.TabIndex = 17;
- this.label1.Text = "图书ISBN";
- //
- // butSearch
- //
- this.butSearch.BackColor = System.Drawing.Color.Transparent;
- this.butSearch.Location = new System.Drawing.Point(364, 295);
- this.butSearch.Name = "butSearch";
- this.butSearch.Size = new System.Drawing.Size(64, 24);
- this.butSearch.TabIndex = 32;
- this.butSearch.Text = "查找图书";
- this.butSearch.Click += new System.EventHandler(this.butSearch_Click);
- //
- // butLast
- //
- this.butLast.BackColor = System.Drawing.Color.Transparent;
- this.butLast.Location = new System.Drawing.Point(308, 336);
- this.butLast.Name = "butLast";
- this.butLast.Size = new System.Drawing.Size(48, 24);
- this.butLast.TabIndex = 36;
- this.butLast.Text = ">|";
- this.butLast.Click += new System.EventHandler(this.butLast_Click);
- //
- // butFirst
- //
- this.butFirst.BackColor = System.Drawing.Color.Transparent;
- this.butFirst.Location = new System.Drawing.Point(164, 336);
- this.butFirst.Name = "butFirst";
- this.butFirst.Size = new System.Drawing.Size(48, 24);
- this.butFirst.TabIndex = 35;
- this.butFirst.Text = "|<";
- this.butFirst.Click += new System.EventHandler(this.butFirst_Click);
- //
- // butNext
- //
- this.butNext.BackColor = System.Drawing.Color.Transparent;
- this.butNext.Location = new System.Drawing.Point(260, 336);
- this.butNext.Name = "butNext";
- this.butNext.Size = new System.Drawing.Size(48, 24);
- this.butNext.TabIndex = 34;
- this.butNext.Text = ">";
- this.butNext.Click += new System.EventHandler(this.butNext_Click);
- //
- // butPrev
- //
- this.butPrev.BackColor = System.Drawing.Color.Transparent;
- this.butPrev.Location = new System.Drawing.Point(212, 336);
- this.butPrev.Name = "butPrev";
- this.butPrev.Size = new System.Drawing.Size(48, 24);
- this.butPrev.TabIndex = 33;
- this.butPrev.Text = "<";
- this.butPrev.Click += new System.EventHandler(this.butPrev_Click);
- //
- // textForSearch
- //
- this.textForSearch.Location = new System.Drawing.Point(260, 295);
- this.textForSearch.Name = "textForSearch";
- this.textForSearch.Size = new System.Drawing.Size(96, 21);
- this.textForSearch.TabIndex = 37;
- this.textForSearch.Text = "";
- //
- // label8
- //
- this.label8.BackColor = System.Drawing.Color.Transparent;
- this.label8.Location = new System.Drawing.Point(56, 295);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(64, 16);
- this.label8.TabIndex = 38;
- this.label8.Text = "查找方式";
- //
- // comboBox1
- //
- this.comboBox1.Items.AddRange(new object[] {
- "图书名称",
- "出版社"});
- this.comboBox1.Location = new System.Drawing.Point(120, 295);
- this.comboBox1.Name = "comboBox1";
- this.comboBox1.Size = new System.Drawing.Size(72, 20);
- this.comboBox1.TabIndex = 39;
- this.comboBox1.Text = "图书名称";
- //
- // comboBox2
- //
- this.comboBox2.Items.AddRange(new object[] {
- "模糊",
- "精确"});
- this.comboBox2.Location = new System.Drawing.Point(204, 295);
- this.comboBox2.Name = "comboBox2";
- this.comboBox2.Size = new System.Drawing.Size(48, 20);
- this.comboBox2.TabIndex = 40;
- this.comboBox2.Text = "模糊";
- //
- // bookpublishdate
- //
- this.bookpublishdate.Location = new System.Drawing.Point(164, 151);
- this.bookpublishdate.Name = "bookpublishdate";
- this.bookpublishdate.ReadOnly = true;
- this.bookpublishdate.Size = new System.Drawing.Size(248, 21);
- this.bookpublishdate.TabIndex = 42;
- this.bookpublishdate.Text = "bookpublishdate";
- //
- // label9
- //
- this.label9.BackColor = System.Drawing.Color.Transparent;
- this.label9.Location = new System.Drawing.Point(60, 151);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(72, 16);
- this.label9.TabIndex = 41;
- this.label9.Text = "出版日期";
- //
- // butShowAll
- //
- this.butShowAll.BackColor = System.Drawing.Color.Transparent;
- this.butShowAll.Location = new System.Drawing.Point(104, 336);
- this.butShowAll.Name = "butShowAll";
- this.butShowAll.Size = new System.Drawing.Size(64, 24);
- this.butShowAll.TabIndex = 43;
- this.butShowAll.Text = "显示全部";
- this.butShowAll.Click += new System.EventHandler(this.butShowAll_Click);
- //
- // Form_Storage
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
- this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
- this.ClientSize = new System.Drawing.Size(472, 382);
- this.ControlBox = false;
- this.Controls.Add(this.butShowAll);
- this.Controls.Add(this.bookpublishdate);
- this.Controls.Add(this.label9);
- this.Controls.Add(this.comboBox2);
- this.Controls.Add(this.comboBox1);
- this.Controls.Add(this.label8);
- this.Controls.Add(this.textForSearch);
- this.Controls.Add(this.butLast);
- this.Controls.Add(this.butFirst);
- this.Controls.Add(this.butNext);
- this.Controls.Add(this.butPrev);
- this.Controls.Add(this.butSearch);
- this.Controls.Add(this.pressname);
- this.Controls.Add(this.bookinprice);
- this.Controls.Add(this.bookquantity);
- this.Controls.Add(this.bookname);
- this.Controls.Add(this.bookISBN);
- this.Controls.Add(this.bookinfo);
- this.Controls.Add(this.bookoutprice);
- this.Controls.Add(this.label7);
- this.Controls.Add(this.label6);
- this.Controls.Add(this.label5);
- this.Controls.Add(this.label4);
- this.Controls.Add(this.label3);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.label1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
- this.Name = "Form_Storage";
- this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
- this.Text = "Form_Storage";
- this.Load += new System.EventHandler(this.Form_Storage_Load);
- this.ResumeLayout(false);
- }
- #endregion
- SQL sql;
- public void show()
- {
- if(sql.rows.GetLength(0)!=0)
- {
- bookISBN.Text=sql.rows[sql.getPos(),0].ToString();
- bookname.Text=sql.rows[sql.getPos(),1].ToString();
- bookinfo.Text=sql.rows[sql.getPos(),2].ToString();
- pressname.Text=sql.rows[sql.getPos(),3].ToString();
- bookpublishdate.Text=sql.rows[sql.getPos(),4].ToString();
- bookinprice.Text=sql.rows[sql.getPos(),5].ToString();
- bookoutprice.Text=sql.rows[sql.getPos(),6].ToString();
- bookquantity.Text=sql.rows[sql.getPos(),7].ToString();
- }
- else
- {
- bookISBN.Text="";
- bookname.Text="";
- bookinfo.Text="";
- pressname.Text="";
- bookpublishdate.Text="";
- bookinprice.Text="";
- bookoutprice.Text="";
- bookquantity.Text="";
- MessageBox.Show("无符合查询条件的结果!","提示");
- }
- }
- private void Form_Storage_Load(object sender, System.EventArgs e)
- {
- sql=new SQL("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=图书管理系统数据库.mdb");
- sql.ExecuteSQL("select * from 库存信息表 order by pressname,bookISBN");
- show();
- }
- private void butFirst_Click(object sender, System.EventArgs e)
- {
- sql.pointToFirst();
- show();
- }
- private void butPrev_Click(object sender, System.EventArgs e)
- {
- sql.pointToPrev();
- show();
- }
- private void butNext_Click(object sender, System.EventArgs e)
- {
- sql.pointToNext();
- show();
- }
- private void butLast_Click(object sender, System.EventArgs e)
- {
- sql.pointToLast();
- show();
- }
- private void butSearch_Click(object sender, System.EventArgs e)
- {
- if(comboBox1.Text=="图书名称")
- {
- if(comboBox2.Text=="精确")
- {
- sql.ExecuteSQL("select * from 库存信息表 where bookname='"+textForSearch.Text+"' order by pressname,bookISBN");
- show();
- }
- else
- {
- sql.ExecuteSQL("select * from 库存信息表 where bookname like '%"+textForSearch.Text+"%' order by pressname,bookISBN");
- show();
- }
- }
- else
- {
- if(comboBox2.Text=="精确")
- {
- sql.ExecuteSQL("select * from 库存信息表 where pressname='"+textForSearch.Text+"' order by pressname,bookISBN");
- show();
- }
- else
- {
- sql.ExecuteSQL("select * from 库存信息表 where pressname like '%"+textForSearch.Text+"%' order by pressname,bookISBN");
- show();
- }
- }
- }
- private void butShowAll_Click(object sender, System.EventArgs e)
- {
- sql.ExecuteSQL("select * from 库存信息表 order by pressname,bookISBN");
- show();
- }
- }
- }