Form_Publisher_BookManagement_Buy.cs
上传用户:chinapurv
上传日期:2014-03-12
资源大小:4870k
文件大小:9k
源码类别:
教育系统应用
开发平台:
C#
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- namespace 图书管理系统
- {
- /// <summary>
- /// Form_Publisher_BookManagemant_Buy 的摘要说明。
- /// </summary>
- public class Form_Publisher_BookManagement_Buy : System.Windows.Forms.Form
- {
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Button butCommit;
- private System.Windows.Forms.Button butCancel;
- private System.Windows.Forms.TextBox AccountNumber;
- private System.Windows.Forms.TextBox bookISBN;
- private System.Windows.Forms.TextBox amount;
- private System.Windows.Forms.TextBox bookinprice;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.TextBox bookoutprice;
- private System.Windows.Forms.Label label5;
- /// <summary>
- /// 必需的设计器变量。
- /// </summary>
- private System.ComponentModel.Container components = null;
- public Form_Publisher_BookManagement_Buy()
- {
- //
- // 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_Publisher_BookManagement_Buy));
- this.AccountNumber = new System.Windows.Forms.TextBox();
- this.amount = new System.Windows.Forms.TextBox();
- this.label2 = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.bookISBN = new System.Windows.Forms.TextBox();
- this.label3 = new System.Windows.Forms.Label();
- this.butCommit = new System.Windows.Forms.Button();
- this.butCancel = new System.Windows.Forms.Button();
- this.bookinprice = new System.Windows.Forms.TextBox();
- this.label4 = new System.Windows.Forms.Label();
- this.bookoutprice = new System.Windows.Forms.TextBox();
- this.label5 = new System.Windows.Forms.Label();
- this.SuspendLayout();
- //
- // AccountNumber
- //
- this.AccountNumber.Location = new System.Drawing.Point(162, 184);
- this.AccountNumber.Name = "AccountNumber";
- this.AccountNumber.Size = new System.Drawing.Size(208, 21);
- this.AccountNumber.TabIndex = 7;
- this.AccountNumber.Text = "";
- //
- // amount
- //
- this.amount.Cursor = System.Windows.Forms.Cursors.IBeam;
- this.amount.Location = new System.Drawing.Point(162, 144);
- this.amount.Name = "amount";
- this.amount.Size = new System.Drawing.Size(208, 21);
- this.amount.TabIndex = 6;
- this.amount.Text = "";
- //
- // label2
- //
- this.label2.BackColor = System.Drawing.Color.Transparent;
- this.label2.Location = new System.Drawing.Point(54, 184);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(76, 24);
- this.label2.TabIndex = 5;
- this.label2.Text = "银行账号";
- //
- // label1
- //
- this.label1.BackColor = System.Drawing.Color.Transparent;
- this.label1.Location = new System.Drawing.Point(54, 144);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(76, 24);
- this.label1.TabIndex = 4;
- this.label1.Text = "购买数量";
- //
- // bookISBN
- //
- this.bookISBN.Location = new System.Drawing.Point(162, 24);
- this.bookISBN.Name = "bookISBN";
- this.bookISBN.ReadOnly = true;
- this.bookISBN.Size = new System.Drawing.Size(208, 21);
- this.bookISBN.TabIndex = 9;
- this.bookISBN.Text = "bookISBN";
- //
- // label3
- //
- this.label3.BackColor = System.Drawing.Color.Transparent;
- this.label3.Location = new System.Drawing.Point(54, 24);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(76, 24);
- this.label3.TabIndex = 8;
- this.label3.Text = "ISBN";
- //
- // butCommit
- //
- this.butCommit.BackColor = System.Drawing.Color.Transparent;
- this.butCommit.Location = new System.Drawing.Point(96, 232);
- this.butCommit.Name = "butCommit";
- this.butCommit.Size = new System.Drawing.Size(80, 24);
- this.butCommit.TabIndex = 10;
- this.butCommit.Text = "提交";
- this.butCommit.Click += new System.EventHandler(this.butCommit_Click);
- //
- // butCancel
- //
- this.butCancel.BackColor = System.Drawing.Color.Transparent;
- this.butCancel.Location = new System.Drawing.Point(248, 232);
- this.butCancel.Name = "butCancel";
- this.butCancel.Size = new System.Drawing.Size(80, 24);
- this.butCancel.TabIndex = 11;
- this.butCancel.Text = "取消";
- this.butCancel.Click += new System.EventHandler(this.butCancel_Click);
- //
- // bookinprice
- //
- this.bookinprice.Cursor = System.Windows.Forms.Cursors.IBeam;
- this.bookinprice.Location = new System.Drawing.Point(162, 64);
- this.bookinprice.Name = "bookinprice";
- this.bookinprice.ReadOnly = true;
- this.bookinprice.Size = new System.Drawing.Size(208, 21);
- this.bookinprice.TabIndex = 13;
- this.bookinprice.Text = "bookinprice";
- //
- // label4
- //
- this.label4.BackColor = System.Drawing.Color.Transparent;
- this.label4.Location = new System.Drawing.Point(54, 64);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(76, 24);
- this.label4.TabIndex = 12;
- this.label4.Text = "购入价格";
- //
- // bookoutprice
- //
- this.bookoutprice.Cursor = System.Windows.Forms.Cursors.IBeam;
- this.bookoutprice.Location = new System.Drawing.Point(162, 104);
- this.bookoutprice.Name = "bookoutprice";
- this.bookoutprice.Size = new System.Drawing.Size(208, 21);
- this.bookoutprice.TabIndex = 15;
- this.bookoutprice.Text = "";
- //
- // label5
- //
- this.label5.BackColor = System.Drawing.Color.Transparent;
- this.label5.Location = new System.Drawing.Point(54, 104);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(76, 24);
- this.label5.TabIndex = 14;
- this.label5.Text = "预定售价";
- //
- // Form_Publisher_BookManagement_Buy
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
- this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
- this.ClientSize = new System.Drawing.Size(424, 270);
- this.Controls.Add(this.bookoutprice);
- this.Controls.Add(this.bookinprice);
- this.Controls.Add(this.bookISBN);
- this.Controls.Add(this.AccountNumber);
- this.Controls.Add(this.amount);
- this.Controls.Add(this.label5);
- this.Controls.Add(this.label4);
- this.Controls.Add(this.butCancel);
- this.Controls.Add(this.butCommit);
- this.Controls.Add(this.label3);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.label1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.Name = "Form_Publisher_BookManagement_Buy";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "购入图书";
- this.Load += new System.EventHandler(this.Form_Publisher_BookManagement_Buy_Load);
- this.ResumeLayout(false);
- }
- #endregion
- SQL sql;
- private void Form_Publisher_BookManagement_Buy_Load(object sender, System.EventArgs e)
- {
- bookISBN.Text=Form_Publisher_BookManagement.BOOKISBN;
- bookinprice.Text=Form_Publisher_BookManagement.BOOKINPRICE;
- sql=new SQL("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=图书管理系统数据库.mdb");
- }
- private void butCommit_Click(object sender, System.EventArgs e)
- {
- try
- {
- int.Parse(amount.Text);
- }
- catch
- {
- MessageBox.Show("购买数量必须为整型数,提交失败!","提示");
- return;
- }
- if(amount.Text!=""&&AccountNumber.Text!="")
- {
- if(MessageBox.Show("确实要提交吗?","提示",MessageBoxButtons.YesNo)==DialogResult.Yes)
- {
- sql.ExecuteSQL("select * from 库存信息表 where bookISBN='"+bookISBN.Text+"'");
- if(sql.rows.GetLength(0)==0)
- {
- sql.ExecuteSQL("insert into 库存信息表 values('"+bookISBN.Text+"','"+Form_Publisher_BookManagement.PRESSNAME+"','"
- +Form_Publisher_BookManagement.BOOKNAME+"','"+Form_Publisher_BookManagement.BOOKINFO+"','"
- +Form_Publisher_BookManagement.BOOKPUBLISHDATE+"','"
- +Form_Publisher_BookManagement.BOOKINPRICE+"','"+bookoutprice.Text+"','"+amount.Text+"')");
- }
- else
- {
- sql.ExecuteSQL("update 库存信息表 set bookoutprice="+bookoutprice.Text+",bookquantity=bookquantity+"+amount.Text+" where bookISBN='"+bookISBN.Text+"'");
- }
- this.Close();
- }
- }
- }
- private void butCancel_Click(object sender, System.EventArgs e)
- {
- this.Close();
- }
- }
- }