Esempio n. 1
0
        private ActionResult ProcessAddToXuQiu()
        {
            #region 需求清单
            VWShoppingCartInfo shoppingCart = SessionUtil.GetXuQiuSession();
            #endregion

            string callback    = QueryString.SafeQ("callback");//jsonp回调函数
            int    prodetailid = QueryString.IntSafeQ("prodetailid");
            int    num         = QueryString.IntSafeQ("Num");
            if (prodetailid == 0)
            {
                return(Content(callback + "({\"Status\":\"请选择商品\"});"));
            }
            if (ProductDetailBLL.Instance.GetProductDetail(prodetailid).StockNum < num)
            {
                return(Content(callback + "({\"Status\":\"库存数量不足\"})"));
            }
            else
            {
                ShoppCookie _entity = new ShoppCookie();
                _entity.C      = 1;
                _entity.Num    = num;
                _entity.ProDId = prodetailid;
                ShoppingXuQiuProcessor.AddToXuQiu(shoppingCart, _entity);
                return(Content(callback + "({\"Status\":\"OK\"});"));
            }
        }
Esempio n. 2
0
        private ActionResult ProcessDeletePdsFromCartXuQiu()
        {
            #region 购物车
            VWShoppingCartInfo shoppingCart = SessionUtil.GetXuQiuSession();
            #endregion

            string callback     = QueryString.SafeQ("callback");//jsonp回调函数
            string prodetailids = QueryString.SafeQ("pdids", 8000);
            int    num          = QueryString.IntSafeQ("Num");

            if (string.IsNullOrEmpty(prodetailids))
            {
                return(Content(callback + "({\"Status\":\"请选择需要删除的商品\"});"));
            }
            else
            {
                List <int> pdidslist = new List <int>();

                string[] pdisattr = prodetailids.Split(',');
                foreach (string str in pdisattr)
                {
                    pdidslist.Add(StringUtils.GetDbInt(str));
                }
                ShoppingXuQiuProcessor.RemoveCartXuQiuItems(shoppingCart, pdidslist);
                return(Content(callback + "({\"Status\":\"OK\"});"));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 获取购物车
        /// </summary>
        /// <param name="shoppingCart"></param>
        /// <returns></returns>
        public static VWShoppingCartInfo GetShoppingXuQiu(IList <ShoppCookie> shoppingCart)
        {
            VWShoppingCartInfo _info = new VWShoppingCartInfo();

            if (shoppingCart.Count > 0)
            {
                SuperMarket.Model.Account.MemberLoginEntity member = CookieBLL.GetLoginCookie();
                VWShoppingCartInfo shoppingXuQiuInfo = new VWShoppingCartInfo();

                shoppingXuQiuInfo.CartItems = shoppingCart;
                return(shoppingXuQiuInfo);
            }
            return(null);
        }
Esempio n. 4
0
        private ActionResult ProcessUpdateCartChecked()
        {
            #region 购物车
            VWShoppingCartInfo shoppingCart = SessionUtil.GetCartSession();
            #endregion

            string callback        = QueryString.SafeQ("callback");//jsonp回调函数
            int    productdetailid = QueryString.IntSafeQ("prodetailid");
            int    check           = QueryString.IntSafeQ("checkstatus");
            if (productdetailid > 0)
            {
                ShoppingCartProcessor.UpdateCarIteChecked(shoppingCart, productdetailid, check);
            }
            return(Content(callback + "({\"Status\":\"OK\"});"));
        }
Esempio n. 5
0
 /// <summary>
 /// 删除购物车数据
 /// </summary>
 /// <param name="wareCode"></param>
 public static void RemoveXuQiuItem(VWShoppingCartInfo shoppingcart, int prodetailid)
 {
     if (shoppingcart == null)
     {
         return;
     }
     for (int i = shoppingcart.CartItems.Count - 1; i >= 0; i--)
     {
         if (shoppingcart.CartItems[i].ProDId == prodetailid)
         {
             shoppingcart.CartItems.RemoveAt(i);
             break;
         }
     }
     WriteShoppingXuQiuCookie(shoppingcart);
 }
Esempio n. 6
0
        public static string UpdateCarIteChecked(VWShoppingCartInfo shoppingcart, int productdetailid, int check)
        {
            string strMsg = null;

            //修改购物车对象
            for (int i = shoppingcart.CartItems.Count - 1; i >= 0; i--)
            {
                if (shoppingcart.CartItems[i].ProDId == productdetailid)
                {
                    shoppingcart.CartItems[i].C = check;
                    break;
                }
            }
            WriteShoppingXuQiuCookie(shoppingcart);
            return(strMsg);
        }
Esempio n. 7
0
 public static VWShoppingCartInfo GetCartSession()
 {
     #region 重新获取购物车SESSSION
     System.Web.HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies[Core.SysCookieName.ComBineCart];
     string result = "0";
     if (cookie != null)
     {
         result = cookie.Value;
     }
     if (result == "1")
     {
         RemoveCartSession();
         ShoppingCartProcessor.WriteShoppingCartCookieByLogin();
         CookieBLL.ComBineCart(0);
     }
     #endregion
     VWShoppingCartInfo shoppingCart = ShoppingCartProcessor.GetShoppingCart();
     return(shoppingCart);
 }
Esempio n. 8
0
 public static void RemoveCartXuQiuItems(VWShoppingCartInfo shoppingcart, List <int> pdids)
 {
     if (shoppingcart == null)
     {
         return;
     }
     foreach (int entityid in pdids)
     {
         for (int i = shoppingcart.CartItems.Count - 1; i >= 0; i--)
         {
             if (shoppingcart.CartItems[i].ProDId == entityid)
             {
                 shoppingcart.CartItems.RemoveAt(i);
                 break;
             }
         }
     }
     WriteShoppingXuQiuCookie(shoppingcart);
 }
Esempio n. 9
0
        /// <summary>
        /// 根据数据库获取购物车
        /// </summary>
        /// <returns></returns>
        public static VWShoppingCartInfo GetShoppingXuQiuByData()
        {
            VWShoppingCartInfo _info = new VWShoppingCartInfo();

            SuperMarket.Model.Account.MemberLoginEntity member = CookieBLL.GetLoginCookie();
            if (member != null && member.MemId > 0)
            {
                if (SuperMarket.Core.ConfigCore.Instance.ConfigCommonEntity.XuQiuCookie == 1)
                {
                    IList <ShoppCookie> listcookie = new List <ShoppCookie>();

                    IList <MemShoppCarEntity> list = new List <MemShoppCarEntity>();
                    string cookieval = WZShopCartBLL.Instance.GetXuQiuCookie(member.MemId);
                    if (cookieval != "")
                    {
                        string cookieValue = HttpUtility.UrlDecode(cookieval, Encoding.GetEncoding("UTF-8"));
                        //string cookieValue = cookieval;
                        if (cookieValue.Contains("ProductName") || cookieValue.Contains("ProductDetailId"))
                        {
                            System.Web.HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies[SysCookieName.ShoppingXuQiu_Data];
                            if (cookie != null)
                            {
                                cookie.Expires = DateTime.Now.AddDays(-1);
                                System.Web.HttpContext.Current.Response.Cookies.Add(cookie);
                            }
                            SetShoppingXuQiuCount(0);
                        }
                        else
                        {
                            listcookie = JsonJC.JsonToObject <List <ShoppCookie> >(cookieValue);
                        }
                    }
                    if (listcookie != null && listcookie.Count > 0)
                    {
                        _info.CartItems = listcookie;
                        WriteShoppingXuQiuCookie(SuperMarket.Core.Json.JsonJC.ObjectToJson(listcookie), _info.CartCount);
                        return(_info);
                    }
                }
            }
            return(null);
        }
Esempio n. 10
0
        public static void AddToXuQiu(VWShoppingCartInfo shoppingcart, ShoppCookie _entitycart)
        {
            bool boo_i  = true;
            int  sort_i = 0;

            if (shoppingcart != null && shoppingcart.CartItems.Count > 0)
            {
                foreach (ShoppCookie item in shoppingcart.CartItems)
                {
                    if (item.ProDId == _entitycart.ProDId)
                    {
                        item.C    = 1;
                        item.Num += _entitycart.Num;
                        boo_i     = false;
                        break;
                    }
                    item.S = sort_i++;
                }
            }
            if (boo_i)
            {
                if (shoppingcart == null)
                {
                    shoppingcart = new VWShoppingCartInfo();
                }
                if (shoppingcart.CartItems == null)
                {
                    shoppingcart.CartItems = new List <ShoppCookie>();
                }
                if (shoppingcart.CartItems.Count >= CommonKey.CartMaxNum)
                {
                    for (int i = 0; i <= shoppingcart.CartItems.Count - CommonKey.CartMaxNum; i++)
                    {
                        shoppingcart.CartItems.RemoveAt(0);
                    }
                }

                _entitycart.S = sort_i;
                shoppingcart.CartItems.Add(_entitycart);
            }
            ShoppingXuQiuProcessor.WriteShoppingXuQiuCookie(shoppingcart);
        }
Esempio n. 11
0
        private ActionResult ProcessDelFromCart()
        {
            #region 购物车
            VWShoppingCartInfo shoppingCart = SessionUtil.GetCartSession();
            #endregion

            string callback    = QueryString.SafeQ("callback");//jsonp回调函数
            int    prodetailid = QueryString.IntSafeQ("prodetailid");
            int    num         = QueryString.IntSafeQ("Num");

            if (prodetailid == 0)
            {
                return(Content(callback + "({\"Status\":\"请选择需要删除的商品\"});"));
            }
            else
            {
                ShoppingCartProcessor.RemoveCartItem(shoppingCart, prodetailid);
                return(Content(callback + "({\"Status\":\"OK\"});"));
            }
        }
Esempio n. 12
0
        private ActionResult ProcessUpdateCartXuQiuNum()
        {
            #region 购物车
            VWShoppingCartInfo shoppingCart = SessionUtil.GetXuQiuSession();
            #endregion

            string callback        = QueryString.SafeQ("callback");//jsonp回调函数
            int    productdetailid = QueryString.IntSafeQ("prodetailid");
            int    num             = QueryString.IntSafeQ("Num");

            if (productdetailid == 0)
            {
                return(Content(callback + "({\"Status\":\"请选择需要删除的商品\"});"));
            }
            else
            {
                ShoppingXuQiuProcessor.UpdateCarItemQty(shoppingCart, productdetailid, num);
                return(Content(callback + "({\"Status\":\"OK\"});"));
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 生成购物车cookie
        /// </summary>
        /// <param name="shoppingCart"></param>
        public static void WriteShoppingXuQiuCookie(VWShoppingCartInfo shoppingcart)
        {
            if (shoppingcart == null)
            {
                return;
            }
            string jsonRst = SuperMarket.Core.Json.JsonJC.ObjectToJson(shoppingcart.CartItems);

            //保存购物车cookie
            System.Web.HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies[SysCookieName.ShoppingXuQiu_Data];
            if (cookie == null)
            {
                cookie = new System.Web.HttpCookie(SysCookieName.ShoppingXuQiu_Data);
            }
            cookie.Value   = HttpUtility.UrlEncode(jsonRst, Encoding.GetEncoding("UTF-8"));
            cookie.Expires = DateTime.Now.AddDays(15);
            System.Web.HttpContext.Current.Response.Cookies.Add(cookie);
            //修改购物车数量cookie
            SetShoppingXuQiuCount(shoppingcart.CartCount);


            //如果登录保存COOKIE至数据库

            if (SuperMarket.Core.ConfigCore.Instance.ConfigCommonEntity.XuQiuCookie == 1)
            {
                if (shoppingcart != null)
                {
                    MemberLoginEntity member = CookieBLL.GetLoginCookie();
                    if (member != null && member.MemId > 0 && jsonRst != "")
                    {
                        MemWZShopCartEntity model = new MemWZShopCartEntity();
                        model.AddDate          = DateTime.Now;
                        model.BuyDate          = DateTime.Now.Date;
                        model.EndDate          = DateTime.Now.Date.AddDays(15);
                        model.MemId            = member.MemId;
                        model.CookieValueXuQiu = jsonRst;
                        WZShopCartBLL.Instance.AddWZShopCartXuQiu(model);
                    }
                }
            }
        }
Esempio n. 14
0
        public static void BuyImmediately(VWShoppingCartInfo shoppingcart, ShoppCookie _entitycart)
        {
            bool boo_i  = true;
            int  sort_i = 0;

            if (shoppingcart != null && shoppingcart.CartItems.Count > 0)
            {
                foreach (ShoppCookie item in shoppingcart.CartItems)
                {
                    item.C = 0;
                    if (item.ProDId == _entitycart.ProDId)
                    {
                        item.C   = 1;
                        item.Num = _entitycart.Num;
                        boo_i    = false;
                        break;
                    }
                    item.S = sort_i++;
                }
            }
            if (boo_i)
            {
                if (shoppingcart == null)
                {
                    shoppingcart = new VWShoppingCartInfo();
                }
                if (shoppingcart.CartItems == null)
                {
                    shoppingcart.CartItems = new List <ShoppCookie>();
                }
                _entitycart.C = 1;
                _entitycart.S = sort_i++;
                shoppingcart.CartItems.Add(_entitycart);
            }
            ShoppingXuQiuProcessor.WriteShoppingXuQiuCookie(shoppingcart);
        }
Esempio n. 15
0
        //public static void SetAddrSession(Model.KH_CusAddressEntity addressEntity)
        //{
        //    HttpContext.Current.Session["OrderAddress"] = addressEntity;
        //}

        //public static Model.KH_CusAddressEntity GetAddrSession()
        //{
        //    HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies[Core.SysCookieName.ComBineCart];
        //    string result = "0";
        //    if (cookie != null)
        //    {
        //        result = cookie.Value;
        //    }
        //    if (result == "1")
        //    {
        //        RemoveAddrSession();
        //        return null;
        //    }
        //    Mola.Model.KH_CusAddressEntity addressEntity = HttpContext.Current.Session["OrderAddress"] as Mola.Model.KH_CusAddressEntity;
        //    if (addressEntity != null)
        //    {
        //        if (addressEntity.Address.Trim() == "" || addressEntity.AccepterName.Trim() == "" || addressEntity.CountryCode.Trim() == "")
        //        {
        //            Mola.BLL.KH_CusAddress.Instance.DeleteMyAddressByCondition(addressEntity.Id.ToString());
        //            SessionUtil.RemoveAddrSession();
        //            addressEntity = null;
        //        }
        //    }

        //    return addressEntity;
        //}

        //public static void RemoveAddrSession()
        //{
        //    HttpContext.Current.Session.Remove("OrderAddress");
        //}

        #endregion


        #region 购物车Session
        public static void SetCartSession(VWShoppingCartInfo shoppingcart)
        {
            //HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies["ShoppingCartKey"];
            //string ShoppingCartKey = "";
            //if (cookie != null)
            //{
            //    ShoppingCartKey = cookie.Value;
            //}
            //if (ShoppingCartKey == "")
            //{
            //    ShoppingCartKey = Guid.NewGuid().ToString();
            //    if (Core.CookieUtil.Domain != "")
            //    {
            //        System.Web.HttpContext.Current.Response.Cookies["ShoppingCartKey"].Domain = Core.CookieUtil.Domain;
            //    }
            //    System.Web.HttpContext.Current.Response.Cookies["ShoppingCartKey"].Value = Guid.NewGuid().ToString();
            //    System.Web.HttpContext.Current.Response.Cookies["ShoppingCartKey"].Expires = DateTime.Now.AddYears(30);
            //}
            //Core.MemCache.AddCache(ShoppingCartKey, shoppingcart);


            //Cache版本
            //HttpContext.Current.Session["ShoppingCart"] = shoppingcart;
        }
Esempio n. 16
0
        /// <summary>
        /// 生成真实订单
        /// </summary>
        /// <returns></returns>
        public string CreateOrder()
        {
            ResultObj _result       = new ResultObj();
            int       _resultstatus = (int)CommonStatus.Fail;
            long      _preordercode = FormString.LongIntSafeQ("preordercode");
            int       _addressid    = FormString.IntSafeQ("addressid");
            //int _paytype = FormString.IntSafeQ("paytype");
            int _systype = FormString.IntSafeQ("systype");

            if (_systype == 0)
            {
                _systype = (int)SystemType.B2B;
            }
            string _remark      = FormString.SafeQ("remark");
            string acceptername = FormString.SafeQ("acceptername");
            int    province     = FormString.IntSafeQ("province");
            int    city         = FormString.IntSafeQ("city");
            string address      = FormString.SafeQ("address", 500);
            string mobilephone  = FormString.SafeQ("mobilephone");
            int    jifen        = FormString.IntSafeQ("jifen");
            int    memcouponid  = FormString.IntSafeQ("memcouponid");
            int    expressid    = FormString.IntSafeQ("expressid");
            int    ordertype    = FormString.IntSafeQ("ordertype", -1);

            if (jifen % 100 != 0)
            {
                jifen = jifen / 100 * 100;
            }
            if (jifen > 0 && !AssetBLL.Instance.CheckIntegralEnough(memid, jifen))
            {
                jifen = 0;
            }
            int billtype = FormString.IntSafeQ("billtype");
            OrderBillBasicEntity _billentity = new OrderBillBasicEntity();

            _billentity.BillType = billtype;
            if (billtype == (int)BillType.Normal)
            {
                string title = FormString.SafeQ("billtitle", 200);
                _billentity.CompanyName = title;
            }
            else if (billtype == (int)BillType.VAT)
            {
                _billentity.BillId = FormString.IntSafeQ("billvatid");

                MemBillVATEntity _mementity = MemBillVATBLL.Instance.GetMemBillVAT(memid);
                //if (_mementity.Status != 1)
                //{
                //    resultstatus = (int)CommonStatus.BillVATNoCheck;
                //    _result.Status = resultstatus;
                //    return JsonJC.ObjectToJson(_result);
                //}
                _billentity.ReceiverName     = FormString.SafeQ("billvatrename");
                _billentity.ReceiverPhone    = FormString.SafeQ("billvatrephone");
                _billentity.ReceiverProvince = FormString.IntSafeQ("billvatreprovince");
                _billentity.ReceiverCity     = FormString.IntSafeQ("billvatrecity");
                _billentity.ReceiverAddress  = FormString.SafeQ("billvatreaddress", 300);
                _billentity.CompanyName      = _mementity.CompanyName;
                _billentity.CompanyPhone     = _mementity.CompanyPhone;
                _billentity.CompanyCode      = _mementity.CompanyCode;
                _billentity.CompanyBank      = _mementity.CompanyBank;
                _billentity.CompanyAddress   = _mementity.CompanyAddress;
                _billentity.BankAccount      = _mementity.BankAccount;
                _billentity.Status           = _mementity.Status;
            }


            VWOrderEntity _vworder = OrderDetailPreTempBLL.Instance.GetVWOrderByTempCode(_preordercode);

            if (ordertype != -1)
            {
                _vworder.OrderType = ordertype;
            }
            _vworder.OrderStyle = (int)OrderStyleEnum.Normal;


            _vworder.DisCountFee = _vworder.DisCountFee;
            decimal tempprice = _vworder.PreDisCountPrice - _vworder.DisCountFee;

            if (tempprice > 1)
            {
                decimal jifenamt = OrderCommonBLL.Instance.GetJiFenAmt(jifen);
                _vworder.Integral    = jifen;
                _vworder.IntegralFee = jifenamt;
                tempprice            = tempprice - jifenamt;
            }
            else
            {
                _vworder.Integral    = 0;
                _vworder.IntegralFee = 0;
            }
            if (memcouponid > 0)
            {
                MemCouponsEntity couponen = MemCouponsBLL.Instance.GetCouponByMemCouponId(memid, memcouponid);
                if (couponen != null && couponen.Id == memcouponid && couponen.EndTime > DateTime.Now)
                {
                    DicCouponsEntity dicen = couponen.DicCoupons;
                    if (dicen.CouponType == (int)CouponTypeEnum.Money && dicen.MinimumReqAmount < tempprice)
                    {
                        _vworder.MemCouponsId = memcouponid;
                        _vworder.CouponsFee   = dicen.CouponValue;
                        tempprice             = tempprice - dicen.CouponValue;
                    }
                }
            }
            _vworder.ActPrice = tempprice;
            //_vworder.PayType = _paytype;
            _vworder.ExpressCom = expressid;

            _vworder.Remark   = _remark;
            _vworder.MemId    = memid;
            _vworder.MemLevel = member.MemGrade;
            _vworder.IsStore  = member.IsStore;
            //if (_paytype == (int)PayType.OutLine)
            //{
            //    _vworder.PayConfirmCode = StringUtils.GetRandomString(12);
            //}
            //if (billtype == 1)
            //{
            //    _vworder.BillType = (int)BillType.Normal;
            //}
            //else if (billtype == 2)
            //{
            //    _vworder.BillType = (int)BillType.VAT;
            //}
            OrderAddressEntity _address = new OrderAddressEntity();

            _address.CityId       = city;
            _address.AccepterName = acceptername;
            _address.ProvinceId   = province;
            _address.Address      = address;
            _address.MobilePhone  = mobilephone;
            //_vworder.AcceptAddress = _address;
            if (_vworder.ActPrice >= 1)
            {
                List <int> listpdids      = new List <int>();
                string     productdetails = "";
                if (_vworder != null && _vworder.Details != null && _vworder.Details.Count > 0)
                {
                    foreach (VWOrderDetailEntity ordetailentity in _vworder.Details)
                    {
                        listpdids.Add(ordetailentity.ProductDetailId);
                        productdetails += "|" + ordetailentity.ProductDetailId.ToString() + "_" + ordetailentity.Num.ToString();
                    }
                    if (productdetails != "")
                    {
                        productdetails = productdetails.TrimStart('|');
                        if (ProductStyleBLL.Instance.ProductsEnough(productdetails))
                        {
                            string ordercode = OrderBLL.Instance.CreateOrder(_vworder, _address, _billentity);
                            if (!string.IsNullOrEmpty(ordercode))
                            {
                                //IList<OrderDetailEntity> _listproduct = OrderDetailBLL.Instance.GetOrderDetailAllByOrder(memid, StringUtils.GetDbLong(ordercode), false);
                                //foreach (OrderDetailEntity _entity in _listproduct)
                                //{
                                //    productdetails += "|" + _entity.ProductDetailId.ToString() + "_" + _entity.Num.ToString();
                                //}
                                if (productdetails != "")
                                {
                                    if (ProductStyleBLL.Instance.ProductsToOrder(productdetails) > 0)
                                    {
                                        VWShoppingCartInfo ShoppingCartentity = ShoppingCartProcessor.GetShoppingCart();
                                        ShoppingCartProcessor.RemoveCartItems(ShoppingCartentity, listpdids);
                                        //if (_vworder.PayType == (int)PayType.WeChat)
                                        //{
                                        _result.Obj = ordercode;
                                        //}
                                        //else
                                        //{

                                        //    _result.Obj = ordercode;
                                        //}
                                        _result.Status = (int)CommonStatus.Success;

                                        return(JsonJC.ObjectToJson(_result));
                                    }
                                    else
                                    {
                                        _result.Status = (int)CommonStatus.ProductLess;
                                        _result.Obj    = "";
                                        return(JsonJC.ObjectToJson(_result));
                                    }
                                }
                                else
                                {
                                    _result.Status = (int)CommonStatus.Success;
                                    _result.Obj    = ordercode;
                                    return(JsonJC.ObjectToJson(_result));
                                }
                            }
                        }
                        else
                        {
                            _result.Status = (int)CommonStatus.ProductLess;
                            _result.Obj    = "";
                            return(JsonJC.ObjectToJson(_result));
                        }
                    }
                }
            }
            _result.Status = (int)CommonStatus.Fail;
            _result.Obj    = "";
            return(JsonJC.ObjectToJson(_result));
        }
Esempio n. 17
0
        /// <summary>
        /// 登录时合并购物车数据
        /// </summary>
        public static void WriteShoppingXuQiuCookieByLogin()
        {
            if (SuperMarket.Core.ConfigCore.Instance.ConfigCommonEntity.XuQiuCookie == 0)
            {
                return;
            }
            List <ShoppCookie> shoppingCart1   = new List <ShoppCookie>();
            List <ShoppCookie> shoppingCart2   = new List <ShoppCookie>();
            List <ShoppCookie> shoppingCartnew = new List <ShoppCookie>();

            System.Web.HttpCookie cookie = System.Web.HttpContext.Current.Request.Cookies[SysCookieName.ShoppingXuQiu_Data];
            if (cookie != null && cookie.Value != "" && cookie.Value != "[]")
            {
                string cookieValue = HttpUtility.UrlDecode(cookie.Value, Encoding.GetEncoding("UTF-8"));
                if (cookieValue.Contains("ProductName") || cookieValue.Contains("ProductDetailId"))
                {
                    if (cookie != null)
                    {
                        cookie.Expires = DateTime.Now.AddDays(-1);
                        System.Web.HttpContext.Current.Response.Cookies.Add(cookie);
                    }
                    SetShoppingXuQiuCount(0);
                    cookieValue = "[]";
                }
                shoppingCart1   = JsonJC.JsonToObject <List <ShoppCookie> >(cookieValue);
                shoppingCartnew = JsonJC.JsonToObject <List <ShoppCookie> >(cookieValue);
                if (shoppingCart1 != null && shoppingCart1.Count > 0)
                {
                    MemberLoginEntity member = CookieBLL.GetLoginCookie();
                    if (member != null && member.MemId > 0)
                    {
                        string cookieval = WZShopCartBLL.Instance.GetXuQiuCookie(member.MemId);
                        if (cookieval != "")
                        {
                            if (cookieval.Contains("ProductName") || cookieval.Contains("ProductDetailId"))
                            {
                                if (cookie != null)
                                {
                                    cookie.Expires = DateTime.Now.AddDays(-1);
                                    System.Web.HttpContext.Current.Response.Cookies.Add(cookie);
                                }
                                SetShoppingXuQiuCount(0);
                                cookieval = "[]";
                            }
                            cookieValue = HttpUtility.UrlDecode(cookieval, Encoding.GetEncoding("UTF-8"));
                            //cookieValue =  cookieval;
                            shoppingCart2 = JsonJC.JsonToObject <List <ShoppCookie> >(cookieValue);

                            bool exit = false;
                            if (shoppingCart2 != null && shoppingCart2.Count > 0)
                            {
                                foreach (ShoppCookie i in shoppingCart2)
                                {
                                    exit = false;
                                    foreach (ShoppCookie j in shoppingCart1)
                                    {
                                        if (j.ProDId == i.ProDId)
                                        {
                                            exit = true;
                                            break;
                                        }
                                    }
                                    if (!exit)
                                    {
                                        shoppingCartnew.Add(i);
                                    }
                                }
                                VWShoppingCartInfo shoppingcart = GetShoppingXuQiu(shoppingCartnew);
                                WriteShoppingXuQiuCookie(shoppingcart);
                            }
                        }
                    }
                }
            }
            else
            {
                GetShoppingXuQiuByData();
            }
        }
Esempio n. 18
0
        public ActionResult Cart()
        {
            string             pids         = QueryString.SafeQ("pids", 500);
            string             nums         = QueryString.SafeQ("nums", 500);
            VWShoppingCartInfo shoppingCart = SessionUtil.GetCartSession();

            //待项目完善后此段判断可删除
            if (shoppingCart != null && shoppingCart.CartItems != null && shoppingCart.CartItems.Count > 0)
            {
                shoppingCart.CartItemsL = new List <MemShoppCarEntity>();

                foreach (ShoppCookie entity in shoppingCart.CartItems)
                {
                    if (entity.ProDId <= 0)
                    {
                        ShoppingCartProcessor.RemoveCartItem(shoppingCart, entity.ProDId);
                    }
                    else
                    {
                        VWProductEntity   vwpentity     = ProductBLL.Instance.GetProVWByDetailId(entity.ProDId);
                        MemShoppCarEntity shopcarentity = new MemShoppCarEntity();
                        shopcarentity.PicUrl          = vwpentity.PicUrl;
                        shopcarentity.PicSuffix       = vwpentity.PicSuffix;
                        shopcarentity.Price           = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, vwpentity.TradePrice, vwpentity.Price, vwpentity.IsBP, vwpentity.DealerPrice);
                        shopcarentity.ProductName     = vwpentity.AdTitle;
                        shopcarentity.Spec1           = vwpentity.Spec1;
                        shopcarentity.Spec2           = vwpentity.Spec2;
                        shopcarentity.Spec3           = vwpentity.Spec3;
                        shopcarentity.TotalPrice      = shopcarentity.Price * entity.Num;
                        shopcarentity.Num             = entity.Num;
                        shopcarentity.ProductType     = vwpentity.ProductType;
                        shopcarentity.ProductId       = vwpentity.ProductId;
                        shopcarentity.Check           = entity.C == 1;
                        shopcarentity.ProductDetailId = entity.ProDId;
                        shopcarentity.CGMemId         = vwpentity.CGMemId;
                        shopcarentity.CGMemNickName   = vwpentity.CGMemNickName;
                        shopcarentity.IsAhmTake       = vwpentity.IsAhmTake;
                        shoppingCart.CartItemsL.Add(shopcarentity);
                    }
                }
            }
            if (!string.IsNullOrEmpty(pids))
            {
                string[]                  pidattr = pids.Split('_');
                string[]                  numattr = nums.Split('_');
                IList <ShoppCookie>       list    = new List <ShoppCookie>();
                IList <MemShoppCarEntity> listL   = new List <MemShoppCarEntity>();
                for (int i = 0; i < pidattr.Length; i++)
                {
                    VWProductEntity _productentity = ProductBLL.Instance.GetProVWByDetailId(StringUtils.GetDbInt(pidattr[i]));
                    if (_productentity.ProductDetailId > 0)
                    {
                        ShoppCookie cookentity = new ShoppCookie();
                        cookentity.C      = 1;
                        cookentity.Num    = StringUtils.GetDbInt(numattr[i]);
                        cookentity.ProDId = _productentity.ProductDetailId;
                        list.Add(cookentity);
                    }
                }
                shoppingCart            = ShoppingCartProcessor.BuyContinue(shoppingCart, list);
                shoppingCart.CartItemsL = new List <MemShoppCarEntity>();

                foreach (ShoppCookie entity in shoppingCart.CartItems)
                {
                    if (entity.ProDId <= 0)
                    {
                        ShoppingCartProcessor.RemoveCartItem(shoppingCart, entity.ProDId);
                    }
                    else
                    {
                        VWProductEntity   vwpentity     = ProductBLL.Instance.GetProVWByDetailId(entity.ProDId);
                        MemShoppCarEntity shopcarentity = new MemShoppCarEntity();
                        shopcarentity.PicUrl          = vwpentity.PicUrl;
                        shopcarentity.PicSuffix       = vwpentity.PicSuffix;
                        shopcarentity.Price           = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, vwpentity.TradePrice, vwpentity.Price, vwpentity.IsBP, vwpentity.DealerPrice);
                        shopcarentity.ProductName     = vwpentity.AdTitle;
                        shopcarentity.Spec1           = vwpentity.Spec1;
                        shopcarentity.Spec2           = vwpentity.Spec2;
                        shopcarentity.Spec3           = vwpentity.Spec3;
                        shopcarentity.TotalPrice      = shopcarentity.Price * entity.Num;
                        shopcarentity.Num             = entity.Num;
                        shopcarentity.ProductType     = vwpentity.ProductType;
                        shopcarentity.ProductId       = vwpentity.ProductId;
                        shopcarentity.Check           = entity.C == 1;
                        shopcarentity.ProductDetailId = entity.ProDId;
                        shopcarentity.CGMemId         = vwpentity.CGMemId;
                        shopcarentity.CGMemNickName   = vwpentity.CGMemNickName;
                        shopcarentity.IsAhmTake       = vwpentity.IsAhmTake;
                        shoppingCart.CartItemsL.Add(shopcarentity);
                    }
                }
            }


            //int memid = 0; int issupplier = 0;
            //MemberLoginEntity member = CookieBLL.GetLoginCookie();
            //if (member != null && member.MemId > 0)
            //{
            //    memid = member.MemId ;
            //    issupplier = member.IsStore;
            //}
            ViewBag.ShoppingCart = shoppingCart;
            ViewBag.MemId        = memid;
            return(View());
        }
Esempio n. 19
0
        /// <summary>
        /// 添加购物车单品
        /// </summary>
        /// <param name="shoppingcart">购物车对象</param>
        /// <param name="wareCode">产品编号</param>
        /// <param name="Qty">数量</param>
        /// <param name="webSiteId">站点编号</param>
        public static VWShoppingCartInfo BuyContinue(VWShoppingCartInfo shoppingcart, IList <ShoppCookie> _entitycart)
        {
            int boo_i = 0;

            if (shoppingcart != null && shoppingcart.CartItems.Count > 0)
            {
                foreach (ShoppCookie item in shoppingcart.CartItems)
                {
                    item.C = 0;
                    foreach (ShoppCookie additem in _entitycart)
                    {
                        if (item.ProDId == additem.ProDId)
                        {
                            item.C   = 1;
                            item.Num = additem.Num;
                            item.S   = boo_i;
                            boo_i   += 1;
                            _entitycart.Remove(additem);
                            break;
                        }
                    }
                }
                if (shoppingcart.CartItems.Count + _entitycart.Count > CommonKey.CartMaxNum)
                {
                    for (int i = 0; i < shoppingcart.CartItems.Count + _entitycart.Count - CommonKey.CartMaxNum; i++)
                    {
                        shoppingcart.CartItems.RemoveAt(0);
                    }
                }
                if (_entitycart.Count > 0)
                {
                    foreach (ShoppCookie _additem in _entitycart)
                    {
                        _additem.C = 1;
                        _additem.S = boo_i;
                        boo_i     += 1;
                        shoppingcart.CartItems.Add(_additem);
                    }
                }
            }
            else
            {
                if (shoppingcart == null)
                {
                    shoppingcart = new VWShoppingCartInfo();
                }
                if (shoppingcart.CartItems == null)
                {
                    shoppingcart.CartItems = new List <ShoppCookie>();
                }
                foreach (ShoppCookie _additem in _entitycart)
                {
                    _additem.C = 1;
                    _additem.S = boo_i;
                    boo_i     += 1;
                }
                shoppingcart.CartItems = _entitycart;
            }
            ShoppingXuQiuProcessor.WriteShoppingXuQiuCookie(shoppingcart);
            return(shoppingcart);
        }
Esempio n. 20
0
        public void XuQiuCartMethod()
        {
            Dictionary <int, IList <MemShoppCarEntity> > shopdic = new Dictionary <int, IList <MemShoppCarEntity> >();

            int                itemproductnum   = 0; //产品数量
            decimal            productamountall = 0; //产品总金额
            string             pids             = QueryString.SafeQ("pids", 500);
            string             nums             = QueryString.SafeQ("nums", 500);
            VWShoppingCartInfo shoppingCart     = SessionUtil.GetXuQiuSession();

            //待项目完善后此段判断可删除
            if (shoppingCart != null && shoppingCart.CartItems != null && shoppingCart.CartItems.Count > 0)
            {
                shoppingCart.CartItemsL = new List <MemShoppCarEntity>();

                foreach (ShoppCookie entity in shoppingCart.CartItems)
                {
                    if (entity.ProDId <= 0)
                    {
                        ShoppingXuQiuProcessor.RemoveXuQiuItem(shoppingCart, entity.ProDId);
                    }
                    else
                    {
                        VWProductEntity vwpentity = ProductBLL.Instance.GetProVWByDetailId(entity.ProDId);

                        MemShoppCarEntity shopcarentity = new MemShoppCarEntity();
                        shopcarentity.PicUrl          = vwpentity.PicUrl;
                        shopcarentity.PicSuffix       = vwpentity.PicSuffix;
                        shopcarentity.Price           = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, vwpentity.TradePrice, vwpentity.Price, vwpentity.IsBP, vwpentity.DealerPrice);
                        shopcarentity.ProductName     = vwpentity.AdTitle;
                        shopcarentity.Spec1           = vwpentity.Spec1;
                        shopcarentity.Spec2           = vwpentity.Spec2;
                        shopcarentity.Spec3           = vwpentity.Spec3;
                        shopcarentity.TotalPrice      = shopcarentity.Price * entity.Num;
                        shopcarentity.Num             = entity.Num;
                        shopcarentity.ProductType     = vwpentity.ProductType;
                        shopcarentity.ProductId       = vwpentity.ProductId;
                        shopcarentity.Check           = entity.C == 1;
                        shopcarentity.ProductDetailId = entity.ProDId;
                        shopcarentity.CGMemId         = vwpentity.CGMemId;
                        shopcarentity.CGMemNickName   = vwpentity.CGMemNickName;
                        shopcarentity.IsAhmTake       = vwpentity.IsAhmTake;
                        if (!shopdic.Keys.Contains(vwpentity.CGMemId))
                        {
                            shopdic[vwpentity.CGMemId] = new List <MemShoppCarEntity>();
                        }
                        shopdic[vwpentity.CGMemId].Add(shopcarentity);
                        itemproductnum    = itemproductnum + entity.Num;
                        productamountall += shopcarentity.TotalPrice;
                    }
                }
            }
            if (!string.IsNullOrEmpty(pids))
            {
                string[]                  pidattr = pids.Split('_');
                string[]                  numattr = nums.Split('_');
                IList <ShoppCookie>       list    = new List <ShoppCookie>();
                IList <MemShoppCarEntity> listL   = new List <MemShoppCarEntity>();
                for (int i = 0; i < pidattr.Length; i++)
                {
                    VWProductEntity _productentity = ProductBLL.Instance.GetProVWByDetailId(StringUtils.GetDbInt(pidattr[i]));
                    if (_productentity.ProductDetailId > 0)
                    {
                        ShoppCookie cookentity = new ShoppCookie();
                        cookentity.C      = 1;
                        cookentity.Num    = StringUtils.GetDbInt(numattr[i]);
                        cookentity.ProDId = _productentity.ProductDetailId;
                        list.Add(cookentity);
                    }
                }
                shoppingCart            = ShoppingXuQiuProcessor.BuyContinue(shoppingCart, list);
                shoppingCart.CartItemsL = new List <MemShoppCarEntity>();

                foreach (ShoppCookie entity in shoppingCart.CartItems)
                {
                    if (entity.ProDId <= 0)
                    {
                        ShoppingXuQiuProcessor.RemoveXuQiuItem(shoppingCart, entity.ProDId);
                    }
                    else
                    {
                        VWProductEntity   vwpentity     = ProductBLL.Instance.GetProVWByDetailId(entity.ProDId);
                        MemShoppCarEntity shopcarentity = new MemShoppCarEntity();
                        shopcarentity.PicUrl          = vwpentity.PicUrl;
                        shopcarentity.PicSuffix       = vwpentity.PicSuffix;
                        shopcarentity.Price           = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, vwpentity.TradePrice, vwpentity.Price, vwpentity.IsBP, vwpentity.DealerPrice);
                        shopcarentity.ProductName     = vwpentity.AdTitle;
                        shopcarentity.Spec1           = vwpentity.Spec1;
                        shopcarentity.Spec2           = vwpentity.Spec2;
                        shopcarentity.Spec3           = vwpentity.Spec3;
                        shopcarentity.TotalPrice      = shopcarentity.Price * entity.Num;
                        shopcarentity.Num             = entity.Num;
                        shopcarentity.ProductType     = vwpentity.ProductType;
                        shopcarentity.ProductId       = vwpentity.ProductId;
                        shopcarentity.Check           = entity.C == 1;
                        shopcarentity.ProductDetailId = entity.ProDId;
                        shopcarentity.CGMemId         = vwpentity.CGMemId;
                        shopcarentity.CGMemNickName   = vwpentity.CGMemNickName;
                        shopcarentity.IsAhmTake       = vwpentity.IsAhmTake;
                        if (!shopdic.Keys.Contains(vwpentity.CGMemId))
                        {
                            shopdic[vwpentity.CGMemId] = new List <MemShoppCarEntity>();
                        }
                        shopdic[vwpentity.CGMemId].Add(shopcarentity);
                        itemproductnum    = itemproductnum + entity.Num;
                        productamountall += shopcarentity.TotalPrice;
                    }
                }
            }
            ViewBag.ShoppingCartXuQiu = shopdic;
            ViewBag.ItemNum           = itemproductnum;
            ViewBag.AmountAll         = productamountall;
        }
Esempio n. 21
0
        /// <summary>
        /// 网站首页
        /// </summary>
        /// <returns></returns>
        public ActionResult ShopCart()
        {
            string pids  = QueryString.SafeQ("pids", 500);
            string nums  = QueryString.SafeQ("nums", 500);
            int    jishi = QueryString.IntSafeQ("js");

            if (jishi == 0)
            {
                jishi = (int)JiShiSongEnum.Normal;
            }
            VWShoppingCartInfo shoppingCart = new VWShoppingCartInfo();

            if (jishi == (int)JiShiSongEnum.JiShi)
            {
                shoppingCart = SessionUtil.GetXuQiuSession();
            }
            else
            {
                shoppingCart = SessionUtil.GetCartSession();
            }


            IList <MemShoppCarEntity> clist = new List <MemShoppCarEntity>();

            if (shoppingCart != null && shoppingCart.CartItems != null && shoppingCart.CartItems.Count > 0)
            {
                IList <ShoppCookie> shopcoolist = shoppingCart.CartItems.OrderByDescending(c => c.C).ThenByDescending(c => c.S).ToList();
                //shoppingCart.CartItemsL = new List<ShoppCarEntity>();
                foreach (ShoppCookie entity in shopcoolist)
                {
                    if (entity.ProDId <= 0)
                    {
                        if (jishi == (int)JiShiSongEnum.JiShi)
                        {
                            ShoppingXuQiuProcessor.RemoveXuQiuItem(shoppingCart, entity.ProDId);
                        }
                        else
                        {
                            ShoppingCartProcessor.RemoveCartItem(shoppingCart, entity.ProDId);
                        }
                    }
                    else
                    {
                        VWProductEntity   vwpentity     = ProductBLL.Instance.GetProVWByDetailId(entity.ProDId);
                        MemShoppCarEntity shopcarentity = new MemShoppCarEntity();
                        shopcarentity.PicUrl          = vwpentity.PicUrl;
                        shopcarentity.PicSuffix       = vwpentity.PicSuffix;
                        shopcarentity.Price           = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, vwpentity.TradePrice, vwpentity.Price, vwpentity.IsBP, vwpentity.DealerPrice);
                        shopcarentity.ProductName     = vwpentity.AdTitle;
                        shopcarentity.Spec1           = vwpentity.Spec1;
                        shopcarentity.Spec2           = vwpentity.Spec2;
                        shopcarentity.Spec3           = vwpentity.Spec3;
                        shopcarentity.TotalPrice      = shopcarentity.Price * entity.Num;
                        shopcarentity.Num             = entity.Num;
                        shopcarentity.ProductType     = vwpentity.ProductType;
                        shopcarentity.ProductId       = vwpentity.ProductId;
                        shopcarentity.StockNum        = vwpentity.StockNum;
                        shopcarentity.Check           = entity.C == 1;
                        shopcarentity.ProductDetailId = entity.ProDId;
                        clist.Add(shopcarentity);
                    }
                }
                shoppingCart.CartItemsL = clist;
            }
            if (!string.IsNullOrEmpty(pids))
            {
                string[]            pidattr = pids.Split('_');
                string[]            numattr = nums.Split('_');
                IList <ShoppCookie> list    = new List <ShoppCookie>();
                for (int i = 0; i < pidattr.Length; i++)
                {
                    VWProductEntity _productentity = ProductBLL.Instance.GetProVWByDetailId(StringUtils.GetDbInt(pidattr[i]));
                    if (_productentity.ProductDetailId > 0)
                    {
                        ShoppCookie cookentity = new ShoppCookie();
                        cookentity.C      = 1;
                        cookentity.Num    = StringUtils.GetDbInt(numattr[i]);
                        cookentity.ProDId = _productentity.ProductDetailId;
                        list.Add(cookentity);
                    }
                }
                if (jishi == (int)JiShiSongEnum.JiShi)
                {
                    shoppingCart = ShoppingXuQiuProcessor.BuyContinue(shoppingCart, list);
                }
                else
                {
                    shoppingCart = ShoppingCartProcessor.BuyContinue(shoppingCart, list);
                }

                clist = new List <MemShoppCarEntity>();
                IList <ShoppCookie> shopcoolist = shoppingCart.CartItems.OrderByDescending(c => c.C).ThenByDescending(c => c.S).ToList();

                foreach (ShoppCookie entity in shopcoolist)
                {
                    if (entity.ProDId <= 0)
                    {
                        if (jishi == (int)JiShiSongEnum.JiShi)
                        {
                            ShoppingXuQiuProcessor.RemoveXuQiuItem(shoppingCart, entity.ProDId);
                        }
                        else
                        {
                            ShoppingCartProcessor.RemoveCartItem(shoppingCart, entity.ProDId);
                        }
                    }
                    else
                    {
                        VWProductEntity   vwpentity     = ProductBLL.Instance.GetProVWByDetailId(entity.ProDId);
                        MemShoppCarEntity shopcarentity = new MemShoppCarEntity();
                        shopcarentity.PicUrl          = vwpentity.PicUrl;
                        shopcarentity.PicSuffix       = vwpentity.PicSuffix;
                        shopcarentity.Price           = Calculate.GetPrice(member.Status, member.IsStore, member.StoreType, member.MemGrade, vwpentity.TradePrice, vwpentity.Price, vwpentity.IsBP, vwpentity.DealerPrice);
                        shopcarentity.ProductName     = vwpentity.AdTitle;
                        shopcarentity.Spec1           = vwpentity.Spec1;
                        shopcarentity.Spec2           = vwpentity.Spec2;
                        shopcarentity.Spec3           = vwpentity.Spec3;
                        shopcarentity.TotalPrice      = shopcarentity.Price * entity.Num;
                        shopcarentity.Num             = entity.Num;
                        shopcarentity.ProductType     = vwpentity.ProductType;
                        shopcarentity.ProductId       = vwpentity.ProductId;
                        shopcarentity.StockNum        = vwpentity.StockNum;
                        shopcarentity.Check           = entity.C == 1;
                        shopcarentity.ProductDetailId = entity.ProDId;
                        clist.Add(shopcarentity);
                    }
                }
                shoppingCart.CartItemsL = clist;
            }
            ViewBag.ShoppingCart = shoppingCart;
            ViewBag.MemId        = memid;
            ViewBag.JiShiSong    = jishi;

            ViewBag.PageMenu = "3";
            return(View());
        }
Esempio n. 22
0
        /// <summary>
        /// 生成真实订单
        /// </summary>
        /// <returns></returns>
        public string CreateOrderXuQiu()
        {
            ResultObj _result       = new ResultObj();
            int       _resultstatus = (int)CommonStatus.Fail;
            long      _preordercode = FormString.LongIntSafeQ("preordercode");
            int       _addressid    = FormString.IntSafeQ("addressid");
            int       _paytype      = FormString.IntSafeQ("paytype");
            string    _remark       = FormString.SafeQ("remark", 80000);
            string    acceptername  = FormString.SafeQ("acceptername");
            int       province      = FormString.IntSafeQ("province");
            int       city          = FormString.IntSafeQ("city");
            string    address       = FormString.SafeQ("address", 500);
            string    mobilephone   = FormString.SafeQ("mobilephone");
            int       jifen         = FormString.IntSafeQ("jifen");
            int       memcouponid   = FormString.IntSafeQ("memcouponid");//折扣券Id
            int       expressid     = FormString.IntSafeQ("expressid");
            int       ordertype     = FormString.IntSafeQ("ordertype", -1);

            if (jifen % 100 != 0)
            {
                jifen = jifen / 100 * 100;
            }
            if (jifen > 0 && !AssetBLL.Instance.CheckIntegralEnough(memid, jifen))
            {
                jifen = 0;
            }
            int billtype = FormString.IntSafeQ("billtype");
            OrderBillBasicEntity _billentity = new OrderBillBasicEntity();

            _billentity.BillType = billtype;
            if (billtype == (int)BillType.Normal)
            {
                string title = FormString.SafeQ("billtitle", 200);
                _billentity.CompanyName = title;
            }
            else if (billtype == (int)BillType.VAT)
            {
                _billentity.BillId = FormString.IntSafeQ("billvatid");

                MemBillVATEntity _mementity = MemBillVATBLL.Instance.GetMemBillVAT(memid);
                _billentity.ReceiverName     = FormString.SafeQ("billvatrename");
                _billentity.ReceiverPhone    = FormString.SafeQ("billvatrephone");
                _billentity.ReceiverProvince = FormString.IntSafeQ("billvatreprovince");
                _billentity.ReceiverCity     = FormString.IntSafeQ("billvatrecity");
                _billentity.ReceiverAddress  = FormString.SafeQ("billvatreaddress", 300);
                _billentity.CompanyName      = _mementity.CompanyName;
                _billentity.CompanyPhone     = _mementity.CompanyPhone;
                _billentity.CompanyCode      = _mementity.CompanyCode;
                _billentity.CompanyBank      = _mementity.CompanyBank;
                _billentity.CompanyAddress   = _mementity.CompanyAddress;
                _billentity.BankAccount      = _mementity.BankAccount;
                _billentity.Status           = _mementity.Status;
            }
            OrderAddressEntity _address = new OrderAddressEntity();

            _address.CityId       = city;
            _address.AccepterName = acceptername;
            _address.ProvinceId   = province;
            _address.Address      = address;
            _address.MobilePhone  = mobilephone;

            Dictionary <int, VWOrderEntity> _vworderdic = OrderDetailPreTempBLL.Instance.GetVWOrdersByTempCode(_preordercode);

            List <int> listpdids      = new List <int>();
            string     productdetails = "";

            if (_vworderdic.Keys.Count > 0)
            {
                IList <VWOrderRemarkEntity> remarklist = new List <VWOrderRemarkEntity>();
                if (!string.IsNullOrEmpty(_remark))
                {
                    remarklist = JsonJC.JsonToObject <List <VWOrderRemarkEntity> >(_remark.Replace(""", "\""));
                }
                Dictionary <int, string> remarkdic = new Dictionary <int, string>();
                foreach (VWOrderRemarkEntity reenti in remarklist)
                {
                    remarkdic.Add(StringUtils.GetDbInt(reenti.CGMemId), reenti.Remark);
                }
                foreach (int okey in _vworderdic.Keys)
                {
                    if (okey > 0)
                    {
                        foreach (VWOrderDetailEntity oden in _vworderdic[okey].Details)
                        {
                            listpdids.Add(oden.ProductDetailId);
                            productdetails += "|" + oden.ProductDetailId.ToString() + "_" + oden.Num.ToString();
                        }
                        productdetails = productdetails.TrimStart('|');
                        OrderCommonBLL.Instance.GetTransFeeForOrder(_vworderdic[okey]);
                        _vworderdic[okey].CGMemId      = okey;
                        _vworderdic[okey].PreOrderCode = _preordercode;
                        _vworderdic[okey].OrderType    = (int)OrderType.OnLine;
                        _vworderdic[okey].NeedDeliver  = 1; //需要发货
                        _vworderdic[okey].PayPrice     = 0; //支付价格0
                        _vworderdic[okey].PayType      = _paytype;
                        _vworderdic[okey].ExpressCom   = 0; //普通配送
                        _vworderdic[okey].MemId        = memid;
                        _vworderdic[okey].MemLevel     = member.MemGrade;
                        _vworderdic[okey].IsStore      = member.IsStore;
                        _vworderdic[okey].OrderStyle   = (int)OrderStyleEnum.XuQiu;
                        if (remarkdic.ContainsKey(okey))
                        {
                            _vworderdic[okey].Remark = remarkdic[okey];
                        }
                    }
                    else
                    {
                        foreach (VWOrderDetailEntity oden in _vworderdic[okey].Details)
                        {
                            listpdids.Add(oden.ProductDetailId);
                        }
                    }
                }
                if (ProductStyleBLL.Instance.ProductsEnough(productdetails))
                {
                    string ordercode = OrderBLL.Instance.CreateOrderList(_vworderdic, _address, _billentity);
                    if (!string.IsNullOrEmpty(ordercode))
                    {
                        if (productdetails != "")
                        {
                            if (ProductStyleBLL.Instance.ProductsToOrder(productdetails) > 0)
                            {
                                VWShoppingCartInfo ShoppingCartentity = ShoppingXuQiuProcessor.GetShoppingXuQiu();
                                ShoppingXuQiuProcessor.RemoveCartXuQiuItems(ShoppingCartentity, listpdids);
                                _result.Status = (int)CommonStatus.Success;
                                _result.Obj    = ordercode;
                                return(JsonJC.ObjectToJson(_result));
                            }
                            else
                            {
                                _result.Status = (int)CommonStatus.ProductLess;
                                _result.Obj    = "";
                                return(JsonJC.ObjectToJson(_result));
                            }
                        }
                        else
                        {
                            _result.Status = (int)CommonStatus.Success;
                            _result.Obj    = ordercode;
                            return(JsonJC.ObjectToJson(_result));
                        }
                    }
                }
                else
                {
                    _result.Status = (int)CommonStatus.ProductLess;
                    _result.Obj    = "";
                    return(JsonJC.ObjectToJson(_result));
                }
            }
            _result.Status = (int)CommonStatus.Fail;
            _result.Obj    = "";
            return(JsonJC.ObjectToJson(_result));
        }