Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

191 righe
5.9 KiB

  1. using HKLib.DB;
  2. using HKCardManager.UserPages;
  3. namespace HKCardManager
  4. {
  5. public partial class Form1 : Form
  6. {
  7. public Form1()
  8. {
  9. InitializeComponent();
  10. splitContainer1.SplitterDistance = 240;
  11. Task.Factory.StartNew(() =>
  12. {
  13. DbContext.InitTable();
  14. });
  15. ShowPage(new PersonnelEntryPage());
  16. this.SizeChanged += Form1_SizeChanged;
  17. this.button1.SizeChanged += Button1_SizeChanged;
  18. MessageLogNotify.GetInstance.Info = new Action<string>((s) =>
  19. {
  20. this.Invoke(() =>
  21. {
  22. if (listBox1.Items.Count > 0)
  23. listBox1.Items.Insert(0, $"{DateTime.Now.ToString("HH:mm:ss")}:{s}");
  24. else
  25. listBox1.Items.Add($"{DateTime.Now.ToString("HH:mm:ss")}:{s}");
  26. });
  27. });
  28. }
  29. private void Button1_SizeChanged(object? sender, EventArgs e)
  30. {
  31. groupBox1.Width = button1.Width;
  32. groupBox2.Width = button1.Width;
  33. groupBox3.Width = button1.Width;
  34. groupBox4.Width = button1.Width;
  35. button2.Left = 10;
  36. button2.Width = (groupBox1.Width - 20);
  37. button3.Left = 10;
  38. button3.Width = (groupBox1.Width - 20);
  39. button4.Left = 10;
  40. button4.Width = (groupBox2.Width - 20);
  41. button5.Left = 10;
  42. button5.Width = (groupBox2.Width - 20);
  43. button6.Left = 10;
  44. button6.Width = (groupBox2.Width - 20);
  45. button7.Left = 10;
  46. button7.Width = (groupBox2.Width - 20);
  47. button9.Left = 10;
  48. button9.Width = (groupBox3.Width - 20);
  49. button10.Left = 10;
  50. button10.Width = (groupBox3.Width - 20);
  51. button11.Left = 10;
  52. button11.Width = (groupBox3.Width - 20);
  53. button12.Left = 10;
  54. button12.Width = (groupBox4.Width - 20);
  55. }
  56. UserControl tempUserControl;
  57. private void Form1_SizeChanged(object? sender, EventArgs e)
  58. {
  59. if (tempUserControl != null)
  60. {
  61. tempUserControl.Width = this.panel1.Width;
  62. tempUserControl.Height = this.panel1.Height;
  63. }
  64. splitContainer1.SplitterDistance = 240;
  65. }
  66. private void 人员录入ToolStripMenuItem_Click(object sender, EventArgs e)
  67. {
  68. new PersonnelEntry().ShowDialog();
  69. }
  70. private void 机构录入ToolStripMenuItem_Click(object sender, EventArgs e)
  71. {
  72. new InstitutionalEntry().ShowDialog();
  73. }
  74. private void 发卡ToolStripMenuItem_Click(object sender, EventArgs e)
  75. {
  76. new Hairpin().ShowDialog();
  77. }
  78. private void 销户ToolStripMenuItem_Click(object sender, EventArgs e)
  79. {
  80. Cancellation cancellation = new Cancellation();
  81. cancellation.Text = "销户";
  82. cancellation.ShowDialog();
  83. }
  84. private void 挂失ToolStripMenuItem_Click(object sender, EventArgs e)
  85. {
  86. Cancellation cancellation = new Cancellation();
  87. cancellation.Text = "挂失";
  88. cancellation.ShowDialog();
  89. }
  90. private void 解挂ToolStripMenuItem_Click(object sender, EventArgs e)
  91. {
  92. Cancellation cancellation = new Cancellation();
  93. cancellation.Text = "解挂";
  94. cancellation.ShowDialog();
  95. }
  96. private void 月餐段汇总表ToolStripMenuItem_Click(object sender, EventArgs e)
  97. {
  98. DailyConsumptionTable dailyConsumptionTable = new DailyConsumptionTable();
  99. dailyConsumptionTable.Text = "月餐段汇总表";
  100. dailyConsumptionTable.ShowDialog();
  101. }
  102. private void 计次就餐天消费表ToolStripMenuItem_Click(object sender, EventArgs e)
  103. {
  104. DailyConsumptionTable dailyConsumptionTable = new DailyConsumptionTable();
  105. dailyConsumptionTable.Text = "计次就餐天消费表";
  106. dailyConsumptionTable.ShowDialog();
  107. }
  108. private void 计次就餐消费明细表ToolStripMenuItem_Click(object sender, EventArgs e)
  109. {
  110. DailyConsumptionTable dailyConsumptionTable = new DailyConsumptionTable();
  111. dailyConsumptionTable.Text = "计次就餐消费明细表";
  112. dailyConsumptionTable.ShowDialog();
  113. }
  114. private void 餐段设置ToolStripMenuItem_Click(object sender, EventArgs e)
  115. {
  116. new MealSegmentSet().ShowDialog();
  117. }
  118. //人员录入
  119. private void button2_Click(object sender, EventArgs e)
  120. {
  121. ShowPage(new PersonnelEntryPage());
  122. }
  123. //机构录入
  124. private void button3_Click(object sender, EventArgs e)
  125. {
  126. ShowPage(new InstitutionalEntryPage());
  127. }
  128. //发卡
  129. private void button5_Click(object sender, EventArgs e)
  130. {
  131. ShowPage(new CarMangerPage());
  132. }
  133. //销户,挂失,解挂
  134. private void button4_Click(object sender, EventArgs e)
  135. {
  136. ShowPage(new CancellationPage(), ((Button)sender)?.Tag.ToString());
  137. }
  138. //月餐段汇总表
  139. private void button11_Click(object sender, EventArgs e)
  140. {
  141. ShowPage(new ReportFormPage(), ((Button)sender)?.Tag.ToString());
  142. }
  143. //餐段设置
  144. private void button12_Click(object sender, EventArgs e)
  145. {
  146. ShowPage(new MealSegmentSetPage());
  147. }
  148. private void ShowPage(UserControl userControl, string? name = "")
  149. {
  150. panel1.Controls.Clear();
  151. userControl.Width = panel1.Width;
  152. userControl.Height = panel1.Height;
  153. tempUserControl = userControl;
  154. userControl.Tag = name;
  155. userControl.Show();
  156. panel1.Controls.Add(userControl);
  157. }
  158. }
  159. }