frmChange.cs 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. namespace BooksManageSystem
  9. {
  10. public partial class frmChange : Form
  11. {
  12. Book book;
  13. EnumOP op;
  14. public frmChange(Book b,EnumOP op)
  15. {
  16. InitializeComponent();
  17. this.book = b;
  18. this.op = op;
  19. switch (op)
  20. {
  21. case EnumOP.售:
  22. this.Text = "售书";
  23. break;
  24. case EnumOP.领:
  25. this.Text = "领用书籍";
  26. break;
  27. case EnumOP.购:
  28. this.Text = "购入书籍";
  29. break;
  30. case EnumOP.还:
  31. this.Text = "归还书籍";
  32. break;
  33. default:
  34. break;
  35. }
  36. }
  37. private void frmChange_Load(object sender, EventArgs e)
  38. {
  39. this.txt_Bookname.Text = book.BookName;
  40. }
  41. private void btn_OK_Click(object sender, EventArgs e)
  42. {
  43. this.BookChangeCount = (int)numberUD.Value;
  44. this.BookID = this.book.BookID;
  45. this.NoteTag = txt_NoteTag.Text;
  46. this.OPDateTime = this.dtp_Op_time.Value;
  47. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  48. }
  49. public DateTime OPDateTime { get; set; }
  50. public int BookChangeCount { get; set; }
  51. public string NoteTag { get; set; }
  52. public int BookID { get; set; }
  53. private void txt_NoteTag_KeyPress(object sender, KeyPressEventArgs e)
  54. {
  55. if (e.KeyChar == 13)
  56. {
  57. //same as btn_OK
  58. this.BookChangeCount = (int)numberUD.Value;
  59. this.BookID = this.book.BookID;
  60. this.NoteTag = txt_NoteTag.Text;
  61. this.OPDateTime = this.dtp_Op_time.Value;
  62. this.DialogResult = System.Windows.Forms.DialogResult.OK;
  63. }
  64. }
  65. private void txt_Bookname_KeyPress(object sender, KeyPressEventArgs e)
  66. {
  67. e.Handled = true;
  68. }
  69. }
  70. }