You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.6 KiB

  1. using HKLib.Dto;
  2. using HKLib.Interfaces;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace HKCardManager.UserPages
  13. {
  14. public partial class MealSegmentSetPage : UserControl
  15. {
  16. public MealSegmentSetPage()
  17. {
  18. InitializeComponent();
  19. this.SizeChanged += MealSegmentSetPage_SizeChanged;
  20. }
  21. private void MealSegmentSetPage_SizeChanged(object? sender, EventArgs e)
  22. {
  23. panel1.Left = (this.Width - panel1.Width) / 2;
  24. panel1.Top = (this.Height - panel1.Height) / 2;
  25. }
  26. private void button1_Click(object sender, EventArgs e)
  27. {
  28. var data = new TimeSpilte()
  29. {
  30. AMStartTime = dateTimePicker1.Value,
  31. AMEndTime = dateTimePicker4.Value,
  32. PMStartTime = dateTimePicker2.Value,
  33. PMEndTime = dateTimePicker5.Value,
  34. ATStartTime = dateTimePicker3.Value,
  35. ATEndTime = dateTimePicker6.Value
  36. };
  37. Task.Factory.StartNew(() =>
  38. {
  39. if (HKLibHelper.SetTime(data))
  40. {
  41. MessageLogNotify.GetInstance.Show("设置餐段时间成功");
  42. }
  43. else
  44. {
  45. MessageLogNotify.GetInstance.ShowError("设置时间段失败,请重试!");
  46. }
  47. });
  48. }
  49. }
  50. }