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

教育系统应用

开发平台:

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 的摘要说明。
  10. /// </summary>
  11. public class Form_Publisher_BookManagement : System.Windows.Forms.Form
  12. {
  13. private System.Windows.Forms.Label label4;
  14. private System.Windows.Forms.Label label3;
  15. private System.Windows.Forms.Label label2;
  16. private System.Windows.Forms.Label label1;
  17. private System.Windows.Forms.TextBox bookpublishdate;
  18. private System.Windows.Forms.TextBox bookinfo;
  19. private System.Windows.Forms.TextBox bookname;
  20. private System.Windows.Forms.TextBox bookISBN;
  21. private System.Windows.Forms.Label label6;
  22. private System.Windows.Forms.Button butLast;
  23. private System.Windows.Forms.Button butFirst;
  24. private System.Windows.Forms.Button butNext;
  25. private System.Windows.Forms.Button butPrev;
  26. private System.Windows.Forms.Label label5;
  27. private System.Windows.Forms.Button butSearch;
  28. private System.Windows.Forms.Button butAll;
  29. private System.Windows.Forms.Button butThisYear;
  30. private System.Windows.Forms.Button butThisQuarter;
  31. private System.Windows.Forms.Button butBuy;
  32. private System.Windows.Forms.Button butAdd;
  33. private System.Windows.Forms.Button butAlter;
  34. private System.Windows.Forms.Button butDelete;
  35. private System.Windows.Forms.TextBox pressname;
  36. private System.Windows.Forms.Label label7;
  37. private System.Windows.Forms.TextBox bookinprice;
  38. private System.Windows.Forms.TextBox textForSearch;
  39. /// <summary>
  40. /// 必需的设计器变量。
  41. /// </summary>
  42. private System.ComponentModel.Container components = null;
  43. public Form_Publisher_BookManagement()
  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_Publisher_BookManagement));
  75. this.bookpublishdate = new System.Windows.Forms.TextBox();
  76. this.bookinfo = new System.Windows.Forms.TextBox();
  77. this.bookname = new System.Windows.Forms.TextBox();
  78. this.bookISBN = new System.Windows.Forms.TextBox();
  79. this.label4 = new System.Windows.Forms.Label();
  80. this.label3 = new System.Windows.Forms.Label();
  81. this.label2 = new System.Windows.Forms.Label();
  82. this.label1 = new System.Windows.Forms.Label();
  83. this.bookinprice = new System.Windows.Forms.TextBox();
  84. this.label6 = new System.Windows.Forms.Label();
  85. this.butAll = new System.Windows.Forms.Button();
  86. this.butThisYear = new System.Windows.Forms.Button();
  87. this.butThisQuarter = new System.Windows.Forms.Button();
  88. this.butBuy = new System.Windows.Forms.Button();
  89. this.butLast = new System.Windows.Forms.Button();
  90. this.butFirst = new System.Windows.Forms.Button();
  91. this.butNext = new System.Windows.Forms.Button();
  92. this.butPrev = new System.Windows.Forms.Button();
  93. this.textForSearch = new System.Windows.Forms.TextBox();
  94. this.label5 = new System.Windows.Forms.Label();
  95. this.butSearch = new System.Windows.Forms.Button();
  96. this.butAdd = new System.Windows.Forms.Button();
  97. this.butAlter = new System.Windows.Forms.Button();
  98. this.butDelete = new System.Windows.Forms.Button();
  99. this.pressname = new System.Windows.Forms.TextBox();
  100. this.label7 = new System.Windows.Forms.Label();
  101. this.SuspendLayout();
  102. // 
  103. // bookpublishdate
  104. // 
  105. this.bookpublishdate.Location = new System.Drawing.Point(196, 152);
  106. this.bookpublishdate.Name = "bookpublishdate";
  107. this.bookpublishdate.ReadOnly = true;
  108. this.bookpublishdate.Size = new System.Drawing.Size(200, 21);
  109. this.bookpublishdate.TabIndex = 15;
  110. this.bookpublishdate.Text = "bookpublishdate";
  111. // 
  112. // bookinfo
  113. // 
  114. this.bookinfo.Location = new System.Drawing.Point(196, 120);
  115. this.bookinfo.Name = "bookinfo";
  116. this.bookinfo.ReadOnly = true;
  117. this.bookinfo.Size = new System.Drawing.Size(200, 21);
  118. this.bookinfo.TabIndex = 14;
  119. this.bookinfo.Text = "bookinfo";
  120. // 
  121. // bookname
  122. // 
  123. this.bookname.Location = new System.Drawing.Point(196, 88);
  124. this.bookname.Name = "bookname";
  125. this.bookname.ReadOnly = true;
  126. this.bookname.Size = new System.Drawing.Size(200, 21);
  127. this.bookname.TabIndex = 13;
  128. this.bookname.Text = "bookname";
  129. // 
  130. // bookISBN
  131. // 
  132. this.bookISBN.Location = new System.Drawing.Point(196, 56);
  133. this.bookISBN.Name = "bookISBN";
  134. this.bookISBN.ReadOnly = true;
  135. this.bookISBN.Size = new System.Drawing.Size(200, 21);
  136. this.bookISBN.TabIndex = 12;
  137. this.bookISBN.Text = "bookISBN";
  138. // 
  139. // label4
  140. // 
  141. this.label4.BackColor = System.Drawing.Color.Transparent;
  142. this.label4.Location = new System.Drawing.Point(68, 152);
  143. this.label4.Name = "label4";
  144. this.label4.Size = new System.Drawing.Size(112, 16);
  145. this.label4.TabIndex = 11;
  146. this.label4.Text = "出版日期";
  147. // 
  148. // label3
  149. // 
  150. this.label3.BackColor = System.Drawing.Color.Transparent;
  151. this.label3.Location = new System.Drawing.Point(68, 120);
  152. this.label3.Name = "label3";
  153. this.label3.Size = new System.Drawing.Size(112, 16);
  154. this.label3.TabIndex = 10;
  155. this.label3.Text = "图书简介";
  156. // 
  157. // label2
  158. // 
  159. this.label2.BackColor = System.Drawing.Color.Transparent;
  160. this.label2.Location = new System.Drawing.Point(68, 88);
  161. this.label2.Name = "label2";
  162. this.label2.Size = new System.Drawing.Size(112, 16);
  163. this.label2.TabIndex = 9;
  164. this.label2.Text = "图书名称";
  165. // 
  166. // label1
  167. // 
  168. this.label1.BackColor = System.Drawing.Color.Transparent;
  169. this.label1.Location = new System.Drawing.Point(68, 56);
  170. this.label1.Name = "label1";
  171. this.label1.Size = new System.Drawing.Size(112, 16);
  172. this.label1.TabIndex = 8;
  173. this.label1.Text = "ISBN号";
  174. // 
  175. // bookinprice
  176. // 
  177. this.bookinprice.Location = new System.Drawing.Point(196, 184);
  178. this.bookinprice.Name = "bookinprice";
  179. this.bookinprice.ReadOnly = true;
  180. this.bookinprice.Size = new System.Drawing.Size(200, 21);
  181. this.bookinprice.TabIndex = 18;
  182. this.bookinprice.Text = "bookinprice";
  183. // 
  184. // label6
  185. // 
  186. this.label6.BackColor = System.Drawing.Color.Transparent;
  187. this.label6.Location = new System.Drawing.Point(68, 184);
  188. this.label6.Name = "label6";
  189. this.label6.Size = new System.Drawing.Size(112, 16);
  190. this.label6.TabIndex = 16;
  191. this.label6.Text = "图书售价";
  192. // 
  193. // butAll
  194. // 
  195. this.butAll.BackColor = System.Drawing.Color.Transparent;
  196. this.butAll.Location = new System.Drawing.Point(360, 240);
  197. this.butAll.Name = "butAll";
  198. this.butAll.Size = new System.Drawing.Size(56, 24);
  199. this.butAll.TabIndex = 35;
  200. this.butAll.Text = "全部";
  201. this.butAll.Click += new System.EventHandler(this.butAll_Click);
  202. // 
  203. // butThisYear
  204. // 
  205. this.butThisYear.BackColor = System.Drawing.Color.Transparent;
  206. this.butThisYear.Location = new System.Drawing.Point(304, 240);
  207. this.butThisYear.Name = "butThisYear";
  208. this.butThisYear.Size = new System.Drawing.Size(56, 24);
  209. this.butThisYear.TabIndex = 32;
  210. this.butThisYear.Text = "今年";
  211. this.butThisYear.Click += new System.EventHandler(this.butThisYear_Click);
  212. // 
  213. // butThisQuarter
  214. // 
  215. this.butThisQuarter.BackColor = System.Drawing.Color.Transparent;
  216. this.butThisQuarter.Location = new System.Drawing.Point(248, 240);
  217. this.butThisQuarter.Name = "butThisQuarter";
  218. this.butThisQuarter.Size = new System.Drawing.Size(56, 24);
  219. this.butThisQuarter.TabIndex = 31;
  220. this.butThisQuarter.Text = "本季度";
  221. this.butThisQuarter.Click += new System.EventHandler(this.butThisQuarter_Click);
  222. // 
  223. // butBuy
  224. // 
  225. this.butBuy.BackColor = System.Drawing.Color.Transparent;
  226. this.butBuy.Location = new System.Drawing.Point(40, 240);
  227. this.butBuy.Name = "butBuy";
  228. this.butBuy.Size = new System.Drawing.Size(64, 24);
  229. this.butBuy.TabIndex = 30;
  230. this.butBuy.Text = "购入图书";
  231. this.butBuy.Click += new System.EventHandler(this.butBuy_Click);
  232. // 
  233. // butLast
  234. // 
  235. this.butLast.BackColor = System.Drawing.Color.Transparent;
  236. this.butLast.Location = new System.Drawing.Point(280, 312);
  237. this.butLast.Name = "butLast";
  238. this.butLast.Size = new System.Drawing.Size(48, 24);
  239. this.butLast.TabIndex = 39;
  240. this.butLast.Text = ">|";
  241. this.butLast.Click += new System.EventHandler(this.butLast_Click);
  242. // 
  243. // butFirst
  244. // 
  245. this.butFirst.BackColor = System.Drawing.Color.Transparent;
  246. this.butFirst.Location = new System.Drawing.Point(136, 312);
  247. this.butFirst.Name = "butFirst";
  248. this.butFirst.Size = new System.Drawing.Size(48, 24);
  249. this.butFirst.TabIndex = 38;
  250. this.butFirst.Text = "|<";
  251. this.butFirst.Click += new System.EventHandler(this.butFirst_Click);
  252. // 
  253. // butNext
  254. // 
  255. this.butNext.BackColor = System.Drawing.Color.Transparent;
  256. this.butNext.Location = new System.Drawing.Point(232, 312);
  257. this.butNext.Name = "butNext";
  258. this.butNext.Size = new System.Drawing.Size(48, 24);
  259. this.butNext.TabIndex = 37;
  260. this.butNext.Text = ">";
  261. this.butNext.Click += new System.EventHandler(this.butNext_Click);
  262. // 
  263. // butPrev
  264. // 
  265. this.butPrev.BackColor = System.Drawing.Color.Transparent;
  266. this.butPrev.Location = new System.Drawing.Point(184, 312);
  267. this.butPrev.Name = "butPrev";
  268. this.butPrev.Size = new System.Drawing.Size(48, 24);
  269. this.butPrev.TabIndex = 36;
  270. this.butPrev.Text = "<";
  271. this.butPrev.Click += new System.EventHandler(this.butPrev_Click);
  272. // 
  273. // textForSearch
  274. // 
  275. this.textForSearch.Location = new System.Drawing.Point(176, 280);
  276. this.textForSearch.Name = "textForSearch";
  277. this.textForSearch.Size = new System.Drawing.Size(152, 21);
  278. this.textForSearch.TabIndex = 40;
  279. this.textForSearch.Text = "在此输入图书名称";
  280. // 
  281. // label5
  282. // 
  283. this.label5.BackColor = System.Drawing.Color.Transparent;
  284. this.label5.Location = new System.Drawing.Point(72, 280);
  285. this.label5.Name = "label5";
  286. this.label5.Size = new System.Drawing.Size(96, 16);
  287. this.label5.TabIndex = 41;
  288. this.label5.Text = "按图书名称查找";
  289. // 
  290. // butSearch
  291. // 
  292. this.butSearch.BackColor = System.Drawing.Color.Transparent;
  293. this.butSearch.Location = new System.Drawing.Point(336, 280);
  294. this.butSearch.Name = "butSearch";
  295. this.butSearch.Size = new System.Drawing.Size(48, 24);
  296. this.butSearch.TabIndex = 42;
  297. this.butSearch.Text = "查找图书";
  298. this.butSearch.Click += new System.EventHandler(this.butSearch_Click);
  299. // 
  300. // butAdd
  301. // 
  302. this.butAdd.BackColor = System.Drawing.Color.Transparent;
  303. this.butAdd.Location = new System.Drawing.Point(152, 240);
  304. this.butAdd.Name = "butAdd";
  305. this.butAdd.Size = new System.Drawing.Size(48, 24);
  306. this.butAdd.TabIndex = 44;
  307. this.butAdd.Text = "添加";
  308. this.butAdd.Click += new System.EventHandler(this.butAdd_Click);
  309. // 
  310. // butAlter
  311. // 
  312. this.butAlter.BackColor = System.Drawing.Color.Transparent;
  313. this.butAlter.Location = new System.Drawing.Point(104, 240);
  314. this.butAlter.Name = "butAlter";
  315. this.butAlter.Size = new System.Drawing.Size(48, 24);
  316. this.butAlter.TabIndex = 43;
  317. this.butAlter.Text = "修改";
  318. this.butAlter.Click += new System.EventHandler(this.butAlter_Click);
  319. // 
  320. // butDelete
  321. // 
  322. this.butDelete.BackColor = System.Drawing.Color.Transparent;
  323. this.butDelete.Location = new System.Drawing.Point(200, 240);
  324. this.butDelete.Name = "butDelete";
  325. this.butDelete.Size = new System.Drawing.Size(48, 24);
  326. this.butDelete.TabIndex = 45;
  327. this.butDelete.Text = "删除";
  328. this.butDelete.Click += new System.EventHandler(this.butDelete_Click);
  329. // 
  330. // pressname
  331. // 
  332. this.pressname.Location = new System.Drawing.Point(196, 24);
  333. this.pressname.Name = "pressname";
  334. this.pressname.ReadOnly = true;
  335. this.pressname.Size = new System.Drawing.Size(200, 21);
  336. this.pressname.TabIndex = 47;
  337. this.pressname.Text = "pressname";
  338. // 
  339. // label7
  340. // 
  341. this.label7.BackColor = System.Drawing.Color.Transparent;
  342. this.label7.Location = new System.Drawing.Point(68, 24);
  343. this.label7.Name = "label7";
  344. this.label7.Size = new System.Drawing.Size(112, 16);
  345. this.label7.TabIndex = 46;
  346. this.label7.Text = "出版社";
  347. // 
  348. // Form_Publisher_BookManagement
  349. // 
  350. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  351. this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
  352. this.ClientSize = new System.Drawing.Size(464, 348);
  353. this.Controls.Add(this.pressname);
  354. this.Controls.Add(this.textForSearch);
  355. this.Controls.Add(this.bookinprice);
  356. this.Controls.Add(this.bookpublishdate);
  357. this.Controls.Add(this.bookinfo);
  358. this.Controls.Add(this.bookname);
  359. this.Controls.Add(this.bookISBN);
  360. this.Controls.Add(this.label7);
  361. this.Controls.Add(this.butDelete);
  362. this.Controls.Add(this.butAdd);
  363. this.Controls.Add(this.butAlter);
  364. this.Controls.Add(this.butSearch);
  365. this.Controls.Add(this.label5);
  366. this.Controls.Add(this.butLast);
  367. this.Controls.Add(this.butFirst);
  368. this.Controls.Add(this.butNext);
  369. this.Controls.Add(this.butPrev);
  370. this.Controls.Add(this.butAll);
  371. this.Controls.Add(this.butThisYear);
  372. this.Controls.Add(this.butThisQuarter);
  373. this.Controls.Add(this.butBuy);
  374. this.Controls.Add(this.label6);
  375. this.Controls.Add(this.label4);
  376. this.Controls.Add(this.label3);
  377. this.Controls.Add(this.label2);
  378. this.Controls.Add(this.label1);
  379. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  380. this.Name = "Form_Publisher_BookManagement";
  381. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  382. this.Text = "出版社书目信息管理";
  383. this.Load += new System.EventHandler(this.Form_Publisher_BookManagement_Load);
  384. this.ResumeLayout(false);
  385. }
  386. #endregion
  387. private void butBuy_Click(object sender, System.EventArgs e)
  388. {
  389. if(bookISBN.Text!="")
  390. {
  391. Form_Publisher_BookManagement_Buy child=new Form_Publisher_BookManagement_Buy();
  392. child.ShowDialog();
  393. }
  394. else 
  395. {
  396. MessageBox.Show("请先选择一本图书!","提示");
  397. }
  398. }
  399. SQL sql;
  400. string oldbookISBN="";
  401. public static string BOOKISBN="";
  402. public static string PRESSNAME="";
  403. public static string BOOKNAME="";
  404. public static string BOOKINFO="";
  405. public static string BOOKPUBLISHDATE="";
  406. public static string BOOKINPRICE="";
  407. private string oldbookpublishdate;
  408. public void show()
  409. {
  410. if(sql.rows.GetLength(0)!=0)
  411. {
  412. bookISBN.Text=sql.rows[sql.getPos(),0].ToString();
  413. bookname.Text=sql.rows[sql.getPos(),2].ToString();
  414. bookinfo.Text=sql.rows[sql.getPos(),3].ToString();
  415. bookpublishdate.Text=sql.rows[sql.getPos(),4].ToString();
  416. bookinprice.Text=sql.rows[sql.getPos(),5].ToString();
  417. }
  418. else
  419. {
  420. bookISBN.Text="";
  421. bookname.Text="";
  422. bookinfo.Text="";
  423. bookpublishdate.Text="";
  424. bookinprice.Text="";
  425. MessageBox.Show("无符合查询条件的结果!","提示");
  426. }
  427. BOOKISBN=bookISBN.Text;
  428. PRESSNAME=pressname.Text;
  429. BOOKNAME=bookname.Text;
  430. BOOKINFO=bookinfo.Text;
  431. BOOKPUBLISHDATE=bookpublishdate.Text;
  432. BOOKINPRICE=bookinprice.Text;
  433. }
  434. private void Form_Publisher_BookManagement_Load(object sender, System.EventArgs e)
  435. {
  436. pressname.Text=Form_Publisher.Pressname;
  437. sql=new SQL("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=图书管理系统数据库.mdb");
  438. sql.ExecuteSQL("select * from 出版社图书信息表 where pressname='"+pressname.Text+"'");
  439. show();
  440. }
  441. private void butFirst_Click(object sender, System.EventArgs e)
  442. {
  443. sql.pointToFirst();
  444. show();
  445. }
  446. private void butPrev_Click(object sender, System.EventArgs e)
  447. {
  448. sql.pointToPrev();
  449. show();
  450. }
  451. private void butNext_Click(object sender, System.EventArgs e)
  452. {
  453. sql.pointToNext();
  454. show();
  455. }
  456. private void butLast_Click(object sender, System.EventArgs e)
  457. {
  458. sql.pointToLast();
  459. show();
  460. }
  461. private void butAlter_Click(object sender, System.EventArgs e)
  462. {
  463. if(butAlter.Text=="修改")
  464. {
  465. butAlter.Text="更新";
  466. oldbookISBN=bookISBN.Text;
  467. oldbookpublishdate=bookpublishdate.Text;
  468. bookISBN.ReadOnly =false;
  469. bookname.ReadOnly  =false;
  470. bookinfo.ReadOnly  =false;
  471. bookpublishdate.ReadOnly  =false;
  472. bookinprice.ReadOnly  =false;
  473. butAdd.Enabled=false;
  474. butDelete.Enabled=false;
  475. butFirst.Enabled=false;
  476. butPrev.Enabled=false;
  477. butNext.Enabled=false;
  478. butLast.Enabled=false;
  479. butSearch.Enabled=false;
  480. butBuy.Enabled=false;
  481. butThisQuarter.Enabled=false;
  482. butThisYear.Enabled=false;
  483. butAll.Enabled=false;
  484. }
  485. else
  486. {
  487. if(STR.IsDate(bookpublishdate.Text)==true)
  488. {
  489. if(sql.ExecuteSQL("update 出版社图书信息表 set bookISBN='"+bookISBN.Text+"',pressname='"+pressname.Text+"',bookname='"+bookname.Text+"',bookinfo='"+bookinfo.Text+"',bookpublishdate='"+bookpublishdate.Text+"',bookinprice='"+bookinprice.Text+"' where bookISBN='"+oldbookISBN+"'")
  490. ==false)
  491. {
  492. show();
  493. }
  494. }
  495. else
  496. {
  497. MessageBox.Show("时间格式错误!","提示");
  498. bookpublishdate.Text=oldbookpublishdate;
  499. }
  500. bookISBN.ReadOnly =true;
  501. bookname.ReadOnly  =true;
  502. bookinfo.ReadOnly  =true;
  503. bookpublishdate.ReadOnly  =true;
  504. bookinprice.ReadOnly =true;
  505. butAlter.Text="修改";
  506. butAdd.Enabled=true;
  507. butDelete.Enabled=true;
  508. butFirst.Enabled=true;
  509. butPrev.Enabled=true;
  510. butNext.Enabled=true;
  511. butLast.Enabled=true;
  512. butSearch.Enabled=true;
  513. butBuy.Enabled=true;
  514. butThisQuarter.Enabled=true;
  515. butThisYear.Enabled=true;
  516. butAll.Enabled=true;
  517. }
  518. }
  519. private void butAdd_Click(object sender, System.EventArgs e)
  520. {
  521. if(butAdd.Text=="添加")
  522. {
  523. butAdd.Text="提交";
  524. bookISBN.Text="";
  525. bookname.Text="";
  526. bookinfo.Text="";
  527. bookpublishdate.Text="";
  528. bookinprice.Text="";
  529. bookISBN.ReadOnly =false;
  530. bookname.ReadOnly  =false;
  531. bookinfo.ReadOnly  =false;
  532. bookpublishdate.ReadOnly  =false;
  533. bookinprice.ReadOnly  =false;
  534. butAlter.Enabled=false;
  535. butDelete.Enabled=false;
  536. butFirst.Enabled=false;
  537. butPrev.Enabled=false;
  538. butNext.Enabled=false;
  539. butLast.Enabled=false;
  540. butSearch.Enabled=false;
  541. butBuy.Enabled=false;
  542. butThisQuarter.Enabled=false;
  543. butThisYear.Enabled=false;
  544. butAll.Enabled=false;
  545. }
  546. else
  547. {
  548. if(STR.IsDate(bookpublishdate.Text)==true)
  549. {
  550. if(sql.ExecuteSQL("insert into 出版社图书信息表 values('"+bookISBN.Text+"','"+pressname.Text+"','"+bookname.Text+"','"+bookinfo.Text+"','"+bookpublishdate.Text+"','"+bookinprice.Text+"')")
  551. ==false)
  552. {
  553. show();
  554. }
  555. }
  556. else
  557. {
  558. MessageBox.Show("时间格式错误!","提示");
  559. show();
  560. }
  561. bookISBN.ReadOnly =true;
  562. bookname.ReadOnly  =true;
  563. bookinfo.ReadOnly  =true;
  564. bookpublishdate.ReadOnly  =true;
  565. bookinprice.ReadOnly  =true;
  566. butAdd.Text="添加";
  567. butAlter.Enabled=true;
  568. butDelete.Enabled=true;
  569. butFirst.Enabled=true;
  570. butPrev.Enabled=true;
  571. butNext.Enabled=true;
  572. butLast.Enabled=true;
  573. butSearch.Enabled=true;
  574. butBuy.Enabled=true;
  575. butThisQuarter.Enabled=true;
  576. butThisYear.Enabled=true;
  577. butAll.Enabled=true;
  578. }
  579. }
  580. private void butDelete_Click(object sender, System.EventArgs e)
  581. {
  582. sql.ExecuteSQL("delete from 出版社图书信息表 where bookISBN='"+bookISBN.Text+"'");
  583. show();
  584. }
  585. private void butThisQuarter_Click(object sender, System.EventArgs e)
  586. {
  587. int month=System.DateTime.Now.Month;
  588. int space=(3-month%3)%3;
  589. string min=System.DateTime.Now.Year.ToString()+STR.add0(Convert.ToString(month+space-2))+"00";
  590. string max=System.DateTime.Now.Year.ToString()+STR.add0(Convert.ToString(month+space))+"99";
  591. sql.ExecuteSQL("select * from 出版社图书信息表 where bookpublishdate>'"+min+"' and bookpublishdate<'"+max+"'");
  592. show();
  593. }
  594. private void butThisYear_Click(object sender, System.EventArgs e)
  595. {
  596. string min=System.DateTime.Now.Year.ToString()+"0000";
  597. string max=System.DateTime.Now.Year.ToString()+"9999";
  598. sql.ExecuteSQL("select * from 出版社图书信息表 where bookpublishdate>'"+min+"' and bookpublishdate<'"+max+"'");
  599. show();
  600. }
  601. private void butAll_Click(object sender, System.EventArgs e)
  602. {
  603. sql.ExecuteSQL("select * from 出版社图书信息表 where pressname='"+pressname.Text+"'");
  604. show();
  605. }
  606. private void butSearch_Click(object sender, System.EventArgs e)
  607. {
  608. sql.ExecuteSQL("select * from 出版社图书信息表 where bookname='"+textForSearch.Text+"'");
  609. show();
  610. }
  611. }
  612. }