Пример #1
0
        //批量删除
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            ChkAdminLevel("order_payment", DTEnums.ActionEnum.Delete.ToString()); //检查权限
            int sucCount   = 0;
            int errorCount = 0;

            BLL.site_payment bll = new BLL.site_payment();
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    if (bll.Delete(id))
                    {
                        sucCount += 1;
                    }
                    else
                    {
                        errorCount += 1;
                    }
                }
            }
            AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除支付方式成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
            JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("site_payment_list.aspx", "site_id={0}&keywords={1}", this.site_id.ToString(), this.keywords));
        }
Пример #2
0
        public NativeConfig(int site_payment_id)
        {
            Model.site_payment model = new BLL.site_payment().GetModel(site_payment_id); //站点支付方式
            if (model != null)
            {
                Model.payment   payModel  = new BLL.payment().GetModel(model.payment_id);        //支付平台
                Model.sites     siteModel = new BLL.sites().GetModel(model.site_id);             //站点配置
                Model.sysconfig sysConfig = new BLL.sysconfig().loadConfig();                    //系统配置

                partner = model.key1;                                                            //商户号(必须配置)
                key     = model.key2;                                                            //商户支付密钥,参考开户邮件设置(必须配置)
                appid   = model.key3;                                                            //绑定支付的APPID(必须配置)
                //回调处理地址
                if (!string.IsNullOrEmpty(siteModel.domain.Trim()) && siteModel.is_default == 0) //如果有自定义域名且不是默认站点
                {
                    notify_url = "http://" + siteModel.domain + payModel.notify_url;
                }
                else if (siteModel.is_default == 0) //不是默认站点也没有绑定域名
                {
                    notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + siteModel.build_path.ToLower() + payModel.notify_url;
                }
                else //否则使用当前域名
                {
                    notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + payModel.notify_url;
                }
            }
        }
Пример #3
0
        public JsApiConfig(int site_payment_id)
        {
            Model.site_payment model = new BLL.site_payment().GetModel(site_payment_id); //站点支付方式
            if (model != null)
            {
                Model.payment   payModel  = new BLL.payment().GetModel(model.payment_id); //支付平台
                Model.sites     siteModel = new BLL.sites().GetModel(model.site_id);      //站点配置
                Model.sysconfig sysConfig = new BLL.sysconfig().loadConfig();             //系统配置

                partner   = model.key1;                                                   //商户号(必须配置)
                key       = model.key2;                                                   //商户支付密钥,参考开户邮件设置(必须配置)
                appid     = model.key3;                                                   //绑定支付的APPID(必须配置)
                appsecret = model.key4;                                                   //公众帐号secert(仅JSAPI支付的时候需要配置)

                //获取用户的OPENID回调地址及登录后的回调地址
                if (!string.IsNullOrEmpty(siteModel.domain.Trim()) && siteModel.is_default == 0) //如果有自定义域名且不是默认站点
                {
                    redirect_url = "http://" + siteModel.domain + payModel.return_url;           //获取用户的OPENID回调地址
                    notify_url   = "http://" + siteModel.domain + payModel.notify_url;           //登录后的回调地址
                }
                else if (siteModel.is_default == 0)                                              //不是默认站点也没有绑定域名
                {
                    redirect_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + siteModel.build_path.ToLower() + payModel.return_url;
                    notify_url   = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + siteModel.build_path.ToLower() + payModel.notify_url;
                }
                else //否则使用当前域名
                {
                    redirect_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + payModel.return_url;
                    notify_url   = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + payModel.notify_url;
                }
            }
        }
Пример #4
0
        private void TreeBind(string strWhere)
        {
            BLL.site_payment bll = new BLL.site_payment();
            DataTable        dt  = bll.GetList(0, strWhere).Tables[0];

            this.ddlPaymentId.Items.Clear();
            this.ddlPaymentId.Items.Add(new ListItem("请选择支付方式", ""));
            foreach (DataRow dr in dt.Rows)
            {
                this.ddlPaymentId.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString()));
            }
        }
Пример #5
0
        /// <summary>
        /// 返回支付列表
        /// </summary>
        /// <param name="top">显示条数</param>
        /// <param name="strwhere">查询条件</param>
        /// <returns>DataTable</returns>
        protected DataTable get_payment_list(int top, string strwhere)
        {
            DataTable dt     = new DataTable();
            string    _where = "is_lock=0";

            if (!string.IsNullOrEmpty(strwhere))
            {
                _where += " and " + strwhere;
            }
            dt = new BLL.site_payment().GetList(top, _where).Tables[0];
            return(dt);
        }
Пример #6
0
        /// <summary>
        /// 返回支付费用金额
        /// </summary>
        /// <param name="payment_id">支付ID</param>
        /// <param name="total_amount">总金额</param>
        /// <returns>decimal</returns>
        protected decimal get_payment_poundage_amount(int payment_id, decimal total_amount)
        {
            Model.payment payModel = new BLL.site_payment().GetPaymentModel(payment_id);
            if (payModel == null)
            {
                return(0);
            }
            decimal poundage_amount = payModel.poundage_amount;

            if (payModel.poundage_type == 1)
            {
                poundage_amount = (poundage_amount * total_amount) / 100;
            }
            return(poundage_amount);
        }
Пример #7
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);
            ddlSiteId.SelectedValue = this.site_id.ToString();
            txtKeywords.Text        = this.keywords;
            BLL.site_payment bll = new BLL.site_payment();
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("site_payment_list.aspx", "site_id={0}&keywords={1}&page={2}", this.site_id.ToString(), this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Пример #8
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("order_payment", DTEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.site_payment bll = new BLL.site_payment();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         int sortId;
         if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId))
         {
             sortId = 99;
         }
         bll.UpdateField(id, "sort_id=" + sortId.ToString());
     }
     AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "保存支付方式排序"); //记录日志
     JscriptMsg("保存排序成功!", Utils.CombUrlTxt("site_payment_list.aspx", "site_id={0}&keywords={1}", this.site_id.ToString(), this.keywords));
 }
Пример #9
0
        public Config(int site_payment_id)
        {
            Model.site_payment model = new BLL.site_payment().GetModel(site_payment_id); //站点支付方式
            if (model != null)
            {
                Model.payment    payModel  = new BLL.payment().GetModel(model.payment_id); //支付平台
                Model.sites      siteModel = new BLL.sites().GetModel(model.site_id);      //站点配置
                Model.siteconfig sysConfig = new BLL.siteconfig().loadConfig();            //系统配置

                //收款支付宝账号
                seller_email = model.key1;
                //合作身份者ID,以2088开头由16位纯数字组成的字符串
                partner = model.key2;
                //如果签名方式设置为“MD5”时,请设置该参数
                key = model.key3;
                //商户的私钥,如果签名方式设置为“0001”时,请设置该参数
                private_key = @"";
                //支付宝的公钥,如果签名方式设置为“0001”时,请设置该参数
                public_key = @"";
                //回调处理地址
                if (!string.IsNullOrEmpty(siteModel.domain.Trim()) && siteModel.is_default == 0) //如果有自定义域名且不是默认站点
                {
                    return_url = "http://" + siteModel.domain + payModel.return_url;
                    notify_url = "http://" + siteModel.domain + payModel.notify_url;
                }
                else if (siteModel.is_default == 0) //不是默认站点也没有绑定域名
                {
                    return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + siteModel.build_path.ToLower() + payModel.return_url;
                    notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + siteModel.build_path.ToLower() + payModel.notify_url;
                }
                else //否则使用当前域名
                {
                    return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + payModel.return_url;
                    notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + payModel.notify_url;
                }
                //字符编码格式 目前支持 utf-8
                input_charset = "utf-8";
                //签名方式,选择项:0001(RSA)、MD5
                sign_type = "MD5";//无线的产品中,签名方式为rsa时,sign_type需赋值为0001而不是RSA
            }
        }
Пример #10
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.site_payment bll = new BLL.site_payment();

            model.site_id    = Utils.StrToInt(ddlSiteId.SelectedValue, 0);
            model.payment_id = Utils.StrToInt(ddlPaymentId.SelectedValue, 0);
            model.sort_id    = Utils.StrToInt(txtSortId.Text.Trim(), 99);
            model.title      = txtTitle.Text.Trim();
            model.key1       = txtKey1.Text.Trim();
            model.key2       = txtKey2.Text.Trim();
            model.key3       = txtKey3.Text.Trim();
            model.key4       = txtKey4.Text.Trim();
            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改站点支付方式:" + model.title); //记录日志
                result = true;
            }

            return(result);
        }
Пример #11
0
        private bool DoAdd()
        {
            bool result = false;

            this.model = new Model.site_payment();
            BLL.site_payment bll = new BLL.site_payment();

            model.site_id    = ConvertTool.ToInt(ddlSiteId.SelectedValue, 0);
            model.payment_id = ConvertTool.ToInt(ddlPaymentId.SelectedValue, 0);
            model.sort_id    = ConvertTool.ToInt(txtSortId.Text.Trim(), 99);
            model.title      = txtTitle.Text.Trim();
            model.key1       = txtKey1.Text.Trim();
            model.key2       = txtKey2.Text.Trim();
            model.key3       = txtKey3.Text.Trim();
            model.key4       = txtKey4.Text.Trim();
            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加站点支付方式:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }
Пример #12
0
 /// <summary>
 /// 返回订单是否需要在线支付
 /// </summary>
 /// <param name="order_id">订单ID</param>
 /// <returns>bool</returns>
 protected bool get_order_payment_status(int order_id)
 {
     Model.orders model = new BLL.orders().GetModel(order_id);
     if (model == null)
     {
         return(false);
     }
     if (model.status != 1)
     {
         return(false);
     }
     Model.payment payModel = new BLL.site_payment().GetPaymentModel(model.payment_id);
     if (payModel == null)
     {
         return(false);
     }
     if (payModel.type == 1 && model.payment_status == 1)
     {
         return(true);
     }
     return(false);
 }
Пример #13
0
        public Config(int site_payment_id)
        {
            Model.site_payment model = new BLL.site_payment().GetModel(site_payment_id); //站点支付方式
            if (model != null)
            {
                Model.payment   payModel  = new BLL.payment().GetModel(model.payment_id); //支付平台
                Model.sites     siteModel = new BLL.sites().GetModel(model.site_id);      //站点配置
                Model.sysconfig sysConfig = new BLL.sysconfig().loadConfig();             //系统配置

                //签约支付宝账号或卖家支付宝帐户
                email = model.key1;
                //合作身份者ID,以2088开头由16位纯数字组成的字符串
                partner = model.key2;
                //交易安全检验码,由数字和字母组成的32位字符串
                key = model.key3;
                //回调处理地址
                if (!string.IsNullOrEmpty(siteModel.domain.Trim()) && siteModel.is_default == 0) //如果有自定义域名且不是默认站点
                {
                    return_url = "http://" + siteModel.domain + payModel.return_url;
                    notify_url = "http://" + siteModel.domain + payModel.notify_url;
                }
                else if (siteModel.is_default == 0) //不是默认站点也没有绑定域名
                {
                    return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + siteModel.build_path.ToLower() + payModel.return_url;
                    notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + siteModel.build_path.ToLower() + payModel.notify_url;
                }
                else //否则使用当前域名
                {
                    return_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + payModel.return_url;
                    notify_url = "http://" + HttpContext.Current.Request.Url.Authority.ToLower() + sysConfig.webpath + payModel.notify_url;
                }
                //字符编码格式 目前支持 gbk 或 utf-8
                input_charset = "utf-8";
                //签名方式 不需修改
                sign_type = "MD5";
            }
        }