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

教育系统应用

开发平台:

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_Customer_AddOrder_SelectBook 的摘要说明。
  10. /// </summary>
  11. public class Form_Customer_AddOrder_SelectBook : System.Windows.Forms.Form
  12. {
  13. private System.Windows.Forms.ListBox listBox1;
  14. private System.Windows.Forms.Button butExit;
  15. private System.Windows.Forms.Button butCommit;
  16. /// <summary>
  17. /// 必需的设计器变量。
  18. /// </summary>
  19. private System.ComponentModel.Container components = null;
  20. public Form_Customer_AddOrder_SelectBook()
  21. {
  22. //
  23. // Windows 窗体设计器支持所必需的
  24. //
  25. InitializeComponent();
  26. //
  27. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  28. //
  29. }
  30. /// <summary>
  31. /// 清理所有正在使用的资源。
  32. /// </summary>
  33. protected override void Dispose( bool disposing )
  34. {
  35. if( disposing )
  36. {
  37. if(components != null)
  38. {
  39. components.Dispose();
  40. }
  41. }
  42. base.Dispose( disposing );
  43. }
  44. #region Windows 窗体设计器生成的代码
  45. /// <summary>
  46. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  47. /// 此方法的内容。
  48. /// </summary>
  49. private void InitializeComponent()
  50. {
  51. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form_Customer_AddOrder_SelectBook));
  52. this.listBox1 = new System.Windows.Forms.ListBox();
  53. this.butExit = new System.Windows.Forms.Button();
  54. this.butCommit = new System.Windows.Forms.Button();
  55. this.SuspendLayout();
  56. // 
  57. // listBox1
  58. // 
  59. this.listBox1.ItemHeight = 12;
  60. this.listBox1.Location = new System.Drawing.Point(32, 16);
  61. this.listBox1.Name = "listBox1";
  62. this.listBox1.Size = new System.Drawing.Size(368, 208);
  63. this.listBox1.TabIndex = 0;
  64. // 
  65. // butExit
  66. // 
  67. this.butExit.BackColor = System.Drawing.Color.Transparent;
  68. this.butExit.Location = new System.Drawing.Point(252, 248);
  69. this.butExit.Name = "butExit";
  70. this.butExit.Size = new System.Drawing.Size(72, 24);
  71. this.butExit.TabIndex = 27;
  72. this.butExit.Text = "取消";
  73. this.butExit.Click += new System.EventHandler(this.butExit_Click);
  74. // 
  75. // butCommit
  76. // 
  77. this.butCommit.BackColor = System.Drawing.Color.Transparent;
  78. this.butCommit.Location = new System.Drawing.Point(108, 248);
  79. this.butCommit.Name = "butCommit";
  80. this.butCommit.Size = new System.Drawing.Size(72, 24);
  81. this.butCommit.TabIndex = 26;
  82. this.butCommit.Text = "选择";
  83. this.butCommit.Click += new System.EventHandler(this.butCommit_Click);
  84. // 
  85. // Form_Customer_AddOrder_SelectBook
  86. // 
  87. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  88. this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
  89. this.ClientSize = new System.Drawing.Size(432, 286);
  90. this.Controls.Add(this.butExit);
  91. this.Controls.Add(this.butCommit);
  92. this.Controls.Add(this.listBox1);
  93. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  94. this.Name = "Form_Customer_AddOrder_SelectBook";
  95. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  96. this.Text = "选择图书";
  97. this.Load += new System.EventHandler(this.Form_Customer_AddOrder_SelectBook_Load);
  98. this.ResumeLayout(false);
  99. }
  100. #endregion
  101. SQL sql;
  102. public static string BOOKISBN="";
  103. public static string BOOKNAME="";
  104. public static string BOOKPRICE="";
  105. private void Form_Customer_AddOrder_SelectBook_Load(object sender, System.EventArgs e)
  106. {
  107. sql=new SQL("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=图书管理系统数据库.mdb");
  108. sql.ExecuteSQL("select * from 库存信息表 order by bookISBN");
  109. for(int i=0;i<sql.rows.GetLength(0);i++)
  110. listBox1.Items.Add(sql.rows[i,0].ToString());
  111. }
  112. private void butCommit_Click(object sender, System.EventArgs e)
  113. {
  114. if(listBox1.SelectedIndex!=-1)
  115. {
  116. BOOKISBN=sql.rows[listBox1.SelectedIndex,0].ToString();
  117. BOOKNAME=sql.rows[listBox1.SelectedIndex,1].ToString();
  118. BOOKPRICE=sql.rows[listBox1.SelectedIndex,5].ToString();
  119. }
  120. this.Close();
  121. }
  122. private void butExit_Click(object sender, System.EventArgs e)
  123. {
  124. BOOKISBN="";
  125. BOOKNAME="";
  126. this.Close();
  127. }
  128. }
  129. }