Beispiel #1
0
        //读取礼品列表
        protected void ReadingGifts()
        {
            List <FavorableActivityGiftInfo> giftList = new List <FavorableActivityGiftInfo>();
            List <FavorableActivityGiftInfo> dataList = new List <FavorableActivityGiftInfo>();
            int favorId = RequestHelper.GetQueryString <int>("favorId");

            if (favorId > 0)
            {
                var theFavor = FavorableActivityBLL.Read(favorId);
                if (!String.IsNullOrEmpty(theFavor.GiftId))
                {
                    FavorableActivityGiftSearchInfo giftSearch = new FavorableActivityGiftSearchInfo();
                    giftSearch.InGiftIds = Array.ConvertAll <string, int>(theFavor.GiftId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k));
                    giftList             = FavorableActivityGiftBLL.SearchList(giftSearch);
                    if (giftList.Count > 0)
                    {
                        foreach (var tmp in giftList)
                        {
                            tmp.Photo = tmp.Photo.Replace("Original", "100-100");
                            dataList.Add(tmp);
                        }
                    }
                }
            }
            Response.Clear();
            ResponseHelper.Write(Newtonsoft.Json.JsonConvert.SerializeObject(new { count = giftList.Count, dataList = dataList }));
            ResponseHelper.End();
        }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         CheckAdminPower("ReadGift", PowerCheckType.Single);
         var searchInfo = new FavorableActivityGiftSearchInfo();
         searchInfo.Name = RequestHelper.GetQueryString <string>("Name");
         BindControl(FavorableActivityGiftBLL.SearchList(CurrentPage, PageSize, searchInfo, ref Count), RecordList, MyPager);
     }
 }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                UserGrade.DataSource     = UserGradeBLL.ReadList();
                UserGrade.DataTextField  = "Name";
                UserGrade.DataValueField = "Id";
                UserGrade.DataBind();


                RegionID.DataSource = RegionBLL.ReadRegionUnlimitClass();

                ProductClass.DataSource = ProductClassBLL.ReadUnlimitClassList();
                favorableActivityID     = RequestHelper.GetQueryString <int>("ID");
                if (favorableActivityID != int.MinValue)
                {
                    CheckAdminPower("ReadFavorableActivity", PowerCheckType.Single);
                    favorableActivity = FavorableActivityBLL.Read(favorableActivityID);
                    Photo.Text        = favorableActivity.Photo;
                    Name.Text         = favorableActivity.Name;
                    Content.Text      = favorableActivity.Content;
                    StartDate.Text    = favorableActivity.StartDate.ToString("yyyy-MM-dd");
                    EndDate.Text      = favorableActivity.EndDate.ToString("yyyy-MM-dd");
                    ControlHelper.SetCheckBoxListValue(UserGrade, favorableActivity.UserGrade);
                    OrderProductMoney.Text   = favorableActivity.OrderProductMoney.ToString();
                    RegionID.ClassIDList     = favorableActivity.RegionId ?? "";
                    ReduceMoney.Text         = favorableActivity.ReduceMoney.ToString();
                    ReduceDiscount.Text      = favorableActivity.ReduceDiscount.ToString();
                    favorableType            = favorableActivity.Type;
                    ProductClass.ClassIDList = favorableActivity.ClassIds ?? "";
                    if (!string.IsNullOrEmpty(favorableActivity.GiftId))
                    {
                        var giftSearch = new FavorableActivityGiftSearchInfo();
                        giftSearch.InGiftIds = Array.ConvertAll <string, int>(favorableActivity.GiftId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k));
                        giftList             = FavorableActivityGiftBLL.SearchList(giftSearch);
                    }
                }
                else
                {//新增:默认所有会员等级全部选中
                    foreach (ListItem item in UserGrade.Items)
                    {
                        item.Selected = true;
                    }
                }
            }
        }
Beispiel #4
0
        protected override void PageLoad()
        {
            base.PageLoad();

            //登录验证
            if (base.UserId <= 0)
            {
                string redirectUrl = "/Mobile/login.html?RedirectUrl=/mobile/CheckOut.html";

                ResponseHelper.Redirect(redirectUrl);
                ResponseHelper.End();
            }

            //购物车验证
            checkCart = HttpUtility.UrlDecode(CookiesHelper.ReadCookieValue("CheckCart"));
            int[] cartIds = Array.ConvertAll <string, int>(checkCart.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k));
            if (string.IsNullOrEmpty(checkCart) || cartIds.Length < 1)
            {
                ResponseHelper.Redirect("/Mobile/cart.html");
                ResponseHelper.End();
            }


            //cart list
            #region cart list
            //商品清单
            cartList = CartBLL.ReadList(base.UserId);
            cartList = cartList.Where(k => cartIds.Contains(k.Id)).ToList();
            if (cartList.Count < 1)
            {
                ResponseHelper.Redirect("/Mobile/cart.html");
                ResponseHelper.End();
            }

            //关联的商品
            int   count    = 0;
            int[] ids      = cartList.Select(k => k.ProductId).ToArray();
            var   products = ProductBLL.SearchList(1, ids.Length, new ProductSearchInfo {
                InProductId = string.Join(",", ids)
            }, ref count);

            //规格
            foreach (var cart in cartList)
            {
                cart.Product = products.FirstOrDefault(k => k.Id == cart.ProductId) ?? new ProductInfo();

                if (cart.Product.StandardType == 1)
                {
                    //使用规格的价格和库存
                    var standardRecord = ProductTypeStandardRecordBLL.Read(cart.ProductId, cart.StandardValueList);
                    cart.Price            = standardRecord.SalePrice;
                    cart.LeftStorageCount = standardRecord.Storage - OrderDetailBLL.GetOrderCount(cart.ProductId, cart.StandardValueList);
                    //规格集合
                    cart.Standards = ProductTypeStandardBLL.ReadList(Array.ConvertAll <string, int>(standardRecord.StandardIdList.Split(';'), k => Convert.ToInt32(k)));
                }
                else
                {
                    cart.Price            = cart.Product.SalePrice;
                    cart.LeftStorageCount = cart.Product.TotalStorageCount - OrderDetailBLL.GetOrderCount(cart.ProductId, cart.StandardValueList);
                }

                if (cart.LeftStorageCount <= 0)
                {
                    ScriptHelper.AlertFront("您购物车中 " + cart.Product.Name + " 库存不足,请重新选择", "/Mobile/Cart.html");
                }
            }
            #endregion

            //收货地址
            addressList = UserAddressBLL.ReadList(base.UserId);
            addressList = addressList.OrderByDescending(k => k.IsDefault).ToList();
            singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass();

            totalProductMoney = cartList.Sum(k => k.BuyCount * k.Price);
            //用户信息
            var user = UserBLL.Read(base.UserId);
            if (user.Id > 0)
            {
                //读取优惠券
                List <UserCouponInfo> tempUserCouponList = UserCouponBLL.ReadCanUse(base.UserId);
                foreach (UserCouponInfo userCoupon in tempUserCouponList)
                {
                    CouponInfo tempCoupon = CouponBLL.Read(userCoupon.CouponId);
                    if (tempCoupon.UseMinAmount <= totalProductMoney)
                    {
                        userCouponList.Add(userCoupon);
                    }
                }

                moneyLeft = UserBLL.ReadUserMore(base.UserId).MoneyLeft;
            }
            //读取优惠活动
            favorableActivity = FavorableActivityBLL.Read(DateTime.Now, DateTime.Now, 0);
            if (favorableActivity.Id > 0)
            {
                if (("," + favorableActivity.UserGrade + ",").IndexOf("," + base.GradeID.ToString() + ",") > -1 && Sessions.ProductTotalPrice >= favorableActivity.OrderProductMoney)
                {
                    if (favorableActivity.GiftId != string.Empty)
                    {
                        FavorableActivityGiftSearchInfo giftSearch = new FavorableActivityGiftSearchInfo();
                        giftSearch.InGiftIds = Array.ConvertAll <string, int>(favorableActivity.GiftId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k));
                        giftList             = FavorableActivityGiftBLL.SearchList(giftSearch);
                    }
                }
                else
                {
                    favorableActivity = new FavorableActivityInfo();
                }
            }
            //支付方式列表
            payPluginsList = PayPlugins.ReadProductBuyPayPluginsList();

            Title = "结算中心";
        }