25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.5 KiB

  1. using HKLib.Logic;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace HKCardManager.UserPages
  12. {
  13. public partial class InstitutionalEntryPage : UserControl
  14. {
  15. public InstitutionalEntryPage()
  16. {
  17. InitializeComponent();
  18. //this.SizeChanged += InstitutionalEntryPage_SizeChanged;
  19. }
  20. //private void InstitutionalEntryPage_SizeChanged(object? sender, EventArgs e)
  21. //{
  22. // this.panel1.Left = (this.Width - this.panel1.Width) / 2;
  23. // this.panel1.Top = (this.Height - this.panel1.Height) / 2;
  24. //}
  25. private void button2_Click(object sender, EventArgs e)
  26. {
  27. string name = this.textBox1.Text.Trim();
  28. if (string.IsNullOrEmpty(name))
  29. {
  30. MessageLogNotify.GetInstance.ShowWarning("请输入机构名称");
  31. }
  32. Task.Factory.StartNew(() =>
  33. {
  34. if (ServiceHandler.AddOrg(name))
  35. {
  36. Global.OrgList.Add(name);
  37. MessageLogNotify.GetInstance.Show($"【{name}】 机构添加成功");
  38. }
  39. else
  40. MessageLogNotify.GetInstance.ShowError($"【{name}】 机构添加失败,请重试,请检查机构是否存在");
  41. });
  42. }
  43. }
  44. }