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

教育系统应用

开发平台:

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_Storage 的摘要说明。
  10. /// </summary>
  11. public class Form_Storage : System.Windows.Forms.Form
  12. {
  13. private System.Windows.Forms.Label label7;
  14. private System.Windows.Forms.Label label6;
  15. private System.Windows.Forms.Label label5;
  16. private System.Windows.Forms.Label label4;
  17. private System.Windows.Forms.Label label3;
  18. private System.Windows.Forms.Label label2;
  19. private System.Windows.Forms.Label label1;
  20. private System.Windows.Forms.Button butLast;
  21. private System.Windows.Forms.Button butFirst;
  22. private System.Windows.Forms.Button butNext;
  23. private System.Windows.Forms.Button butPrev;
  24. private System.Windows.Forms.TextBox pressname;
  25. private System.Windows.Forms.TextBox bookquantity;
  26. private System.Windows.Forms.TextBox bookname;
  27. private System.Windows.Forms.TextBox bookISBN;
  28. private System.Windows.Forms.TextBox bookinfo;
  29. private System.Windows.Forms.TextBox bookoutprice;
  30. private System.Windows.Forms.Button butSearch;
  31. private System.Windows.Forms.TextBox textForSearch;
  32. private System.Windows.Forms.Label label8;
  33. private System.Windows.Forms.ComboBox comboBox1;
  34. private System.Windows.Forms.ComboBox comboBox2;
  35. private System.Windows.Forms.TextBox bookinprice;
  36. private System.Windows.Forms.TextBox bookpublishdate;
  37. private System.Windows.Forms.Label label9;
  38. private System.Windows.Forms.Button butShowAll;
  39. /// <summary>
  40. /// 必需的设计器变量。
  41. /// </summary>
  42. private System.ComponentModel.Container components = null;
  43. public Form_Storage()
  44. {
  45. //
  46. // Windows 窗体设计器支持所必需的
  47. //
  48. InitializeComponent();
  49. //
  50. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  51. //
  52. }
  53. /// <summary>
  54. /// 清理所有正在使用的资源。
  55. /// </summary>
  56. protected override void Dispose( bool disposing )
  57. {
  58. if( disposing )
  59. {
  60. if(components != null)
  61. {
  62. components.Dispose();
  63. }
  64. }
  65. base.Dispose( disposing );
  66. }
  67. #region Windows 窗体设计器生成的代码
  68. /// <summary>
  69. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  70. /// 此方法的内容。
  71. /// </summary>
  72. private void InitializeComponent()
  73. {
  74. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form_Storage));
  75. this.pressname = new System.Windows.Forms.TextBox();
  76. this.bookinprice = new System.Windows.Forms.TextBox();
  77. this.bookquantity = new System.Windows.Forms.TextBox();
  78. this.bookname = new System.Windows.Forms.TextBox();
  79. this.bookISBN = new System.Windows.Forms.TextBox();
  80. this.bookinfo = new System.Windows.Forms.TextBox();
  81. this.bookoutprice = new System.Windows.Forms.TextBox();
  82. this.label7 = new System.Windows.Forms.Label();
  83. this.label6 = new System.Windows.Forms.Label();
  84. this.label5 = new System.Windows.Forms.Label();
  85. this.label4 = new System.Windows.Forms.Label();
  86. this.label3 = new System.Windows.Forms.Label();
  87. this.label2 = new System.Windows.Forms.Label();
  88. this.label1 = new System.Windows.Forms.Label();
  89. this.butSearch = new System.Windows.Forms.Button();
  90. this.butLast = new System.Windows.Forms.Button();
  91. this.butFirst = new System.Windows.Forms.Button();
  92. this.butNext = new System.Windows.Forms.Button();
  93. this.butPrev = new System.Windows.Forms.Button();
  94. this.textForSearch = new System.Windows.Forms.TextBox();
  95. this.label8 = new System.Windows.Forms.Label();
  96. this.comboBox1 = new System.Windows.Forms.ComboBox();
  97. this.comboBox2 = new System.Windows.Forms.ComboBox();
  98. this.bookpublishdate = new System.Windows.Forms.TextBox();
  99. this.label9 = new System.Windows.Forms.Label();
  100. this.butShowAll = new System.Windows.Forms.Button();
  101. this.SuspendLayout();
  102. // 
  103. // pressname
  104. // 
  105. this.pressname.Location = new System.Drawing.Point(164, 119);
  106. this.pressname.Name = "pressname";
  107. this.pressname.ReadOnly = true;
  108. this.pressname.Size = new System.Drawing.Size(248, 21);
  109. this.pressname.TabIndex = 30;
  110. this.pressname.Text = "pressname";
  111. // 
  112. // bookinprice
  113. // 
  114. this.bookinprice.Location = new System.Drawing.Point(164, 183);
  115. this.bookinprice.Name = "bookinprice";
  116. this.bookinprice.ReadOnly = true;
  117. this.bookinprice.Size = new System.Drawing.Size(248, 21);
  118. this.bookinprice.TabIndex = 28;
  119. this.bookinprice.Text = "bookinprice";
  120. // 
  121. // bookquantity
  122. // 
  123. this.bookquantity.Location = new System.Drawing.Point(164, 247);
  124. this.bookquantity.Name = "bookquantity";
  125. this.bookquantity.ReadOnly = true;
  126. this.bookquantity.Size = new System.Drawing.Size(248, 21);
  127. this.bookquantity.TabIndex = 26;
  128. this.bookquantity.Text = "bookquantity";
  129. // 
  130. // bookname
  131. // 
  132. this.bookname.Location = new System.Drawing.Point(164, 55);
  133. this.bookname.Name = "bookname";
  134. this.bookname.ReadOnly = true;
  135. this.bookname.Size = new System.Drawing.Size(248, 21);
  136. this.bookname.TabIndex = 25;
  137. this.bookname.Text = "bookname";
  138. // 
  139. // bookISBN
  140. // 
  141. this.bookISBN.Location = new System.Drawing.Point(164, 23);
  142. this.bookISBN.Name = "bookISBN";
  143. this.bookISBN.ReadOnly = true;
  144. this.bookISBN.Size = new System.Drawing.Size(248, 21);
  145. this.bookISBN.TabIndex = 24;
  146. this.bookISBN.Text = "bookISBN";
  147. // 
  148. // bookinfo
  149. // 
  150. this.bookinfo.Location = new System.Drawing.Point(164, 87);
  151. this.bookinfo.Name = "bookinfo";
  152. this.bookinfo.ReadOnly = true;
  153. this.bookinfo.Size = new System.Drawing.Size(248, 21);
  154. this.bookinfo.TabIndex = 27;
  155. this.bookinfo.Text = "bookinfo";
  156. // 
  157. // bookoutprice
  158. // 
  159. this.bookoutprice.Location = new System.Drawing.Point(164, 215);
  160. this.bookoutprice.Name = "bookoutprice";
  161. this.bookoutprice.ReadOnly = true;
  162. this.bookoutprice.Size = new System.Drawing.Size(248, 21);
  163. this.bookoutprice.TabIndex = 29;
  164. this.bookoutprice.Text = "bookoutprice";
  165. // 
  166. // label7
  167. // 
  168. this.label7.BackColor = System.Drawing.Color.Transparent;
  169. this.label7.Location = new System.Drawing.Point(60, 247);
  170. this.label7.Name = "label7";
  171. this.label7.Size = new System.Drawing.Size(72, 16);
  172. this.label7.TabIndex = 23;
  173. this.label7.Text = "存货量";
  174. // 
  175. // label6
  176. // 
  177. this.label6.BackColor = System.Drawing.Color.Transparent;
  178. this.label6.Location = new System.Drawing.Point(60, 215);
  179. this.label6.Name = "label6";
  180. this.label6.Size = new System.Drawing.Size(72, 16);
  181. this.label6.TabIndex = 22;
  182. this.label6.Text = "预定售价";
  183. // 
  184. // label5
  185. // 
  186. this.label5.BackColor = System.Drawing.Color.Transparent;
  187. this.label5.Location = new System.Drawing.Point(60, 183);
  188. this.label5.Name = "label5";
  189. this.label5.Size = new System.Drawing.Size(72, 16);
  190. this.label5.TabIndex = 21;
  191. this.label5.Text = "进价";
  192. // 
  193. // label4
  194. // 
  195. this.label4.BackColor = System.Drawing.Color.Transparent;
  196. this.label4.Location = new System.Drawing.Point(60, 119);
  197. this.label4.Name = "label4";
  198. this.label4.Size = new System.Drawing.Size(72, 16);
  199. this.label4.TabIndex = 20;
  200. this.label4.Text = "出版社";
  201. // 
  202. // label3
  203. // 
  204. this.label3.BackColor = System.Drawing.Color.Transparent;
  205. this.label3.Location = new System.Drawing.Point(60, 87);
  206. this.label3.Name = "label3";
  207. this.label3.Size = new System.Drawing.Size(72, 16);
  208. this.label3.TabIndex = 19;
  209. this.label3.Text = "图书简介";
  210. // 
  211. // label2
  212. // 
  213. this.label2.BackColor = System.Drawing.Color.Transparent;
  214. this.label2.Location = new System.Drawing.Point(60, 55);
  215. this.label2.Name = "label2";
  216. this.label2.Size = new System.Drawing.Size(72, 16);
  217. this.label2.TabIndex = 18;
  218. this.label2.Text = "图书名称";
  219. // 
  220. // label1
  221. // 
  222. this.label1.BackColor = System.Drawing.Color.Transparent;
  223. this.label1.Location = new System.Drawing.Point(60, 23);
  224. this.label1.Name = "label1";
  225. this.label1.Size = new System.Drawing.Size(72, 16);
  226. this.label1.TabIndex = 17;
  227. this.label1.Text = "图书ISBN";
  228. // 
  229. // butSearch
  230. // 
  231. this.butSearch.BackColor = System.Drawing.Color.Transparent;
  232. this.butSearch.Location = new System.Drawing.Point(364, 295);
  233. this.butSearch.Name = "butSearch";
  234. this.butSearch.Size = new System.Drawing.Size(64, 24);
  235. this.butSearch.TabIndex = 32;
  236. this.butSearch.Text = "查找图书";
  237. this.butSearch.Click += new System.EventHandler(this.butSearch_Click);
  238. // 
  239. // butLast
  240. // 
  241. this.butLast.BackColor = System.Drawing.Color.Transparent;
  242. this.butLast.Location = new System.Drawing.Point(308, 336);
  243. this.butLast.Name = "butLast";
  244. this.butLast.Size = new System.Drawing.Size(48, 24);
  245. this.butLast.TabIndex = 36;
  246. this.butLast.Text = ">|";
  247. this.butLast.Click += new System.EventHandler(this.butLast_Click);
  248. // 
  249. // butFirst
  250. // 
  251. this.butFirst.BackColor = System.Drawing.Color.Transparent;
  252. this.butFirst.Location = new System.Drawing.Point(164, 336);
  253. this.butFirst.Name = "butFirst";
  254. this.butFirst.Size = new System.Drawing.Size(48, 24);
  255. this.butFirst.TabIndex = 35;
  256. this.butFirst.Text = "|<";
  257. this.butFirst.Click += new System.EventHandler(this.butFirst_Click);
  258. // 
  259. // butNext
  260. // 
  261. this.butNext.BackColor = System.Drawing.Color.Transparent;
  262. this.butNext.Location = new System.Drawing.Point(260, 336);
  263. this.butNext.Name = "butNext";
  264. this.butNext.Size = new System.Drawing.Size(48, 24);
  265. this.butNext.TabIndex = 34;
  266. this.butNext.Text = ">";
  267. this.butNext.Click += new System.EventHandler(this.butNext_Click);
  268. // 
  269. // butPrev
  270. // 
  271. this.butPrev.BackColor = System.Drawing.Color.Transparent;
  272. this.butPrev.Location = new System.Drawing.Point(212, 336);
  273. this.butPrev.Name = "butPrev";
  274. this.butPrev.Size = new System.Drawing.Size(48, 24);
  275. this.butPrev.TabIndex = 33;
  276. this.butPrev.Text = "<";
  277. this.butPrev.Click += new System.EventHandler(this.butPrev_Click);
  278. // 
  279. // textForSearch
  280. // 
  281. this.textForSearch.Location = new System.Drawing.Point(260, 295);
  282. this.textForSearch.Name = "textForSearch";
  283. this.textForSearch.Size = new System.Drawing.Size(96, 21);
  284. this.textForSearch.TabIndex = 37;
  285. this.textForSearch.Text = "";
  286. // 
  287. // label8
  288. // 
  289. this.label8.BackColor = System.Drawing.Color.Transparent;
  290. this.label8.Location = new System.Drawing.Point(56, 295);
  291. this.label8.Name = "label8";
  292. this.label8.Size = new System.Drawing.Size(64, 16);
  293. this.label8.TabIndex = 38;
  294. this.label8.Text = "查找方式";
  295. // 
  296. // comboBox1
  297. // 
  298. this.comboBox1.Items.AddRange(new object[] {
  299.    "图书名称",
  300.    "出版社"});
  301. this.comboBox1.Location = new System.Drawing.Point(120, 295);
  302. this.comboBox1.Name = "comboBox1";
  303. this.comboBox1.Size = new System.Drawing.Size(72, 20);
  304. this.comboBox1.TabIndex = 39;
  305. this.comboBox1.Text = "图书名称";
  306. // 
  307. // comboBox2
  308. // 
  309. this.comboBox2.Items.AddRange(new object[] {
  310.    "模糊",
  311.    "精确"});
  312. this.comboBox2.Location = new System.Drawing.Point(204, 295);
  313. this.comboBox2.Name = "comboBox2";
  314. this.comboBox2.Size = new System.Drawing.Size(48, 20);
  315. this.comboBox2.TabIndex = 40;
  316. this.comboBox2.Text = "模糊";
  317. // 
  318. // bookpublishdate
  319. // 
  320. this.bookpublishdate.Location = new System.Drawing.Point(164, 151);
  321. this.bookpublishdate.Name = "bookpublishdate";
  322. this.bookpublishdate.ReadOnly = true;
  323. this.bookpublishdate.Size = new System.Drawing.Size(248, 21);
  324. this.bookpublishdate.TabIndex = 42;
  325. this.bookpublishdate.Text = "bookpublishdate";
  326. // 
  327. // label9
  328. // 
  329. this.label9.BackColor = System.Drawing.Color.Transparent;
  330. this.label9.Location = new System.Drawing.Point(60, 151);
  331. this.label9.Name = "label9";
  332. this.label9.Size = new System.Drawing.Size(72, 16);
  333. this.label9.TabIndex = 41;
  334. this.label9.Text = "出版日期";
  335. // 
  336. // butShowAll
  337. // 
  338. this.butShowAll.BackColor = System.Drawing.Color.Transparent;
  339. this.butShowAll.Location = new System.Drawing.Point(104, 336);
  340. this.butShowAll.Name = "butShowAll";
  341. this.butShowAll.Size = new System.Drawing.Size(64, 24);
  342. this.butShowAll.TabIndex = 43;
  343. this.butShowAll.Text = "显示全部";
  344. this.butShowAll.Click += new System.EventHandler(this.butShowAll_Click);
  345. // 
  346. // Form_Storage
  347. // 
  348. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  349. this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
  350. this.ClientSize = new System.Drawing.Size(472, 382);
  351. this.ControlBox = false;
  352. this.Controls.Add(this.butShowAll);
  353. this.Controls.Add(this.bookpublishdate);
  354. this.Controls.Add(this.label9);
  355. this.Controls.Add(this.comboBox2);
  356. this.Controls.Add(this.comboBox1);
  357. this.Controls.Add(this.label8);
  358. this.Controls.Add(this.textForSearch);
  359. this.Controls.Add(this.butLast);
  360. this.Controls.Add(this.butFirst);
  361. this.Controls.Add(this.butNext);
  362. this.Controls.Add(this.butPrev);
  363. this.Controls.Add(this.butSearch);
  364. this.Controls.Add(this.pressname);
  365. this.Controls.Add(this.bookinprice);
  366. this.Controls.Add(this.bookquantity);
  367. this.Controls.Add(this.bookname);
  368. this.Controls.Add(this.bookISBN);
  369. this.Controls.Add(this.bookinfo);
  370. this.Controls.Add(this.bookoutprice);
  371. this.Controls.Add(this.label7);
  372. this.Controls.Add(this.label6);
  373. this.Controls.Add(this.label5);
  374. this.Controls.Add(this.label4);
  375. this.Controls.Add(this.label3);
  376. this.Controls.Add(this.label2);
  377. this.Controls.Add(this.label1);
  378. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
  379. this.Name = "Form_Storage";
  380. this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  381. this.Text = "Form_Storage";
  382. this.Load += new System.EventHandler(this.Form_Storage_Load);
  383. this.ResumeLayout(false);
  384. }
  385. #endregion
  386. SQL sql;
  387. public void show()
  388. {
  389. if(sql.rows.GetLength(0)!=0)
  390. {
  391. bookISBN.Text=sql.rows[sql.getPos(),0].ToString();
  392. bookname.Text=sql.rows[sql.getPos(),1].ToString();
  393. bookinfo.Text=sql.rows[sql.getPos(),2].ToString();
  394. pressname.Text=sql.rows[sql.getPos(),3].ToString();
  395. bookpublishdate.Text=sql.rows[sql.getPos(),4].ToString();
  396. bookinprice.Text=sql.rows[sql.getPos(),5].ToString();
  397. bookoutprice.Text=sql.rows[sql.getPos(),6].ToString();
  398. bookquantity.Text=sql.rows[sql.getPos(),7].ToString();
  399. }
  400. else
  401. {
  402. bookISBN.Text="";
  403. bookname.Text="";
  404. bookinfo.Text="";
  405. pressname.Text="";
  406. bookpublishdate.Text="";
  407. bookinprice.Text="";
  408. bookoutprice.Text="";
  409. bookquantity.Text="";
  410. MessageBox.Show("无符合查询条件的结果!","提示");
  411. }
  412. }
  413. private void Form_Storage_Load(object sender, System.EventArgs e)
  414. {
  415. sql=new SQL("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=图书管理系统数据库.mdb");
  416. sql.ExecuteSQL("select * from 库存信息表 order by pressname,bookISBN");
  417. show();
  418. }
  419. private void butFirst_Click(object sender, System.EventArgs e)
  420. {
  421. sql.pointToFirst();
  422. show();
  423. }
  424. private void butPrev_Click(object sender, System.EventArgs e)
  425. {
  426. sql.pointToPrev();
  427. show();
  428. }
  429. private void butNext_Click(object sender, System.EventArgs e)
  430. {
  431. sql.pointToNext();
  432. show();
  433. }
  434. private void butLast_Click(object sender, System.EventArgs e)
  435. {
  436. sql.pointToLast();
  437. show();
  438. }
  439. private void butSearch_Click(object sender, System.EventArgs e)
  440. {
  441. if(comboBox1.Text=="图书名称")
  442. {
  443. if(comboBox2.Text=="精确")
  444. {
  445. sql.ExecuteSQL("select * from 库存信息表 where bookname='"+textForSearch.Text+"' order by pressname,bookISBN");
  446. show();
  447. }
  448. else
  449. {
  450. sql.ExecuteSQL("select * from 库存信息表 where bookname like '%"+textForSearch.Text+"%' order by pressname,bookISBN");
  451. show();
  452. }
  453. }
  454. else
  455. {
  456. if(comboBox2.Text=="精确")
  457. {
  458. sql.ExecuteSQL("select * from 库存信息表 where pressname='"+textForSearch.Text+"' order by pressname,bookISBN");
  459. show();
  460. }
  461. else
  462. {
  463. sql.ExecuteSQL("select * from 库存信息表 where pressname like '%"+textForSearch.Text+"%' order by pressname,bookISBN");
  464. show();
  465. }
  466. }
  467. }
  468. private void butShowAll_Click(object sender, System.EventArgs e)
  469. {
  470. sql.ExecuteSQL("select * from 库存信息表 order by pressname,bookISBN");
  471. show();
  472. }
  473. }
  474. }