예제 #1
0
 //确认订单
 protected void lbtnConfirm_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("orders", DTEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.orders   bll   = new BLL.orders();
     Model.orders model = bll.GetModel(this.id);
     //检查订单状态
     if (model == null || model.status > 1)
     {
         JscriptMsg("订单不符合要求,无法确认!", "", "Error");
         return;
     }
     //检查支付方式
     Model.payment payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         JscriptMsg("支付方式不存在,无法确认!", "", "Error");
         return;
     }
     //如果支付方式为线上支付,则检查付款状态
     if (payModel.type == 1)
     {
         if (model.payment_status != 2)
         {
             JscriptMsg("订单未付款,无法确认!", "", "Error");
             return;
         }
     }
     bll.UpdateField(this.id, "status=2,confirm_time='" + DateTime.Now + "'");
     JscriptMsg("订单确认成功!", "order_edit.aspx?id=" + this.id, "Success");
 }
예제 #2
0
 //完成订单
 protected void lbtnComplete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("orders", DTEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.orders   bll   = new BLL.orders();
     Model.orders model = bll.GetModel(this.id);
     //检查订单状态
     if (model == null || model.status != 2 || model.distribution_status != 2)
     {
         JscriptMsg("订单不符合要求,无法发货!", "", "Error");
         return;
     }
     //检查支付方式
     Model.payment payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         JscriptMsg("支付方式不存在,无法完成订单!", "", "Error");
         return;
     }
     //增加积分/经验值
     if (model.point > 0)
     {
         new BLL.point_log().Add(model.user_id, model.user_name, model.point, "购物获得积分,订单号:" + model.order_no);
     }
     //如果配送方式为先款后货,则检查付款状态
     if (payModel.type == 2)
     {
         bll.UpdateField(this.id, "status=3,complete_time='" + DateTime.Now + "'," + "payment_status=2,payment_time='" + DateTime.Now + "'");
     }
     else
     {
         bll.UpdateField(this.id, "status=3,complete_time='" + DateTime.Now + "'");
     }
     JscriptMsg("订单已经完成啦!", "order_edit.aspx?id=" + this.id, "Success");
 }
예제 #3
0
        private bool DoAdd()
        {
            bool result = false;

            Model.payment model = new Model.payment();
            BLL.payment   bll   = new BLL.payment();

            model.title           = txtTitle.Text.Trim();
            model.img_url         = txtImgUrl.Text.Trim();
            model.remark          = txtRemark.Text;
            model.type            = int.Parse(rblType.SelectedValue);
            model.poundage_type   = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            model.api_path        = txtApiPath.Text.Trim();
            model.redirect_url    = txtRedirectUrl.Text.Trim();
            model.return_url      = txtReturnUrl.Text.Trim();
            model.notify_url      = txtNotifyUrl.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.sort_id = ConvertTool.ToInt(txtSortId.Text.Trim(), 99);

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加支付平台:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }
예제 #4
0
 protected void lbtnComplete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("orders", DTEnums.ActionEnum.Edit.ToString()); //檢查許可權
     BLL.orders   bll   = new BLL.orders();
     Model.orders model = bll.GetModel(this.id);
     //檢查訂單狀態
     if (model == null || model.status != 2 || model.distribution_status != 2)
     {
         JscriptMsg("訂單不符合要求,無法發貨!", "", "Error");
         return;
     }
     //檢查付款方式
     Model.payment payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         JscriptMsg("付款方式不存在,無法完成訂單!", "", "Error");
         return;
     }
     //增加積分/經驗值
     if (model.point > 0)
     {
         new BLL.point_log().Add(model.user_id, model.user_name, model.point, "購物獲得積分,訂單號:" + model.order_no);
     }
     //如果配送方式為先款後貨,則檢查付款狀態
     if (payModel.type == 2)
     {
         bll.UpdateField(this.id, "status=3,complete_time='" + DateTime.Now + "'," + "payment_status=2,payment_time='" + DateTime.Now + "'");
     }
     else
     {
         bll.UpdateField(this.id, "status=3,complete_time='" + DateTime.Now + "'");
     }
     JscriptMsg("訂單已經完成!", "order_edit.aspx?id=" + this.id, "Success");
 }
예제 #5
0
 private void ShowInfo(int _id)
 {
     BLL.payment bll = new BLL.payment();
     model = bll.GetModel(_id);
     txtTitle.Text = model.title;
     rblType.SelectedValue = model.type.ToString();
     rblIsLock.SelectedValue = model.is_lock.ToString();
     txtSortId.Text = model.sort_id.ToString();
     rblPoundageType.SelectedValue = model.poundage_type.ToString();
     txtPoundageAmount.Text = model.poundage_amount.ToString();
     //txtApiPath.Text = model.api_path;
     txtImgUrl.Text = model.img_url;
     txtRemark.Text = model.remark;
     if (model.api_path.ToLower() == "alipay")
     {
         //支付宝
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath("~/xmlconfig/alipay.config"));
         txtAlipayPartner.Text = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtAlipayKey.Text = doc.SelectSingleNode(@"Root/key").InnerText;
         txtAlipaySellerEmail.Text = doc.SelectSingleNode(@"Root/seller_email").InnerText;
     }
     else if (model.api_path.ToLower() == "tenpay")
     {
         //财付通
         XmlDocument doc1 = XmlHelper.LoadXmlDoc(Utils.GetMapPath("~/xmlconfig/tenpay.config"));
         txtTenpayBargainorId.Text = doc1.SelectSingleNode(@"Root/bargainor_id").InnerText;
         txtTenpayKey.Text = doc1.SelectSingleNode(@"Root/tenpay_key").InnerText;
     }
 }
예제 #6
0
 private void RptBind(string _strWhere, string _orderby)
 {
     txtKeywords.Text = this.keywords;
     BLL.payment bll = new BLL.payment();
     this.rptList.DataSource = bll.GetList(0, _strWhere, _orderby);
     this.rptList.DataBind();
 }
예제 #7
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;
                }
            }
        }
예제 #8
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.payment   bll   = new BLL.payment();
            Model.payment model = bll.GetModel(_id);

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.sort_id         = int.Parse(txtSortId.Text.Trim());
            model.poundage_type   = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            model.img_url         = txtImgUrl.Text.Trim();
            model.remark          = txtRemark.Text;
            int payid = MyCommFun.Str2Int(hidPayId.Value);


            if (bll.Update(model))
            {
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改支付方式:" + model.title); //记录日志
                result = true;
            }

            return(result);
        }
예제 #9
0
 private void RptBind(string _strWhere, string _orderby)
 {
     txtKeywords.Text = this.keywords;
     BLL.payment bll = new BLL.payment();
     this.rptList.DataSource = bll.GetList(0, _strWhere, _orderby);
     this.rptList.DataBind();
 }
예제 #10
0
 //完成订单
 protected void lbtnComplete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("orders", DTEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.orders bll = new BLL.orders();
     Model.orders model = bll.GetModel(this.id);
     //检查订单状态
     if (model == null || model.status != 2 || model.distribution_status != 2)
     {
         JscriptMsg("订单不符合要求,无法发货!", "", "Error");
         return;
     }
     //检查支付方式
     Model.payment payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         JscriptMsg("支付方式不存在,无法完成订单!", "", "Error");
         return;
     }
     //增加积分/经验值
     if (model.point > 0)
     {
         new BLL.point_log().Add(model.user_id, model.user_name, model.point, "购物获得积分,订单号:" + model.order_no);
     }
     //如果配送方式为先款后货,则检查付款状态
     if (payModel.type == 2)
     {
         bll.UpdateField(this.id, "status=3,complete_time='" + DateTime.Now + "'," + "payment_status=2,payment_time='" + DateTime.Now + "'");
     }
     else
     {
         bll.UpdateField(this.id, "status=3,complete_time='" + DateTime.Now + "'");
     }
     JscriptMsg("订单已经完成啦!", "order_edit.aspx?id=" + this.id, "Success");
 }
예제 #11
0
 protected void lbtnConfirm_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("orders", DTEnums.ActionEnum.Edit.ToString()); //檢查許可權
     BLL.orders   bll   = new BLL.orders();
     Model.orders model = bll.GetModel(this.id);
     //檢查訂單狀態
     if (model == null || model.status > 1)
     {
         JscriptMsg("訂單不符合要求,無法確認!", "", "Error");
         return;
     }
     //檢查付款方式
     Model.payment payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         JscriptMsg("付款方式不存在,無法確認!", "", "Error");
         return;
     }
     //如果付款方式為線上付款,則檢查付款狀態
     if (payModel.type == 1)
     {
         if (model.payment_status != 2)
         {
             JscriptMsg("訂單未付款,無法確認!", "", "Error");
             return;
         }
     }
     bll.UpdateField(this.id, "status=2,confirm_time='" + DateTime.Now + "'");
     JscriptMsg("訂單確認成功!", "order_edit.aspx?id=" + this.id, "Success");
 }
예제 #12
0
 private void ShowInfo(int _id)
 {
     BLL.payment bll = new BLL.payment();
     model                         = bll.GetModel(_id);
     txtTitle.Text                 = model.title;
     rblType.SelectedValue         = model.type.ToString();
     rblIsLock.SelectedValue       = model.is_lock.ToString();
     txtSortId.Text                = model.sort_id.ToString();
     rblPoundageType.SelectedValue = model.poundage_type.ToString();
     txtPoundageAmount.Text        = model.poundage_amount.ToString();
     //txtApiPath.Text = model.api_path;
     txtImgUrl.Text = model.img_url;
     txtRemark.Text = model.remark;
     if (model.api_path.ToLower() == "alipay")
     {
         //支付宝
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath("~/xmlconfig/alipay.config"));
         txtAlipayPartner.Text     = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtAlipayKey.Text         = doc.SelectSingleNode(@"Root/key").InnerText;
         txtAlipaySellerEmail.Text = doc.SelectSingleNode(@"Root/seller_email").InnerText;
     }
     else if (model.api_path.ToLower() == "tenpay")
     {
         //财付通
         XmlDocument doc1 = XmlHelper.LoadXmlDoc(Utils.GetMapPath("~/xmlconfig/tenpay.config"));
         txtTenpayBargainorId.Text = doc1.SelectSingleNode(@"Root/bargainor_id").InnerText;
         txtTenpayKey.Text         = doc1.SelectSingleNode(@"Root/tenpay_key").InnerText;
     }
 }
예제 #13
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;
                }
            }
        }
예제 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BLL.payment bll = new BLL.payment();
            DataTable   dt  = new DataTable();

            this.rptList.DataSource = dt;
            this.rptList.DataBind();
        }
예제 #15
0
 private void RptBind(string _strWhere, string _orderby)
 {
     Model.wx_userweixin weixin = GetWeiXinCode();
     _strWhere = " wid="+weixin.id+" " + _strWhere;
     txtKeywords.Text = this.keywords;
     BLL.payment bll = new BLL.payment();
     this.rptList.DataSource = bll.GetList(0, _strWhere, _orderby);
     this.rptList.DataBind();
 }
예제 #16
0
 private void RptBind(string _strWhere, string _orderby)
 {
     Model.wx_userweixin weixin = GetWeiXinCode();
     _strWhere        = " wid=" + weixin.id + " " + _strWhere;
     txtKeywords.Text = this.keywords;
     BLL.payment bll = new BLL.payment();
     this.rptList.DataSource = bll.GetList(0, _strWhere, _orderby);
     this.rptList.DataBind();
 }
예제 #17
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.payment   bll   = new BLL.payment();
            Model.payment model = bll.GetModel(_id);

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.sort_id         = int.Parse(txtSortId.Text.Trim());
            model.poundage_type   = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            model.img_url         = txtImgUrl.Text.Trim();
            model.remark          = txtRemark.Text;
            int payid = MyCommFun.Str2Int(hidPayId.Value);

            if (model.pTypeId == 2)
            {
                //支付宝

                Model.wx_payment_alipay alipay = aliBll.GetModel(payid);
                alipay.ownerName   = txtAlipaySellerEmail.Text.Trim();
                alipay.partner     = txtAlipayPartner.Text.Trim();
                alipay.e_key       = txtAlipayKey.Text.Trim();
                alipay.private_key = txtprivate_key.Text.Trim();
                alipay.public_key  = txtpublic_key.Text.Trim();
                aliBll.Update(alipay);
            }
            else if (model.pTypeId == 3)
            {
                //微支付
                Model.wx_payment_wxpay wxpay = wxBll.GetModel(payid);
                wxpay.paySignKey = txtpaySignKey.Text.Trim();
                wxpay.partnerId  = txtTenpayPartnerId.Text.Trim();
                wxpay.partnerKey = txtTenpayKey.Text.Trim();
                wxpay.quicklyFH  = rblQuicklyFH.SelectedItem.Value == "1" ? true : false;
                wxpay.appId      = lblAppId.Text.Trim();
                wxBll.Update(wxpay);
            }


            if (bll.Update(model))
            {
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改支付方式:" + model.title); //记录日志
                result = true;
            }

            return(result);
        }
예제 #18
0
        /// <summary>
        /// 确认订单页面
        /// </summary>
        public void confirmOrder()
        {
            //1用户的地址
            BLL.wx_shop_user_addr           uAddrBll  = new BLL.wx_shop_user_addr();
            IList <Model.wx_shop_user_addr> uaddrList = uAddrBll.GetOpenidAddrName(openid, wid);

            if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0)
            {
            }
            else
            {
                this.Document.SetValue("addrinfo", uaddrList[0]);
            }

            //快递信息列表
            BLL.express expressBll = new BLL.express();
            DataSet     dsExpress  = expressBll.GetExpressList100(wid);

            this.Document.SetValue("express", dsExpress);

            //支付信息列表
            BLL.payment pbll  = new BLL.payment();
            DataSet     dsPay = pbll.GetList(0, "  is_lock=0 and wid=" + wid, "  sort_id asc");

            this.Document.SetValue("payment", dsPay);

            //购物车里的商品
            BLL.wx_shop_cart          cartBll  = new BLL.wx_shop_cart();
            IList <Model.cartProduct> cartList = cartBll.GetCartList(openid, wid);

            this.Document.SetValue("cartlist", cartList);

            string cartStr = "[";

            if (cartList.Count > 0)
            {
                for (int i = cartList.Count - 1; i >= 0; i--)
                {
                    if (i != 0)
                    {
                        cartStr += "{ \"ic\": \"" + cartList[i].id + "\", \"attr\": \"\", \"bc\": \"" + cartList[i].productNum + "\", \"mid\": " + cartList[i].skuId + " },";
                    }
                    else
                    {
                        cartStr += "{ \"ic\": \"" + cartList[i].id + "\", \"attr\": \"\", \"bc\": \"" + cartList[i].productNum + "\", \"mid\": " + cartList[i].skuId + " }";
                    }
                }
            }
            cartStr += "]";
            decimal alltotPrice = cartList.Sum(item => item.totPrice);

            this.Document.SetValue("alltot", alltotPrice * 100);
            this.Document.SetValue("alltot_y", alltotPrice);
            this.Document.SetValue("cartStr", cartStr);
        }
예제 #19
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.payment   bll   = new BLL.payment();
            Model.payment model = bll.GetModel(_id);

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.is_mobile       = int.Parse(rblIsMobile.SelectedValue);
            model.sort_id         = int.Parse(txtSortId.Text.Trim());
            model.poundage_type   = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            model.img_url         = txtImgUrl.Text.Trim();
            model.remark          = txtRemark.Text;
            if (model.api_path.ToLower() == "alipaypc")
            {
                //支付宝
                string alipayFilePath = Utils.GetMapPath(siteConfig.webpath + "xmlconfig/alipaypc.config");
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/partner", txtAlipayPartner.Text);
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/key", txtAlipayKey.Text);
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/email", txtAlipaySellerEmail.Text);
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/type", rblAlipayType.SelectedValue);
            }
            else if (model.api_path.ToLower() == "tenpaypc")
            {
                //财付通
                string tenpayFilePath = Utils.GetMapPath(siteConfig.webpath + "xmlconfig/tenpaypc.config");
                XmlHelper.UpdateNodeInnerText(tenpayFilePath, @"Root/partner", txtTenpayBargainorId.Text);
                XmlHelper.UpdateNodeInnerText(tenpayFilePath, @"Root/key", txtTenpayKey.Text);
                XmlHelper.UpdateNodeInnerText(tenpayFilePath, @"Root/type", rblTenpayType.SelectedValue);
            }
            else if (model.api_path.ToLower().StartsWith("chinabankpc"))
            {
                //网银在线
                string chinaBankFilePath = Utils.GetMapPath(siteConfig.webpath + "xmlconfig/chinabankpc.config");
                XmlHelper.UpdateNodeInnerText(chinaBankFilePath, @"Root/partner", txtChinaBankPartner.Text);
                XmlHelper.UpdateNodeInnerText(chinaBankFilePath, @"Root/key", txtChinaBankKey.Text);
            }

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改支付方式:" + model.title); //记录日志
                result = true;
            }

            return(result);
        }
예제 #20
0
        protected string GetOrderStatus(string _id)
        {
            string _title = "";

            if (!string.IsNullOrEmpty(_id))
            {
                int          ordrerID = Utils.StringToNum(_id);
                Model.orders model    = new BLL.orders().GetModel(ordrerID);
                if (model != null)
                {
                    switch (model.status)
                    {
                    case 1:
                        _title = "等待確認";
                        Model.payment payModel = new BLL.payment().GetModel(model.payment_id);
                        if (payModel != null)
                        {
                            if (model.payment_status > 1)
                            {
                                _title = "付款成功";
                            }
                            else
                            {
                                _title = "等待付款";
                            }
                        }
                        break;

                    case 2:
                        if (model.distribution_status > 1)
                        {
                            _title = "已發貨";
                        }
                        else
                        {
                            _title = "待發貨";
                        }
                        break;

                    case 3:
                        _title = "交易完成";
                        break;

                    case 4:
                        _title = "訂單取消";
                        break;

                    case 5:
                        _title = "訂單作廢";
                        break;
                    }
                }
            }
            return(_title);
        }
예제 #21
0
        private bool DoEdit(int _id)
        {
            bool result = false;
            BLL.payment bll = new BLL.payment();
            Model.payment model = bll.GetModel(_id);

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.poundage_type = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            model.img_url = txtImgUrl.Text.Trim();
            model.remark = txtRemark.Text;
            int payid = MyCommFun.Str2Int(hidPayId.Value);
            if (model.pTypeId==2)
            {
                //支付宝

                Model.wx_payment_alipay alipay = aliBll.GetModel(payid);
                alipay.ownerName = txtAlipaySellerEmail.Text.Trim();
                alipay.partner = txtAlipayPartner.Text.Trim();
                alipay.e_key = txtAlipayKey.Text.Trim();
                alipay.private_key = txtprivate_key.Text.Trim();
                alipay.public_key = txtpublic_key.Text.Trim();
                aliBll.Update(alipay);

            }
            else if (model.pTypeId==3)
            {
                //微支付
                Model.wx_payment_wxpay wxpay = wxBll.GetModel(payid);
                wxpay.paySignKey = txtpaySignKey.Text.Trim();
                wxpay.partnerId = txtTenpayPartnerId.Text.Trim();
                wxpay.partnerKey = txtTenpayKey.Text.Trim();
                wxpay.quicklyFH = rblQuicklyFH.SelectedItem.Value == "1" ? true : false;
                wxpay.appId = txtAppId.Text.Trim();
                wxBll.Update(wxpay);

            }

            if (bll.Update(model))
            {
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改支付方式:" + model.title); //记录日志
                result = true;
            }

            return result;
        }
예제 #22
0
        private bool DoEdit(int _id)
        {
            bool result = false;
            BLL.payment bll = new BLL.payment();
            Model.payment model = bll.GetModel(_id);

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.is_mobile = int.Parse(rblIsMobile.SelectedValue);
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.poundage_type = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            model.img_url = txtImgUrl.Text.Trim();
            model.remark = txtRemark.Text;
            if (model.api_path.ToLower() == "alipaypc")
            {
                //支付宝
                string alipayFilePath = Utils.GetMapPath(siteConfig.webpath + "xmlconfig/alipaypc.config");
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/partner", txtAlipayPartner.Text);
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/key", txtAlipayKey.Text);
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/email", txtAlipaySellerEmail.Text);
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/type", rblAlipayType.SelectedValue);
            }
            else if (model.api_path.ToLower() == "tenpaypc")
            {
                //财付通
                string tenpayFilePath = Utils.GetMapPath(siteConfig.webpath + "xmlconfig/tenpaypc.config");
                XmlHelper.UpdateNodeInnerText(tenpayFilePath, @"Root/partner", txtTenpayBargainorId.Text);
                XmlHelper.UpdateNodeInnerText(tenpayFilePath, @"Root/key", txtTenpayKey.Text);
                XmlHelper.UpdateNodeInnerText(tenpayFilePath, @"Root/type", rblTenpayType.SelectedValue);
            }
            else if (model.api_path.ToLower().StartsWith("chinabankpc"))
            {
                //网银在线
                string chinaBankFilePath = Utils.GetMapPath(siteConfig.webpath + "xmlconfig/chinabankpc.config");
                XmlHelper.UpdateNodeInnerText(chinaBankFilePath, @"Root/partner", txtChinaBankPartner.Text);
                XmlHelper.UpdateNodeInnerText(chinaBankFilePath, @"Root/key", txtChinaBankKey.Text);
            }

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改支付方式:" + model.title); //记录日志
                result = true;
            }

            return result;
        }
예제 #23
0
파일: payment.cs 프로젝트: LutherW/MTMS
 /// <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.payment().GetList(top, _where, "sort_id asc,id desc").Tables[0];
     return dt;
 }
예제 #24
0
        private void TreeBind(string strWhere)
        {
            BLL.payment bll = new BLL.payment();
            DataTable dt = bll.GetList(0, strWhere, "sort_id asc,id asc").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()));
            }
        }
예제 #25
0
        /// <summary>
        /// 返回支付列表
        /// </summary>
        /// <param name="top">显示条数</param>
        /// <param name="strwhere">查询条件</param>
        /// <returns>DataTable</returns>
        public List <Model.payment> get_payment_list(int top, string strwhere)
        {
            List <Model.payment> list = new List <Model.payment>();
            string _where             = "is_lock=0";

            if (!string.IsNullOrEmpty(strwhere))
            {
                _where += " and " + strwhere;
            }
            list = new BLL.payment().GetModelList(top, _where, "*", "sort_id asc,id desc");
            return(list);
        }
예제 #26
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.payment().GetList(top, _where, "sort_id asc,id desc").Tables[0];
            return(dt);
        }
예제 #27
0
        private void TreeBind(string strWhere)
        {
            BLL.payment bll = new BLL.payment();
            DataTable   dt  = bll.GetList(0, strWhere, "sort_id asc,id asc").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()));
            }
        }
예제 #28
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page        = DTRequest.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.payment bll = new BLL.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("payment_list.aspx", "keywords={0}&page={1}", this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
예제 #29
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.payment().GetModel(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;
 }
예제 #30
0
파일: orders.cs 프로젝트: eazytec/TestGit
        /// <summary>
        /// 返回订单状态
        /// </summary>
        /// <param name="_id">订单ID</param>
        /// <returns>String</returns>
        protected string get_order_status(int _id)
        {
            string _title = "";

            Model.orders model = new BLL.orders().GetModel(_id);
            switch (model.status)
            {
            case 1:
                _title = "等待确认";
                Model.payment payModel = new BLL.payment().GetModel(model.payment_id);
                if (payModel != null && payModel.type == 1)
                {
                    if (model.payment_status > 1)
                    {
                        _title = "付款成功";
                    }
                    else
                    {
                        _title = "等待付款";
                    }
                }
                break;

            case 2:
                if (model.distribution_status > 1)
                {
                    _title = "已发货";
                }
                else
                {
                    _title = "待发货";
                }
                break;

            case 3:
                _title = "交易完成";
                break;

            case 4:
                _title = "订单取消";
                break;

            case 5:
                _title = "订单作废";
                break;
            }

            return(_title);
        }
예제 #31
0
        protected string GetOrderStatus(int _id)
        {
            string _title = "";

            Model.orders model = new BLL.orders().GetModel(_id);
            switch (model.status)
            {
            case 1:
                _title = "等待確認";
                Model.payment payModel = new BLL.payment().GetModel(model.payment_id);
                if (payModel != null && payModel.type == 2)
                {
                    if (model.payment_status > 1)
                    {
                        _title = "付款成功";
                    }
                    else
                    {
                        _title = "等待付款";
                    }
                }
                break;

            case 2:
                if (model.distribution_status > 1)
                {
                    _title = "已發貨";
                }
                else
                {
                    _title = "待發貨";
                }
                break;

            case 3:
                _title = "交易完成";
                break;

            case 4:
                _title = "訂單取消";
                break;

            case 5:
                _title = "訂單作廢";
                break;
            }

            return(_title);
        }
예제 #32
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.payment().GetModel(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);
        }
예제 #33
0
        private void ShowInfo(int _id)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();
            BLL.payment         bll    = new BLL.payment();
            model         = bll.GetModel(_id);
            txtTitle.Text = model.title;

            if (model.is_lock == 0)
            {
                cbIsLock.Checked = true;
            }
            else
            {
                cbIsLock.Checked = false;
            }
            txtSortId.Text = model.sort_id.ToString();
            rblPoundageType.SelectedValue = model.poundage_type.ToString();
            txtPoundageAmount.Text        = model.poundage_amount.ToString();
            txtImgUrl.Text = model.img_url;
            txtRemark.Text = model.remark;
            if (model.pTypeId == 2)
            {
                //支付宝
                Model.wx_payment_alipay alipay = aliBll.GetModelList("wid=" + weixin.id)[0];
                txtAlipaySellerEmail.Text = alipay.ownerName;
                txtAlipayPartner.Text     = alipay.partner;
                txtAlipayKey.Text         = alipay.e_key;
                txtprivate_key.Text       = alipay.private_key;
                txtpublic_key.Text        = alipay.public_key;
                hidPayId.Value            = alipay.id.ToString();
            }
            else if (model.pTypeId == 3)
            {
                //微信支付
                Model.wx_payment_wxpay wxpay = wxBll.GetModelByWid(weixin.id);
                txtpaySignKey.Text         = wxpay.paySignKey;
                txtTenpayPartnerId.Text    = wxpay.partnerId;
                txtTenpayKey.Text          = wxpay.partnerKey;
                hidPayId.Value             = wxpay.id.ToString();
                rblQuicklyFH.SelectedValue = wxpay.quicklyFH.ToString().ToLower() == "true" ? "1" : "0";
                BLL.wx_userweixin   uwBll    = new BLL.wx_userweixin();
                Model.wx_userweixin uwEneity = uwBll.GetModel(weixin.id);

                lblAppId.Text = uwEneity.AppId;
            }
        }
예제 #34
0
 private void ShowInfo(int _id)
 {
     BLL.payment bll = new BLL.payment();
     model                 = bll.GetModel(_id);
     txtTitle.Text         = model.title;
     rblType.SelectedValue = model.type.ToString();
     rblType.Enabled       = false;
     if (model.is_lock == 0)
     {
         cbIsLock.Checked = true;
     }
     else
     {
         cbIsLock.Checked = false;
     }
     rblIsMobile.SelectedValue     = model.is_mobile.ToString();
     txtSortId.Text                = model.sort_id.ToString();
     rblPoundageType.SelectedValue = model.poundage_type.ToString();
     txtPoundageAmount.Text        = model.poundage_amount.ToString();
     txtImgUrl.Text                = model.img_url;
     txtRemark.Text                = model.remark;
     if (model.api_path.ToLower() == "alipaypc")
     {
         //支付宝
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath(siteConfig.webpath + "xmlconfig/alipaypc.config"));
         txtAlipayPartner.Text       = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtAlipayKey.Text           = doc.SelectSingleNode(@"Root/key").InnerText;
         txtAlipaySellerEmail.Text   = doc.SelectSingleNode(@"Root/email").InnerText;
         rblAlipayType.SelectedValue = doc.SelectSingleNode(@"Root/type").InnerText;
     }
     else if (model.api_path.ToLower() == "tenpaypc")
     {
         //财付通
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath(siteConfig.webpath + "xmlconfig/tenpaypc.config"));
         txtTenpayBargainorId.Text   = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtTenpayKey.Text           = doc.SelectSingleNode(@"Root/key").InnerText;
         rblTenpayType.SelectedValue = doc.SelectSingleNode(@"Root/type").InnerText;
     }
     else if (model.api_path.ToLower() == "chinabankpc")
     {
         //网银在线
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath(siteConfig.webpath + "xmlconfig/chinabankpc.config"));
         txtChinaBankPartner.Text = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtChinaBankKey.Text     = doc.SelectSingleNode(@"Root/key").InnerText;
     }
 }
예제 #35
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("order_payment", DTEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.payment bll = new BLL.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("payment_list.aspx", "keywords={0}", this.keywords));
 }
예제 #36
0
 private void ShowInfo(int _id)
 {
     BLL.payment bll = new BLL.payment();
     model = bll.GetModel(_id);
     txtTitle.Text = model.title;
     rblType.SelectedValue = model.type.ToString();
     rblType.Enabled = false;
     if (model.is_lock == 0)
     {
         cbIsLock.Checked = true;
     }
     else
     {
         cbIsLock.Checked = false;
     }
     rblIsMobile.SelectedValue = model.is_mobile.ToString();
     txtSortId.Text = model.sort_id.ToString();
     rblPoundageType.SelectedValue = model.poundage_type.ToString();
     txtPoundageAmount.Text = model.poundage_amount.ToString();
     txtImgUrl.Text = model.img_url;
     txtRemark.Text = model.remark;
     if (model.api_path.ToLower() == "alipaypc")
     {
         //支付宝
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath(siteConfig.webpath + "xmlconfig/alipaypc.config"));
         txtAlipayPartner.Text = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtAlipayKey.Text = doc.SelectSingleNode(@"Root/key").InnerText;
         txtAlipaySellerEmail.Text = doc.SelectSingleNode(@"Root/email").InnerText;
         rblAlipayType.SelectedValue = doc.SelectSingleNode(@"Root/type").InnerText;
     }
     else if (model.api_path.ToLower() == "tenpaypc")
     {
         //财付通
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath(siteConfig.webpath + "xmlconfig/tenpaypc.config"));
         txtTenpayBargainorId.Text = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtTenpayKey.Text = doc.SelectSingleNode(@"Root/key").InnerText;
         rblTenpayType.SelectedValue = doc.SelectSingleNode(@"Root/type").InnerText;
     }
     else if (model.api_path.ToLower() == "chinabankpc")
     {
         //网银在线
         XmlDocument doc = XmlHelper.LoadXmlDoc(Utils.GetMapPath(siteConfig.webpath + "xmlconfig/chinabankpc.config"));
         txtChinaBankPartner.Text = doc.SelectSingleNode(@"Root/partner").InnerText;
         txtChinaBankKey.Text = doc.SelectSingleNode(@"Root/key").InnerText;
     }
 }
예제 #37
0
 //保存排序
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("order_payment", DTEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.payment bll = new BLL.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("payment_list.aspx", "keywords={0}", this.keywords));
 }
예제 #38
0
        private void ShowInfo(int _id)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();
            BLL.payment bll = new BLL.payment();
            model = bll.GetModel(_id);
            txtTitle.Text = model.title;
          
            if (model.is_lock == 0)
            {
                cbIsLock.Checked = true;
            }
            else
            {
                cbIsLock.Checked = false;
            }
            txtSortId.Text = model.sort_id.ToString();
            rblPoundageType.SelectedValue = model.poundage_type.ToString();
            txtPoundageAmount.Text = model.poundage_amount.ToString();
            txtImgUrl.Text = model.img_url;
            txtRemark.Text = model.remark;
            if (model.pTypeId==2)
            {
                //支付宝
                Model.wx_payment_alipay alipay = aliBll.GetModelList("wid=" + weixin.id)[0];
                txtAlipaySellerEmail.Text = alipay.ownerName;
                txtAlipayPartner.Text = alipay.partner;
                txtAlipayKey.Text = alipay.e_key;
                txtprivate_key.Text = alipay.private_key;
                txtpublic_key.Text = alipay.public_key;
                hidPayId.Value = alipay.id.ToString();

            }
            else if (model.pTypeId==3)
            {
                //微信支付
                Model.wx_payment_wxpay wxpay = wxBll.GetModelByWid(weixin.id);
                txtpaySignKey.Text = wxpay.paySignKey;
                txtTenpayPartnerId.Text = wxpay.partnerId;
                txtTenpayKey.Text = wxpay.partnerKey;
                hidPayId.Value = wxpay.id.ToString();
                rblQuicklyFH.SelectedValue = wxpay.quicklyFH.ToString().ToLower()=="true" ? "1" : "0";
                txtAppId.Text=wxpay.appId ;

            }
            
        }
예제 #39
0
 private void PaymentBind(int _site_id, int _payment_id)
 {
     if (_site_id > 0)
     {
         DataTable dt = new BLL.payment().GetList(_site_id, _payment_id).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()));
         }
     }
     else
     {
         this.ddlPaymentId.Items.Clear();
         this.ddlPaymentId.Items.Add(new ListItem("请选择站点...", ""));
     }
 }
예제 #40
0
        /// <summary>
        /// 返回支付费用金额
        /// </summary>
        /// <param name="payment_id">支付ID</param>
        /// <returns>decimal</returns>
        protected decimal get_payment_poundage_amount(int payment_id)
        {
            //TODO 会员组特殊优惠?
            //int group_id = 0;
            //Model.users userModel = GetUserInfo();
            //if (userModel != null)
            //{
            //    group_id = userModel.group_id;
            //}
            Model.payment payModel = new BLL.payment().GetModel(payment_id);
            if (payModel == null)
            {
                return(0);
            }
            decimal poundage_amount = payModel.poundage_amount;

            return(poundage_amount);
        }
예제 #41
0
        /// <summary>
        /// 返回订单状态
        /// </summary>
        /// <param name="_id">订单ID</param>
        /// <returns>String</returns>
        protected string get_order_status(int _id)
        {
            string _title = "";
            Model.orders model = new BLL.orders().GetModel(_id);
            switch (model.status)
            {
                case 1:
                    _title = "等待确认";
                    Model.payment payModel = new BLL.payment().GetModel(model.payment_id);
                    if (payModel != null && payModel.type == 1)
                    {
                        if (model.payment_status > 1)
                        {
                            _title = "付款成功";
                        }
                        else
                        {
                            _title = "等待付款";
                        }
                    }
                    break;
                case 2:
                    if (model.distribution_status > 1)
                    {
                        _title = "已发货";
                    }
                    else
                    {
                        _title = "待发货";
                    }
                    break;
                case 3:
                    _title = "交易完成";
                    break;
                case 4:
                    _title = "订单取消";
                    break;
                case 5:
                    _title = "订单作废";
                    break;
            }

            return _title;
        }
예제 #42
0
파일: payment.cs 프로젝트: LutherW/MTMS
 /// <summary>
 /// 返回支付费用金额
 /// </summary>
 /// <param name="payment_id">支付ID</param>
 /// <returns>decimal</returns>
 protected decimal get_payment_poundage_amount(int payment_id)
 {
     int group_id = 0;
     Model.users userModel = GetUserInfo();
     if (userModel != null)
     {
         group_id = userModel.group_id;
     }
     Model.payment payModel = new BLL.payment().GetModel(payment_id);
     if (payModel == null)
     {
         return 0;
     }
     decimal poundage_amount = payModel.poundage_amount;
     if (payModel.poundage_type == 1)
     {
         poundage_amount = (poundage_amount * Web.UI.ShopCart.GetTotal(group_id).real_amount) / 100;
     }
     return poundage_amount;
 }
예제 #43
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
            }
        }
예제 #44
0
        private void ShowInfo(int _id)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();
            BLL.payment         bll    = new BLL.payment();
            model         = bll.GetModel(_id);
            txtTitle.Text = model.title;

            if (model.is_lock == 0)
            {
                cbIsLock.Checked = true;
            }
            else
            {
                cbIsLock.Checked = false;
            }
            txtSortId.Text = model.sort_id.ToString();
            rblPoundageType.SelectedValue = model.poundage_type.ToString();
            txtPoundageAmount.Text        = model.poundage_amount.ToString();
            txtImgUrl.Text = model.img_url;
            txtRemark.Text = model.remark;
        }
예제 #45
0
파일: orders.cs 프로젝트: LutherW/MTMS
 /// <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 == 0 || model.status == 2)
     {
         return false;
     }
     Model.payment payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         return false;
     }
     if (payModel.type == 1 && model.payment_status == 1)
     {
         return true;
     }
     return false;
 }
        private bool DoEdit(int _id)
        {
            bool result = true;
            BLL.payment bll = new BLL.payment();
            Model.payment model = bll.GetModel(_id);

            model.title = txtTitle.Text.Trim();
            model.type = int.Parse(rblType.SelectedValue);
            model.is_lock = int.Parse(rblIsLock.SelectedValue);
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.poundage_type = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            //model.api_path = txtApiPath.Text.Trim();
            model.img_url = txtImgUrl.Text.Trim();
            model.remark = txtRemark.Text;
            if (model.api_path.ToLower() == "alipay")
            {
                //支付宝
                string alipayFilePath = Utils.GetMapPath("~/xmlconfig/alipay.config");
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/partner", txtAlipayPartner.Text);
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/key", txtAlipayKey.Text);
                XmlHelper.UpdateNodeInnerText(alipayFilePath, @"Root/seller_email", txtAlipaySellerEmail.Text);
            }
            else
                if (model.api_path.ToLower() == "tenpay")
                {
                    //财付通
                    string tenpayFilePath = Utils.GetMapPath("~/xmlconfig/tenpay.config");
                    XmlHelper.UpdateNodeInnerText(tenpayFilePath, @"Root/bargainor_id", txtTenpayBargainorId.Text);
                    XmlHelper.UpdateNodeInnerText(tenpayFilePath, @"Root/tenpay_key", txtTenpayKey.Text);
                }

            if (!bll.Update(model))
            {
                result = false;
            }

            return result;
        }
예제 #47
0
        /// <summary>
        /// 确认订单页面
        /// </summary>
        public void confirmOrder()
        {
            //1用户的地址
            BLL.wx_shop_user_addr uAddrBll = new BLL.wx_shop_user_addr();
            IList<Model.wx_shop_user_addr> uaddrList = uAddrBll.GetOpenidAddrName(openid, wid);
            if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0)
            { }
            else
            {
                this.Document.SetValue("addrinfo", uaddrList[0]);
            }

            //快递信息列表
            BLL.express expressBll = new BLL.express();
            DataSet dsExpress = expressBll.GetExpressList100(wid);
            this.Document.SetValue("express", dsExpress);

            //支付信息列表
            BLL.payment pbll = new BLL.payment();
            DataSet dsPay = pbll.GetList(0, "  is_lock=0 and wid=" + wid, "  sort_id asc");
            this.Document.SetValue("payment", dsPay);

            //购物车里的商品
            BLL.wx_shop_cart cartBll = new BLL.wx_shop_cart();
            IList<Model.cartProduct> cartList = cartBll.GetCartList(openid, wid);
            this.Document.SetValue("cartlist", cartList);

            string cartStr = "[";
            if (cartList.Count > 0)
            {
                for (int i = cartList.Count - 1; i >= 0; i--)
                {
                    if (i != 0)
                    {
                        cartStr += "{ \"ic\": \"" + cartList[i].id + "\", \"attr\": \"\", \"bc\": \"" + cartList[i].productNum + "\", \"mid\": " + cartList[i].skuId + " },";
                    }
                    else
                    {
                        cartStr += "{ \"ic\": \"" + cartList[i].id + "\", \"attr\": \"\", \"bc\": \"" + cartList[i].productNum + "\", \"mid\": " + cartList[i].skuId + " }";
                    }
                }
            }
            cartStr += "]";
            decimal alltotPrice = cartList.Sum(item => item.totPrice);

            this.Document.SetValue("alltot", alltotPrice*100);
            this.Document.SetValue("cartStr", cartStr);
        }
예제 #48
0
        private bool DoAdd(int _id)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            bool result = false;
            BLL.payment bll = new BLL.payment();
            Model.payment model = new Model.payment();

            model.title = txtTitle.Text.Trim();
            if (cbIsLock.Checked == true)
            {
                model.is_lock = 0;
            }
            else
            {
                model.is_lock = 1;
            }
            model.sort_id = int.Parse(txtSortId.Text.Trim());
            model.poundage_type = int.Parse(rblPoundageType.SelectedValue);
            model.poundage_amount = decimal.Parse(txtPoundageAmount.Text.Trim());
            model.img_url = txtImgUrl.Text.Trim();
            model.remark = txtRemark.Text;
            model.pTypeId = _id;
            model.wid = weixin.id;
            model.api_path = hidApi_path.Value;
            if (_id==2)
            {
                //支付宝
                BLL.wx_payment_alipay aliBll = new BLL.wx_payment_alipay();
                Model.wx_payment_alipay alipay = new Model.wx_payment_alipay();
                alipay.ownerName = txtAlipaySellerEmail.Text.Trim();
                alipay.partner = txtAlipayPartner.Text.Trim();
                alipay.e_key = txtAlipayKey.Text.Trim();
                alipay.private_key = txtprivate_key.Text.Trim();
                alipay.public_key = txtpublic_key.Text.Trim();
                alipay.sign_type = "MD5";
                alipay.wid = weixin.id;
                alipay.createDate = DateTime.Now;
                aliBll.Add(alipay);
            }
            else if (_id==3)
            {
                //微支付
                BLL.wx_payment_wxpay wxpayBll = new BLL.wx_payment_wxpay();
                Model.wx_payment_wxpay wxpay = new Model.wx_payment_wxpay();
                wxpay.wid = weixin.id;

                //财付通--相关信息
                wxpay.partnerId = txtpartnerId.Text.Trim();
                wxpay.partnerKey = txtpartnerKey.Text.Trim();
                wxpay.CertInfoPath = txtCertInfoPath.Text.Trim();
                wxpay.partnerPwd = txtPartnerPwd.Text.Trim();

                //微信--相关配置
                wxpay.paySignKey = txtpaySignKey.Text.Trim();
                wxpay.appId = txtAppId.Text.Trim();
                wxpay.quicklyFH = rblQuicklyFH.SelectedItem.Value == "1" ? true : false;
                wxpay.createDate = DateTime.Now;
                wxpayBll.Add(wxpay);
            }

            if (bll.Add(model)>0)
            {
                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "添加支付方式:" + model.title); //记录日志
                result = true;
            }

            return result;
        }
예제 #49
0
        private void order_pay(HttpContext context)
        {
            Model.users model = new BasePage().GetUserInfo();
            if (model == null)
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"对不起,请重新登录!\"}");
                return;
            }

            string pay_type = DTRequest.GetQueryString("pay_type");//支付类型
            int pay_ment = DTRequest.GetQueryInt("pay_ment");//支付方式
            int order_id = DTRequest.GetQueryInt("order_id");

            BLL.orders bll = new BLL.orders();
            Model.orders model_order = bll.GetModel(order_id);
            if (model_order == null)
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"订单不存在!\"}");
                return;
            }

            switch (pay_type)
            {
                case "month":
                    model_order.is_up = 3;
                    break;
                case "is_up":
                    model_order.is_up = 2;
                    break;
                case "payno":
                    model_order.is_up = 1;
                    break;
            }

            //直接支付
            BLL.payment bll_pay = new BLL.payment();
            Model.payment model_pay = new Model.payment();
            string url = "";
            if (pay_type == "payno")
            {
                model_pay = bll_pay.GetModel(pay_ment);
                if (model_pay == null)
                {
                    context.Response.Write("{\"status\":\"0\", \"msg\":\"支付方式不存在或已删除!\"}");
                    return;
                }
                model_order.payment_id = model_pay.id;
                if (model_pay.type == 1)
                {
                    //用户余额
                    if (model_pay.api_path == "balance")
                    {
                        if (model.amount < model_order.order_amount)
                        {
                            context.Response.Write("{\"status\":\"0\", \"msg\":\"对不起,您的用户余额不足请充值!\"}");
                            return;
                        }
                        decimal user_amount = model.amount - model_order.order_amount;
                        if (new BLL.users().UpdateField(model.id, "amount=" + user_amount) <= 0)
                        {
                            context.Response.Write("{\"status\":\"0\", \"msg\":\"扣除余额失败,支付失败!\"}");
                            return;
                        }
                        model_order.status = 2;
                        model_order.payment_status = 2;
                    }
                    else
                    {
                        url = siteConfig.webpath + "api/payment/" + model_pay.api_path + "/index.aspx?action=pay&pay_user_name=" + model.nick_name.Trim()
                                  + "&pay_order_type=" + DTEnums.AmountTypeEnum.BuyGoods.ToString() + "&pay_order_no=" + model_order.order_no + "&pay_order_amount=" + model_order.order_amount + "&pay_subject=商品订单";
                    }
                }
                else
                {
                    //货到付款
                }
            }

            if (!bll.Update(model_order))
            {
                context.Response.Write("{\"status\":\"0\", \"msg\":\"支付方式保存失败!\"}");
                return;
            }
            else
            {
                context.Response.Write("{\"status\":\"1\", \"msg\":\"支付成功!\",\"url\":\"" + url + "\"}");
                return;
            }
        }
예제 #50
0
 private void order_save(HttpContext context)
 {
     int payment_id = DTRequest.GetFormInt("payment_id");
     int distribution_id = DTRequest.GetFormInt("distribution_id");
     string accept_name = DTRequest.GetFormString("accept_name");
     string post_code = DTRequest.GetFormString("post_code");
     string telphone = DTRequest.GetFormString("telphone");
     string mobile = DTRequest.GetFormString("mobile");
     string address = DTRequest.GetFormString("address");
     string message = DTRequest.GetFormString("message");
     //检查配送方式
     if (distribution_id == 0)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请选择配送方式!\"}");
         return;
     }
     Model.distribution disModel = new BLL.distribution().GetModel(distribution_id);
     if (disModel == null)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您选择的配送方式不存在或已删除!\"}");
         return;
     }
     //检查支付方式
     if (payment_id == 0)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请选择支付方式!\"}");
         return;
     }
     Model.payment payModel = new BLL.payment().GetModel(payment_id);
     if (payModel == null)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您选择的支付方式不存在或已删除!\"}");
         return;
     }
     //检查收货人
     if (string.IsNullOrEmpty(accept_name))
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入收货人姓名!\"}");
         return;
     }
     //检查手机和电话
     if (string.IsNullOrEmpty(telphone) && string.IsNullOrEmpty(mobile))
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入收货人联系电话或手机!\"}");
         return;
     }
     //检查地址
     if (string.IsNullOrEmpty(address))
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入详细的收货地址!\"}");
         return;
     }
     //检查用户是否登录
     Model.users userModel = new BasePage().GetUserInfo();
     if (userModel == null)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户没有登录或登录超时啦!\"}");
         return;
     }
     //检查购物车商品
     IList<Model.cart_items> iList = DTcms.Web.UI.ShopCart.GetList(userModel.group_id);
     if (iList == null)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,购物车为空,无法结算!\"}");
         return;
     }
     //统计购物车
     Model.cart_total cartModel = DTcms.Web.UI.ShopCart.GetTotal(userModel.group_id);
     //保存订单=======================================================================
     Model.orders model = new Model.orders();
     model.order_no = Utils.GetOrderNumber(); //订单号
     model.user_id = userModel.id;
     model.user_name = userModel.user_name;
     model.payment_id = payment_id;
     model.distribution_id = distribution_id;
     model.accept_name = accept_name;
     model.post_code = post_code;
     model.telphone = telphone;
     model.mobile = mobile;
     model.address = address;
     model.message = message;
     model.payable_amount = cartModel.payable_amount;
     model.real_amount = cartModel.real_amount;
     model.payable_freight = disModel.amount; //应付运费
     model.real_freight = disModel.amount; //实付运费
     //如果是先款后货的话
     if (payModel.type == 1)
     {
         if (payModel.poundage_type == 1) //百分比
         {
             model.payment_fee = model.real_amount * payModel.poundage_amount / 100;
         }
         else //固定金额
         {
             model.payment_fee = payModel.poundage_amount;
         }
     }
     //订单总金额=实付商品金额+运费+支付手续费
     model.order_amount = model.real_amount + model.real_freight + model.payment_fee;
     //购物积分,可为负数
     model.point = cartModel.total_point;
     model.add_time = DateTime.Now;
     //商品详细列表
     List<Model.order_goods> gls = new List<Model.order_goods>();
     foreach (Model.cart_items item in iList)
     {
         gls.Add(new Model.order_goods { goods_id = item.id, goods_name = item.title, goods_price = item.price, real_price = item.user_price, quantity = item.quantity, point = item.point });
     }
     model.order_goods = gls;
     int result = new BLL.orders().Add(model);
     if (result < 1)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"订单保存过程中发生错误,请重新提交!\"}");
         return;
     }
     //扣除积分
     if (model.point < 0)
     {
         new BLL.point_log().Add(model.user_id, model.user_name, model.point, "积分换购,订单号:" + model.order_no);
     }
     //清空购物车
     DTcms.Web.UI.ShopCart.Clear("0");
     //提交成功,返回URL
     context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("payment1", "confirm", DTEnums.AmountTypeEnum.BuyGoods.ToString(), model.order_no) + "\", \"msgbox\":\"恭喜您,订单已成功提交!\"}");
     return;
 }
예제 #51
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            BLL.wx_shop_cart cartBll = new BLL.wx_shop_cart();
            string _action = MyCommFun.QueryString("myact");
            string openid = MyCommFun.RequestOpenid();  //得到微信用户的openid
            Dictionary<string, string> jsonDict = new Dictionary<string, string>();
            if (_action == "addCart")
            {
                #region 添加购物车
                try
                {
                    int wid = MyCommFun.RequestInt("wid");
                    int productId = MyCommFun.RequestInt("productid");
                    int skuId = MyCommFun.RequestInt("mid");
                    string skuInfo = MyCommFun.QueryString("attr");
                    int productNum = MyCommFun.RequestInt("bc");
                    decimal totalPrice = (decimal)MyCommFun.RequestFloat("totprice", 0);

                    Model.wx_shop_cart cart = new Model.wx_shop_cart();

                    IList<Model.wx_shop_cart> cartList = cartBll.GetModelList("productId=" + productId + " and openid='" + openid + "' and skuId=" + skuId);
                    bool isAdd = true;
                    if (cartList != null && cartList.Count > 0)
                    {
                        isAdd = false;
                        cart = cartList[0];
                    }
                    if (isAdd)
                    {
                        cart.createDate = DateTime.Now;
                        cart.openid = openid;
                        cart.productId = productId;
                        cart.productNum = productNum;
                        cart.skuId = skuId;
                        cart.skuInfo = skuInfo;
                        cart.totPrice = totalPrice * productNum;
                        cart.wid = wid;
                        int ret = cartBll.Add(cart);
                        if (ret > 0)
                        {
                            jsonDict.Add("errCode", "false");
                        }
                        else
                        {
                            jsonDict.Add("errCode", "true");
                        }
                    }
                    else
                    {

                        cart.openid = openid;

                        cart.productNum += productNum;
                        cart.skuId = skuId;
                        cart.skuInfo = skuInfo;
                        cart.totPrice += totalPrice * productNum;
                        cart.wid = wid;
                        bool ret = cartBll.Update(cart);
                        if (ret)
                        {
                            jsonDict.Add("errCode", "false");
                        }
                        else
                        {
                            jsonDict.Add("errCode", "true");
                        }
                    }

                }
                catch (Exception ex)
                {
                    jsonDict.Add("errCode", "true");
                }
                finally
                {
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));

                }
                #endregion
            }
            else if (_action == "pcount")
            {
                #region 购物车商品数量
                jsonDict = new Dictionary<string, string>();
                int wid = MyCommFun.RequestInt("wid");
                int count = cartBll.GetRecordCount("wid=" + wid + " and openid='" + openid + "'");
                jsonDict.Add("data", count.ToString());
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                #endregion

            }
            else if (_action == "remove")
            {
                #region 移除购物车商品
                jsonDict = new Dictionary<string, string>();
                int cartId = MyCommFun.RequestInt("id");
                cartBll.Delete(cartId);
                jsonDict.Add("errCode", "false");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                #endregion
            }
            else if (_action == "modifyNum")
            {
                #region 修改购物车商品数量
                jsonDict = new Dictionary<string, string>();
                int cartId = MyCommFun.RequestInt("ic");
                int newNum = MyCommFun.RequestInt("bc");
                cartBll.UpdateNum(cartId, newNum);
                jsonDict.Add("errCode", "false");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                #endregion

            }
            else if (_action == "getCity")
            {
                #region 选择省份,改变城市列表
                int privice = MyCommFun.RequestInt("pvid");
                BLL.pre_common_district areaBll = new BLL.pre_common_district();
                IList<Model.pre_common_district> disList = areaBll.GetModelList("upid=" + privice + " and level=2");
                Model.pre_common_district dis;
                StringBuilder jsonStr = new StringBuilder("{\"errCode\":0,\"retCode\":0,\"msgType\":0,\"errMsg\":\"\",\"data\":[");
                for (int i = 0; i < disList.Count; i++)
                {
                    dis = new Model.pre_common_district();
                    if (i != disList.Count - 1)
                    {
                        jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"},");
                    }
                    else
                    {
                        jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"}");
                    }
                }
                jsonStr.Append("]}");
                context.Response.Write(jsonStr);
                #endregion

            }
            else if (_action == "getArea")
            {
                #region 选择城市,改变区域列表
                int ctid = MyCommFun.RequestInt("ctid");
                BLL.pre_common_district areaBll = new BLL.pre_common_district();
                IList<Model.pre_common_district> disList = areaBll.GetModelList("upid=" + ctid + " and level=3");
                Model.pre_common_district dis;
                StringBuilder jsonStr = new StringBuilder("{\"errCode\":0,\"retCode\":0,\"msgType\":0,\"errMsg\":\"\",\"data\":[");
                for (int i = 0; i < disList.Count; i++)
                {
                    dis = new Model.pre_common_district();
                    if (i != disList.Count - 1)
                    {
                        jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"},");
                    }
                    else
                    {
                        jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"}");
                    }
                }
                jsonStr.Append("]}");
                context.Response.Write(jsonStr);
                #endregion

            }
            else if (_action == "order_save")
            {
                #region 保存订单信息
                //获得传参信息
                int wid = MyCommFun.RequestInt("wid");

                int payment_id = MyCommFun.RequestInt("pc");//支付方式:1货到付款;3微支付
                int express_id = MyCommFun.RequestInt("mtype");//物流方式
                // string orderStrList = MyCommFun.QueryString("orderStrList");

                //检查物流方式
                if (express_id == 0)
                {
                    context.Response.Write("{\"errCode\":3, \"msg\":\"对不起,请选择配送方式!\"}");
                    return;
                }
                BLL.wx_shop_user_addr uAddrBll = new BLL.wx_shop_user_addr();
                IList<Model.wx_shop_user_addr> uaddrList = uAddrBll.GetOpenidAddrName(openid, wid);
                if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0)
                {
                    context.Response.Write("{\"errCode\":3, \"msg\":\"收货地址不存在,无法结算!\"}");
                    return;
                }

                //检查购物车商品
                IList<Model.cartProduct> cartList = cartBll.GetCartList(openid, wid);
                if (cartList == null)
                {
                    context.Response.Write("{\"errCode\":3, \"msg\":\"对不起,购物车为空,无法结算!\"}");
                    return;
                }
                //统计购物车
                decimal payable_amount = cartList.Sum(c => c.totPrice);
                //物流费用
                BLL.express expressBll = new BLL.express();
                Model.express expModel = expressBll.GetModel(express_id);
                //支付方式
                BLL.payment pbll = new BLL.payment();
                Model.payment payModel = pbll.GetModelBypTypeId(payment_id);
                //保存订单=======================================================================
                Model.orders model = new Model.orders();
                model.order_no = "b" + Utils.GetOrderNumber(); //订单号B开头为商品订单

                model.wid = wid;
                model.openid = openid;
                model.modelName = "微商城";
                model.modelCode = "shop";
                model.modelActionName = "";
                model.modelActionId = 0;
                model.user_id = 0;
                model.user_name = "";
                model.payment_id = payment_id;
                model.express_id = express_id;
                model.accept_name = uaddrList[0].contractPerson;
                model.post_code = "";
                model.telphone = uaddrList[0].tel;
                model.mobile = uaddrList[0].tel;
                model.area = uaddrList[0].province;
                model.city = uaddrList[0].city;
                model.district = uaddrList[0].area;
                model.address = uaddrList[0].province + " " + uaddrList[0].city + " " + uaddrList[0].area + " " + uaddrList[0].addrDetail;
                model.message = "";
                model.payable_amount = payable_amount;//应付商品总金额
                model.real_amount = payable_amount;//实际商品总金额,
                model.status = 1;
                model.express_status = 1;
                model.express_fee = expModel.express_fee; //物流费用

                if (payment_id == 1)
                {  //货到付款,需要确认订单
                    model.payment_status = 0; //标记未付款
                }
                else
                {//先款后货
                    model.payment_status = 1; //标记未付款
                }
                bool quicklyFH = false;
                //如果是先款后货的话
                if (payment_id == 3)
                {

                    if (payModel.poundage_type == 1) //百分比
                    {
                        model.payment_fee = model.real_amount * payModel.poundage_amount / 100;
                    }
                    else //固定金额
                    {
                        model.payment_fee = payModel.poundage_amount;
                    }
                    BLL.wx_payment_wxpay wxBll = new BLL.wx_payment_wxpay();
                    Model.wx_payment_wxpay wxpay = wxBll.GetModelByWid(wid);
                    quicklyFH = wxpay.quicklyFH;

                }
                if (quicklyFH)
                {
                    model.express_status = 0;
                }
                //订单总金额=实付商品金额+运费+支付手续费
                model.order_amount = model.real_amount + model.express_fee + model.payment_fee;
                //购物积分,可为负数
                model.point = 0;
                model.add_time = DateTime.Now;
                //商品详细列表
                List<Model.order_goods> gls = new List<Model.order_goods>();
                foreach (Model.cartProduct item in cartList)
                {
                    gls.Add(new Model.order_goods { goods_id = item.productId, goods_title = item.productName, goods_price = item.totPrice, real_price = item.totPrice, quantity = item.productNum, point = 0 });
                }
                model.order_goods = gls;
                int result = new BLL.orders().Add(model);
                if (result < 1)
                {
                    context.Response.Write("{\"errCode\":3, \"msg\":\"订单保存过程中发生错误,请重新提交!\"}");
                    return;
                }

                //清空购物车
                cartBll.RemoveCartInfo(wid, openid);
                //提交成功,返回URL  order_no
                context.Response.Write("{\"errCode\":true, \"payType\":\"" + payment_id + "\", \"order_no\":\"" + model.order_no + "\",\"orderid\":\"" + result + "\",\"wid\":\"" + wid + "\",\"openid\":\"" + openid + "\",\"payable_amount\":\"" + payable_amount + "\", \"msg\":\"恭喜您,订单已成功提交!\"}");
                return;
                #endregion
            }
            else if (_action == "order_canel")
            {
                #region  //取消订单
                int orderid = MyCommFun.RequestInt("order_id");
                BLL.orders oBll = new BLL.orders();
                oBll.UpdateField(orderid, "status=4");
                context.Response.Write("{\"errCode\":true, \"msg\":\"订单已取消!\"}");
                #endregion

            }
            else if (_action == "shouhuo")
            {
                #region  //确认收货
                int orderid = MyCommFun.RequestInt("order_id");
                BLL.orders oBll = new BLL.orders();
                Model.orders order = oBll.GetModel(orderid);
                if (order.payment_id == 1)
                {
                    //货到付款
                    oBll.UpdateField(orderid, "express_status=2,payment_status=2 , status=3");
                }
                else
                {
                    //在线支付
                    oBll.UpdateField(orderid, "express_status=2,payment_status=2 , status=3");
                }

                context.Response.Write("{\"errCode\":true, \"msg\":\"确人收货!\"}");
                #endregion

            }
        }
예제 #52
0
        private void order_save(HttpContext context)
        {
            //获取传参信息===================================
            string hideGoodsJson = Utils.GetCookie(DTKeys.COOKIE_SHOPPING_BUY); //获取商品JSON数据
            string sitepath = DTRequest.GetQueryString("site"); //站点目录
            int book_id = DTRequest.GetFormInt("book_id", 1);
            int payment_id = DTRequest.GetFormInt("payment_id");
            int express_id = DTRequest.GetFormInt("express_id");
            int is_invoice = DTRequest.GetFormInt("is_invoice", 0);
            string accept_name = Utils.ToHtml(DTRequest.GetFormString("accept_name"));
            string province = Utils.ToHtml(DTRequest.GetFormString("province"));
            string city = Utils.ToHtml(DTRequest.GetFormString("city"));
            string area = Utils.ToHtml(DTRequest.GetFormString("area"));
            string address = Utils.ToHtml(DTRequest.GetFormString("address"));
            string telphone = Utils.ToHtml(DTRequest.GetFormString("telphone"));
            string mobile = Utils.ToHtml(DTRequest.GetFormString("mobile"));
            string email = Utils.ToHtml(DTRequest.GetFormString("email"));
            string post_code = Utils.ToHtml(DTRequest.GetFormString("post_code"));
            string message = Utils.ToHtml(DTRequest.GetFormString("message"));
            string invoice_title = Utils.ToHtml(DTRequest.GetFormString("invoice_title"));
            Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig(); //获取订单配置

            //检查传参信息===================================
            if (string.IsNullOrEmpty(hideGoodsJson))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,无法获取商品信息!\"}");
                return;
            }
            //检查站点目录
            if (string.IsNullOrEmpty(sitepath))
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"错误提示:站点传输参数不正确!\"}");
                return;
            }
            if (express_id == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请选择配送方式!\"}");
                return;
            }
            if (payment_id == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请选择支付方式!\"}");
                return;
            }
            Model.express expModel = new BLL.express().GetModel(express_id);
            if (expModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,配送方式不存在或已删除!\"}");
                return;
            }
            //检查支付方式
            Model.payment payModel = new BLL.payment().GetModel(payment_id);
            if (payModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,支付方式不存在或已删除!\"}");
                return;
            }
            //检查收货人
            if (string.IsNullOrEmpty(accept_name))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入收货人姓名!\"}");
                return;
            }
            //检查手机和电话
            if (string.IsNullOrEmpty(telphone) && string.IsNullOrEmpty(mobile))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入收货人联系电话或手机!\"}");
                return;
            }
            //检查地区
            if (string.IsNullOrEmpty(province) && string.IsNullOrEmpty(city))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请选择您所在的省市区!\"}");
                return;
            }
            //检查地址
            if (string.IsNullOrEmpty(address))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入详细的收货地址!\"}");
                return;
            }
            //如果开启匿名购物则不检查会员是否登录
            int user_id = 0;
            int user_group_id = 0;
            string user_name = string.Empty;
            //检查用户是否登录
            Model.users userModel = new Web.UI.BasePage().GetUserInfo();
            if (userModel != null)
            {
                user_id = userModel.id;
                user_group_id = userModel.group_id;
                user_name = userModel.user_name;
                //检查是否需要添加会员地址
                if (book_id == 0)
                {
                    Model.user_addr_book addrModel = new Model.user_addr_book();
                    addrModel.user_id=userModel.id;
                    addrModel.user_name=userModel.user_name;
                    addrModel.accept_name = accept_name;
                    addrModel.area = province + "," + city + "," + area;
                    addrModel.address = address;
                    addrModel.mobile = mobile;
                    addrModel.telphone = telphone;
                    addrModel.email = email;
                    addrModel.post_code = post_code;
                    new BLL.user_addr_book().Add(addrModel);
                }
            }
            if (orderConfig.anonymous == 0 && userModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,用户尚未登录或已超时!\"}");
                return;
            }
            //获取商品信息==================================
            List<Model.cart_keys> iList = (List<Model.cart_keys>)JsonHelper.JSONToObject<List<Model.cart_keys>>(hideGoodsJson);
            List<Model.cart_items> goodsList = ShopCart.ToList(iList, user_group_id); //商品列表
            Model.cart_total goodsTotal = ShopCart.GetTotal(goodsList); //商品统计
            if (goodsList == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,商品为空,无法结算!\"}");
                return;
            }
            //保存订单=======================================
            Model.orders model = new Model.orders();
            model.order_no = "B" + Utils.GetOrderNumber(); //订单号B开头为商品订单
            model.user_id = user_id;
            model.user_name = user_name;
            model.payment_id = payment_id;
            model.express_id = express_id;
            model.accept_name = accept_name;
            model.area = province + "," + city + "," + area; //省市区以逗号相隔
            model.address = address;
            model.telphone = telphone;
            model.mobile = mobile;
            model.message = message;
            model.email = email;
            model.post_code = post_code;
            model.is_invoice = is_invoice;
            model.payable_amount = goodsTotal.payable_amount;
            model.real_amount = goodsTotal.real_amount;
            model.express_status = 1;
            model.express_fee = expModel.express_fee; //物流费用
            //是否先款后货
            if (payModel.type == 1)
            {
                model.payment_status = 1; //标记未付款
                if (payModel.poundage_type == 1 && payModel.poundage_amount > 0) //百分比
                {
                    model.payment_fee = model.real_amount * payModel.poundage_amount / 100;
                }
                else //固定金额
                {
                    model.payment_fee = payModel.poundage_amount;
                }
            }
            //是否开具发票
            if (model.is_invoice == 1)
            {
                model.invoice_title = invoice_title;
                if (orderConfig.taxtype == 1 && orderConfig.taxamount > 0) //百分比
                {
                    model.invoice_taxes = model.real_amount * orderConfig.taxamount / 100;
                }
                else //固定金额
                {
                    model.invoice_taxes = orderConfig.taxamount;
                }
            }
            //订单总金额=实付商品金额+运费+支付手续费+税金
            model.order_amount = model.real_amount + model.express_fee + model.payment_fee + model.invoice_taxes;
            //购物积分,可为负数
            model.point = goodsTotal.total_point;
            model.add_time = DateTime.Now;
            //商品详细列表
            List<Model.order_goods> gls = new List<Model.order_goods>();
            foreach (Model.cart_items item in goodsList)
            {
                gls.Add(new Model.order_goods { article_id = item.article_id, goods_id = item.goods_id, goods_no = item.goods_no, goods_title = item.title, 
                    img_url = item.img_url, spec_text = item.spec_text, goods_price = item.sell_price, real_price = item.user_price, quantity = item.quantity, point = item.point });
            }
            model.order_goods = gls;
            int result = new BLL.orders().Add(model);
            if (result < 1)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"订单保存发生错误,请联系管理员!\"}");
                return;
            }
            //扣除积分
            if (model.point < 0)
            {
                new BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "积分换购,订单号:" + model.order_no, false);
            }
            //删除购物车对应的商品
            Web.UI.ShopCart.Clear(iList);
            //清空结账清单
            Utils.WriteCookie(DTKeys.COOKIE_SHOPPING_BUY, "");
            //提交成功,返回URL
            context.Response.Write("{\"status\":1, \"url\":\""
                + new Web.UI.BasePage().getlink(sitepath, new Web.UI.BasePage().linkurl("payment", "?action=confirm&order_no=" + model.order_no)) + "\", \"msg\":\"恭喜您,订单已成功提交!\"}");
            return;
        }
예제 #53
0
 private void RptBind(string _orderby)
 {
     BLL.payment bll = new BLL.payment();
     this.rptList.DataSource = bll.GetList(0, "", _orderby);
     this.rptList.DataBind();
 }
예제 #54
0
        private void order_save(HttpContext context)
        {
            //获得传参信息
            int payment_id = DTRequest.GetFormInt("payment_id");
            int express_id = DTRequest.GetFormInt("express_id");
            string accept_name = Utils.ToHtml(DTRequest.GetFormString("accept_name"));
            string post_code = Utils.ToHtml(DTRequest.GetFormString("post_code"));
            string telphone = Utils.ToHtml(DTRequest.GetFormString("telphone"));
            string mobile = Utils.ToHtml(DTRequest.GetFormString("mobile"));
            string address = Utils.ToHtml(DTRequest.GetFormString("address"));
            string message = Utils.ToHtml(DTRequest.GetFormString("message"));
            //获取订单配置信息
            Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();

            //检查物流方式
            if (express_id == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请选择配送方式!\"}");
                return;
            }
            Model.express expModel = new BLL.express().GetModel(express_id);
            if (expModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,配送方式不存在或已删除!\"}");
                return;
            }
            //检查支付方式
            if (payment_id == 0)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请选择支付方式!\"}");
                return;
            }
            Model.payment payModel = new BLL.payment().GetModel(payment_id);
            if (payModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,支付方式不存在或已删除!\"}");
                return;
            }
            //检查收货人
            if (string.IsNullOrEmpty(accept_name))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入收货人姓名!\"}");
                return;
            }
            //检查手机和电话
            if (string.IsNullOrEmpty(telphone) && string.IsNullOrEmpty(mobile))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入收货人联系电话或手机!\"}");
                return;
            }
            //检查地址
            if (string.IsNullOrEmpty(address))
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,请输入详细的收货地址!\"}");
                return;
            }
            //如果开启匿名购物则不检查会员是否登录
            int user_id = 0;
            int user_group_id = 0;
            string user_name = string.Empty;
            //检查用户是否登录
            Model.users userModel = new BasePage().GetUserInfo();
            if (userModel != null)
            {
                user_id = userModel.id;
                user_group_id = userModel.group_id;
                user_name = userModel.user_name;
            }
            if (orderConfig.anonymous == 0 && userModel == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,用户尚未登录或已超时!\"}");
                return;
            }
            //检查购物车商品
            IList<Model.cart_items> iList = DTcms.Web.UI.ShopCart.GetList(user_group_id);
            if (iList == null)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"对不起,购物车为空,无法结算!\"}");
                return;
            }
            //统计购物车
            Model.cart_total cartModel = DTcms.Web.UI.ShopCart.GetTotal(user_group_id);
            //保存订单=======================================================================
            Model.orders model = new Model.orders();
            model.order_no = "B" + Utils.GetOrderNumber(); //订单号B开头为商品订单
            model.user_id = user_id;
            model.user_name = user_name;
            model.payment_id = payment_id;
            model.express_id = express_id;
            model.accept_name = accept_name;
            model.post_code = post_code;
            model.telphone = telphone;
            model.mobile = mobile;
            model.address = address;
            model.message = message;
            model.payable_amount = cartModel.payable_amount;
            model.real_amount = cartModel.real_amount;
            model.express_status = 1;
            model.express_fee = expModel.express_fee; //物流费用
            //如果是先款后货的话
            if (payModel.type == 1)
            {
                model.payment_status = 1; //标记未付款
                if (payModel.poundage_type == 1) //百分比
                {
                    model.payment_fee = model.real_amount * payModel.poundage_amount / 100;
                }
                else //固定金额
                {
                    model.payment_fee = payModel.poundage_amount;
                }
            }
            //订单总金额=实付商品金额+运费+支付手续费
            model.order_amount = model.real_amount + model.express_fee + model.payment_fee;
            //购物积分,可为负数
            model.point = cartModel.total_point;
            model.add_time = DateTime.Now;
            //商品详细列表
            List<Model.order_goods> gls = new List<Model.order_goods>();
            foreach (Model.cart_items item in iList)
            {
                gls.Add(new Model.order_goods { goods_id = item.id, goods_title = item.title, goods_price = item.price, real_price = item.user_price, quantity = item.quantity, point = item.point });
            }
            model.order_goods = gls;
            int result = new BLL.orders().Add(model);
            if (result < 1)
            {
                context.Response.Write("{\"status\":0, \"msg\":\"订单保存过程中发生错误,请重新提交!\"}");
                return;
            }
            //扣除积分
            if (model.point < 0)
            {
                new BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "积分换购,订单号:" + model.order_no, false);
            }
            //清空购物车
            DTcms.Web.UI.ShopCart.Clear("0");
            //提交成功,返回URL
            context.Response.Write("{\"status\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("payment", "confirm", model.order_no) + "\", \"msg\":\"恭喜您,订单已成功提交!\"}");
            return;
        }
예제 #55
0
 //确认订单
 protected void lbtnConfirm_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("orders", DTEnums.ActionEnum.Edit.ToString()); //检查权限
     BLL.orders bll = new BLL.orders();
     Model.orders model = bll.GetModel(this.id);
     //检查订单状态
     if (model == null || model.status > 1)
     {
         JscriptMsg("订单不符合要求,无法确认!", "", "Error");
         return;
     }
     //检查支付方式
     Model.payment payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         JscriptMsg("支付方式不存在,无法确认!", "", "Error");
         return;
     }
     //如果支付方式为线上支付,则检查付款状态
     if (payModel.type == 1)
     {
         if (model.payment_status != 2)
         {
             JscriptMsg("订单未付款,无法确认!", "", "Error");
             return;
         }
     }
     bll.UpdateField(this.id, "status=2,confirm_time='" + DateTime.Now + "'");
     JscriptMsg("订单确认成功!", "order_edit.aspx?id=" + this.id, "Success");
 }