Esempio n. 1
0
        public JsonResult AjaxApplyCoupon(CheckOutContext context)
        {
            CheckOutResult checkOutResult = BuildCheckout(context);
            var            result         = new
            {
                couponCode = checkOutResult.ApplyCouponCode,
                couponName = checkOutResult.ApplyCouponName,
                success    = checkOutResult.HasSucceed && string.IsNullOrWhiteSpace(checkOutResult.ApplyedCouponDesc),
                message    = !checkOutResult.HasSucceed ? checkOutResult.ErrorMessages[0] : checkOutResult.ApplyedCouponDesc
            };

            return(Json(result));
        }
Esempio n. 2
0
        public ActionResult AjaxGetCustomerInvoice(CheckOutContext context)
        {
            if (context == null)
            {
                throw new BusinessException("无效的请求");
            }
            var custInvoiceInfo = CustomerFacade.GetCustomerInvoiceInfo(CurrUser.UserSysNo);

            if (custInvoiceInfo == null)
            {
                custInvoiceInfo = new CustomerInvoiceInfo();
            }
            custInvoiceInfo.NeedInvoice = (context.NeedInvoice == 1);
            return(PartialView("_CustomerInvoicePanel", custInvoiceInfo));
        }
Esempio n. 3
0
        public JsonResult AjaxSubmitCheckout(CheckOutContext context)
        {
            if (context == null)
            {
                return(Json(BuildAjaxErrorObject("无效的请求")));
            }

            ShoppingCart shoppingCart = ShoppingStorageManager.GetShoppingCartFromCreateNew();

            //优先从购买商品参数来构建购物车对象
            if (!String.IsNullOrWhiteSpace(context.ShoppingItemParam))
            {
                String[] shoppingItemParams = context.ShoppingItemParam.Split(new char[] { '|' });
                if (shoppingItemParams.Length == 2)
                {
                    shoppingCart = ShoppingStorageManager.GetShoppingCartFromParam(shoppingItemParams[0], shoppingItemParams[1]);
                }
            }
            //其次从cookie中来构建购物车对象
            if (ShoppingCartIsEmpty(shoppingCart))
            {
                shoppingCart = ShoppingStorageManager.GetShoppingCartFromCookieOrCreateNew();
            }

            if (ShoppingCartIsEmpty(shoppingCart))
            {
                return(Json(new { url = PageHelper.BuildUrl("ShoppingCart") }));
            }

            CheckOutResult result = ShoppingFacade.SubmitCheckout(context, shoppingCart, CurrUser.UserSysNo, SOSource.Wechat);

            if (result.HasSucceed)
            {
                //取得订单编号列表
                List <int> soSysNoList = result.OrderProcessResult.ReturnData.SubOrderList.Select(subOrder => subOrder.Value.ID).ToList();
                ShoppingStorageManager.SaveLatestSO(soSysNoList);
                //团购订单数据不是来自cookie,不能清除cookie
                if (!result.OrderProcessResult.ReturnData.SubOrderList.Any(x => x.Value.SOType == (int)SOType.GroupBuy))
                {
                    ShoppingStorageManager.RemoveShoppingCartCookie();
                }
                return(Json(new { url = PageHelper.BuildUrl("Thankyou", result.OrderProcessResult.ReturnData.ShoppingCartID) }));
            }

            return(Json(new { error = true, messages = result.ErrorMessages }));
        }
Esempio n. 4
0
        public ActionResult AjaxEditPayAndShipType(CheckOutContext context)
        {
            if (context == null)
            {
                throw new BusinessException("无效的请求");
            }
            PaymentCategory paymentCate;
            int             shipTypeID;

            if (!Enum.TryParse(context.PaymentCategoryID, out paymentCate) ||
                !int.TryParse(context.ShipTypeID, out shipTypeID))
            {
                throw new BusinessException("无效的请求");
            }
            CustomerShippingAddresssFacade.UpdateCustomerContactInfo(context.ShippingAddressID,
                                                                     (int)paymentCate, shipTypeID, CurrUser.UserSysNo);
            return(Content("y"));
        }
Esempio n. 5
0
        public ActionResult AjaxGetPayAndShipType(CheckOutContext context)
        {
            ShoppingCart shoppingCart    = ShoppingStorageManager.GetShoppingCartFromCookieOrCreateNew();
            ShoppingCart shoppingCartNew = ShoppingStorageManager.GetShoppingCartFromCreateNew();

            if (context == null)
            {
                throw new BusinessException("无效的请求");
            }
            ShoppingItemGroup ShoppingItem = new ShoppingItemGroup();

            if (!string.IsNullOrEmpty(context.PackageTypeGroupList))
            {
                string[] array = context.PackageTypeGroupList.Split(',');
                foreach (var item in array)
                {
                    int sysNo = 0;
                    if (int.TryParse(item, out sysNo))
                    {
                        ShoppingItem = shoppingCart.ShoppingItemGroupList.FindAll(m =>
                                                                                  (m.PackageType.Equals(1) && m.PackageNo.Equals(sysNo)))[0];
                        shoppingCartNew.ShoppingItemGroupList.Add(ShoppingItem);
                    }
                }
            }

            if (!string.IsNullOrEmpty(context.PackageTypeSingleList))
            {
                string[] array = context.PackageTypeSingleList.Split(',');
                foreach (var item in array)
                {
                    int sysNo = 0;
                    if (int.TryParse(item, out sysNo))
                    {
                        ShoppingItem = shoppingCart.ShoppingItemGroupList.FindAll(m =>
                                                                                  (m.PackageType.Equals(0) && m.ShoppingItemList[0].ProductSysNo.Equals(sysNo)))[0];
                        shoppingCartNew.ShoppingItemGroupList.Add(ShoppingItem);
                    }
                }
            }
            CheckOutResult result = ShoppingFacade.GetPayAndShipTypeList(context, CurrUser.UserSysNo, shoppingCartNew);

            return(PartialView("_PayAndShipTypePanel", result));
        }
Esempio n. 6
0
        private CheckOutResult BuildCheckout(CheckOutContext context)
        {
            if (context == null)
            {
                throw new BusinessException("无效的请求");
            }
            ShoppingCart shoppingCart = ShoppingStorageManager.GetShoppingCartFromCreateNew();

            //优先从购买商品参数来构建购物车对象
            if (!String.IsNullOrWhiteSpace(context.ShoppingItemParam))
            {
                String[] shoppingItemParams = context.ShoppingItemParam.Split(new char[] { '|' });
                if (shoppingItemParams.Length == 2)
                {
                    shoppingCart = ShoppingStorageManager.GetShoppingCartFromParam(shoppingItemParams[0], shoppingItemParams[1]);
                }
            }
            //其次从cookie中来构建购物车对象
            if (ShoppingCartIsEmpty(shoppingCart))
            {
                shoppingCart = ShoppingStorageManager.GetShoppingCartFromCookieOrCreateNew();
            }

            var checkOutResult = ShoppingFacade.BuildCheckOut(context, shoppingCart, CurrUser.UserSysNo);

            //重新保存一次购物车cookie,在购物流程中会对购物车中库存数量不足的赠品进行剔除
            //fixbug: 直接购物车下单不应该影响购物车Cookie
            if (String.IsNullOrWhiteSpace(context.ShoppingItemParam))
            {
                ShoppingCart pipelineShoppingCart = (checkOutResult.OrderProcessResult != null &&
                                                     checkOutResult.OrderProcessResult.ReturnData != null &&
                                                     checkOutResult.OrderProcessResult.ReturnData["ShoppingCart"] != null)
                    ? checkOutResult.OrderProcessResult.ReturnData["ShoppingCart"] as ShoppingCart
                    : ShoppingStorageManager.GetShoppingCartFromCookie();

                //Key添加CustomerSysNo
                LoginUser userInfo = UserManager.ReadUserInfo();
                shoppingCart.CustomerSysNo = userInfo == null ? 0 : userInfo.UserSysNo;
                ShoppingStorageManager.SaveShoppingCart(pipelineShoppingCart);
            }

            return(checkOutResult);
        }
Esempio n. 7
0
        public static CheckOutResultModel AjaxBuildCheckOut(CheckOutContext context)
        {
            if (context == null)
            {
                throw new BusinessException("无效的请求");
            }

            ShoppingCart shoppingCart    = ShoppingStorageManager.GetShoppingCartFromCreateNew();
            ShoppingCart shoppingCartNew = ShoppingStorageManager.GetShoppingCartFromCreateNew();

            //优先从购买商品参数来构建购物车对象
            if (!String.IsNullOrWhiteSpace(context.ShoppingItemParam))
            {
                String[] shoppingItemParams = context.ShoppingItemParam.Split(new char[] { '|' });
                if (shoppingItemParams.Length == 2)
                {
                    shoppingCartNew = ShoppingStorageManager.GetShoppingCartFromParam(shoppingItemParams[0], shoppingItemParams[1]);
                }
            }
            //其次从cookie中来构建购物车对象
            if (ShoppingCartIsEmpty(shoppingCartNew))
            {
                shoppingCart = ShoppingStorageManager.GetShoppingCartFromCookieOrCreateNew();
                ShoppingItemGroup ShoppingItem = new ShoppingItemGroup();
                shoppingCartNew.ShoppingItemGroupList = shoppingCart.ShoppingItemGroupList.FindAll(m => m.PackageChecked);
            }

            shoppingCartNew.OrderDeleteGiftSysNo = shoppingCart.OrderDeleteGiftSysNo;
            shoppingCartNew.OrderSelectGiftSysNo = shoppingCart.OrderSelectGiftSysNo;

            var checkOutResult        = ShoppingFacade.BuildCheckOut(context, shoppingCartNew, UserMgr.ReadUserInfo().UserSysNo);
            CheckOutResultModel model = OrderMapping.MappingCheckOutResult(checkOutResult);

            //重新保存一次购物车cookie,在购物流程中会对购物车中库存数量不足的赠品进行剔除
            //fixbug: 直接购物车下单不应该影响购物车Cookie
            if (String.IsNullOrWhiteSpace(context.ShoppingItemParam))
            {
                ShoppingStorageManager.SaveShoppingCart(GetShoppingCart(checkOutResult));
            }

            return(model);
        }
Esempio n. 8
0
 private void btnThanhToan_Click(object sender, EventArgs e)
 {
     try
     {
         int discount = (int)spDiscount.Value;
         if (gvProduct.RowCount <= 0)
         {
             XtraMessageBox.Show("Vui lòng chọn món để thanh toán!");
             return;
         }
         if (XtraMessageBox.Show(string.Format("Bạn có chắc thanh toán hóa đơn này chứ?"),
                                 "Thông báo", MessageBoxButtons.OKCancel) == DialogResult.OK)
         {
             CheckOutContext checkOutContext = new CheckOutContext();
             if (rdTieuChuan.Checked == true)
             {
                 checkOutContext.SetStrategy(new StandardCheckOut());
             }
             else
             {
                 if (int.Parse(txtDiem.Text) >= 1000 && finalPrice >= 100000)
                 {
                     spDiscount.Value = 10;
                     discount         = 10;
                 }
                 else
                 {
                     XtraMessageBox.Show("Không đủ điểm để thanh toán");
                     return;
                 }
                 calCheckOut();
                 checkOutContext.SetStrategy(new MemberCheckOut());
             }
             checkOutContext.CheckOut(discount, finalPrice, id_hoadon, 1000, id_member);
             BillBus.Instance.UpdateBill(id_hoadon);
             Refesh();
         }
     }
     catch (Exception ex) {
         XtraMessageBox.Show("Error: " + ex.Message);
     }
 }
Esempio n. 9
0
        public ActionResult GetShippingAddressList(CheckOutContext context)
        {
            if (context == null)
            {
                throw new BusinessException("无效的请求");
            }

            CheckOutResult result = new CheckOutResult();

            result.ShippingAddressList = CustomerShippingAddresssFacade.GetCustomerShippingAddressList(CurrUser.UserSysNo);
            if (result.ShippingAddressList != null)
            {
                result.SelShippingAddress = result.ShippingAddressList.Find(x => x.SysNo == context.ShippingAddressID);
                if (result.SelShippingAddress == null)
                {
                    result.SelShippingAddress = result.ShippingAddressList.Find(x => x.IsDefault);
                }
            }
            return(PartialView("_RMAShippingAddressPanel", result));
        }
Esempio n. 10
0
        public ActionResult AjaxBuildCheckOut(CheckOutContext context)
        {
            CheckOutResult checkOutResult = BuildCheckout(context);

            return(PartialView("_CheckoutPanel", checkOutResult));
        }
Esempio n. 11
0
 public JsonResult SubmitCheckout(CheckOutContext context)
 {
     return BulidJsonResult(OrderManager.AjaxSubmitCheckout(context));
 }
Esempio n. 12
0
        public JsonResult BuildCheckOut(CheckOutContext context)
        {
            CheckOutResultModel model = OrderManager.AjaxBuildCheckOut(context);

            return BulidJsonResult(model);
        }
Esempio n. 13
0
        public static AjaxResult AjaxSubmitCheckout(CheckOutContext context)
        {
            AjaxResult ajaxResult = new AjaxResult();

            ajaxResult.Success = false;
            ajaxResult.Code    = -1;
            if (context == null)
            {
                ajaxResult.Code    = -2;
                ajaxResult.Message = "无效的请求";

                return(ajaxResult);
            }

            ShoppingCart shoppingCart    = ShoppingStorageManager.GetShoppingCartFromCreateNew();
            ShoppingCart shoppingCartNew = ShoppingStorageManager.GetShoppingCartFromCreateNew();

            //优先从购买商品参数来构建购物车对象
            if (!String.IsNullOrWhiteSpace(context.ShoppingItemParam))
            {
                String[] shoppingItemParams = context.ShoppingItemParam.Split(new char[] { '|' });
                if (shoppingItemParams.Length == 2)
                {
                    shoppingCartNew = ShoppingStorageManager.GetShoppingCartFromParam(shoppingItemParams[0], shoppingItemParams[1]);
                }
            }
            //其次从cookie中来构建购物车对象
            if (ShoppingCartIsEmpty(shoppingCartNew))
            {
                shoppingCart = ShoppingStorageManager.GetShoppingCartFromCookieOrCreateNew();
                ShoppingItemGroup ShoppingItem = new ShoppingItemGroup();
                shoppingCartNew.ShoppingItemGroupList = shoppingCart.ShoppingItemGroupList.FindAll(m => m.PackageChecked);
            }

            if (ShoppingCartIsEmpty(shoppingCartNew))
            {
                ajaxResult.Code    = -3;
                ajaxResult.Message = "空购物车";

                return(ajaxResult);
            }
            shoppingCartNew.OrderDeleteGiftSysNo = shoppingCart.OrderDeleteGiftSysNo;
            shoppingCartNew.OrderSelectGiftSysNo = shoppingCart.OrderSelectGiftSysNo;
            CheckOutResult result = ShoppingFacade.SubmitCheckout(context, shoppingCartNew, UserMgr.ReadUserInfo().UserSysNo, HeaderHelper.GetClientType() == ClientType.IPhone ? SOSource.IPhone : SOSource.Android);

            if (result.ErrorMessages != null && result.ErrorMessages.Count > 0)
            {
                result.ErrorMessages.ForEach(item =>
                {
                    if (!string.IsNullOrWhiteSpace(item))
                    {
                        ajaxResult.Message += item;
                    }
                });
            }
            if (result.HasSucceed)
            {
                //取得订单编号列表
                List <int> soSysNoList = result.OrderProcessResult.ReturnData.SubOrderList.Select(subOrder => subOrder.Value.ID).ToList();
                ShoppingStorageManager.SaveLatestSO(soSysNoList);
                //团购订单数据不是来自cookie,不能清除cookie
                if (!result.OrderProcessResult.ReturnData.SubOrderList.Any(x => x.Value.SOType == (int)SOType.GroupBuy))
                {
                    //ShoppingStorageManager.RemoveShoppingCartCookie();
                    ShoppingCart leaveshoppingCart = ShoppingStorageManager.GetShoppingCartFromCreateNew();
                    leaveshoppingCart.ShoppingItemGroupList = shoppingCart.ShoppingItemGroupList.FindAll(m => !m.PackageChecked);
                    if (leaveshoppingCart.ShoppingItemGroupList.Count > 0)
                    {
                        foreach (var itemGroup in leaveshoppingCart.ShoppingItemGroupList)
                        {
                            if (itemGroup.PackageType.Equals(0))
                            {
                                foreach (ShoppingItem ProductItem in itemGroup.ShoppingItemList)
                                {
                                    itemGroup.PackageChecked   = true;
                                    ProductItem.ProductChecked = true;
                                }
                            }
                            if (itemGroup.PackageType.Equals(1))
                            {
                                itemGroup.PackageChecked = true;
                            }
                        }
                    }
                    LoginUser userInfo = UserMgr.ReadUserInfo();
                    leaveshoppingCart.CustomerSysNo = userInfo == null ? 0 : userInfo.UserSysNo;
                    HttpContext.Current.Request.Cookies.Remove(ShoppingStorageManager.GetConfigCartName());
                    ShoppingStorageManager.SaveShoppingCart(leaveshoppingCart);
                }

                ajaxResult.Code    = 0;
                ajaxResult.Success = true;
                ajaxResult.Data    = result.OrderProcessResult.ReturnData.ShoppingCartID;
                //var cookie = HttpContext.Current.Request.Cookies.Get(ShoppingStorageManager.GetConfigCartName());
                //ShoppingCart shoppingCart222 = ShoppingStorageManager.GetShoppingCartFromCookieOrCreateNew();
                return(ajaxResult);
            }


            return(ajaxResult);
        }
Esempio n. 14
0
        public JsonResult AjaxSubmitCheckout(CheckOutContext context)
        {
            if (context == null)
            {
                return(Json(BuildAjaxErrorObject("无效的请求")));
            }

            ShoppingCart shoppingCart    = ShoppingStorageManager.GetShoppingCartFromCreateNew();
            ShoppingCart shoppingCartNew = ShoppingStorageManager.GetShoppingCartFromCreateNew();

            //优先从购买商品参数来构建购物车对象
            if (!String.IsNullOrWhiteSpace(context.ShoppingItemParam))
            {
                String[] shoppingItemParams = context.ShoppingItemParam.Split(new char[] { '|' });
                if (shoppingItemParams.Length == 2)
                {
                    shoppingCartNew = ShoppingStorageManager.GetShoppingCartFromParam(shoppingItemParams[0], shoppingItemParams[1]);
                }
            }
            //其次从cookie中来构建购物车对象
            if (ShoppingCartIsEmpty(shoppingCartNew))
            {
                shoppingCart = ShoppingStorageManager.GetShoppingCartFromCookieOrCreateNew();
                ShoppingItemGroup ShoppingItem = new ShoppingItemGroup();
                if (!string.IsNullOrEmpty(context.PackageTypeGroupList))
                {
                    string[] array = context.PackageTypeGroupList.Split(',');
                    foreach (var item in array)
                    {
                        int sysNo = 0;
                        if (int.TryParse(item, out sysNo))
                        {
                            ShoppingItem = shoppingCart.ShoppingItemGroupList.FindAll(m =>
                                                                                      (m.PackageType.Equals(1) && m.PackageNo.Equals(sysNo)))[0];
                            shoppingCartNew.ShoppingItemGroupList.Add(ShoppingItem);
                        }
                    }
                }

                if (!string.IsNullOrEmpty(context.PackageTypeSingleList))
                {
                    string[] array = context.PackageTypeSingleList.Split(',');
                    foreach (var item in array)
                    {
                        int sysNo = 0;
                        if (int.TryParse(item, out sysNo))
                        {
                            ShoppingItem = shoppingCart.ShoppingItemGroupList.FindAll(m =>
                                                                                      (m.PackageType.Equals(0) && m.ShoppingItemList[0].ProductSysNo.Equals(sysNo)))[0];
                            shoppingCartNew.ShoppingItemGroupList.Add(ShoppingItem);
                        }
                    }
                }
            }

            if (ShoppingCartIsEmpty(shoppingCartNew))
            {
                return(Json(new { url = PageHelper.BuildUrl("ShoppingCartRoute") }));
            }
            shoppingCartNew.OrderDeleteGiftSysNo = shoppingCart.OrderDeleteGiftSysNo;
            shoppingCartNew.OrderSelectGiftSysNo = shoppingCart.OrderSelectGiftSysNo;
            CheckOutResult result = ShoppingFacade.SubmitCheckout(context, shoppingCartNew, CurrUser.UserSysNo, SOSource.None);

            if (result.HasSucceed)
            {
                //取得订单编号列表
                List <int> soSysNoList = result.OrderProcessResult.ReturnData.SubOrderList.Select(subOrder => subOrder.Value.ID).ToList();
                ShoppingStorageManager.SaveLatestSO(soSysNoList);
                //团购订单数据不是来自cookie,不能清除cookie
                if (!result.OrderProcessResult.ReturnData.SubOrderList.Any(x => x.Value.SOType == (int)SOType.GroupBuy || x.Value.SOType == (int)SOType.VirualGroupBuy))
                {
                    //ShoppingStorageManager.RemoveShoppingCartCookie();
                    //移除mini购物车
                    //ShoppingStorageManager.RemoveShoppingCartMiniCookie();

                    //删除套餐
                    if (!string.IsNullOrEmpty(context.PackageTypeGroupList))
                    {
                        string[] array = context.PackageTypeGroupList.Split(',');
                        foreach (var item in array)
                        {
                            int sysNo = 0;
                            if (int.TryParse(item, out sysNo))
                            {
                                shoppingCart.ShoppingItemGroupList =
                                    shoppingCart.ShoppingItemGroupList.FindAll(m
                                                                               => (m.PackageType.Equals(1) && !m.PackageNo.Equals(sysNo)) ||
                                                                               m.PackageType.Equals(0));
                            }
                        }
                    }
                    //删除单个商品
                    if (!string.IsNullOrEmpty(context.PackageTypeSingleList))
                    {
                        string[] array = context.PackageTypeSingleList.Split(',');
                        foreach (var item in array)
                        {
                            int sysNo = 0;
                            if (int.TryParse(item, out sysNo))
                            {
                                shoppingCart.ShoppingItemGroupList =
                                    shoppingCart.ShoppingItemGroupList.FindAll(m
                                                                               => (m.PackageType.Equals(0) && !m.ShoppingItemList[0].ProductSysNo.Equals(sysNo)) ||
                                                                               m.PackageType.Equals(1));
                            }
                        }
                    }
                    //用于计算会员价:
                    LoginUser userInfo = UserMgr.ReadUserInfo();
                    shoppingCart.CustomerSysNo = userInfo == null ? 0 : userInfo.UserSysNo;
                    OrderPipelineProcessResult shoppingResult = ShoppingFacade.BuildShoppingCart(shoppingCart);
                    ShoppingCart pipelineShoppingCart         = (shoppingResult.ReturnData != null &&
                                                                 shoppingResult.ReturnData["ShoppingCart"] != null)
                        ? shoppingResult.ReturnData["ShoppingCart"] as ShoppingCart
                        : new ShoppingCart();
                    shoppingCart.OrderSelectGiftSysNo = pipelineShoppingCart.OrderSelectGiftSysNo;
                    shoppingCart.OrderDeleteGiftSysNo = pipelineShoppingCart.OrderDeleteGiftSysNo;
                    ShoppingStorageManager.SaveShoppingCart(shoppingCart);
                    //将迷你购物车加入Cookie
                    ShoppingStorageManager.SaveShoppingCartMini(ShoppingFacade.BuildMiniShoppingCartFromPipeline(shoppingResult));
                }

                return(Json(new { url = PageHelper.BuildUrl("Thankyou", result.OrderProcessResult.ReturnData.ShoppingCartID) }));
            }

            return(Json(new { errors = result.ErrorMessages }));
        }
Esempio n. 15
0
        public ActionResult AjaxBuildCheckOut(CheckOutContext context)
        {
            if (context == null)
            {
                throw new BusinessException("无效的请求");
            }

            ShoppingCart shoppingCart    = ShoppingStorageManager.GetShoppingCartFromCreateNew();
            ShoppingCart shoppingCartNew = ShoppingStorageManager.GetShoppingCartFromCreateNew();

            //优先从购买商品参数来构建购物车对象
            if (!String.IsNullOrWhiteSpace(context.ShoppingItemParam))
            {
                String[] shoppingItemParams = context.ShoppingItemParam.Split(new char[] { '|' });
                if (shoppingItemParams.Length == 2)
                {
                    shoppingCartNew = ShoppingStorageManager.GetShoppingCartFromParam(shoppingItemParams[0], shoppingItemParams[1]);
                }
            }
            //其次从cookie中来构建购物车对象
            if (ShoppingCartIsEmpty(shoppingCartNew))
            {
                shoppingCart = ShoppingStorageManager.GetShoppingCartFromCookieOrCreateNew();
                ShoppingItemGroup ShoppingItem = new ShoppingItemGroup();
                if (!string.IsNullOrEmpty(context.PackageTypeGroupList))
                {
                    string[] array = context.PackageTypeGroupList.Split(',');
                    foreach (var item in array)
                    {
                        int sysNo = 0;
                        if (int.TryParse(item, out sysNo))
                        {
                            ShoppingItem = shoppingCart.ShoppingItemGroupList.FindAll(m =>
                                                                                      (m.PackageType.Equals(1) && m.PackageNo.Equals(sysNo)))[0];
                            shoppingCartNew.ShoppingItemGroupList.Add(ShoppingItem);
                        }
                    }
                }

                if (!string.IsNullOrEmpty(context.PackageTypeSingleList))
                {
                    string[] array = context.PackageTypeSingleList.Split(',');
                    foreach (var item in array)
                    {
                        int sysNo = 0;
                        if (int.TryParse(item, out sysNo))
                        {
                            ShoppingItem = shoppingCart.ShoppingItemGroupList.FindAll(m =>
                                                                                      (m.PackageType.Equals(0) && m.ShoppingItemList[0].ProductSysNo.Equals(sysNo)))[0];
                            shoppingCartNew.ShoppingItemGroupList.Add(ShoppingItem);
                        }
                    }
                }
            }

            shoppingCartNew.OrderDeleteGiftSysNo = shoppingCart.OrderDeleteGiftSysNo;
            shoppingCartNew.OrderSelectGiftSysNo = shoppingCart.OrderSelectGiftSysNo;

            var checkOutResult = ShoppingFacade.BuildCheckOut(context, shoppingCartNew, CurrUser.UserSysNo);

            //重新保存一次购物车cookie,在购物流程中会对购物车中库存数量不足的赠品进行剔除
            //fixbug: 直接购物车下单不应该影响购物车Cookie
            if (String.IsNullOrWhiteSpace(context.ShoppingItemParam))
            {
                ShoppingCart pipelineShoppingCart = (checkOutResult.OrderProcessResult != null &&
                                                     checkOutResult.OrderProcessResult.ReturnData != null &&
                                                     checkOutResult.OrderProcessResult.ReturnData["shoppingCartNew"] != null)
                    ? checkOutResult.OrderProcessResult.ReturnData["shoppingCartNew"] as ShoppingCart
                    : ShoppingStorageManager.GetShoppingCartFromCookie();


                //Key添加CustomerSysNo
                LoginUser userInfo = UserMgr.ReadUserInfo();
                pipelineShoppingCart.CustomerSysNo = userInfo == null ? 0 : userInfo.UserSysNo;
                ShoppingStorageManager.SaveShoppingCart(pipelineShoppingCart);
            }

            checkOutResult = CalcGroupBuyTag(checkOutResult);

            return(PartialView("_CheckOutEditPanel", checkOutResult));
        }