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.

80 lines
2.3 KiB

2 years ago
  1. using Euro.Transfer.Base;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Windows.Forms;
  5. namespace Euro.Transfer
  6. {
  7. public partial class GetOrig : Form
  8. {
  9. public GetOrig()
  10. {
  11. InitializeComponent();
  12. IList<KeyValue> lst = new List<KeyValue>();
  13. var kv = new KeyValue
  14. {
  15. key = "TE",
  16. value = "奕達"
  17. };
  18. lst.Add(kv);
  19. kv = new KeyValue
  20. {
  21. key = "TG",
  22. value = "駒驛"
  23. };
  24. lst.Add(kv);
  25. kv = new KeyValue
  26. {
  27. key = "SG",
  28. value = "上海駒驛"
  29. };
  30. lst.Add(kv);
  31. kv = new KeyValue
  32. {
  33. key = "TEST",
  34. value = "TEST"
  35. };
  36. lst.Add(kv);
  37. comorig.DataSource = lst;//绑定
  38. comorig.DisplayMember = "value";//显示的文本
  39. comorig.ValueMember = "key";//对应的值
  40. comorig.SelectedValue = "TE";
  41. }
  42. private void btnSure_Click(object sender, EventArgs e)
  43. {
  44. try
  45. {
  46. var bError = true;
  47. do
  48. {
  49. var dicUpdKeys = new Dictionary<string, string>();
  50. dicUpdKeys.Add("TransferOrgID", comorig.SelectedValue.ToString());
  51. dicUpdKeys.Add("TransferUserID", txtID.Text);
  52. foreach (string key in dicUpdKeys.Keys)
  53. {
  54. var bOk = Common.UpdateAppSettings(key, dicUpdKeys[key]);
  55. if (!bOk)
  56. {
  57. bError = false;
  58. break;
  59. }
  60. }
  61. }
  62. while (false);
  63. if (bError)
  64. {
  65. this.DialogResult = DialogResult.OK; //this 指向的是GetOrig
  66. }
  67. else
  68. {
  69. MessageBox.Show("修改失敗");
  70. }
  71. }
  72. catch (Exception error)
  73. {
  74. ServiceTools.WriteLog(ServiceBase.Errorlog_Path, error.ToString(), true);
  75. }
  76. }
  77. }
  78. }