using LYFZ.BLL; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.OAShopManagement { public partial class frmMicroWeiXinPayConfig : LYFZ.Software.UI.OAShopManagement.frmMicroWeiXinPayConfig { LYFZ.BLL.BLL_ErpSystemConfigure config = new BLL.BLL_ErpSystemConfigure(); LYFZ.Model.Model_ErpSystemConfigure modConfig; string MchID = ""; public frmMicroWeiXinPayConfig() { InitializeComponent(); DataSet ds = config.GetSystemConfigure("*", "WeiXinPayConfig"); if(ds.Tables[0].Rows.Count==0) { modConfig = new Model.Model_ErpSystemConfigure() { Sconfig_Code = "WeiXinPayConfig", Sconfig_Name = "微信支付账户", Sconfig_Value = Json.JsonTool.ObjectToJson(new WXConfigData() { AppId = "", MCHID = "", Key = "", SubMchId="" }) }; config.Add(modConfig); } else { modConfig = config.DataRowToModel(ds.Tables[0].Rows[0]); WXConfigData data = new WXConfigData(); data = (WXConfigData)Json.JsonTool.JsonToObject(modConfig.Sconfig_Value, data); txt_AppId.Text = data.AppId.Trim(); txt_Key.Text = data.Key.Trim(); txt_MchId.Text = data.SubMchId.Trim(); MchID = data.MCHID.Trim(); } } protected override void btn_Check_Click(object sender, EventArgs e) { frmActionPay frmPay = new frmActionPay(); frmPay.BindInfoData("微信支付", 0.01m, txt_AppId.Text.Trim(), MchID, txt_Key.Text.Trim(), txt_MchId.Text.Trim(), ""); frmPay.ShowDialog(); //base.btn_Cancel_Click(sender, e); } protected override void btn_OK_Click(object sender, EventArgs e) { LYFZ.BLL.WXConfigData data = new LYFZ.BLL.WXConfigData() { AppId = txt_AppId.Text.Trim(), Key = txt_Key.Text.Trim(), SubMchId = txt_MchId.Text.Trim(), MCHID = MchID.Trim() }; string strJson = Json.JsonTool.ObjectToJson(data); modConfig.Sconfig_Value=strJson; config.Update( (object)modConfig, " Sconfig_Code='WeiXinPayConfig' ","ID"); base.btn_OK_Click(sender, e); } } }