Beispiel #1
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");
 }
Beispiel #2
0
        /// <summary>
        /// 重写虚方法,此方法在Init事件执行
        /// </summary>
        protected override void InitPage()
        {
            action = MXRequest.GetQueryString("action");

            //获得最后登录日志
            DataTable dt = new BLL.user_login_log().GetList(2, "user_name='" + userModel.user_name + "'", "id desc").Tables[0];
            if (dt.Rows.Count == 2)
            {
                curr_login_ip = dt.Rows[0]["login_ip"].ToString();
                pre_login_ip = dt.Rows[1]["login_ip"].ToString();
                pre_login_time = dt.Rows[1]["login_time"].ToString();
            }
            else if (dt.Rows.Count == 1)
            {
                curr_login_ip = dt.Rows[0]["login_ip"].ToString();
            }
            //未完成订单
            total_order = new BLL.orders().GetCount("user_name='" + userModel.user_name + "' and status<3");
            //未读短信息
            total_msg = new BLL.user_message().GetCount("accept_user_name='" + userModel.user_name + "' and is_read=0");

            //退出登录==========================================================
            if (action == "exit")
            {
                //清险Session
                HttpContext.Current.Session[MXKeys.SESSION_USER_INFO] = null;
                //清除Cookies
                Utils.WriteCookie(MXKeys.COOKIE_USER_NAME_REMEMBER, "MxWeiXinPF", -43200);
                Utils.WriteCookie(MXKeys.COOKIE_USER_PWD_REMEMBER, "MxWeiXinPF", -43200);
                Utils.WriteCookie("UserName", "MxWeiXinPF", -1);
                Utils.WriteCookie("Password", "MxWeiXinPF", -1);
                //自动登录,跳转URL
                HttpContext.Current.Response.Redirect(linkurl("login"));
            }
        }
Beispiel #3
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);
            if (this.status > 0)
            {
                this.ddlStatus.SelectedValue = this.status.ToString();
            }
            if (this.payment_status > 0)
            {
                this.ddlPaymentStatus.SelectedValue = this.payment_status.ToString();
            }
            if (this.distribution_status > 0)
            {
                this.ddlDistributionStatus.SelectedValue = this.distribution_status.ToString();
            }
            this.txtKeywords.Text = this.keywords;
            BLL.orders bll = new BLL.orders();
            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("order_list.aspx", "status={0}&payment_status={1}&distribution_status={2}&keywords={3}&page={4}",
                this.status.ToString(), this.payment_status.ToString(), this.distribution_status.ToString(), this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     openid = MyCommFun.RequestOpenid();
     int otid = MyCommFun.RequestInt("orderid");
     wid = MyCommFun.RequestInt("wid");
     expireMinute = MyCommFun.RequestInt("expireminute");
     if (expireMinute == 0)
     {
         expireMinute = 30;
     }
     else if(expireMinute==-1)
     {  //如果为-1,则有限期间为1年
         expireMinute = 60 * 12 * 365;
     }
     if (openid == "" || otid == 0 || wid==0)
     {
         return;
     }
     BLL.orders otBll = new BLL.orders();
     Model.orders orderEntity = otBll.GetModel(otid,wid);
     litout_trade_no.Text = orderEntity.order_no;
     litMoney.Text = orderEntity.order_amount.ToString();
     litDate.Text = orderEntity.add_time.ToString();
     WxPayData(orderEntity.order_amount, orderEntity.id.ToString(), orderEntity.order_no);
 }
 //批量删除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("order_list", DTEnums.ActionEnum.Delete.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.orders bll = new BLL.orders();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             if (bll.Delete(id))
             {
                 sucCount += 1;
             }
             else
             {
                 errorCount += 1;
             }
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Delete.ToString(), "删除订单成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("order_list.aspx", "status={0}&payment_status={1}&express_status={2}&keywords={3}",
         this.status.ToString(), this.payment_status.ToString(), this.express_status.ToString(), this.keywords));
 }
Beispiel #6
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")));
         return;
     }
     model = bll.GetModel(id);
     if (model.user_id != userModel.id)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")));
         return;
     }
     payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     //根据订单状态和物流单号跟踪物流信息
     if (model.status > 1 && model.status < 4 && model.express_status == 2 && model.express_no.Trim().Length > 0)
     {
         Model.express modelt = new BLL.express().GetModel(model.express_id);
         Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
     }
 }
        private void RptBind(string _strWhere, string _orderby)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();
            this.page = MXRequest.GetQueryInt("page", 1);
            
            txtKeywords.Text = this.keywords;
            BLL.orders bll = new BLL.orders();
            DataSet ds = bll.GetList(weixin.id,this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); ;
            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    dr = ds.Tables[0].Rows[i];
                    dr["statusName"] = GetOrderStatus(MyCommFun.Obj2Int(dr["id"]), MyCommFun.Obj2Int(dr["status"]), MyCommFun.Obj2Int(dr["payment_status"]), MyCommFun.Obj2Int(dr["express_status"]));

                }
            }
            this.rptList.DataSource = ds;
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("order_confirm.aspx", "keywords={0}&page={1}", this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //读取站点配置信息
            Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig(DTKeys.FILE_SITE_XML_CONFING);

            string order_type = DTRequest.GetFormString("pay_order_type"); //订单类型
            string order_no = DTRequest.GetFormString("pay_order_no");
            decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0);
            string subject = DTRequest.GetFormString("pay_subject");
            if (order_no == "" || order_amount == 0 )
            {
                Response.Redirect(siteConfig.webpath + "error.aspx?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!"));
                return;
            }
            //检查是否已登录
            Model.users userModel = new Web.UI.BasePage().GetUserInfo();
            if (userModel == null)
            {
                Response.Redirect(new Web.UI.BasePage().linkurl("payment", "login")); //尚未登录
                return;
            }
            if (userModel.amount < order_amount)
            {
                Response.Redirect(new Web.UI.BasePage().linkurl("payment", "recharge")); //账户的余额不足
                return;
            }

            if (order_type.ToLower() == DTEnums.AmountTypeEnum.BuyGoods.ToString().ToLower()) //购买商品
            {
                BLL.orders bll = new BLL.orders();
                Model.orders model = bll.GetModel(order_no);
                if (model == null)
                {
                    Response.Redirect(siteConfig.webpath + "error.aspx?msg=" + Utils.UrlEncode("对不起,商品订单号不存在!"));
                    return;
                }
                //执行扣取账户金额
                int result = new BLL.amount_log().Add(userModel.id, userModel.user_name, DTEnums.AmountTypeEnum.BuyGoods.ToString(), order_no, model.payment_id, -1 * order_amount, subject, 1);
                if (result > 0)
                {
                    //更改订单状态
                    bool result1 = bll.UpdateField(order_no, "payment_status=2,payment_time='" + DateTime.Now + "'");
                    if (!result1)
                    {
                        Response.Redirect(new Web.UI.BasePage().linkurl("payment", "error"));
                        return;
                    }
                    //扣除积分
                    if (model.point < 0)
                    {
                        new BLL.point_log().Add(model.user_id, model.user_name, model.point, "换购扣除积分,订单号:" + model.order_no);
                    }
                    //支付成功
                    Response.Redirect(new Web.UI.BasePage().linkurl("payment1", "succeed", order_type, order_no));
                    return;
                }
            }
            Response.Redirect(siteConfig.webpath + "error.aspx?msg=" + Utils.UrlEncode("对不起,找不到需要支付的订单类型!"));
            return;
        }
Beispiel #9
0
 private void ShowInfo(string _order_no)
 {
     BLL.orders bll = new BLL.orders();
     model = bll.GetModel(_order_no);
     adminModel = GetAdminInfo();
     this.rptList.DataSource = model.order_goods;
     this.rptList.DataBind();
 }
 private void ShowInfo(int _id)
 {
     BLL.orders bll = new BLL.orders();
     model = bll.GetModel(_id);
     managerModel = GetAdminInfo();
     this.rptList.DataSource = model.order_goods;
     this.rptList.DataBind();
 }
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = DTRequest.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.orders bll = new BLL.orders();
            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("order_confirm.aspx", "keywords={0}&page={1}", this.keywords, "__id__");
            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Beispiel #12
0
 //作废订单
 protected void btnInvalid_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("orders", DTEnums.ActionEnum.Invalid.ToString()); //检查权限
     BLL.orders bll = new BLL.orders();
     Model.orders model = bll.GetModel(this.id);
     if (model == null && model.status != 3)
     {
         JscriptMsg("订单未完成,无法作废!", "", "Error");
         return;
     }
     bll.UpdateField(this.id, "status=5");
     JscriptMsg("订单取消成功啦!", "order_edit.aspx?id=" + this.id, "Success");
 }
Beispiel #13
0
 private void ShowInfo(int _id)
 {
     BLL.orders bll = new BLL.orders();
     model = bll.GetModel(_id);
     payModel = new BLL.payment().GetModel(model.payment_id);
     userModel = new BLL.users().GetModel(model.user_id);
     if (userModel != null)
     {
         groupModel = new BLL.user_groups().GetModel(userModel.group_id);
     }
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     this.rptList.DataSource = model.order_goods;
     this.rptList.DataBind();
     //订单状态
     if (model.status == 1)
     {
         if (payModel != null && payModel.type == 1)
         {
             if (model.payment_status > 1)
             {
                 this.lbtnConfirm.Enabled = true;
             }
         }
         else
         {
             this.lbtnConfirm.Enabled = true;
         }
     }
     else if (model.status == 2 && model.distribution_status == 1)
     {
         this.lbtnSend.Enabled = true;
     }
     else if (model.status == 2 && model.distribution_status == 2)
     {
         this.lbtnComplete.Enabled = true;
     }
     if (model.status < 3)
     {
         this.btnCancel.Visible = true;
     }
     //如果订单为已完成时,不能取消订单
     if (model.status == 3)
     {
         this.btnInvalid.Visible = true;
     }
 }
Beispiel #14
0
 //确认订单
 protected void btnConfirm_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("order_list", DTEnums.ActionEnum.Confirm.ToString()); //检查权限
     int sucCount = 0;
     int errorCount = 0;
     BLL.orders bll = new BLL.orders();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             Model.orders model = bll.GetModel(id);
             if (model != null)
             {
                 //检查订单是否使用在线支付方式
                 if (model.payment_status > 0)
                 {
                     //在线支付方式
                     model.payment_status = 2; //标志已付款
                     model.payment_time = DateTime.Now; //支付时间
                     model.status = 2; // 订单为确认状态
                     model.confirm_time = DateTime.Now; //确认时间
                 }
                 else
                 {
                     //线下支付方式
                     model.status = 2; // 订单为确认状态
                     model.confirm_time = DateTime.Now; //确认时间
                 }
                 if (bll.Update(model))
                 {
                     sucCount++;
                 }
                 else
                 {
                     errorCount++;
                 }
             }
             else
             {
                 errorCount++;
             }
         }
     }
     AddAdminLog(DTEnums.ActionEnum.Confirm.ToString(), "确认订单成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志
     JscriptMsg("确认成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("order_confirm.aspx", "keywords={0}", this.keywords), "Success");
 }
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = MXRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "error.aspx?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
         return;
     }
     model = bll.GetModel(id);
     payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
 }
        private void ShowInfo(string _order_no)
        {
            BLL.orders bll = new BLL.orders();
            Model.orders model = bll.GetModel(_order_no);

            BLL.express bll2 = new BLL.express();
            DataTable dt = bll2.GetList("").Tables[0];
            ddlExpressId.Items.Clear();
            ddlExpressId.Items.Add(new ListItem("请选择配送方式", ""));
            foreach (DataRow dr in dt.Rows)
            {
                ddlExpressId.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString()));
            }

            txtExpressNo.Text = model.express_no;
            ddlExpressId.SelectedValue = model.express_id.ToString();
        }
Beispiel #17
0
        protected string GetOrderStatus(int _id)
        {
            string _title = string.Empty;

            Model.orders model = new BLL.orders().GetModel(_id);
            switch (model.status)
            {
            case 1:     //如果是線下支付,支付狀態為0,如果是線上支付,支付成功後會自動改變訂單狀態為已確認
                if (model.payment_status > 0)
                {
                    _title = "前往付款";
                }
                else
                {
                    _title = "前往付款";
                }
                break;

            case 2:     //如果訂單為已確認狀態,則進入發貨狀態
                if (model.express_status > 1)
                {
                    _title = "貨已寄出";
                }
                else
                {
                    _title = "待出貨";
                }
                break;

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

            case 4:
                _title = "交易取消";
                break;

            case 5:
                _title = "退貨完成";
                break;
            }

            return(_title);
        }
Beispiel #18
0
        protected string GetOrderStatus(int _id)
        {
            string _title = string.Empty;

            Model.orders model = new BLL.orders().GetModel(_id);
            switch (model.status)
            {
            case 1:     //如果是线下支付,支付状态为0,如果是线上支付,支付成功后会自动改变订单状态为已确认
                if (model.payment_status > 0)
                {
                    _title = "待付款";
                }
                else
                {
                    _title = "待确认";
                }
                break;

            case 2:     //如果订单为已确认状态,则进入发货状态
                if (model.express_status > 1)
                {
                    _title = "已发货";
                }
                else
                {
                    _title = "待发货";
                }
                break;

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

            case 4:
                _title = "已取消";
                break;

            case 5:
                _title = "已作废";
                break;
            }

            return(_title);
        }
Beispiel #19
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;
        }
Beispiel #20
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page        = Vincent._DTcms.DTRequest.GetQueryInt("page", 1);
            txtKeywords.Text = this.keywords;
            BLL.orders bll = new BLL.orders();
            BuysingooShop.Model.manager manModel = Session[Vincent._DTcms.DTKeys.SESSION_ADMIN_INFO] as Model.manager;
            if (manModel.brand_id != 0)
            {
                _strWhere += " and brand_id=" + manModel.brand_id;
            }
            this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

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

            PageContent.InnerHtml = Vincent._DTcms.Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Beispiel #21
0
        private void ShowInfo(string _order_no)
        {
            BLL.orders   bll   = new BLL.orders();
            Model.orders model = bll.GetModel(_order_no);

            BLL.express bll2 = new BLL.express();
            DataTable   dt   = bll2.GetList("").Tables[0];

            ddlExpressId.Items.Clear();
            hiddOrderNo.Value = _order_no;
            ddlExpressId.Items.Add(new ListItem("请选择配送方式", ""));
            foreach (DataRow dr in dt.Rows)
            {
                ddlExpressId.Items.Add(new ListItem(dr["title"].ToString(), dr["id"].ToString()));
            }

            txtExpressNo.Text          = model.express_no;
            ddlExpressId.SelectedValue = model.express_id.ToString();
        }
Beispiel #22
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = Vincent._DTcms.DTRequest.GetQueryInt("page", 1);

            if (date != null && date != "")
            {
                ipt_Time.Value = date;
            }

            BLL.orders bll = new BLL.orders();
            this.rptList.DataSource = bll.GetList1(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

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

            PageContent.InnerHtml = Vincent._DTcms.Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 15);
        }
        protected string GetOrderServer(int _id)
        {
            string _bill_type = string.Empty;
            //Model.orders model = new BLL.orders().GetModel(_id);
            DataTable dt = new BLL.orders().GetOrderList(0, " t1.id=" + _id, " id desc").Tables[0];

            //var servertype = "";
            //       if (json._bill_type == 0) {
            //           servertype = "更换轮胎"
            //       } else if (json._bill_type == 1) {
            //           servertype = "更换机油"
            //       } else if (json._bill_type == 2) {
            //           servertype = "镀晶一档"
            //       } else if (json._bill_type == 3) {
            //           servertype = "镀晶二档"
            //       } else if (json._bill_type == 4) {
            //           servertype = "镀晶三档"
            //       }
            switch (int.Parse(dt.Rows[0]["bill_type"].ToString()))
            {
            case 0:
                _bill_type = "更换轮胎";
                break;

            case 1:
                _bill_type = "更换机油";
                break;

            case 2:
                _bill_type = "镀晶一档";
                break;

            case 3:
                _bill_type = "镀晶二档";
                break;

            case 4:
                _bill_type = "镀晶三档";
                break;
            }
            return(_bill_type);
        }
Beispiel #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //读取站点配置信息
            Model.sysconfig             sysConfig       = new BLL.sysconfig().loadConfig();
            int                         site_payment_id = 0; //站点支付方式ID
            Dictionary <string, string> sPara           = GetRequestGet();

            if (sPara.Count > 0)                                                 //判断是否有带返回参数
            {
                string order_no = DTRequest.GetString("out_trade_no").ToUpper(); //获取订单号
                string trade_no = DTRequest.GetString("trade_no");               //支付宝交易号
                string result   = DTRequest.GetString("result");                 //交易状态
                if (order_no.StartsWith("R"))                                    //充值订单
                {
                    site_payment_id = new BLL.user_recharge().GetPaymentId(order_no);
                }
                else if (order_no.StartsWith("B")) //商品订单
                {
                    site_payment_id = new BLL.orders().GetPaymentId(order_no);
                }

                //找到站点支付方式ID开始验证
                if (site_payment_id > 0)
                {
                    Notify aliNotify    = new Notify(site_payment_id);
                    bool   verifyResult = aliNotify.VerifyReturn(sPara, Request.QueryString["sign"]);

                    if (verifyResult)//验证成功
                    {
                        if (result == "success")
                        {
                            //成功状态
                            Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=succeed&order_no=" + order_no));
                            return;
                        }
                    }
                }
            }
            //失败状态
            Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=error"));
            return;
        }
Beispiel #25
0
 //批次刪除
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("orders", DTEnums.ActionEnum.Delete.ToString()); //檢查許可權
     BLL.orders bll = new BLL.orders();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int      id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             Model.orders model = bll.GetModel(id);
             if (model != null && model.status == 4)
             {
                 bll.Delete(id);
             }
         }
     }
     JscriptMsg("符合的訂單已刪除!", Utils.CombUrlTxt("order_list.aspx", "status={0}&payment_status={1}&distribution_status={2}&keywords={3}",
                                              this.status.ToString(), this.payment_status.ToString(), this.distribution_status.ToString(), this.keywords), "Success");
 }
 //作废订单
 protected void btnInvalid_Click(object sender, EventArgs e)
 {
     ChkAdminLevel("orders", DTEnums.ActionEnum.Invalid.ToString()); //检查权限
     BLL.orders bll = new BLL.orders();
     for (int i = 0; i < rptList.Items.Count; i++)
     {
         int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value);
         CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
         if (cb.Checked)
         {
             Model.orders model = bll.GetModel(id);
             if (model != null && model.status == 3)
             {
                 bll.UpdateField(id, "status=5");
             }
         }
     }
     JscriptMsg("符合的订单已作废!", Utils.CombUrlTxt("order_list.aspx", "status={0}&payment_status={1}&distribution_status={2}&keywords={3}",
     this.status.ToString(), this.payment_status.ToString(), this.distribution_status.ToString(), this.keywords), "Success");
 }
Beispiel #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                openid = MyCommFun.RequestOpenid();
                otid   = MyCommFun.RequestInt("otid");
                int wid = MyCommFun.RequestWid();
                if (openid == "" || otid == 0 || wid == 0)
                {
                    return;
                }

                WeiXinCRMComm wxComm = new WeiXinCRMComm();
                string        err    = "";
                token = wxComm.getAccessToken(wid, out err);

                BLL.orders otBll = new BLL.orders();
                ordertmp = otBll.GetModel(otid, wid);
            }
        }
Beispiel #28
0
 /// <summary>
 /// 返回订单商品列表
 /// </summary>
 /// <param name="order_id">订单</param>
 /// <returns>List</returns>
 protected List<Model.article> get_order_goods_list(int order_id)
 {
     Model.orders model = new BLL.orders().GetModel(order_id);
     if (model == null)
     {
         return null;
     }
     List<Model.article> ls = new List<Model.article>();
     if (model.order_goods != null)
     {
         foreach (Model.order_goods modelt in model.order_goods)
         {
             Model.article goodsModel = new BLL.article().GetModel(modelt.goods_id);
             if (goodsModel != null)
             {
                 ls.Add(goodsModel);
             }
         }
     }
     return ls;
 }
Beispiel #29
0
 /// <summary>
 /// 返回订单商品列表
 /// </summary>
 /// <param name="order_id">订单</param>
 /// <returns>List</returns>
 protected List<Model.article> get_order_goods_list(int order_id)
 {
     Model.orders model = new BLL.orders().GetModel(order_id);
     if (model == null)
     {
         return null;
     }
     List<Model.article> ls = new List<Model.article>();
     if (model.order_goods != null)
     {
         foreach (Model.order_goods modelt in model.order_goods)
         {
             Model.article goodsModel = new BLL.article().GetModel(modelt.article_id);
             if (goodsModel != null)
             {
                 ls.Add(goodsModel);
             }
         }
     }
     return ls;
 }
Beispiel #30
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")));
         return;
     }
     model = bll.GetModel(id);
     if (model.user_id != userModel.id)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")));
         return;
     }
     payModel = new BLL.site_payment().GetPaymentModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
 }
Beispiel #31
0
 private void ShowInfo(int _id)
 {
     BLL.orders bll = new BLL.orders();
     model     = bll.GetModel(_id);
     payModel  = new BLL.payment().GetModel(model.payment_id);
     userModel = new BLL.users().GetModel(model.user_id);
     if (userModel != null)
     {
         groupModel = new BLL.user_groups().GetModel(userModel.group_id);
     }
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     this.rptList.DataSource = model.order_goods;
     this.rptList.DataBind();
     //訂單狀態
     if (model.status == 1)
     {
         if (payModel != null && payModel.type == 1)
         {
             if (model.payment_status > 1)
             {
                 this.lbtnConfirm.Enabled = true;
             }
         }
         else
         {
             this.lbtnConfirm.Enabled = true;
         }
     }
     else if (model.status == 2 && model.distribution_status == 1)
     {
         this.lbtnSend.Enabled = true;
     }
     else if (model.status == 2 && model.distribution_status == 2)
     {
         this.lbtnComplete.Enabled = true;
     }
 }
Beispiel #32
0
        private void RptBind(string _strWhere, string _orderby)
        {
            Model.wx_userweixin weixin = GetWeiXinCode();

            this.page = MXRequest.GetQueryInt("page", 1);
            if (this.status > 0)
            {
                this.ddlStatus.SelectedValue = this.status.ToString();
            }
            if (this.payment_status > 0)
            {
                this.ddlPaymentStatus.SelectedValue = this.payment_status.ToString();
            }
            if (this.express_status > 0)
            {
                this.ddlExpressStatus.SelectedValue = this.express_status.ToString();
            }
            txtKeywords.Text = this.keywords;
            BLL.orders bll = new BLL.orders();
            DataSet    ds  = bll.GetList(weixin.id, this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);;

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    dr = ds.Tables[0].Rows[i];
                    dr["statusName"] = GetOrderStatus(MyCommFun.Obj2Int(dr["id"]), MyCommFun.Obj2Int(dr["status"]), MyCommFun.Obj2Int(dr["payment_status"]), MyCommFun.Obj2Int(dr["express_status"]));
                }
            }
            this.rptList.DataSource = ds;
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("order_list.aspx", "status={0}&payment_status={1}&express_status={2}&keywords={3}&page={4}",
                                              this.status.ToString(), this.payment_status.ToString(), this.express_status.ToString(), this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
        protected string GetOrderStatus(int _id)
        {
            string _title = string.Empty;
            Model.orders model = new BLL.orders().GetModel(_id);
            switch (model.status)
            {
                case 1: //如果是线下支付,支付状态为0,如果是线上支付,支付成功后会自动改变订单状态为已确认
                    if (model.payment_status > 0)
                    {
                        _title = "待付款";
                    }
                    else
                    {
                        _title = "待确认";
                    }
                    break;
                case 2: //如果订单为已确认状态,则进入发货状态
                    if (model.express_status > 1)
                    {
                        _title = "已发货";
                    }
                    else
                    {
                        _title = "待发货";
                    }
                    break;
                case 3:
                    _title = "交易完成";
                    break;
                case 4:
                    _title = "已取消";
                    break;
                case 5:
                    _title = "已作废";
                    break;
            }

            return _title;
        }
Beispiel #34
0
 /// <summary>
 /// 返回订单是否需要在线支付
 /// </summary>
 /// <param name="order_id">订单ID</param>
 /// <returns>bool</returns>
 public bool get_order_payment_status(int order_id)
 {
     Model.orders model = new BLL.orders().Get(order_id);
     if (model == null)
     {
         return(false);
     }
     if (model.status != 1)
     {
         return(false);
     }
     Model.payment payModel = new BLL.payment().Get(model.payment_id);
     if (payModel == null)
     {
         return(false);
     }
     if (payModel.type == 1 && model.payment_status == 1)
     {
         return(true);
     }
     return(false);
 }
Beispiel #35
0
 /// <summary>
 /// 返回订单是否需要在线支付
 /// </summary>
 /// <param name="order_id">订单ID</param>
 /// <returns>bool</returns>
 protected bool get_order_payment_status(int order_id)
 {
     Model.orders model = new BLL.orders().GetModel(order_id);
     if (model == null)
     {
         return false;
     }
     if (model.status == 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;
 }
Beispiel #36
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int             site_payment_id = 0;                                                 //站点支付方式ID
            ResponseHandler resHandler      = new ResponseHandler(Context);                      //创建ResponseHandler实例
            string          notify_id       = resHandler.getParameter("notify_id");              //通知id
            string          out_trade_no    = resHandler.getParameter("out_trade_no").ToUpper(); //商户订单号
            string          transaction_id  = resHandler.getParameter("transaction_id");         //财付通订单号
            string          total_fee       = resHandler.getParameter("total_fee");              //金额,以分为单位
            string          discount        = resHandler.getParameter("discount");               //如果有使用折扣券,discount有值,total_fee+discount=原请求的total_fee
            string          trade_state     = resHandler.getParameter("trade_state");            //支付结果

            if (out_trade_no.StartsWith("R"))                                                    //充值订单
            {
                site_payment_id = new BLL.user_recharge().GetPaymentId(out_trade_no);
            }
            else if (out_trade_no.StartsWith("B")) //商品订单
            {
                site_payment_id = new BLL.orders().GetPaymentId(out_trade_no);
            }
            //找到站点支付方式ID开始验证
            if (site_payment_id > 0)
            {
                TenpayUtil config = new TenpayUtil(site_payment_id);
                resHandler.setKey(config.key);
                //判断签名
                if (resHandler.isTenpaySign())
                {
                    if ("0".Equals(trade_state))
                    {
                        //给财付通系统发送成功信息,财付通系统收到此结果后不再进行后续通知
                        Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=succeed&order_no=" + out_trade_no));
                        return;
                    }
                }
            }
            //认证签名失败
            Response.Redirect(new Web.UI.BasePage().linkurl("payment", "?action=error"));
            return;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                openid = MyCommFun.RequestOpenid();
                otid = MyCommFun.RequestInt("otid");
                int wid = MyCommFun.RequestWid();
                if (openid == "" || otid == 0 || wid == 0)
                {
                    return;
                }

                WeiXinCRMComm wxComm = new WeiXinCRMComm();
                string err = "";
                token = wxComm.getAccessToken(wid, out err);

                BLL.orders otBll = new BLL.orders();
                ordertmp = otBll.GetModel(otid, wid);

            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string action = MyCommFun.QueryString("act");
            Dictionary<string, string> jsonDict = new Dictionary<string, string>();

            if (action == "orderRet")
            {
                #region   //跳转到结果页面,查询订单的最终结果信息
                string openid = MyCommFun.RequestOpenid();
                int otid = MyCommFun.RequestInt("otid");
                jsonDict = new Dictionary<string, string>();
                if (openid == "" || otid == 0)
                {
                    jsonDict.Add("ret", "err");
                    jsonDict.Add("content", "抱歉,参数不正确!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                BLL.orders otBll = new BLL.orders();
                Model.orders ordertmp = otBll.GetModel(otid);
                if (ordertmp.payment_status == 2)
                {
                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "下单已经成功!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));

                }
                else
                {
                    jsonDict.Add("ret", "err");
                    jsonDict.Add("content", "下单失败!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                #endregion
            }


        }
Beispiel #39
0
        /// <summary>
        /// 返回订单商品列表
        /// </summary>
        /// <param name="order_id">订单</param>
        /// <returns>List</returns>
        public List <Model.article> get_order_goods_list(int order_id)
        {
            Model.orders model = new BLL.orders().GetModel(order_id);
            if (model == null)
            {
                return(null);
            }
            List <Model.article> ls = new List <Model.article>();

            if (model.order_goods != null)
            {
                foreach (Model.order_goods modelt in model.order_goods)
                {
                    Model.article goodsModel = new BLL.article().GetModel(modelt.channel_id, modelt.article_id);
                    if (goodsModel != null)
                    {
                        ls.Add(goodsModel);
                    }
                }
            }
            return(ls);
        }
Beispiel #40
0
 /// <summary>
 /// 返回订单是否需要在线支付
 /// </summary>
 /// <param name="order_id">订单ID</param>
 /// <returns>bool</returns>
 protected bool get_order_payment_status(int order_id)
 {
     Model.orders model = new BLL.orders().GetModel(order_id);
     if (model == null)
     {
         return(false);
     }
     if (model.status == 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 void RptBind(string _strWhere, string _orderby)
        {
            this.page = Vincent._DTcms.DTRequest.GetQueryInt("page", 1);
            //if (this.status > 0)
            //{
            //    this.ddlStatus.SelectedValue = this.status.ToString();
            //}
            //if (this.payment_status > 0)
            //{
            //    this.ddlPaymentStatus.SelectedValue = this.payment_status.ToString();
            //}
            //if (this.express_status > 0)
            //{
            //    this.ddlExpressStatus.SelectedValue = this.express_status.ToString();
            //}


            txtKeywords.Text = this.keywords;
            txtDate.Value    = this.keyDate;
            BLL.orders bll = new BLL.orders();
            BuysingooShop.Model.manager manModel = Session[Vincent._DTcms.DTKeys.SESSION_ADMIN_INFO] as Model.manager;
            //if (manModel.brand_id != 0)
            //{
            //    //_strWhere += " and brand_id=" + manModel.brand_id + "  and preID=" + uid;

            //    _strWhere += brend_id;//查询店长下线订单

            //}
            this.rptList.DataSource = bll.Getoutlet_fuwuzhanbystoreid(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Vincent._DTcms.Utils.CombUrlTxt("outlet_fuwuzhan.aspx", "status={0}&payment_status={1}&express_status={2}&keywords={3}&keyDate={4}&page={5}",
                                                             this.status.ToString(), this.payment_status.ToString(), this.express_status.ToString(), this.keywords, this.keyDate, "__id__");

            PageContent.InnerHtml = Vincent._DTcms.Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
Beispiel #42
0
        private void RptBind(string _strWhere, string _orderby)
        {
            this.page = Vincent._DTcms.DTRequest.GetQueryInt("page", 1);

            if (this.outlet_id > 0)
            {
                this.ddlGroupId.SelectedValue = this.outlet_id.ToString();
            }
            if (this.city_id > 0)
            {
                this.DropDownList1.SelectedValue = this.city_id.ToString();
            }

            BLL.orders bll = new BLL.orders();
            this.rptList.DataSource = bll.GetList1(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);
            this.rptList.DataBind();

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

            PageContent.InnerHtml = Vincent._DTcms.Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 15);
        }
Beispiel #43
0
        /// <summary>
        /// 订单详情页面
        /// </summary>
        public void orderDetail()
        {
            int wid = MyCommFun.RequestInt("wid");

            int orderId = MyCommFun.RequestInt("orderid");

            BLL.orders oBll = new BLL.orders();
            //Model.orders order = oBll.GetModel(orderId);
            IList <Model.orders> orderlist_detail = oBll.GetModelList(" id=" + orderId);

            if (orderlist_detail != null)
            {
                Model.orders order = orderlist_detail[0];
                this.Document.SetValue("order", order);
                string statusName = GetOrderStatus(order.status, order.payment_status, order.express_status);
                this.Document.SetValue("statusName", statusName);

                string paymentName = new MxWeiXinPF.BLL.payment().GetTitle(wid, order.payment_id);
                this.Document.SetValue("paymentName", paymentName);
                string expressName = new MxWeiXinPF.BLL.express().GetTitle(order.express_id);
                this.Document.SetValue("expressName", expressName);
            }
        }
Beispiel #44
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")));
         return;
     }
     model = bll.GetModel(id);
     if (model.user_id != userModel.id)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")));
         return;
     }
     payModel = new BLL.payment().GetModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     //根据订单状态和物流单号跟踪物流信息
     if (model.status > 1 && model.status < 4 && model.express_status == 2 && model.express_no.Trim().Length > 0)
     {
         Model.express modelt = new BLL.express().GetModel(model.express_id);
         Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
         if (modelt != null && modelt.express_code.Trim().Length > 0 && orderConfig.kuaidiapi != "")
         {
             string apiurl = orderConfig.kuaidiapi + "?id=" + orderConfig.kuaidikey + "&com=" + modelt.express_code + "&nu=" + model.express_no + "&show=" + orderConfig.kuaidishow + "&muti=" + orderConfig.kuaidimuti + "&order=" + orderConfig.kuaidiorder;
             string detail = Utils.HttpGet(@apiurl);
             if (detail != null)
             {
                 expressdetail = Utils.ToHtml(detail);
             }
         }
     }
 }
Beispiel #45
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string action = MyCommFun.QueryString("act");
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            if (action == "orderRet")
            {
                #region   //跳转到结果页面,查询订单的最终结果信息
                string openid = MyCommFun.RequestOpenid();
                int    otid   = MyCommFun.RequestInt("otid");
                jsonDict = new Dictionary <string, string>();
                if (openid == "" || otid == 0)
                {
                    jsonDict.Add("ret", "err");
                    jsonDict.Add("content", "抱歉,参数不正确!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                BLL.orders   otBll    = new BLL.orders();
                Model.orders ordertmp = otBll.GetModel(otid);
                if (ordertmp.payment_status == 2)
                {
                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "下单已经成功!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                else
                {
                    jsonDict.Add("ret", "err");
                    jsonDict.Add("content", "下单失败!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                #endregion
            }
        }
Beispiel #46
0
 /// <summary>
 /// 重写虚方法,此方法在Init事件执行
 /// </summary>
 protected override void InitPage()
 {
     id = DTRequest.GetQueryInt("id");
     BLL.orders bll = new BLL.orders();
     if (!bll.Exists(id))
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您要浏览的页面不存在或已删除!")));
         return;
     }
     model = bll.GetModel(id);
     if (model.user_id != userModel.id)
     {
         HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错了,您所查看的并非自己的订单信息!")));
         return;
     }
     payModel = new BLL.site_payment().GetPaymentModel(model.payment_id);
     if (payModel == null)
     {
         payModel = new Model.payment();
     }
     //根据订单状态和物流单号跟踪物流信息
     if (model.status > 1 && model.status < 4 && model.express_status == 2 && model.express_no.Trim().Length > 0)
     {
         Model.express     modelt      = new BLL.express().GetModel(model.express_id);
         Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
         if (modelt != null && modelt.express_code.Trim().Length > 0 && orderConfig.kuaidiapi != "")
         {
             string apiurl = orderConfig.kuaidiapi + "?id=" + orderConfig.kuaidikey + "&com=" + modelt.express_code + "&nu=" + model.express_no + "&show=" + orderConfig.kuaidishow + "&muti=" + orderConfig.kuaidimuti + "&order=" + orderConfig.kuaidiorder;
             string detail = Utils.HttpGet(@apiurl);
             if (detail != null)
             {
                 expressdetail = Utils.ToHtml(detail);
             }
         }
     }
 }
Beispiel #47
0
        private void ShowInfo(int _id)
        {
            BLL.orders bll = new BLL.orders();
            model = bll.GetModel(_id);
            //绑定商品列表
            this.rptList.DataSource = model.order_goods;
            this.rptList.DataBind();
            //获得会员信息
            if (model.user_id > 0)
            {
                Model.users user_info = new BLL.users().GetModel(model.user_id);
                if (user_info != null)
                {
                    Model.user_groups group_info = new BLL.user_groups().GetModel(user_info.group_id);
                    if (group_info != null)
                    {
                        dlUserInfo.Visible  = true;
                        lbUserName.Text     = user_info.user_name;
                        lbUserGroup.Text    = group_info.title;
                        lbUserDiscount.Text = group_info.discount.ToString() + " %";
                        lbUserAmount.Text   = user_info.amount.ToString();
                        lbUserPoint.Text    = user_info.point.ToString();
                    }
                }
            }
            //根据订单状态,显示各类操作按钮
            switch (model.status)
            {
            case 1:     //如果是线下支付,支付状态为0,如果是线上支付,支付成功后会自动改变订单状态为已确认
                if (model.payment_status > 0)
                {
                    //确认付款、取消订单、修改收货按钮显示
                    btnPayment.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true;
                }
                else
                {
                    //确认订单、取消订单、修改收货按钮显示
                    btnConfirm.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true;
                }
                //修改订单备注、修改商品总金额、修改配送费用、修改支付手续费、修改发票税金按钮显示
                btnEditRemark.Visible = btnEditRealAmount.Visible = btnEditExpressFee.Visible = btnEditPaymentFee.Visible = btnEditInvoiceTaxes.Visible = true;
                break;

            case 2:     //如果订单为已确认状态,则进入发货状态
                if (model.express_status == 1)
                {
                    //确认发货、取消订单、修改收货信息按钮显示
                    btnExpress.Visible = btnCancel.Visible = btnEditAcceptInfo.Visible = true;
                }
                else if (model.express_status == 2)
                {
                    //完成订单、取消订单按钮可见
                    btnComplete.Visible = btnCancel.Visible = true;
                }
                //修改订单备注按钮可见
                btnEditRemark.Visible = true;
                break;

            case 3:
                //作废订单、修改订单备注按钮可见
                btnInvalid.Visible = btnEditRemark.Visible = true;
                break;
            }
            //根据订单状态和物流单号跟踪物流信息
            if (model.express_status == 2 && model.express_no.Trim().Length > 0)
            {
                Model.express     modelt      = new BLL.express().GetModel(model.express_id);
                Model.orderconfig orderConfig = new BLL.orderconfig().loadConfig();
                if (modelt != null && modelt.express_code.Trim().Length > 0 && orderConfig.kuaidiapi != "")
                {
                    string apiurl = orderConfig.kuaidiapi + "?id=" + orderConfig.kuaidikey + "&com=" + modelt.express_code + "&nu=" + model.express_no + "&show=" + orderConfig.kuaidishow + "&muti=" + orderConfig.kuaidimuti + "&order=" + orderConfig.kuaidiorder;
                    string detail = Utils.HttpGet(@apiurl);
                    if (detail != null)
                    {
                        litExpressDetail.Text = Utils.ToHtml(detail);
                    }
                }
            }
        }
Beispiel #48
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //读取站点配置信息
            Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig();
            //=============================获得订单信息================================
            string  order_no     = MXRequest.GetFormString("pay_order_no").ToUpper(); //订单号
            decimal order_amount = MXRequest.GetFormDecimal("pay_order_amount", 0);   //订单金额
            string  user_name    = MXRequest.GetFormString("pay_user_name");          //支付用户名
            string  subject      = MXRequest.GetFormString("pay_subject");            //备注说明
            string  trans_type   = string.Empty;                                      //交易类型1实物2虚拟

            if (order_no == "" || order_amount == 0)
            {
                Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!")));
                return;
            }
            if (order_no.StartsWith("R")) //R开头为在线充值订单
            {
                Model.user_amount_log model = new BLL.user_amount_log().GetModel(order_no);
                if (model == null)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!")));
                    return;
                }
                if (model.value != order_amount)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!")));
                    return;
                }
                trans_type = "2";
            }
            else //B开头为商品订单
            {
                Model.orders model = new BLL.orders().GetModel(order_no);
                if (model == null)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!")));
                    return;
                }
                if (model.order_amount != order_amount)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!")));
                    return;
                }
                trans_type = "1";
            }
            //检查会员还是匿名
            if (user_name != "")
            {
                user_name = "支付会员:" + user_name;
            }
            else
            {
                user_name = "匿名用户";
            }

            //===============================请求参数==================================
            //创建RequestHandler实例
            RequestHandler reqHandler = new RequestHandler(Context);

            //初始化
            reqHandler.init();
            //设置密钥
            reqHandler.setKey(TenpayUtil.key);
            reqHandler.setGateUrl("https://gw.tenpay.com/gateway/pay.htm");
            //-----------------------------
            //设置支付参数
            //-----------------------------
            reqHandler.setParameter("partner", TenpayUtil.partner);                                  //商户号
            reqHandler.setParameter("out_trade_no", order_no);                                       //商家订单号
            reqHandler.setParameter("total_fee", (Convert.ToDouble(order_amount) * 100).ToString()); //商品金额,以分为单位
            reqHandler.setParameter("return_url", TenpayUtil.return_url);                            //交易完成后跳转的URL
            reqHandler.setParameter("notify_url", TenpayUtil.notify_url);                            //接收财付通通知的URL
            reqHandler.setParameter("body", user_name);                                              //商品描述
            reqHandler.setParameter("bank_type", "DEFAULT");                                         //银行类型(中介担保时此参数无效)
            reqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress);               //用户的公网ip,不是商户服务器IP
            reqHandler.setParameter("fee_type", "1");                                                //币种,1人民币
            reqHandler.setParameter("subject", siteConfig.webname + "-" + subject);                  //商品名称(中介交易时必填)

            //系统可选参数
            reqHandler.setParameter("sign_type", "MD5");
            reqHandler.setParameter("service_version", "1.0");
            reqHandler.setParameter("input_charset", "UTF-8");
            reqHandler.setParameter("sign_key_index", "1");

            //业务可选参数
            reqHandler.setParameter("product_fee", "0");                                    //商品费用,必须保证transport_fee + product_fee=total_fee
            reqHandler.setParameter("transport_fee", "0");                                  //物流费用,必须保证transport_fee + product_fee=total_fee
            reqHandler.setParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); //订单生成时间,格式为yyyymmddhhmmss
            reqHandler.setParameter("time_expire", "");                                     //订单失效时间,格式为yyyymmddhhmmss
            reqHandler.setParameter("buyer_id", "");                                        //买方财付通账号
            reqHandler.setParameter("goods_tag", "");                                       //商品标记
            reqHandler.setParameter("trade_mode", TenpayUtil.type);                         //交易模式,1即时到账(默认),2中介担保,3后台选择(买家进支付中心列表选择)
            reqHandler.setParameter("transport_desc", "");                                  //物流说明
            reqHandler.setParameter("trans_type", "1");                                     //交易类型,1实物交易,2虚拟交易
            reqHandler.setParameter("agentid", "");                                         //平台ID
            reqHandler.setParameter("agent_type", "");                                      //代理模式,0无代理(默认),1表示卡易售模式,2表示网店模式
            reqHandler.setParameter("seller_id", "");                                       //卖家商户号,为空则等同于partner

            //获取请求带参数的url
            string requestUrl = reqHandler.getRequestURL();

            //实现自动跳转===============================
            StringBuilder sbHtml = new StringBuilder();

            sbHtml.Append("<form id='tenpaysubmit' name='tenpaysubmit' action='" + reqHandler.getGateUrl() + "' method='get'>");
            Hashtable ht = reqHandler.getAllParameters();

            foreach (DictionaryEntry de in ht)
            {
                sbHtml.Append("<input type=\"hidden\" name=\"" + de.Key + "\" value=\"" + de.Value + "\" >\n");
            }
            //submit按钮控件请不要含有name属性
            sbHtml.Append("<input type='submit' value='确认' style='display:none;'></form>");
            sbHtml.Append("<script>document.forms['tenpaysubmit'].submit();</script>");

            Response.Write(sbHtml.ToString());
        }
Beispiel #49
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;
 }
Beispiel #50
0
 private void order_cancel(HttpContext context)
 {
     //检查用户是否登录
     Model.users userModel = new BasePage().GetUserInfo();
     if (userModel == null)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户没有登录或登录超时啦!\"}");
         return;
     }
     //检查订单是否存在
     string order_no = DTRequest.GetQueryString("order_no");
     Model.orders orderModel = new BLL.orders().GetModel(order_no);
     if (order_no == "" || orderModel == null)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,该订单号不存在啦!\"}");
         return;
     }
     //检查是否自己的订单
     if (userModel.id != orderModel.user_id)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,不能取消别人的订单状态!\"}");
         return;
     }
     //检查订单状态
     if (orderModel.status > 1)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,该订单不是生成状态,不能取消!\"}");
         return;
     }
     bool result = new BLL.orders().UpdateField(order_no, "status=4");
     if (!result)
     {
         context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,操作过程中发生不可遇知的错误!\"}");
         return;
     }
     //如果是积分换购则返还积分
     if (orderModel.point < 0)
     {
         new BLL.point_log().Add(orderModel.user_id, orderModel.user_name, -1 * orderModel.point, "取消订单,返还换购积分,订单号:" + orderModel.order_no);
     }
     context.Response.Write("{\"msg\":1, \"msgbox\":\"取消订单成功啦!\"}");
     return;
 }
Beispiel #51
0
        /// <summary>
        /// 将在Init事件执行
        /// </summary>
        protected void payment_Init(object sender, EventArgs e)
        {
            //取得处事类型
            action = DTRequest.GetString("action");
            order_type = DTRequest.GetString("order_type");
            order_no = DTRequest.GetString("order_no");
            
            switch (action)
            {
                case "confirm":
                    if (string.IsNullOrEmpty(action) || string.IsNullOrEmpty(order_type) || string.IsNullOrEmpty(order_no))
                    {
                        HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,URL传输参数有误!"));
                        return;
                    }
                    //检查用户是否登录
                    userModel = new Web.UI.BasePage().GetUserInfo();
                    if (userModel == null)
                    {
                        //用户未登录
                        HttpContext.Current.Response.Redirect(linkurl("payment", "login"));
                        return;
                    }
                    //检查订单的类型(充值或购物)
                    if (order_type == DTEnums.AmountTypeEnum.Recharge.ToString()) //充值
                    {
                        amountModel = new BLL.amount_log().GetModel(order_no);
                        if (amountModel == null)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!"));
                            return;
                        }
                        //检查订单号是否已支付
                        if (amountModel.status == 1)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment1", "succeed", order_type, amountModel.order_no));
                            return;
                        }
                        //检查支付方式
                        payModel = new BLL.payment().GetModel(amountModel.payment_id);
                        if (payModel == null)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!"));
                            return;
                        }
                        //检查是否线上支付
                        if (payModel.type == 2)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,账户充值不允许线下支付!"));
                            return;
                        }
                        order_amount = amountModel.value; //订单金额
                    }
                    else if (order_type == DTEnums.AmountTypeEnum.BuyGoods.ToString()) //购物
                    {
                        //检查订单是否存在
                        orderModel = new BLL.orders().GetModel(order_no);
                        if (orderModel == null)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!"));
                            return;
                        }
                        //检查是否已支付过
                        if (orderModel.payment_status == 2)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment1", "succeed", order_type, orderModel.order_no));
                            return;
                        }
                        //检查支付方式
                        payModel = new BLL.payment().GetModel(orderModel.payment_id);
                        if (payModel == null)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!"));
                            return;
                        }
                        //检查是否线下付款
                        if (payModel.type == 2)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment1", "succeed", order_type, orderModel.order_no));
                            return;
                        }
                        //检查是否积分换购,直接跳转成功页面
                        if (orderModel.order_amount == 0)
                        {
                            //修改订单状态
                            bool result = new BLL.orders().UpdateField(orderModel.order_no, "payment_status=2,payment_time='" + DateTime.Now + "'");
                            if (!result)
                            {
                                HttpContext.Current.Response.Redirect(linkurl("payment", "error"));
                                return;
                            }
                            HttpContext.Current.Response.Redirect(linkurl("payment1", "succeed", order_type, orderModel.order_no));
                            return;
                        }
                        order_amount = orderModel.order_amount; //订单金额
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!"));
                        return;
                    }
                    break;
                case "succeed":
                    //检查订单的类型(充值或购物)
                    if (order_type == DTEnums.AmountTypeEnum.Recharge.ToString()) //充值
                    {
                        amountModel = new BLL.amount_log().GetModel(order_no);
                        if (amountModel == null)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!"));
                            return;
                        }

                    }
                    else if (order_type == DTEnums.AmountTypeEnum.BuyGoods.ToString()) //购物
                    {
                        orderModel = new BLL.orders().GetModel(order_no);
                        if (orderModel == null)
                        {
                            HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!"));
                            return;
                        }
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect(config.webpath + "error.aspx?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!"));
                        return;
                    }
                    break;
            }
        }
Beispiel #52
0
        protected DataTable dt_other_goods     = new DataTable(); //其他商品表

        /// <summary>
        /// 重写虚方法,此方法将在Init事件前执行
        /// </summary>
        protected override void ShowPage()
        {
            id   = DTRequest.GetQueryInt("id");
            page = DTRequest.GetQueryString("page");
            BLL.article bll = new BLL.article();

            if (id > 0) //如果ID获取到,将使用ID
            {
                if (!bll.Exists(id))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
                    return;
                }
                model = bll.GetModel(id);
            }
            else if (!string.IsNullOrEmpty(page)) //否则检查设置的别名
            {
                if (!bll.Exists(page))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,您要浏览的页面不存在或已删除啦!")));
                    return;
                }
                model = bll.GetModel(page);
            }
            else
            {
                return;
            }
            //跳转URL
            if (model.link_url != null)
            {
                model.link_url = model.link_url.Trim();
            }
            if (!string.IsNullOrEmpty(model.link_url))
            {
                HttpContext.Current.Response.Redirect(model.link_url);
            }


            //销量
            DataTable dt_order_good_count = new BLL.orders().get_order_good_count(id).Tables[0];

            if (dt_order_good_count != null && dt_order_good_count.Rows.Count > 0)
            {
                order_sum = Convert.ToDecimal(dt_order_good_count.Rows[0]["quantity"]);
            }
            Model.article_category model_category = new BLL.article_category().GetModel(model.category_id);
            #region
            //规格表
            BLL.standard_price bll_standard_price = new BLL.standard_price();
            DataTable          dt_standard_price  = bll_standard_price.GetList("good_id=" + id).Tables[0];
            if (dt_standard_price != null && dt_standard_price.Rows.Count > 0)
            {
                BLL.standard bll_standard = new BLL.standard();

                if (model_category != null)
                {
                    DataTable dt_old_standard = bll_standard.GetList("'" + model_category.class_list + "' like '%,'+convert(nvarchar(10),category_id)+',%'").Tables[0];

                    dt_standard.Columns.Add("id", typeof(int));
                    dt_standard.Columns.Add("title", typeof(string));
                    dt_standard.Columns.Add("value", typeof(string));
                    dt_standard.PrimaryKey = new DataColumn[] { dt_standard.Columns["id"] };

                    foreach (DataRow dr in dt_old_standard.Rows)
                    {
                        //if(Convert.ToInt32(dr[""]))
                        DataRow new_dr = dt_standard.NewRow();
                        new_dr["id"]    = dr["id"];
                        new_dr["title"] = dr["title"];
                        DataTable dt_standard_value = new BLL.standard_value().GetList("standard_id=" + dr["id"].ToString()).Tables[0];
                        if (dt_standard_value != null || dt_standard_value.Rows.Count > 0)
                        {
                            string str_value = "";
                            foreach (DataRow dr_value in dt_standard_value.Rows)
                            {
                                str_value += dr_value["id"].ToString() + "|" + dr_value["value"].ToString() + ",";
                            }
                            new_dr["value"] = str_value.TrimEnd(',');
                            dt_standard.Rows.Add(new_dr);
                        }
                    }
                }
            }
            #endregion

            //单位表
            BLL.unit bll_unit = new BLL.unit();
            dt_unit = bll_unit.GetList("good_id=" + id).Tables[0];


            //套餐()
            BLL.meal_good bll_meal_good = new BLL.meal_good();
            BLL.meal      bll_meal      = new BLL.meal();
            dt_meal = bll_meal.GetMealByGood(id, "jiejuefangan").Tables[0];

            dt_meal.TableName = "dt_meal";
            if (dt_meal != null && dt_meal.Rows.Count > 0)
            {
                //套餐商品
                DataTable old_dt_meal_good = bll_meal_good.GetList("meal_id=" + dt_meal.Rows[0]["id"].ToString()).Tables[0];
                dt_meal_good = new DataTable();
                dt_meal_good.Columns.Add("meal_id");
                dt_meal_good.Columns.Add("good_standard_price");
                dt_meal_good.Columns.Add("title");
                dt_meal_good.Columns.Add("all_title");
                dt_meal_good.Columns.Add("img_url");
                dt_meal_good.Columns.Add("good_id");
                dt_meal_good.Columns.Add("price");
                string str_meal_good_ids = ",";
                if (old_dt_meal_good != null && old_dt_meal_good.Rows.Count > 0)
                {
                    foreach (DataRow dr in old_dt_meal_good.Rows)
                    {
                        if (str_meal_good_ids.IndexOf("," + dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",") > -1)
                        {
                            continue;
                        }
                        str_meal_good_ids += dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",";
                        Model.article modelt = bll.GetModel(Convert.ToInt32(dr["good_id"]));
                        if (modelt != null)
                        {
                            Model.standard_price model_standard_price = bll_standard_price.GetModel(Convert.ToDecimal(dr["standard_price_id"]));
                            string str_standard_price = "";
                            string str_unit           = "";
                            if (model_standard_price != null)
                            {
                                for (int i = 0; i < model_standard_price.standards.Split(',').Length; i++)
                                {
                                    if (!string.IsNullOrEmpty(model_standard_price.standards.Split(',')[i]))
                                    {
                                        str_standard_price += model_standard_price.standards.Split(',')[i];
                                        if (i < model_standard_price.standard_values.Split(',').Length)
                                        {
                                            str_standard_price += ":" + model_standard_price.standard_values.Split(',')[i];
                                        }
                                    }
                                }
                            }

                            Model.unit model_unit = bll_unit.GetModel(Convert.ToDecimal(dr["unit_id"]));
                            if (model_unit != null)
                            {
                                str_unit += "单位:" + model_unit.title + (string.IsNullOrEmpty(model_unit.content) ? "" : model_unit.content);
                            }


                            DataRow new_dr = dt_meal_good.NewRow();
                            new_dr["meal_id"]             = dr["meal_id"];
                            new_dr["title"]               = Utils.CutString(modelt.title, 10);
                            new_dr["good_standard_price"] = dr["good_id"].ToString() + dr["standard_price_id"].ToString();
                            new_dr["all_title"]           = modelt.title + " " + str_standard_price + str_unit;
                            new_dr["img_url"]             = modelt.img_url;
                            new_dr["price"]               = dr["sell_price"];
                            new_dr["good_id"]             = dr["good_id"];

                            dt_meal_good.Rows.Add(new_dr);
                        }
                    }
                    dt_meal_good.TableName = "dt_meal_good";
                }
            }


            //属性表
            BLL.property_good  bll_property_good  = new BLL.property_good();
            BLL.property       bll_property       = new BLL.property();
            BLL.property_value bll_property_value = new BLL.property_value();

            DataTable dt_old_property = bll_property_good.GetList("good_id=" + id).Tables[0];
            dt_property.Columns.Add("id");
            dt_property.Columns.Add("title");
            dt_property.Columns.Add("value");
            dt_property.PrimaryKey = new DataColumn[] { dt_property.Columns["id"] };

            foreach (DataRow dr in dt_old_property.Rows)
            {
                Model.property       model_property       = bll_property.GetModel(Convert.ToInt32(dr["property_id"]));
                Model.property_value model_property_value = bll_property_value.GetModel(Convert.ToDecimal(dr["property_value_id"]));
                if (model != null && model_property_value != null)
                {
                    if (dt_property.Rows.Find(dr["property_id"]) != null)
                    {
                        dt_property.Rows.Find(dr["property_id"])["value"] = dt_property.Rows.Find(dr["property_id"])["value"].ToString() + "," + model_property_value.value;
                    }
                    else
                    {
                        DataRow new_dr = dt_property.NewRow();
                        new_dr["id"]    = dr["property_id"];
                        new_dr["title"] = model_property.title;
                        new_dr["value"] = model_property_value.value;
                        dt_property.Rows.Add(new_dr);
                    }
                }
            }


            //标签
            BLL.tag_good bll_tag_good = new BLL.tag_good();
            DataTable    dt_tag_good  = bll_tag_good.GetList("good_id=" + id).Tables[0];
            dt_tag.Columns.Add("title");
            foreach (DataRow dr in dt_tag_good.Rows)
            {
                Model.tag model_tag = new BLL.tag().GetModel(Convert.ToInt32(dr["tag_id"]));
                if (model_tag != null)
                {
                    DataRow new_dr = dt_tag.NewRow();
                    new_dr["title"] = model_tag.title;
                    dt_tag.Rows.Add(new_dr);
                }
            }


            //推荐搭配
            dt_red = bll_meal.GetMealByGood(id, "tuijiandapei").Tables[0];

            dt_red.TableName = "dt_red";
            if (dt_red != null && dt_red.Rows.Count > 0)
            {
                DataTable old_dt_red_good = bll_meal_good.GetList("meal_id=" + dt_red.Rows[0]["id"].ToString()).Tables[0];


                dt_red_good = new DataTable();
                dt_red_good.Columns.Add("meal_id");
                dt_red_good.Columns.Add("good_standard_price");
                dt_red_good.Columns.Add("title");
                dt_red_good.Columns.Add("all_title");
                dt_red_good.Columns.Add("good_id");
                dt_red_good.Columns.Add("img_url");
                dt_red_good.Columns.Add("price");
                string str_red_good_ids = ",";
                if (old_dt_red_good != null && old_dt_red_good.Rows.Count > 0)
                {
                    foreach (DataRow dr in old_dt_red_good.Rows)
                    {
                        if (str_red_good_ids.IndexOf("," + dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",") > -1)
                        {
                            continue;
                        }
                        str_red_good_ids += dr["good_id"].ToString() + "_" + dr["standard_price_id"].ToString() + ",";
                        Model.article modelt = bll.GetModel(Convert.ToInt32(dr["good_id"]));
                        if (modelt != null)
                        {
                            Model.standard_price model_standard_price = bll_standard_price.GetModel(Convert.ToDecimal(dr["standard_price_id"]));
                            string str_standard_price = "";
                            string str_unit           = "";
                            if (model_standard_price != null)
                            {
                                for (int i = 0; i < model_standard_price.standards.Split(',').Length; i++)
                                {
                                    if (!string.IsNullOrEmpty(model_standard_price.standards.Split(',')[i]))
                                    {
                                        str_standard_price += model_standard_price.standards.Split(',')[i];
                                        if (i < model_standard_price.standard_values.Split(',').Length)
                                        {
                                            str_standard_price += ":" + model_standard_price.standard_values.Split(',')[i];
                                        }
                                    }
                                }
                            }

                            Model.unit model_unit = bll_unit.GetModel(Convert.ToDecimal(dr["unit_id"]));
                            if (model_unit != null)
                            {
                                str_unit += "单位:" + model_unit.title + (string.IsNullOrEmpty(model_unit.content) ? "" : model_unit.content);
                            }


                            DataRow new_dr = dt_red_good.NewRow();
                            new_dr["meal_id"]             = dr["meal_id"];
                            new_dr["title"]               = Utils.CutString(modelt.title, 10);
                            new_dr["good_standard_price"] = dr["good_id"].ToString() + dr["standard_price_id"].ToString();
                            new_dr["all_title"]           = modelt.title + " " + str_standard_price + str_unit;
                            new_dr["img_url"]             = modelt.img_url;
                            new_dr["price"]               = dr["sell_price"];
                            new_dr["good_id"]             = dr["good_id"];

                            dt_red_good.Rows.Add(new_dr);
                        }
                    }
                    dt_red_good.TableName = "dt_red_good";
                }
            }

            //类别相关
            if (model_category != null)
            {
                if (new BLL.article_category().GetModel(model_category.parent_id) != null)
                {
                    parent_category_title = new BLL.article_category().GetModel(model_category.parent_id).title;
                    dt_category           = new BLL.article_category().GetList(model_category.parent_id, "goods");
                }
                dt_other_goods = bll.get_order_buy_good(5, model_category.id).Tables[0];
            }
        }
Beispiel #53
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //读取站点配置信息
            Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig();
            string           order_no   = MXRequest.GetFormString("pay_order_no").ToUpper();

            BLL.orders   objorders   = new BLL.orders();
            Model.orders modelorders = objorders.GetModel(order_no);
            if (modelorders == null)
            {
                Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,订单详情获取出错,请重试!")));
                return;
            }
            decimal order_amount = modelorders.payable_amount;
            string  subject      = MXRequest.GetFormString("pay_subject");

            if (order_no == "" || order_amount == 0)
            {
                Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!")));
                return;
            }
            //检查是否已登录
            Model.users userModel = new Web.UI.BasePage().GetUserInfo();
            if (userModel == null)
            {
                Response.Redirect(new Web.UI.BasePage().linkurl("payment", "login")); //尚未登录
                return;
            }
            if (userModel.amount < order_amount)
            {
                Response.Redirect(new Web.UI.BasePage().linkurl("payment", "recharge")); //账户的余额不足
                return;
            }

            if (order_no.StartsWith("B")) //B开头为商品订单
            {
                BLL.orders   bll   = new BLL.orders();
                Model.orders model = bll.GetModel(order_no);
                if (model == null)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,商品订单号不存在!")));
                    return;
                }
                if (model.payment_status == 1)
                {
                    //执行扣取账户金额
                    int result = new BLL.user_amount_log().Add(userModel.id, userModel.user_name, MXEnums.AmountTypeEnum.BuyGoods.ToString(), order_no, model.payment_id, -1 * order_amount, subject, 1);
                    if (result > 0)
                    {
                        //更改订单状态
                        bool result1 = bll.UpdateField(order_no, "status=2,payment_status=2,payment_time='" + DateTime.Now + "'");
                        if (!result1)
                        {
                            Response.Redirect(new Web.UI.BasePage().linkurl("payment", "error"));
                            return;
                        }
                        //扣除积分
                        if (model.point < 0)
                        {
                            new BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "换购扣除积分,订单号:" + model.order_no, false);
                        }
                    }
                    else
                    {
                        Response.Redirect(new Web.UI.BasePage().linkurl("payment", "error"));
                        return;
                    }
                }
                //支付成功
                Response.Redirect(new Web.UI.BasePage().linkurl("payment", "succeed", order_no));
                return;
            }
            Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,找不到需要支付的订单类型!")));
            return;
        }
Beispiel #54
0
        /// <summary>
        /// 将在Init事件执行
        /// </summary>
        protected void payment_Init(object sender, EventArgs e)
        {
            //取得处事类型
            action = DTRequest.GetString("action");
            order_no = DTRequest.GetString("order_no");
            if (order_no.ToUpper().StartsWith("R")) //充值订单
            {
                order_type = DTEnums.AmountTypeEnum.Recharge.ToString().ToLower();
            }
            else if (order_no.ToUpper().StartsWith("B")) //商品订单
            {
                order_type = DTEnums.AmountTypeEnum.BuyGoods.ToString().ToLower();
            }
            
            switch (action)
            {
                case "confirm":
                    if (string.IsNullOrEmpty(action) || string.IsNullOrEmpty(order_no))
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,URL传输参数有误!")));
                        return;
                    }
                    //是否需要支持匿名购物
                    userModel = new Web.UI.BasePage().GetUserInfo(); //取得用户登录信息
                    if (orderConfig.anonymous == 0 || order_no.ToUpper().StartsWith("R"))
                    {
                        if (userModel == null)
                        {
                            //用户未登录
                            HttpContext.Current.Response.Redirect(linkurl("payment", "?action=login"));
                            return;
                        }
                    }
                    else if (userModel == null)
                    {
                        userModel = new Model.users();
                    }
                    //检查订单的类型(充值或购物)
                    if (order_no.ToUpper().StartsWith("R")) //充值订单
                    {
                        rechargeModel = new BLL.user_recharge().GetModel(order_no);
                        if (rechargeModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                            return;
                        }
                        //检查订单号是否已支付
                        if (rechargeModel.status == 1)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + rechargeModel.recharge_no));
                            return;
                        }
                        //检查支付方式
                        payModel = new BLL.payment().GetModel(rechargeModel.payment_id);
                        if (payModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!")));
                            return;
                        }
                        //检查是否线上支付
                        if (payModel.type == 2)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,账户充值不允许线下支付!")));
                            return;
                        }
                        order_amount = rechargeModel.amount; //订单金额
                    }
                    else if (order_no.ToUpper().StartsWith("B")) //商品订单
                    {
                        //检查订单是否存在
                        orderModel = new BLL.orders().GetModel(order_no);
                        if (orderModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                            return;
                        }
                        //检查是否已支付过
                        if (orderModel.payment_status == 2)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + orderModel.order_no));
                            return;
                        }
                        //检查支付方式
                        payModel = new BLL.payment().GetModel(orderModel.payment_id);
                        if (payModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!")));
                            return;
                        }
                        //检查是否线下付款
                        if (orderModel.payment_status == 0)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + orderModel.order_no));
                            return;
                        }
                        //检查是否积分换购,直接跳转成功页面
                        if (orderModel.order_amount == 0)
                        {
                            //修改订单状态
                            bool result = new BLL.orders().UpdateField(orderModel.order_no, "status=2,payment_status=2,payment_time='" + DateTime.Now + "'");
                            if (!result)
                            {
                                HttpContext.Current.Response.Redirect(linkurl("payment", "?action=error"));
                                return;
                            }
                            HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + orderModel.order_no));
                            return;
                        }
                        order_amount = orderModel.order_amount; //订单金额
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!")));
                        return;
                    }
                    break;
                case "succeed":
                    //检查订单的类型(充值或购物)
                    if (order_no.ToUpper().StartsWith("R")) //充值订单
                    {
                        rechargeModel = new BLL.user_recharge().GetModel(order_no);
                        if (rechargeModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                            return;
                        }

                    }
                    else if (order_no.ToUpper().StartsWith("B")) //商品订单
                    {
                        orderModel = new BLL.orders().GetModel(order_no);
                        if (orderModel == null)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                            return;
                        }
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!")));
                        return;
                    }
                    break;
            }
        }
Beispiel #55
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //读取站点配置信息
            Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig();

            //=============================获得订单信息================================
            string order_no = DTRequest.GetFormString("pay_order_no").ToUpper();
            decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0);
            string user_name = DTRequest.GetFormString("pay_user_name");
            string subject = DTRequest.GetFormString("pay_subject");
            //以下收货人信息
            string receive_name = string.Empty; //收货人姓名
            string receive_address = string.Empty; //收货人地址
            string receive_zip = string.Empty; //收货人邮编
            string receive_phone = string.Empty; //收货人电话
            string receive_mobile = string.Empty; //收货人手机
            //检查参数是否正确
            if (string.IsNullOrEmpty(order_no) || order_amount == 0)
            {
                Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!")));
                return;
            }
            if (order_no.StartsWith("R")) //R开头为在线充值订单
            {
                Model.user_recharge model = new BLL.user_recharge().GetModel(order_no);
                if (model == null)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!")));
                    return;
                }
                if (model.amount != order_amount)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!")));
                    return;
                }
                //取得用户信息
                Model.users userModel = new BLL.users().GetModel(model.user_id);
                if (userModel == null)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,用户账户不存在或已删除!")));
                    return;
                }
                receive_name = userModel.nick_name;
                receive_address = userModel.address;
                receive_phone = userModel.telphone;
                receive_mobile = userModel.mobile;
            }
            else //B开头为商品订单
            {
                Model.orders model = new BLL.orders().GetModel(order_no);
                if (model == null)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!")));
                    return;
                }
                if (model.order_amount != order_amount)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!")));
                    return;
                }
                receive_name = model.accept_name;
                receive_address = model.address;
                receive_zip = model.post_code;
                receive_phone = model.telphone;
                receive_mobile = model.mobile;
            }
            if (user_name != "")
            {
                user_name = "支付会员:" + user_name;
            }
            else
            {
                user_name = "匿名用户";
            }

            //===============================请求参数==================================

            //判断担保或是即时到帐接口
            if (Config.Type == "1") //即时到帐
            {
                //把请求参数打包成数组
                SortedDictionary<string, string> sParaTemp = new SortedDictionary<string, string>();
                sParaTemp.Add("payment_type", "1"); //收款类型1商品购买
                sParaTemp.Add("show_url", siteConfig.weburl); //商品展示地址
                sParaTemp.Add("out_trade_no", order_no); //网站订单号
                sParaTemp.Add("subject", siteConfig.webname + "-" + subject); //订单名称
                sParaTemp.Add("body", user_name); //订单描述
                sParaTemp.Add("total_fee", order_amount.ToString()); //订单总金额
                sParaTemp.Add("paymethod", ""); //默认支付方式
                sParaTemp.Add("defaultbank", ""); //默认网银代号
                sParaTemp.Add("anti_phishing_key", ""); //防钓鱼时间戳
                sParaTemp.Add("exter_invoke_ip", DTRequest.GetIP()); ////获取客户端的IP地址
                sParaTemp.Add("buyer_email", ""); //默认买家支付宝账号
                sParaTemp.Add("royalty_type", "");
                sParaTemp.Add("royalty_parameters", "");

                //构造即时到帐接口表单提交HTML数据,无需修改
                Service ali = new Service();
                string sHtmlText = ali.Create_direct_pay_by_user(sParaTemp);
                Response.Write(sHtmlText);
            }
            else //担保交易
            {
                //把请求参数打包成数组
                SortedDictionary<string, string> sParaTemp = new SortedDictionary<string, string>();
                sParaTemp.Add("payment_type", "1"); //收款类型1商品购买
                sParaTemp.Add("out_trade_no", order_no); //网站订单号
                sParaTemp.Add("subject", siteConfig.webname + "-" + subject); //订单名称
                sParaTemp.Add("price", order_amount.ToString()); //付款金额
                sParaTemp.Add("quantity", "1"); //建议默认为1,不改变值,把一次交易看成是一次下订单而非购买一件商品
                sParaTemp.Add("logistics_fee", "0.00"); //物流费用
                sParaTemp.Add("logistics_type", "EXPRESS"); //物流类型,EXPRESS(快递)、POST(平邮)、EMS(EMS)
                sParaTemp.Add("logistics_payment", "SELLER_PAY"); //物流支付方式,SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费)
                sParaTemp.Add("body", user_name); //订单描述
                sParaTemp.Add("show_url", siteConfig.weburl); //商品展示地址
                sParaTemp.Add("receive_name", receive_name); //收货人姓名
                sParaTemp.Add("receive_address", receive_address); //收货人地址
                sParaTemp.Add("receive_zip", receive_zip); //收货人邮编
                sParaTemp.Add("receive_phone", receive_phone); //收货人电话号码
                sParaTemp.Add("receive_mobile", receive_mobile); //收货人手机号码
                //构造即时到帐接口表单提交HTML数据,无需修改
                Service ali = new Service();
                string sHtmlText = ali.Create_partner_trade_by_buyer(sParaTemp);
                Response.Write(sHtmlText);
            }
        }
Beispiel #56
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int site_payment_id = 0; //站点支付方式ID
            SortedDictionary <string, string> sPara = GetRequestPost();

            if (sPara.Count > 0)                                                     //判断是否有带返回参数
            {
                string trade_no     = DTRequest.GetString("trade_no");               //支付宝交易号
                string order_no     = DTRequest.GetString("out_trade_no").ToUpper(); //获取订单号
                string total_fee    = DTRequest.GetString("total_fee");              //获取总金额
                string trade_status = DTRequest.GetString("trade_status");           //交易状态
                if (order_no.StartsWith("R"))                                        //充值订单
                {
                    site_payment_id = new BLL.user_recharge().GetPaymentId(order_no);
                }
                else if (order_no.StartsWith("B")) //商品订单
                {
                    site_payment_id = new BLL.orders().GetPaymentId(order_no);
                }
                if (site_payment_id == 0)
                {
                    Response.Write("该订单号不存在");
                    return;
                }

                //找到站点支付方式ID开始验证
                Notify aliNotify    = new Notify(site_payment_id);
                bool   verifyResult = aliNotify.Verify(sPara, DTRequest.GetString("notify_id"), DTRequest.GetString("sign"));

                if (verifyResult)//验证成功
                {
                    if (trade_status == "TRADE_FINISHED" || trade_status == "TRADE_SUCCESS")
                    {
                        if (order_no.StartsWith("R")) //充值订单
                        {
                            BLL.user_recharge   bll   = new BLL.user_recharge();
                            Model.user_recharge model = bll.GetModel(order_no);
                            if (model == null)
                            {
                                Response.Write("该订单号不存在");
                                return;
                            }
                            if (model.status == 1) //已成功
                            {
                                Response.Write("success");
                                return;
                            }
                            if (model.amount != decimal.Parse(total_fee))
                            {
                                Response.Write("订单金额和支付金额不相符");
                                return;
                            }
                            bool result = bll.Confirm(order_no);
                            if (!result)
                            {
                                Response.Write("修改订单状态失败");
                                return;
                            }
                        }
                        else if (order_no.StartsWith("B")) //商品订单
                        {
                            BLL.orders   bll   = new BLL.orders();
                            Model.orders model = bll.GetModel(order_no);
                            if (model == null)
                            {
                                Response.Write("该订单号不存在");
                                return;
                            }
                            if (model.payment_status == 2) //已付款
                            {
                                Response.Write("success");
                                return;
                            }
                            if (model.order_amount != decimal.Parse(total_fee))
                            {
                                Response.Write("订单金额和支付金额不相符");
                                return;
                            }
                            bool result = bll.UpdateField(order_no, "trade_no='" + trade_no + "',status=2,payment_status=2,payment_time='" + DateTime.Now + "'");
                            if (!result)
                            {
                                Response.Write("修改订单状态失败");
                                return;
                            }
                            //扣除积分
                            if (model.point < 0)
                            {
                                new BLL.user_point_log().Add(model.user_id, model.user_name, model.point, "换购扣除积分,订单号:" + model.order_no, false);
                            }
                        }
                    }

                    Response.Write("success");  //请不要修改或删除
                }
                else//验证失败
                {
                    Response.Write("fail");
                }
            }
            else
            {
                Response.Write("无通知参数");
            }
        }
Beispiel #57
0
 private void ShowInfo(int _id)
 {
     BLL.orders bll = new BLL.orders();
     model = bll.GetModelGoods(_id);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            SortedDictionary<string, string> sPara = GetRequestPost();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify = new Notify();
                bool verifyResult = aliNotify.Verify(sPara, DTRequest.GetString("notify_id"), DTRequest.GetString("sign"));

                if (verifyResult)//验证成功
                {
                    string trade_no = DTRequest.GetString("trade_no"); //支付宝交易号
                    string order_no = DTRequest.GetString("out_trade_no"); //获取订单号
                    string total_fee = DTRequest.GetString("total_fee"); //获取总金额
                    string subject = DTRequest.GetString("subject"); //商品名称、订单名称
                    string body = DTRequest.GetString("body"); //商品描述、订单备注、描述
                    string buyer_email = DTRequest.GetString("buyer_email"); //买家支付宝账号
                    string trade_status = DTRequest.GetString("trade_status"); //交易状态
                    string order_type = DTRequest.GetString("extra_common_param"); //订单交易类别

                    if (DTRequest.GetString("trade_status") == "TRADE_FINISHED" || DTRequest.GetString("trade_status") == "TRADE_SUCCESS")
                    {
                        //修改支付状态、时间
                        if (order_type.ToLower() == DTEnums.AmountTypeEnum.Recharge.ToString().ToLower()) //在线充值
                        {
                            BLL.amount_log bll = new BLL.amount_log();
                            Model.amount_log model = bll.GetModel(order_no);
                            if (model == null)
                            {
                                Response.Write("该订单号不存在");
                                return;
                            }
                            if (model.value != decimal.Parse(total_fee))
                            {
                                Response.Write("订单金额和支付金额不相符");
                                return;
                            }
                            model.status = 1;
                            model.complete_time = DateTime.Now;
                            bool result = bll.Update(model);
                            if (!result)
                            {
                                Response.Write("修改订单状态失败");
                                return;
                            }
                        }
                        else
                            if (order_type.ToLower() == DTEnums.AmountTypeEnum.BuyGoods.ToString().ToLower()) //购买商品
                            {
                                BLL.orders bll = new BLL.orders();
                                Model.orders model = bll.GetModel(order_no);
                                if (model == null)
                                {
                                    Response.Write("该订单号不存在");
                                    return;
                                }
                                if (model.order_amount != decimal.Parse(total_fee))
                                {
                                    Response.Write("订单金额和支付金额不相符");
                                    return;
                                }
                                bool result = bll.UpdateField(order_no, "payment_status=2,payment_time='" + DateTime.Now + "'");
                                if (!result)
                                {
                                    Response.Write("修改订单状态失败");
                                    return;
                                }
                                //扣除积分
                                if (model.point < 0)
                                {
                                    new BLL.point_log().Add(model.user_id, model.user_name, model.point, "换购扣除积分,订单号:" + model.order_no);
                                }
                            }
                    }

                    Response.Write("success"); //请不要修改或删除
                }
                else//验证失败
                {
                    Response.Write("fail");
                }
            }
            else
            {
                Response.Write("无通知参数");
            }
        }
Beispiel #59
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //读取站点配置信息
            Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig();

            //=============================获得订单信息================================
            string  order_no     = DTRequest.GetFormString("pay_order_no").ToUpper();
            decimal order_amount = DTRequest.GetFormDecimal("pay_order_amount", 0);
            string  user_name    = DTRequest.GetFormString("pay_user_name");
            string  subject      = DTRequest.GetFormString("pay_subject");
            //以下收货人信息
            string receive_name    = string.Empty; //收货人姓名
            string receive_address = string.Empty; //收货人地址
            string receive_zip     = string.Empty; //收货人邮编
            string receive_phone   = string.Empty; //收货人电话
            string receive_mobile  = string.Empty; //收货人手机

            //检查参数是否正确
            if (string.IsNullOrEmpty(order_no) || order_amount == 0)
            {
                Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您提交的参数有误!")));
                return;
            }
            if (order_no.StartsWith("R")) //R开头为在线充值订单
            {
                Model.user_recharge model = new BLL.user_recharge().GetModel(order_no);
                if (model == null)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单号不存在或已删除!")));
                    return;
                }
                if (model.amount != order_amount)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您充值的订单金额与实际金额不一致!")));
                    return;
                }
                //取得用户信息
                Model.users userModel = new BLL.users().GetModel(model.user_id);
                if (userModel == null)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,用户账户不存在或已删除!")));
                    return;
                }
                receive_name    = userModel.nick_name;
                receive_address = userModel.address;
                receive_phone   = userModel.telphone;
                receive_mobile  = userModel.mobile;
            }
            else //B开头为商品订单
            {
                Model.orders model = new BLL.orders().GetModel(order_no);
                if (model == null)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单号不存在或已删除!")));
                    return;
                }
                if (model.order_amount != order_amount)
                {
                    Response.Redirect(new Web.UI.BasePage().linkurl("error", "?msg=" + Utils.UrlEncode("对不起,您支付的订单金额与实际金额不一致!")));
                    return;
                }
                receive_name    = model.accept_name;
                receive_address = model.address;
                receive_zip     = model.post_code;
                receive_phone   = model.telphone;
                receive_mobile  = model.mobile;
            }
            if (user_name != "")
            {
                user_name = "支付会员:" + user_name;
            }
            else
            {
                user_name = "匿名用户";
            }

            //===============================请求参数==================================

            //判断担保或是即时到帐接口
            if (Config.Type == "1") //即时到帐
            {
                //把请求参数打包成数组
                SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();
                sParaTemp.Add("payment_type", "1");                           //收款类型1商品购买
                sParaTemp.Add("show_url", siteConfig.weburl);                 //商品展示地址
                sParaTemp.Add("out_trade_no", order_no);                      //网站订单号
                sParaTemp.Add("subject", siteConfig.webname + "-" + subject); //订单名称
                sParaTemp.Add("body", user_name);                             //订单描述
                sParaTemp.Add("total_fee", order_amount.ToString());          //订单总金额
                sParaTemp.Add("paymethod", "");                               //默认支付方式
                sParaTemp.Add("defaultbank", "");                             //默认网银代号
                sParaTemp.Add("anti_phishing_key", "");                       //防钓鱼时间戳
                sParaTemp.Add("exter_invoke_ip", DTRequest.GetIP());          ////获取客户端的IP地址
                sParaTemp.Add("buyer_email", "");                             //默认买家支付宝账号
                sParaTemp.Add("royalty_type", "");
                sParaTemp.Add("royalty_parameters", "");

                //构造即时到帐接口表单提交HTML数据,无需修改
                Service ali       = new Service();
                string  sHtmlText = ali.Create_direct_pay_by_user(sParaTemp);
                Response.Write(sHtmlText);
            }
            else //担保交易
            {
                //把请求参数打包成数组
                SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();
                sParaTemp.Add("payment_type", "1");                           //收款类型1商品购买
                sParaTemp.Add("out_trade_no", order_no);                      //网站订单号
                sParaTemp.Add("subject", siteConfig.webname + "-" + subject); //订单名称
                sParaTemp.Add("price", order_amount.ToString());              //付款金额
                sParaTemp.Add("quantity", "1");                               //建议默认为1,不改变值,把一次交易看成是一次下订单而非购买一件商品
                sParaTemp.Add("logistics_fee", "0.00");                       //物流费用
                sParaTemp.Add("logistics_type", "EXPRESS");                   //物流类型,EXPRESS(快递)、POST(平邮)、EMS(EMS)
                sParaTemp.Add("logistics_payment", "SELLER_PAY");             //物流支付方式,SELLER_PAY(卖家承担运费)、BUYER_PAY(买家承担运费)
                sParaTemp.Add("body", user_name);                             //订单描述
                sParaTemp.Add("show_url", siteConfig.weburl);                 //商品展示地址
                sParaTemp.Add("receive_name", receive_name);                  //收货人姓名
                sParaTemp.Add("receive_address", receive_address);            //收货人地址
                sParaTemp.Add("receive_zip", receive_zip);                    //收货人邮编
                sParaTemp.Add("receive_phone", receive_phone);                //收货人电话号码
                sParaTemp.Add("receive_mobile", receive_mobile);              //收货人手机号码
                //构造即时到帐接口表单提交HTML数据,无需修改
                Service ali       = new Service();
                string  sHtmlText = ali.Create_partner_trade_by_buyer(sParaTemp);
                Response.Write(sHtmlText);
            }
        }
Beispiel #60
0
        /// <summary>
        /// 将在Init事件执行
        /// </summary>
        protected void payment_Init(object sender, EventArgs e)
        {
            //取得处事类型
            action   = DTRequest.GetString("action");
            order_no = DTRequest.GetString("order_no");
            if (order_no.ToUpper().StartsWith("R")) //充值订单
            {
                order_type = DTEnums.AmountTypeEnum.Recharge.ToString().ToLower();
            }
            else if (order_no.ToUpper().StartsWith("B")) //商品订单
            {
                order_type = DTEnums.AmountTypeEnum.BuyGoods.ToString().ToLower();
            }

            switch (action)
            {
            case "confirm":
                if (string.IsNullOrEmpty(action) || string.IsNullOrEmpty(order_no))
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,URL传输参数有误!")));
                    return;
                }
                //是否需要支持匿名购物
                userModel = new Web.UI.BasePage().GetUserInfo();     //取得用户登录信息
                if (orderConfig.anonymous == 0 || order_no.ToUpper().StartsWith("R"))
                {
                    if (userModel == null)
                    {
                        //用户未登录
                        HttpContext.Current.Response.Redirect(linkurl("payment", "?action=login"));
                        return;
                    }
                }
                else if (userModel == null)
                {
                    userModel = new Model.users();
                }
                //检查订单的类型(充值或购物)
                if (order_no.ToUpper().StartsWith("R"))     //充值订单
                {
                    rechargeModel = new BLL.user_recharge().GetModel(order_no);
                    if (rechargeModel == null)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                        return;
                    }
                    //检查订单号是否已支付
                    if (rechargeModel.status == 1)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + rechargeModel.recharge_no));
                        return;
                    }
                    //检查支付方式
                    payModel = new BLL.site_payment().GetPaymentModel(rechargeModel.payment_id);
                    if (payModel == null)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!")));
                        return;
                    }
                    //检查是否线上支付
                    if (payModel.type == 2)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,账户充值不允许线下支付!")));
                        return;
                    }
                    order_amount = rechargeModel.amount;     //订单金额
                }
                else if (order_no.ToUpper().StartsWith("B")) //商品订单
                {
                    //检查订单是否存在
                    orderModel = new BLL.orders().GetModel(order_no);
                    if (orderModel == null)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                        return;
                    }
                    //检查是否已支付过
                    if (orderModel.payment_status == 2)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + orderModel.order_no));
                        return;
                    }
                    //检查支付方式
                    payModel = new BLL.site_payment().GetPaymentModel(orderModel.payment_id);
                    if (payModel == null)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,支付方式不存在或已删除!")));
                        return;
                    }
                    //检查是否线下付款
                    if (orderModel.payment_status == 0)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + orderModel.order_no));
                        return;
                    }
                    //检查是否积分换购,直接跳转成功页面
                    if (orderModel.order_amount == 0)
                    {
                        //修改订单状态
                        bool result = new BLL.orders().UpdateField(orderModel.order_no, "status=2,payment_status=2,payment_time='" + DateTime.Now + "'");
                        if (!result)
                        {
                            HttpContext.Current.Response.Redirect(linkurl("payment", "?action=error"));
                            return;
                        }
                        HttpContext.Current.Response.Redirect(linkurl("payment", "?action=succeed&order_no=" + orderModel.order_no));
                        return;
                    }
                    order_amount = orderModel.order_amount;     //订单金额
                }
                else
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!")));
                    return;
                }
                break;

            case "succeed":
                //检查订单的类型(充值或购物)
                if (order_no.ToUpper().StartsWith("R"))     //充值订单
                {
                    rechargeModel = new BLL.user_recharge().GetModel(order_no);
                    if (rechargeModel == null)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                        return;
                    }
                }
                else if (order_no.ToUpper().StartsWith("B"))     //商品订单
                {
                    orderModel = new BLL.orders().GetModel(order_no);
                    if (orderModel == null)
                    {
                        HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,订单号不存在或已删除!")));
                        return;
                    }
                }
                else
                {
                    HttpContext.Current.Response.Redirect(linkurl("error", "?msg=" + Utils.UrlEncode("出错啦,找不到您要提交的订单类型!")));
                    return;
                }
                break;
            }
        }