示例#1
0
    /// <summary>
    /// 保存系统设置信息
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Settings()
    {
        string bind   = string.Empty;
        string strSql = string.Empty;

        SqlTransaction TranSaction = null;
        SqlConnection  Connection  = new SqlConnection(SqlHelper.LocalSqlServer);

        Connection.Open();
        TranSaction = Connection.BeginTransaction();

        try
        {
            //企业ID
            int CompId = Convert.ToInt32(Request["hid_compID"]);

            string chkisno      = Convert.ToString(Request["chkisno"]);
            string seller_email = Convert.ToString(Request["seller_email"]);
            string partner      = Convert.ToString(Request["partner"]);
            string PayKey       = Convert.ToString(Request["PayKey"]);
            string alirsa       = Convert.ToString(Request["alirsa"]);

            bool fal = false;

            //查询该企业的设置
            List <Hi.Model.Pay_PayWxandAli> Sysl = new Hi.BLL.Pay_PayWxandAli().GetList("", " CompID=" + CompId, "");

            //判断企业的是否有设置
            if (Sysl.Count > 0)
            {
                Hi.Model.Pay_PayWxandAli paywxandaliModel = Sysl[0];
                paywxandaliModel.ali_isno         = chkisno;
                paywxandaliModel.ali_seller_email = seller_email;
                paywxandaliModel.ali_partner      = partner;
                paywxandaliModel.ali_key          = PayKey;
                paywxandaliModel.ali_RSAkey       = alirsa;
                fal = new Hi.BLL.Pay_PayWxandAli().Update(paywxandaliModel);
                if (fal)
                {
                    string strmessage = string.Format("支付宝企业账户:{0};合作者身(Partner ID):{1};安全校验码(Key):{2};RSA加密(RSA秘钥):{3};是否启用:{4}", seller_email, partner, PayKey, alirsa, chisno);
                    Utils.AddSysBusinessLog(CompId, "paymentbank", paywxandaliModel.ID.ToString(), "支付宝收款账户修改", strmessage, this.UserID.ToString());
                }
            }
            else
            {
                Hi.Model.Pay_PayWxandAli paywxandaliModel = new Hi.Model.Pay_PayWxandAli();
                paywxandaliModel.ali_isno         = chkisno;
                paywxandaliModel.ali_seller_email = seller_email;
                paywxandaliModel.ali_partner      = partner;
                paywxandaliModel.ali_key          = PayKey;
                paywxandaliModel.ali_RSAkey       = alirsa;
                paywxandaliModel.CompID           = CompId;

                int num = new Hi.BLL.Pay_PayWxandAli().Add(paywxandaliModel);
                if (num > 0)
                {
                    fal = true;
                    string strmessage = string.Format("支付宝企业账户:{0};合作者身(Partner ID):{1};安全校验码(Key):{2};RSA加密(RSA秘钥):{3};是否启用:{4}", seller_email, partner, PayKey, alirsa, chisno);
                    Utils.AddSysBusinessLog(CompId, "paymentbank", paywxandaliModel.ID.ToString(), "支付宝收款账户新增", strmessage, this.UserID.ToString());
                }
            }


            if (fal)
            {
                TranSaction.Commit();
                bind = "{\"ds\":\"0\",\"prompt\":\"提交成功!\"}";
            }
            else
            {
                TranSaction.Rollback();
                bind = "{\"ds\":\"1\",\"prompt\":\"提交失败!\"}";
            }
        }
        catch (Exception ex)
        {
            TranSaction.Rollback();
            bind = "{\"ds\":\"1\",\"prompt\":\"提交失败!\"}";
        }
        finally
        {
            Connection.Dispose();

            Response.Write(bind);
            Response.End();
        }
    }
示例#2
0
    public ResultWX Result_WX(string JSon, string version)
    {
        string disID  = string.Empty;
        string UserID = string.Empty;

        Hi.BLL.BD_Distributor bll_dis  = new Hi.BLL.BD_Distributor();
        Hi.BLL.BD_Company     bll_comp = new Hi.BLL.BD_Company();
        ResultWX result = new ResultWX();
        string   appid  = string.Empty;
        string   mchid  = string.Empty;
        string   key    = string.Empty;

        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString().Trim() != "" && JInfo["ResellerID"].ToString().Trim() != "")
            {
                disID  = JInfo["ResellerID"].ToString();
                UserID = JInfo["UserID"].ToString();
            }
            else
            {
                return(new ResultWX()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            #endregion
            //判断登录信息是否正确
            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out user, 0, int.Parse(disID == "" ? "0" : disID)))
            {
                return new ResultWX()
                       {
                           Result = "F", Description = "用户异常"
                       }
            }
            ;
            //判断经销商信息是否异常
            Hi.Model.BD_Distributor dis = bll_dis.GetModel(Convert.ToInt32(disID));
            if (dis == null || dis.dr == 1 || dis.AuditState == 0 || dis.IsEnabled == 0)
            {
                return new ResultWX()
                       {
                           Result = "F", Description = "经销商异常"
                       }
            }
            ;
            //判断经销商对应的核心企业是否异常
            Hi.Model.BD_Company comp = bll_comp.GetModel(dis.CompID);
            if (comp == null || comp.dr == 1 || comp.AuditState == 0 || comp.IsEnabled == 0)
            {
                return new ResultWX()
                       {
                           Result = "F", Description = "核心企业异常"
                       }
            }
            ;
            //获取Pay_PayWxandAli表的实体
            Hi.Model.Pay_PayWxandAli paywx = Common.GetPayWxandAli(comp.ID);
            if (paywx == null || ClsSystem.gnvl(paywx.wx_Isno, "0") == "0")
            {
                return new ResultWX()
                       {
                           Result = "F", Description = "核心企业无可用的微信收款账户"
                       }
            }
            ;
            #region //返回参数
            result.Result      = "T";
            result.Description = "返回成功";
            //对数据库中取出的值进行解密
            appid = Common.DesDecrypt(paywx.wx_appid, Common.EncryptKey);
            mchid = Common.DesDecrypt(paywx.wx_mchid, Common.EncryptKey);
            key   = Common.DesDecrypt(paywx.wx_key, Common.EncryptKey);
            //对解密过的字段,用我们这边的方法重新加密
            appid = AESHelper.Encrpt_string(appid);
            mchid = AESHelper.Encrpt_string(mchid);
            key   = AESHelper.Encrpt_string(key);
            //将加密完的值赋给返回实体
            result.AppID = appid;
            result.Mchid = mchid;
            //result.AppSecret = paywx.wx_appsechet;
            result.APPkey = key;

            #endregion
            //return result;
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "Result_WX:" + JSon);
            return(new ResultWX()
            {
                Result = "F", Description = "参数异常"
            });
        }
        return(result);
    }
示例#3
0
    /// <summary>
    /// 查看是否启用微信支付或者支付宝支付
    /// </summary>
    public ResultPayInfo GetPayInfo(string JSon, string version)
    {
        string    disID           = string.Empty;
        string    UserID          = string.Empty;
        string    OrderType       = string.Empty;
        string    ReceiptNo       = string.Empty;
        string    PayPrice        = string.Empty;
        string    PayIDJSon       = string.Empty;
        string    partner         = string.Empty;
        string    seller          = string.Empty;
        string    private_key     = string.Empty;
        string    subject         = string.Empty; //提示内容
        string    GoodsName       = string.Empty; //订单所有商品的名称
        string    OrderNumberJSon = string.Empty; //订单支付流水号的json
        string    OrderNumber     = string.Empty; //订单支付流水号
        string    orderInfo       = string.Empty; //订单信息
        string    OrderCode       = string.Empty; //企业订单号
        DataTable dt_order        = null;


        Hi.BLL.BD_Distributor bll_dis   = new Hi.BLL.BD_Distributor();
        Hi.BLL.BD_Company     bll_comp  = new Hi.BLL.BD_Company();
        Hi.BLL.DIS_Order      bll_order = new Hi.BLL.DIS_Order();
        ResultPayInfo         payinfo   = new ResultPayInfo();
        Common comm = new Common();

        try
        {
            #region//JSon取值
            JsonData JInfo = null;
            JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString().Trim() != "" && JInfo["ResellerID"].ToString().Trim() != "" && JInfo["OrderType"].ToString().Trim() != "" &&
                JInfo["PayPrice"].ToString().Trim() != "" && JInfo["PayIDJson"].ToString().Trim() != "")
            {
                UserID = JInfo["UserID"].ToString();

                disID     = JInfo["ResellerID"].ToString();
                OrderType = JInfo["OrderType"].ToString();
                PayPrice  = JInfo["PayPrice"].ToString();
                PayIDJSon = JInfo["PayIDJson"].ToString();
            }
            else
            {
                return(new ResultPayInfo()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            if (OrderType == "0")
            {
                if (JInfo["ReceiptNo"].ToString().Trim() != "")
                {
                    ReceiptNo = JInfo["ReceiptNo"].ToString();
                }
                else
                {
                    return(new ResultPayInfo()
                    {
                        Result = "F", Description = "参数异常"
                    });
                }
            }
            #endregion

            //判断登录信息是否正确
            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out user, 0, int.Parse(disID == "" ? "0" : disID)))
            {
                return new ResultPayInfo()
                       {
                           Result = "F", Description = "用户异常"
                       }
            }
            ;
            //判断经销商信息是否异常
            Hi.Model.BD_Distributor dis = bll_dis.GetModel(Convert.ToInt32(disID));
            if (dis == null || dis.dr == 1 || dis.AuditState == 0 || dis.IsEnabled == 0)
            {
                return new ResultPayInfo()
                       {
                           Result = "F", Description = "经销商异常"
                       }
            }
            ;
            //判断经销商对应的核心企业是否异常
            Hi.Model.BD_Company comp = bll_comp.GetModel(dis.CompID);
            if (comp == null || comp.dr == 1 || comp.AuditState == 0 || comp.IsEnabled == 0)
            {
                return new ResultPayInfo()
                       {
                           Result = "F", Description = "核心企业异常"
                       }
            }
            ;
            //判断此订单的信息是否异常,是否可支付
            //根据订单号,取出订单数据放入dt中
            if (OrderType == "0")
            {
                dt_order = bll_order.GetData(ReceiptNo).Tables[0];

                if (Convert.ToInt32(dt_order.Rows[0]["OState"]) == (int)Enums.OrderState.待审核 ||
                    Convert.ToInt32(dt_order.Rows[0]["OState"]) == (int)Enums.OrderState.已作废 ||
                    Convert.ToInt32(dt_order.Rows[0]["PayState"]) == (int)Enums.PayState.已支付)
                {
                    return new ResultPayInfo()
                           {
                               Result = "F", Description = "订单信息异常"
                           }
                }
                ;
            }

            //获取Pay_PayWxandAli表的实体
            Hi.Model.Pay_PayWxandAli payali = Common.GetPayWxandAli(comp.ID);
            if (payali == null || ClsSystem.gnvl(payali.ali_isno, "0") == "0")
            {
                return new ResultPayInfo()
                       {
                           Result = "F", Description = "核心企业无可用的支付宝收款账户"
                       }
            }
            ;
            //对数据库中数据进行解密
            //partner = Common.DesDecrypt(payali.ali_partner, Common.EncryptKey);
            //seller = Common.DesDecrypt(payali.ali_seller_email, Common.EncryptKey);
            //private_key = Common.DesDecrypt(payali.ali_key, Common.EncryptKey);
            partner     = payali.ali_partner;
            seller      = payali.ali_seller_email;
            private_key = payali.ali_RSAkey;
            //订单支付跟预付款充值的提示信息(两种请款下的提示信息是不同的)
            if (OrderType == "0")
            {
                subject = "医站通订单-" + ReceiptNo;
            }
            else
            {
                subject = "医站通预付款充值";
            }
            //订单所有商品明细

            if (OrderType == "0")
            {
                DataTable l = new Hi.BLL.DIS_OrderDetail().GetOrderDe("", " IsNUll(o.dr,0)=0 and o.OrderId=" + Convert.ToInt32(dt_order.Rows[0]["ID"]));
                foreach (DataRow dr in l.Rows)
                {
                    GoodsName += dr["GoodsName"] + ",";
                }
                GoodsName = GoodsName.Substring(0, GoodsName.Length - 1);//去掉最后一个逗号
                if (GoodsName.Length > 15)
                {
                    GoodsName = GoodsName.Substring(0, 10) + "...";
                }
            }

            //获取订单支付时的支付流水号
            if (OrderType == "0")
            {
                OrderNumberJSon = new OrderPay().GetPayID(PayIDJSon);
                //解析返回的订单支付流水号的JSon
                JInfo = JsonMapper.ToObject(OrderNumberJSon);
                if (JInfo["Result"].ToString().Trim() == "F" || JInfo["PayNumb"].ToString().Trim() == "" || JInfo["Result"].ToString().Trim() == "" ||
                    JInfo["OrderCode"].ToString().Trim() == "")
                {
                    return(new ResultPayInfo()
                    {
                        Result = "F", Description = "获取支付流水号异常"
                    });
                }
                else
                {
                    OrderNumber = JInfo["PayNumb"].ToString();
                    OrderCode   = JInfo["OrderCode"].ToString();
                }
            }
            else//钱包充值时的流水号跟企业订单号
            {
                List <string> list = new List <string>();
                list        = Getpayidyfk(user.ID, comp.ID, dis.ID, PayPrice);
                OrderNumber = list[0];
                OrderCode   = list[1];
                if (OrderNumber == "" || OrderCode == "")
                {
                    return new ResultPayInfo()
                           {
                               Result = "F", Description = "获取支付流水号异常"
                           }
                }
                ;
            }
            //创建订单信息
            orderInfo = comm.getOrderInfo(subject, GoodsName, PayPrice, OrderNumber, partner, seller);
            // 对订单做RSA 签名
            //private_key = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANDptrV3pWWdbnr6wT8lPkZ6kbRgsjf8CfXpQNrJyOsmktOaX8DQRh5nd0lSFTtbfeGV4oWXi26bv+1Vt+CfAsYssf+futRj0l6Cxx0psJapK7QEXq3HqjB0tM11M9ym75WFFvTSZs1DysUkRV35g5rXuRtBOWR2sqm9JRAen+29AgMBAAECgYEAzZ+L1xb5c4e960uOE1Hb9tDDQs/9+j6XqzQ3QmFj4Zeo4p9KaeRVb62U6lThUvgdcYDuYWEkuuyPvtEk1/CKb61AvEW69ehwLeDXOy9AzEgQpGFPb1bgJ+kU8YCpgcOGR9G55iVc0ZW7B2iyx111Wvij8pc+A2ZeuByAG1f8PoECQQD7wvCyBJRNb7Gv7iHF+zx2lDxG6LTX2rCAZdr8FyWVjZEBfL6uPI+/2J2AqtFPaLa25+jQc3b74r4wuGKsvxBhAkEA1G4aDQovfB9RO/c4I+NX4mmitpNt66IuqKp0a9pOL/YfpNtr5GBgmK4LMVASqIG74bw5wAV7zJkunlGGPusK3QJBALLiUm/KvS1AXbqpsymfV9jRfvrLQiPVaW/x72ULdVMMIaoy3rGiqmkgGtlfhhWsS5cutMfYIwTamVS4zrP7lkECQFTvDJVoHCI5d0ZNivG2ZR4OdFMhURKkTpl7RX8V0qsUcgR9An9WFWkWNT1rMXqUHGWd100yJBRirqP4Hn+rhDUCQBPVgm4jNd5WjKD0Oj39FmF5D89OviTgQK4xYxYUIfqLBhuGZ3kWDvAmeE6uRgVXjQncv/c68W8pS2huT0syom4=";
            //private_key = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCnxj/9qwVfgoUh/y2W89L6BkRAFljhNhgPdyPuBV64bfQNN1PjbCzkIM6qRdKBoLPXmKKMiFYnkd6rAoprih3/PrQEB/VsW8OoM8fxn67UDYuyBTqA23MML9q1+ilIZwBC2AQ2UBVOrFXfFl75p6/B5KsiNG9zpgmLCUYuLkxpLQIDAQAB";
            string sign = Com.Alipay.RSAFromPkcs8.sign(orderInfo, private_key, "utf-8");
            //string sign = RSAFromPkcs8.sign(orderInfo, private_key, "utf-8");
            sign = HttpUtility.UrlEncode(sign, Encoding.UTF8);
            //返回实体
            // 完整的符合支付宝参数规范的订单信息
            payinfo.Result      = "T";
            payinfo.Description = "返回成功";
            payinfo.InfoString  = orderInfo + "&sign=\"" + sign + "\"&"
                                  + comm.getSignType();
            payinfo.OrderCode = OrderCode;
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetPayInfo:" + JSon);
            return(new ResultPayInfo()
            {
                Result = "F", Description = "参数异常"
            });
        }
        return(payinfo);
    }
示例#4
0
    public ResultAli Result_Ali(string JSon, string version)
    {
        string disID  = string.Empty;
        string UserID = string.Empty;

        Hi.BLL.BD_Distributor bll_dis  = new Hi.BLL.BD_Distributor();
        Hi.BLL.BD_Company     bll_comp = new Hi.BLL.BD_Company();
        ResultAli             result   = new ResultAli();
        string partner     = string.Empty;
        string seller      = string.Empty;
        string private_key = string.Empty;

        try
        {
            #region//JSon取值
            JsonData JInfo = JsonMapper.ToObject(JSon);
            if (JInfo.Count > 0 && JInfo["UserID"].ToString().Trim() != "" && JInfo["ResellerID"].ToString().Trim() != "")
            {
                disID = JInfo["ResellerID"].ToString();

                UserID = JInfo["UserID"].ToString();
            }
            else
            {
                return(new ResultAli()
                {
                    Result = "F", Description = "参数异常"
                });
            }

            #endregion
            //判断登录信息是否正确
            Hi.Model.SYS_Users user = new Hi.Model.SYS_Users();
            if (!new Common().IsLegitUser(int.Parse(UserID), out user, 0, int.Parse(disID == "" ? "0" : disID)))
            {
                return new ResultAli()
                       {
                           Result = "F", Description = "用户异常"
                       }
            }
            ;
            //判断经销商信息是否异常
            Hi.Model.BD_Distributor dis = bll_dis.GetModel(Convert.ToInt32(disID));
            if (dis == null || dis.dr == 1 || dis.AuditState == 0 || dis.IsEnabled == 0)
            {
                return new ResultAli()
                       {
                           Result = "F", Description = "经销商异常"
                       }
            }
            ;
            //判断经销商对应的核心企业是否异常
            Hi.Model.BD_Company comp = bll_comp.GetModel(dis.CompID);
            if (comp == null || comp.dr == 1 || comp.AuditState == 0 || comp.IsEnabled == 0)
            {
                return new ResultAli()
                       {
                           Result = "F", Description = "核心企业异常"
                       }
            }
            ;
            //获取Pay_PayWxandAli表的实体
            Hi.Model.Pay_PayWxandAli payali = Common.GetPayWxandAli(comp.ID);
            if (payali == null || ClsSystem.gnvl(payali.ali_isno, "0") == "0")
            {
                return new ResultAli()
                       {
                           Result = "F", Description = "核心企业无可用的支付宝收款账户"
                       }
            }
            ;
            #region //返回参数

            result.Result      = "T";
            result.Description = "返回成功";
            //对数据库中数据进行解密
            partner     = Common.DesDecrypt(payali.ali_partner, Common.EncryptKey);
            seller      = Common.DesDecrypt(payali.ali_seller_email, Common.EncryptKey);
            private_key = Common.DesDecrypt(payali.ali_key, Common.EncryptKey);
            //对解密过的数据,再用我们的加密方法进行加密
            partner     = AESHelper.Encrpt_string(partner);
            seller      = AESHelper.Encrpt_string(seller);
            private_key = AESHelper.Encrpt_string(private_key);
            //将我们这边加密完的数据,赋值给返回实体
            result.PARTNER     = partner;
            result.SELLER      = seller;
            result.RSA_PRIVATE = private_key;
            #endregion
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "Result_Ali:" + JSon);
            return(new ResultAli()
            {
                Result = "F", Description = "参数异常"
            });
        }
        return(result);
    }
示例#5
0
    /// <summary>
    /// 保存方法操作
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click()
    {
        string bind = string.Empty;
        //声明变量
        string AccountName = string.Empty;
        string bankcode    = string.Empty;
        string bankAddress = string.Empty;
        string bankPrivate = string.Empty;
        string bankCity    = string.Empty;
        int    Isno        = 0;
        string county      = string.Empty; //开户所在区县
        int    BankId      = 0;            //银行Id
        int    type        = 0;            //账户类型

        try
        {
            //收集数据
            AccountName = Common.NoHTML(Convert.ToString(Request["txtDisUser"]));           //账户名称
            bankcode    = Common.NoHTML(Convert.ToString(Request["txtbankcode"]));          //账户号码
            bankAddress = Common.NoHTML(Convert.ToString(Request["txtbankAddress"]));       //开户行地址
            bankPrivate = Common.NoHTML(Convert.ToString(Request["hidProvince"]));          //省
            bankCity    = Common.NoHTML(Convert.ToString(Request["hidCity"]));              //市
            county      = Common.NoHTML(Convert.ToString(Request["hidArea"]));              //区
            Isno        = Convert.ToInt32(Request["chkIsno"]);                              //是否启用
            BankId      = Convert.ToInt32(Request["ddlbank"]);                              //银行Id
            type        = Convert.ToInt32(Request["ddltype"]);                              //账户类型

            string SltPesontype = Convert.ToString(Request["SltPesontype"]);                //证件类型
            string txtpesoncode = Common.NoHTML(Convert.ToString(Request["txtpesoncode"])); //证件号码

            //查询收款帐号设置
            List <Hi.Model.PAY_PaymentBank> pbModellist = new Hi.BLL.PAY_PaymentBank().GetList("", " CompID=" + this.CompID, "");

            if (pbModellist.Count > 0)
            {
                Hi.Model.PAY_PaymentBank pbModel = pbModellist[0];
                pbModel.BankID      = BankId;
                pbModel.AccountName = AccountName;
                pbModel.bankcode    = bankcode;
                pbModel.bankAddress = bankAddress;
                pbModel.bankPrivate = bankPrivate;
                pbModel.bankCity    = bankCity;
                pbModel.Isno        = Isno;
                pbModel.modifyuser  = UserID;
                pbModel.ts          = DateTime.Now;
                pbModel.vdef1       = county;
                pbModel.type        = type;
                pbModel.vdef2       = SltPesontype;
                pbModel.vdef3       = txtpesoncode;

                bool result = new Hi.BLL.PAY_PaymentBank().Update(pbModel);
                if (result)
                {
                    string strmessage = string.Format("帐号类型:{0};户名:{1};开户行:{2};帐号:{3};开户所在省市:{4}/{5};开户地址:{6}", type, AccountName, BankId, bankcode, bankPrivate, bankCity, bankAddress);
                    Utils.AddSysBusinessLog(CompID, "paymentbank", pbModel.ID.ToString(), "收款账户修改", strmessage, this.UserID.ToString());
                }
            }
            else
            {
                //实例化对象实体
                Hi.Model.PAY_PaymentBank pbModel = new Hi.Model.PAY_PaymentBank();
                pbModel.paymentAccountID = 0;
                pbModel.BankID           = BankId;
                pbModel.AccountName      = AccountName;
                pbModel.bankcode         = bankcode;
                pbModel.bankAddress      = bankAddress;
                pbModel.bankPrivate      = bankPrivate;
                pbModel.bankCity         = bankCity;
                pbModel.Isno             = Isno;
                pbModel.CreateDate       = DateTime.Now;
                pbModel.CreateUser       = UserID;
                pbModel.dr         = 0;
                pbModel.modifyuser = UserID;
                pbModel.ts         = DateTime.Now;
                pbModel.vdef1      = county;
                pbModel.Start      = 1;
                pbModel.CompID     = CompID;
                pbModel.type       = type;
                pbModel.vdef2      = SltPesontype;
                pbModel.vdef3      = txtpesoncode;

                int succes = new Hi.BLL.PAY_PaymentBank().Add(pbModel);
                if (succes > 0)
                {
                    string strmessage = string.Format("帐号类型:{0};户名:{1};开户行:{2};帐号:{3};开户所在省市:{4}/{5};开户地址:{6}", type, AccountName, BankId, bankcode, bankPrivate, bankCity, bankAddress);
                    Utils.AddSysBusinessLog(CompID, "paymentbank", succes.ToString(), "收款账户新增", strmessage, this.UserID.ToString());
                }
            }

            #region  微信、支付宝 -支付

            //微信
            string wx_chkisno = Common.NoHTML(Convert.ToString(Request["wx_chisno"]));
            string appid      = Common.NoHTML(Convert.ToString(Request["appid"]));
            string appsecret  = Common.NoHTML(Convert.ToString(Request["appsecret"]));
            string mchid      = Common.NoHTML(Convert.ToString(Request["mchid"]));
            string key        = Common.NoHTML(Convert.ToString(Request["key"]));

            //支付宝
            string ali_chkisno  = Common.NoHTML(Convert.ToString(Request["ali_chkisno"]));
            string seller_email = Common.NoHTML(Convert.ToString(Request["seller_email"]));
            string partner      = Common.NoHTML(Convert.ToString(Request["partner"]));
            string PayKey       = Common.NoHTML(Convert.ToString(Request["PayKey"]));
            string alirsa       = Common.NoHTML(Convert.ToString(Request["alirsa"]));

            bool fal = false;

            //查询该企业的设置
            List <Hi.Model.Pay_PayWxandAli> Sysl = new Hi.BLL.Pay_PayWxandAli().GetList("", " CompID=" + this.CompID, "");

            //判断企业的是否有设置
            if (Sysl.Count > 0)
            {
                Hi.Model.Pay_PayWxandAli paywxandaliModel = Sysl[0];
                //微信
                paywxandaliModel.wx_Isno      = wx_chkisno;
                paywxandaliModel.wx_appid     = appid;
                paywxandaliModel.wx_appsechet = appsecret;
                paywxandaliModel.wx_mchid     = mchid;
                paywxandaliModel.wx_key       = key;
                //支付宝
                paywxandaliModel.ali_isno         = ali_chkisno;
                paywxandaliModel.ali_seller_email = seller_email;
                paywxandaliModel.ali_partner      = partner;
                paywxandaliModel.ali_key          = PayKey;
                paywxandaliModel.ali_RSAkey       = alirsa;

                fal = new Hi.BLL.Pay_PayWxandAli().Update(paywxandaliModel);
                if (fal)
                {
                    if (wx_chkisno.Equals("1"))
                    {
                        string strmessage = string.Format("ApppID(应用ID):{0};AppSecrect(应用秘钥):{1};Mchid(商户号):{2};APPKey(API秘钥):{3};是否启用:{4}", appid, appsecret, mchid, key, wx_chkisno);
                        Utils.AddSysBusinessLog(CompID, "paymentbank", paywxandaliModel.ID.ToString(), "微信收款账户修改", strmessage, this.UserID.ToString());
                    }
                    if (ali_chkisno.Equals("1"))
                    {
                        string strmessage = string.Format("支付宝企业账户:{0};合作者身(Partner ID):{1};安全校验码(Key):{2};RSA加密(RSA秘钥):{3};是否启用:{4}", seller_email, partner, PayKey, alirsa, ali_chkisno);
                        Utils.AddSysBusinessLog(CompID, "paymentbank", paywxandaliModel.ID.ToString(), "支付宝收款账户修改", strmessage, this.UserID.ToString());
                    }
                }
            }
            else
            {
                Hi.Model.Pay_PayWxandAli paywxandaliModel = new Hi.Model.Pay_PayWxandAli();
                //微信
                paywxandaliModel.wx_Isno      = wx_chkisno;
                paywxandaliModel.wx_appid     = appid;
                paywxandaliModel.wx_appsechet = appsecret;
                paywxandaliModel.wx_mchid     = mchid;
                paywxandaliModel.wx_key       = key;

                //支付宝
                paywxandaliModel.ali_isno         = ali_chkisno;
                paywxandaliModel.ali_seller_email = seller_email;
                paywxandaliModel.ali_partner      = partner;
                paywxandaliModel.ali_key          = PayKey;
                paywxandaliModel.ali_RSAkey       = alirsa;

                paywxandaliModel.CompID = this.CompID;
                int num = new Hi.BLL.Pay_PayWxandAli().Add(paywxandaliModel);
                if (num > 0)
                {
                    if (wx_chkisno.Equals("1"))
                    {
                        string strmessage = string.Format("ApppID(应用ID):{0};AppSecrect(应用秘钥):{1};Mchid(商户号):{2};APPKey(API秘钥):{3};是否启用:{4}", appid, appsecret, mchid, key, wx_chkisno);
                        Utils.AddSysBusinessLog(CompID, "paymentbank", paywxandaliModel.ID.ToString(), "微信收款账户新增", strmessage, this.UserID.ToString());
                    }
                    if (ali_chkisno.Equals("1"))
                    {
                        string strmessage = string.Format("支付宝企业账户:{0};合作者身(Partner ID):{1};安全校验码(Key):{2};RSA加密(RSA秘钥):{3};是否启用:{4}", seller_email, partner, PayKey, alirsa, ali_chkisno);
                        Utils.AddSysBusinessLog(CompID, "paymentbank", paywxandaliModel.ID.ToString(), "支付宝收款账户新增", strmessage, this.UserID.ToString());
                    }
                }
            }

            #endregion

            bind = "{\"ds\":\"1\",\"prompt\":\"提交成功!\"}";
        }
        catch (Exception ex)
        {
            bind = "{\"ds\":\"1\",\"prompt\":\"提交失败!\"}";
        }
        finally
        {
            Response.Write(bind);
            Response.End();
        }
    }
示例#6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hi.Model.Pay_PayWxandAli model)
 {
     return(dal.Update(model));
 }
示例#7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Hi.Model.Pay_PayWxandAli model)
 {
     return(dal.Add(model));
 }
示例#8
0
    /// <summary>
    /// 保存系统设置信息
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Settings()
    {
        string bind   = string.Empty;
        string strSql = string.Empty;

        SqlTransaction TranSaction = null;
        SqlConnection  Connection  = new SqlConnection(SqlHelper.LocalSqlServer);

        Connection.Open();
        TranSaction = Connection.BeginTransaction();

        try
        {
            //企业ID
            int CompId = Convert.ToInt32(Request["hid_compID"]);

            string chkisno   = Convert.ToString(Request["chkisno"]);
            string appid     = Convert.ToString(Request["appid"]);
            string appsecret = Convert.ToString(Request["appsecret"]);
            string mchid     = Convert.ToString(Request["mchid"]);
            string key       = Convert.ToString(Request["key"]);

            bool fal = false;

            //查询该企业的设置
            List <Hi.Model.Pay_PayWxandAli> Sysl = new Hi.BLL.Pay_PayWxandAli().GetList("", " CompID=" + CompId, "");

            //判断企业的是否有设置
            if (Sysl.Count > 0)
            {
                Hi.Model.Pay_PayWxandAli paywxandaliModel = Sysl[0];
                paywxandaliModel.wx_Isno      = chkisno;
                paywxandaliModel.wx_appid     = appid;
                paywxandaliModel.wx_appsechet = appsecret;
                paywxandaliModel.wx_mchid     = mchid;
                paywxandaliModel.wx_key       = key;

                fal = new Hi.BLL.Pay_PayWxandAli().Update(paywxandaliModel);
                if (fal)
                {
                    string strmessage = string.Format("ApppID(应用ID):{0};AppSecrect(应用秘钥):{1};Mchid(商户号):{2};APPKey(API秘钥):{3};是否启用:{4}", appid, appsecret, mchid, key, chkisno);
                    Utils.AddSysBusinessLog(CompId, "paymentbank", paywxandaliModel.ID.ToString(), "微信收款帐号修改", strmessage, this.UserID.ToString());
                }
            }
            else
            {
                Hi.Model.Pay_PayWxandAli paywxandaliModel = new Hi.Model.Pay_PayWxandAli();
                paywxandaliModel.wx_Isno      = chkisno;
                paywxandaliModel.wx_appid     = appid;
                paywxandaliModel.wx_appsechet = appsecret;
                paywxandaliModel.wx_mchid     = mchid;
                paywxandaliModel.wx_key       = key;
                paywxandaliModel.CompID       = CompId;
                int num = new Hi.BLL.Pay_PayWxandAli().Add(paywxandaliModel);
                if (num > 0)
                {
                    fal = true;
                    string strmessage = string.Format("ApppID(应用ID):{0};AppSecrect(应用秘钥):{1};Mchid(商户号):{2};APPKey(API秘钥):{3};是否启用:{4}", appid, appsecret, mchid, key, chkisno);
                    Utils.AddSysBusinessLog(CompId, "paymentbank", paywxandaliModel.ID.ToString(), "微信收款帐号新增", strmessage, this.UserID.ToString());
                }
            }


            if (fal)
            {
                TranSaction.Commit();
                bind = "{\"ds\":\"0\",\"prompt\":\"提交成功!\"}";
            }
            else
            {
                TranSaction.Rollback();
                bind = "{\"ds\":\"1\",\"prompt\":\"提交失败!\"}";
            }
        }
        catch (Exception ex)
        {
            TranSaction.Rollback();
            bind = "{\"ds\":\"1\",\"prompt\":\"提交失败!\"}";
        }
        finally
        {
            Connection.Dispose();

            Response.Write(bind);
            Response.End();
        }
    }