Form_Publisher_BookManagement_Buy.cs
上传用户:chinapurv
上传日期:2014-03-12
资源大小:4870k
文件大小:9k
源码类别:

教育系统应用

开发平台:

C#

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. namespace 图书管理系统
  7. {
  8. /// <summary>
  9. /// Form_Publisher_BookManagemant_Buy 的摘要说明。
  10. /// </summary>
  11. public class Form_Publisher_BookManagement_Buy : System.Windows.Forms.Form
  12. {
  13. private System.Windows.Forms.Label label2;
  14. private System.Windows.Forms.Label label1;
  15. private System.Windows.Forms.Label label3;
  16. private System.Windows.Forms.Button butCommit;
  17. private System.Windows.Forms.Button butCancel;
  18. private System.Windows.Forms.TextBox AccountNumber;
  19. private System.Windows.Forms.TextBox bookISBN;
  20. private System.Windows.Forms.TextBox amount;
  21. private System.Windows.Forms.TextBox bookinprice;
  22. private System.Windows.Forms.Label label4;
  23. private System.Windows.Forms.TextBox bookoutprice;
  24. private System.Windows.Forms.Label label5;
  25. /// <summary>
  26. /// 必需的设计器变量。
  27. /// </summary>
  28. private System.ComponentModel.Container components = null;
  29. public Form_Publisher_BookManagement_Buy()
  30. {
  31. //
  32. // Windows 窗体设计器支持所必需的
  33. //
  34. InitializeComponent();
  35. //
  36. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  37. //
  38. }
  39. /// <summary>
  40. /// 清理所有正在使用的资源。
  41. /// </summary>
  42. protected override void Dispose( bool disposing )
  43. {
  44. if( disposing )
  45. {
  46. if(components != null)
  47. {
  48. components.Dispose();
  49. }
  50. }
  51. base.Dispose( disposing );
  52. }
  53. #region Windows 窗体设计器生成的代码
  54. /// <summary>
  55. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  56. /// 此方法的内容。
  57. /// </summary>
  58. private void InitializeComponent()
  59. {
  60. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form_Publisher_BookManagement_Buy));
  61. this.AccountNumber = new System.Windows.Forms.TextBox();
  62. this.amount = new System.Windows.Forms.TextBox();
  63. this.label2 = new System.Windows.Forms.Label();
  64. this.label1 = new System.Windows.Forms.Label();
  65. this.bookISBN = new System.Windows.Forms.TextBox();
  66. this.label3 = new System.Windows.Forms.Label();
  67. this.butCommit = new System.Windows.Forms.Button();
  68. this.butCancel = new System.Windows.Forms.Button();
  69. this.bookinprice = new System.Windows.Forms.TextBox();
  70. this.label4 = new System.Windows.Forms.Label();
  71. this.bookoutprice = new System.Windows.Forms.TextBox();
  72. this.label5 = new System.Windows.Forms.Label();
  73. this.SuspendLayout();
  74. // 
  75. // AccountNumber
  76. // 
  77. this.AccountNumber.Location = new System.Drawing.Point(162, 184);
  78. this.AccountNumber.Name = "AccountNumber";
  79. this.AccountNumber.Size = new System.Drawing.Size(208, 21);
  80. this.AccountNumber.TabIndex = 7;
  81. this.AccountNumber.Text = "";
  82. // 
  83. // amount
  84. // 
  85. this.amount.Cursor = System.Windows.Forms.Cursors.IBeam;
  86. this.amount.Location = new System.Drawing.Point(162, 144);
  87. this.amount.Name = "amount";
  88. this.amount.Size = new System.Drawing.Size(208, 21);
  89. this.amount.TabIndex = 6;
  90. this.amount.Text = "";
  91. // 
  92. // label2
  93. // 
  94. this.label2.BackColor = System.Drawing.Color.Transparent;
  95. this.label2.Location = new System.Drawing.Point(54, 184);
  96. this.label2.Name = "label2";
  97. this.label2.Size = new System.Drawing.Size(76, 24);
  98. this.label2.TabIndex = 5;
  99. this.label2.Text = "银行账号";
  100. // 
  101. // label1
  102. // 
  103. this.label1.BackColor = System.Drawing.Color.Transparent;
  104. this.label1.Location = new System.Drawing.Point(54, 144);
  105. this.label1.Name = "label1";
  106. this.label1.Size = new System.Drawing.Size(76, 24);
  107. this.label1.TabIndex = 4;
  108. this.label1.Text = "购买数量";
  109. // 
  110. // bookISBN
  111. // 
  112. this.bookISBN.Location = new System.Drawing.Point(162, 24);
  113. this.bookISBN.Name = "bookISBN";
  114. this.bookISBN.ReadOnly = true;
  115. this.bookISBN.Size = new System.Drawing.Size(208, 21);
  116. this.bookISBN.TabIndex = 9;
  117. this.bookISBN.Text = "bookISBN";
  118. // 
  119. // label3
  120. // 
  121. this.label3.BackColor = System.Drawing.Color.Transparent;
  122. this.label3.Location = new System.Drawing.Point(54, 24);
  123. this.label3.Name = "label3";
  124. this.label3.Size = new System.Drawing.Size(76, 24);
  125. this.label3.TabIndex = 8;
  126. this.label3.Text = "ISBN";
  127. // 
  128. // butCommit
  129. // 
  130. this.butCommit.BackColor = System.Drawing.Color.Transparent;
  131. this.butCommit.Location = new System.Drawing.Point(96, 232);
  132. this.butCommit.Name = "butCommit";
  133. this.butCommit.Size = new System.Drawing.Size(80, 24);
  134. this.butCommit.TabIndex = 10;
  135. this.butCommit.Text = "提交";
  136. this.butCommit.Click += new System.EventHandler(this.butCommit_Click);
  137. // 
  138. // butCancel
  139. // 
  140. this.butCancel.BackColor = System.Drawing.Color.Transparent;
  141. this.butCancel.Location = new System.Drawing.Point(248, 232);
  142. this.butCancel.Name = "butCancel";
  143. this.butCancel.Size = new System.Drawing.Size(80, 24);
  144. this.butCancel.TabIndex = 11;
  145. this.butCancel.Text = "取消";
  146. this.butCancel.Click += new System.EventHandler(this.butCancel_Click);
  147. // 
  148. // bookinprice
  149. // 
  150. this.bookinprice.Cursor = System.Windows.Forms.Cursors.IBeam;
  151. this.bookinprice.Location = new System.Drawing.Point(162, 64);
  152. this.bookinprice.Name = "bookinprice";
  153. this.bookinprice.ReadOnly = true;
  154. this.bookinprice.Size = new System.Drawing.Size(208, 21);
  155. this.bookinprice.TabIndex = 13;
  156. this.bookinprice.Text = "bookinprice";
  157. // 
  158. // label4
  159. // 
  160. this.label4.BackColor = System.Drawing.Color.Transparent;
  161. this.label4.Location = new System.Drawing.Point(54, 64);
  162. this.label4.Name = "label4";
  163. this.label4.Size = new System.Drawing.Size(76, 24);
  164. this.label4.TabIndex = 12;
  165. this.label4.Text = "购入价格";
  166. // 
  167. // bookoutprice
  168. // 
  169. this.bookoutprice.Cursor = System.Windows.Forms.Cursors.IBeam;
  170. this.bookoutprice.Location = new System.Drawing.Point(162, 104);
  171. this.bookoutprice.Name = "bookoutprice";
  172. this.bookoutprice.Size = new System.Drawing.Size(208, 21);
  173. this.bookoutprice.TabIndex = 15;
  174. this.bookoutprice.Text = "";
  175. // 
  176. // label5
  177. // 
  178. this.label5.BackColor = System.Drawing.Color.Transparent;
  179. this.label5.Location = new System.Drawing.Point(54, 104);
  180. this.label5.Name = "label5";
  181. this.label5.Size = new System.Drawing.Size(76, 24);
  182. this.label5.TabIndex = 14;
  183. this.label5.Text = "预定售价";
  184. // 
  185. // Form_Publisher_BookManagement_Buy
  186. // 
  187. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  188. this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
  189. this.ClientSize = new System.Drawing.Size(424, 270);
  190. this.Controls.Add(this.bookoutprice);
  191. this.Controls.Add(this.bookinprice);
  192. this.Controls.Add(this.bookISBN);
  193. this.Controls.Add(this.AccountNumber);
  194. this.Controls.Add(this.amount);
  195. this.Controls.Add(this.label5);
  196. this.Controls.Add(this.label4);
  197. this.Controls.Add(this.butCancel);
  198. this.Controls.Add(this.butCommit);
  199. this.Controls.Add(this.label3);
  200. this.Controls.Add(this.label2);
  201. this.Controls.Add(this.label1);
  202. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  203. this.Name = "Form_Publisher_BookManagement_Buy";
  204. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  205. this.Text = "购入图书";
  206. this.Load += new System.EventHandler(this.Form_Publisher_BookManagement_Buy_Load);
  207. this.ResumeLayout(false);
  208. }
  209. #endregion
  210. SQL sql;
  211. private void Form_Publisher_BookManagement_Buy_Load(object sender, System.EventArgs e)
  212. {
  213. bookISBN.Text=Form_Publisher_BookManagement.BOOKISBN;
  214. bookinprice.Text=Form_Publisher_BookManagement.BOOKINPRICE;
  215. sql=new SQL("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=图书管理系统数据库.mdb");
  216. }
  217. private void butCommit_Click(object sender, System.EventArgs e)
  218. {
  219. try
  220. {
  221. int.Parse(amount.Text);
  222. }
  223. catch
  224. {
  225. MessageBox.Show("购买数量必须为整型数,提交失败!","提示");
  226. return;
  227. }
  228. if(amount.Text!=""&&AccountNumber.Text!="")
  229. {
  230. if(MessageBox.Show("确实要提交吗?","提示",MessageBoxButtons.YesNo)==DialogResult.Yes)
  231. {
  232. sql.ExecuteSQL("select * from 库存信息表 where bookISBN='"+bookISBN.Text+"'");
  233. if(sql.rows.GetLength(0)==0)
  234. {
  235. sql.ExecuteSQL("insert into 库存信息表 values('"+bookISBN.Text+"','"+Form_Publisher_BookManagement.PRESSNAME+"','"
  236. +Form_Publisher_BookManagement.BOOKNAME+"','"+Form_Publisher_BookManagement.BOOKINFO+"','"
  237. +Form_Publisher_BookManagement.BOOKPUBLISHDATE+"','"
  238. +Form_Publisher_BookManagement.BOOKINPRICE+"','"+bookoutprice.Text+"','"+amount.Text+"')");
  239. }
  240. else
  241. {
  242. sql.ExecuteSQL("update 库存信息表 set bookoutprice="+bookoutprice.Text+",bookquantity=bookquantity+"+amount.Text+" where bookISBN='"+bookISBN.Text+"'");
  243. }
  244. this.Close();
  245. }
  246. }
  247. }
  248. private void butCancel_Click(object sender, System.EventArgs e)
  249. {
  250. this.Close();
  251. }
  252. }
  253. }