123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- 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 frmAliPayConfig : LYFZ.Software.UI.OAShopManagement.frmAliPayConfig
- {
- LYFZ.BLL.BLL_ErpSystemConfigure config = new BLL.BLL_ErpSystemConfigure();
- LYFZ.Model.Model_ErpSystemConfigure modConfig;
- string aliSubMchId = "";
- public frmAliPayConfig()
- {
- InitializeComponent();
- DataSet ds = config.GetSystemConfigure("*", "AliPayConfig");
- if (ds.Tables[0].Rows.Count == 0)
- {
- modConfig = new Model.Model_ErpSystemConfigure()
- {
- Sconfig_Code = "AliPayConfig",
- Sconfig_Name = "支付宝账户",
- Sconfig_Value = Json.JsonTool.ObjectToJson(new LYFZ.BLL.AliConfigData() { AppId = "", Key = "", MCHID = "", publicKey="", SubMchId="" })
- };
- config.Add(modConfig);
- }
- else
- {
- modConfig = config.DataRowToModel(ds.Tables[0].Rows[0]);
- LYFZ.BLL.AliConfigData data = new LYFZ.BLL.AliConfigData();
- data = (LYFZ.BLL.AliConfigData)Json.JsonTool.JsonToObject(modConfig.Sconfig_Value, data);
- txt_AppId.Text = data.AppId.Trim();
- txt_MchId.Text = data.MCHID.Trim();
- aliSubMchId = data.SubMchId.Trim();
- txt_Key.Text = data.Key;
- txt_PublicKey.Text = data.publicKey;
- }
- }
- protected override void btn_Check_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.MultipleFileImport.FileUtil.WriteFileByASCII(Application.StartupPath + "\\RSA\\alipay_rsa_public_key.pem", txt_PublicKey.Text);
- LYFZ.Software.MainBusiness.MultipleFileImport.FileUtil.WriteFileByASCII(Application.StartupPath + "\\RSA\\rsa_public_key.pem", txt_PublicKey.Text);
- LYFZ.Software.MainBusiness.MultipleFileImport.FileUtil.WriteFileByASCII(Application.StartupPath + "\\RSA\\rsa_private_key.pem", txt_Key.Text);
- frmActionPay frmPay = new frmActionPay();
- frmPay.BindInfoData("支付宝支付", 0.01m, txt_AppId.Text.Trim(), txt_MchId.Text.Trim(), "", aliSubMchId, "");
- frmPay.ShowDialog();
- //base.btn_Cancel_Click(sender, e);
- }
- protected override void btn_OK_Click(object sender, EventArgs e)
- {
- LYFZ.BLL.AliConfigData data = new LYFZ.BLL.AliConfigData()
- {
- AppId = txt_AppId.Text.Trim(),
- MCHID = txt_MchId.Text.Trim(),
- Key = txt_Key.Text,
- publicKey = txt_PublicKey.Text
- };
- string strJson = Json.JsonTool.ObjectToJson(data);
- modConfig.Sconfig_Value = strJson;
- config.Update((object)modConfig, " Sconfig_Code='AliPayConfig' ", "ID");
- LYFZ.Software.MainBusiness.MultipleFileImport.FileUtil.WriteFileByASCII(Application.StartupPath + "\\RSA\\alipay_rsa_public_key.pem", txt_PublicKey.Text);
- LYFZ.Software.MainBusiness.MultipleFileImport.FileUtil.WriteFileByASCII(Application.StartupPath + "\\RSA\\rsa_public_key.pem", txt_PublicKey.Text);
- LYFZ.Software.MainBusiness.MultipleFileImport.FileUtil.WriteFileByASCII(Application.StartupPath + "\\RSA\\rsa_private_key.pem", txt_Key.Text);
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- this.Close();
- base.btn_OK_Click(sender, e);
- }
- }
- }
|