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.

66 lines
2.1 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. using BPA.Helper;
  13. namespace HKCardManager.UserPages
  14. {
  15. public partial class CancellationPage : UserControl
  16. {
  17. public CancellationPage()
  18. {
  19. InitializeComponent();
  20. //this.SizeChanged += CancellationPage_SizeChanged;
  21. }
  22. //private void CancellationPage_SizeChanged(object? sender, EventArgs e)
  23. //{
  24. // panel1.Left = (this.Width - panel1.Width) / 2;
  25. // panel1.Top = (this.Height - panel1.Height) / 2;
  26. //}
  27. private void button2_Click(object sender, EventArgs e)
  28. {
  29. string name = textBox1.Text.Trim();
  30. if (string.IsNullOrEmpty(name))
  31. {
  32. MessageLogNotify.GetInstance.ShowWarning("请输入用户名");
  33. return;
  34. }
  35. string TagName = this.Tag.ToString();
  36. if (string.IsNullOrEmpty(TagName))
  37. {
  38. MessageLogNotify.GetInstance.ShowError("功能名称为空,操作失败,请重试");
  39. }
  40. else
  41. {
  42. int status = 0;
  43. if (TagName == "销户") status = 3;
  44. else if (TagName == "挂失") status = 2;
  45. else if (TagName == "解挂") status = 1;
  46. Task.Factory.StartNew(() =>
  47. {
  48. this.Invoke(() => { button2.Enabled = false; });
  49. var res = HKLibHelper.CardStutasChange(new CardStutasDto()
  50. {
  51. keywrod = name,
  52. Stutas = status
  53. });
  54. if (res) MessageLogNotify.GetInstance.Show($"用户 {TagName} 成功");
  55. else MessageLogNotify.GetInstance.ShowError($"用户 {TagName} 失败,请重试");
  56. this.Invoke(() => { button2.Enabled = true; });
  57. });
  58. }
  59. }
  60. }
  61. }