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.

MealSegmentSet.cs 1.3 KiB

2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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
  13. {
  14. public partial class MealSegmentSet : Form
  15. {
  16. public MealSegmentSet()
  17. {
  18. InitializeComponent();
  19. }
  20. private void button2_Click(object sender, EventArgs e)
  21. {
  22. this.Close();
  23. }
  24. private void button1_Click(object sender, EventArgs e)
  25. {
  26. var data = new TimeSpilte()
  27. {
  28. AMStartTime = dateTimePicker1.Value,
  29. AMEndTime = dateTimePicker4.Value,
  30. PMStartTime = dateTimePicker2.Value,
  31. PMEndTime = dateTimePicker5.Value,
  32. ATStartTime = dateTimePicker3.Value,
  33. ATEndTime = dateTimePicker6.Value
  34. };
  35. Task.Factory.StartNew(() =>
  36. {
  37. if (HKLibHelper.SetTime(data))
  38. {
  39. this.Invoke(() => { this.Close(); });
  40. }
  41. else
  42. {
  43. this.label7.Text = "设置时间段失败,请重试!";
  44. }
  45. });
  46. }
  47. }
  48. }