Esempio n. 1
0
        private void Bind()
        {
            if (string.IsNullOrEmpty(orderNum))
            {
                WebHelper.MessageBox.Messager(this.Page, Page.Controls[0], "非法进入,已终止执行", "操作错误", "error");
                return;
            }
            if (bll == null)
            {
                bll = new BLL.OrderInfo();
            }
            Model.OrderInfo model = bll.GetModel(orderNum, userId);
            if (model == null)
            {
                WebHelper.MessageBox.Messager(this.Page, Page.Controls[0], "非法操作,已终止执行", "操作错误", "error");
                return;
            }

            string htmlAppend = "<s class=\"icon-succ02\"></s><h3 class=\"ftx-02\">付款成功,我们将尽快处理,请耐心等待!</h3>";

            htmlAppend     += "<ul class=\"list-h\"><li class=\"fore1\">订单号:" + model.OrderNum + "</li>";
            htmlAppend     += "<li class=\"fore2\">已付金额:<strong class=\"ftx-01\">" + model.TotalPrice + "元</strong></li>";
            htmlAppend     += "</ul></div>";
            ltrSucceed.Text = htmlAppend;
        }
        private void OnPay()
        {
            if (ViewState["OrderId"] == null || ViewState["TotalPrice"] == null)
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "当前订单不存在,请检查", "系统提示");
                return;
            }
            object  orderId    = ViewState["OrderId"];
            decimal totalPrice = 0;

            if (!decimal.TryParse(ViewState["TotalPrice"].ToString(), out totalPrice))
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "付款金额转换失败,请检查", "系统提示");
                return;
            }

            if (bll == null)
            {
                bll = new BLL.OrderInfo();
            }
            if (bll.PayPrice(Guid.Parse(userId), orderId, totalPrice) > 0)
            {
                Response.Redirect(string.Format("PayOrder.aspx?oN={0}", HttpUtility.UrlEncode(orderNum)), true);
            }
            else
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "付款失败,请检查", "系统提示");
            }
        }
        private void Bind()
        {
            if (!string.IsNullOrEmpty(orderNum))
            {
                if (bll == null)
                {
                    bll = new BLL.OrderInfo();
                }
                Model.OrderInfo model = bll.GetModel(orderNum, userId);
                if (model == null)
                {
                    ltrBank.Text = "";
                    WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "非法操作,已终止执行", "操作错误", "error");
                    return;
                }

                ViewState["OrderId"]    = model.OrderId;
                ViewState["TotalPrice"] = model.TotalPrice;

                string htmlAppend = "<s class=\"icon-succ02\"></s><h3 class=\"ftx-02\">订单提交成功,请您尽快付款!</h3>";
                htmlAppend     += "<ul class=\"list-h\"><li class=\"fore1\">订单号:" + model.OrderNum + "</li>";
                htmlAppend     += "<li class=\"fore2\">应付金额:<strong class=\"ftx-01\">" + model.TotalPrice + "元</strong></li>";
                htmlAppend     += "</ul><p id=\"p_show_info\">&nbsp;</p><p class=\"reminder\"><strong>立即支付<span class=\"ftx-01\">" + model.TotalPrice + "元</span>,即可完成订单。</strong>";
                htmlAppend     += "请您在<span class=\"ftx-04\">24小时</span>内完成支付,否则订单会被自动取消。</p></div>";
                ltrSucceed.Text = htmlAppend;
            }
        }
Esempio n. 4
0
        private void Bind()
        {
            if (bll == null)
            {
                bll = new BLL.OrderInfo();
            }
            int totalCount = 0;

            rpData.DataSource = bll.GetDsForOrderInfo(AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out totalCount, sqlWhere, parms == null ? null : parms.ToArray());
            rpData.DataBind();
            AspNetPager1.RecordCount = totalCount;
        }
Esempio n. 5
0
        private void OnDelete()
        {
            string sAppend = hV.Value.Trim();

            if (!string.IsNullOrEmpty(sAppend))
            {
                string[] orderIds = sAppend.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                if (orderIds.Length > 0)
                {
                    if (bll == null)
                    {
                        bll = new BLL.OrderInfo();
                    }
                    if (bll.DeleteBatch(orderIds.ToList <string>()))
                    {
                        Bind();
                    }
                }
            }
        }
Esempio n. 6
0
        private void Bind()
        {
            if (!string.IsNullOrEmpty(orderNum))
            {
                IList <Model.OrderInfo> list = new List <Model.OrderInfo>();
                if (bll == null)
                {
                    bll = new BLL.OrderInfo();
                }
                Model.OrderInfo model = bll.GetModel(orderNum, Guid.Parse(userId));
                if (model != null)
                {
                    list.Add(model);
                }

                rpData.DataSource = list;
                rpData.DataBind();
                GetProductList(model.Products);
            }
        }
Esempio n. 7
0
        private void OnCommit()
        {
            if (WebHelper.Common.GetUserId() != Guid.Empty)
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnSave, "请先登录再执行操作");
                return;
            }
            string addressId = hNId.Value.Trim();

            if (string.IsNullOrEmpty(addressId))
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnSave, "请选择收货人信息", "操作错误", "error");
                return;
            }
            if (profile == null)
            {
                profile = new CustomProfileCommon();
            }
            Model.UserAddress addressModel = profile.UserAddress.GetModel(Guid.Parse(addressId));
            if (addressModel == null)
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnSave, "不存在当前收货人信息记录,请检查", "操作错误", "error");
                return;
            }
            string payOption = selectPay.InnerText.Trim();

            if (string.IsNullOrEmpty(payOption))
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnSave, "请选择支付及配送方式", "操作错误", "error");
                return;
            }

            int     totalCount = profile.ShoppingCart.Count;
            decimal totalPrice = profile.ShoppingCart.TotalPrice;

            if (totalCount < 1)
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnSave, "商品清单不存在任何商品,请检查", "操作错误", "error");
                return;
            }

            string sProducts = "";
            ICollection <Model.CartItemInfo> items = profile.ShoppingCart.CartItems;

            foreach (Model.CartItemInfo item in items)
            {
                sProducts += string.Format("{2},{1},{0}|", item.Subtotal, item.Quantity, item.ProductId);
            }
            sProducts = sProducts.Trim('|');

            DateTime dtime = DateTime.Now;

            Model.OrderInfo model = new Model.OrderInfo();
            model.OrderNum        = WebHelper.CustomsHelper.CreateDateTimeString();
            model.UserId          = WebHelper.Common.GetUserId();
            model.Receiver        = addressModel.Receiver;
            model.ProviceCity     = addressModel.ProvinceCity;
            model.Address         = addressModel.Address;
            model.Mobilephone     = addressModel.Mobilephone;
            model.Telephone       = addressModel.Telephone;
            model.Email           = addressModel.Email;
            model.Products        = sProducts;
            model.TotalCount      = totalCount;
            model.TotalPrice      = totalPrice;
            model.PayOption       = payOption;
            model.LastUpdatedDate = dtime;
            model.CreateDate      = dtime;

            string errorMsg = "";

            try
            {
                TransactionOptions options = new TransactionOptions();
                options.IsolationLevel = IsolationLevel.ReadUncommitted;
                options.Timeout        = TimeSpan.FromSeconds(90);
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
                {
                    if (bll == null)
                    {
                        bll = new BLL.OrderInfo();
                    }
                    if (bll.Insert(model) > 0)
                    {
                        profile.ShoppingCart.Clear();
                        profile.Save();
                    }

                    //提交事务
                    scope.Complete();
                }

                Response.Redirect(string.Format("AddOrderSucceed.aspx?oN={0}", HttpUtility.UrlEncode(model.OrderNum)), true);
            }
            catch (Exception ex)
            {
                errorMsg = ex.Message;
            }
            if (!string.IsNullOrEmpty(errorMsg))
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnSave, errorMsg, "系统异常提醒");
                return;
            }
        }