frmMicroWeiXinPayConfig.cs 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. using LYFZ.BLL;
  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.Windows.Forms;
  10. namespace LYFZ.Software.MainBusiness.OAShopManagement
  11. {
  12. public partial class frmMicroWeiXinPayConfig : LYFZ.Software.UI.OAShopManagement.frmMicroWeiXinPayConfig
  13. {
  14. LYFZ.BLL.BLL_ErpSystemConfigure config = new BLL.BLL_ErpSystemConfigure();
  15. LYFZ.Model.Model_ErpSystemConfigure modConfig;
  16. string MchID = "";
  17. public frmMicroWeiXinPayConfig()
  18. {
  19. InitializeComponent();
  20. DataSet ds = config.GetSystemConfigure("*", "WeiXinPayConfig");
  21. if(ds.Tables[0].Rows.Count==0)
  22. {
  23. modConfig = new Model.Model_ErpSystemConfigure()
  24. {
  25. Sconfig_Code = "WeiXinPayConfig",
  26. Sconfig_Name = "微信支付账户",
  27. Sconfig_Value = Json.JsonTool.ObjectToJson(new WXConfigData() {
  28. AppId = "",
  29. MCHID = "",
  30. Key = "",
  31. SubMchId=""
  32. })
  33. };
  34. config.Add(modConfig);
  35. }
  36. else
  37. {
  38. modConfig = config.DataRowToModel(ds.Tables[0].Rows[0]);
  39. WXConfigData data = new WXConfigData();
  40. data = (WXConfigData)Json.JsonTool.JsonToObject(modConfig.Sconfig_Value, data);
  41. txt_AppId.Text = data.AppId.Trim();
  42. txt_Key.Text = data.Key.Trim();
  43. txt_MchId.Text = data.SubMchId.Trim();
  44. MchID = data.MCHID.Trim();
  45. }
  46. }
  47. protected override void btn_Check_Click(object sender, EventArgs e)
  48. {
  49. frmActionPay frmPay = new frmActionPay();
  50. frmPay.BindInfoData("微信支付", 0.01m, txt_AppId.Text.Trim(), MchID, txt_Key.Text.Trim(), txt_MchId.Text.Trim(), "");
  51. frmPay.ShowDialog();
  52. //base.btn_Cancel_Click(sender, e);
  53. }
  54. protected override void btn_OK_Click(object sender, EventArgs e)
  55. {
  56. LYFZ.BLL.WXConfigData data = new LYFZ.BLL.WXConfigData()
  57. {
  58. AppId = txt_AppId.Text.Trim(),
  59. Key = txt_Key.Text.Trim(),
  60. SubMchId = txt_MchId.Text.Trim(),
  61. MCHID = MchID.Trim()
  62. };
  63. string strJson = Json.JsonTool.ObjectToJson(data);
  64. modConfig.Sconfig_Value=strJson;
  65. config.Update( (object)modConfig, " Sconfig_Code='WeiXinPayConfig' ","ID");
  66. base.btn_OK_Click(sender, e);
  67. }
  68. }
  69. }