Ejemplo n.º 1
0
        /// <summary>
        /// 满赠主商品列表
        /// </summary>
        /// <returns></returns>
        public ActionResult FullSendMainProductList()
        {
            //满赠促销活动id
            int pmId = GetRouteInt("pmId");

            if (pmId == 0)
            {
                pmId = WebHelper.GetQueryInt("pmId");
            }
            //开始价格
            int startPrice = GetRouteInt("startPrice");

            if (startPrice == 0)
            {
                startPrice = WebHelper.GetQueryInt("startPrice");
            }
            //结束价格
            int endPrice = GetRouteInt("endPrice");

            if (endPrice == 0)
            {
                endPrice = WebHelper.GetQueryInt("endPrice");
            }
            //排序列
            int sortColumn = GetRouteInt("sortColumn");

            if (sortColumn == 0)
            {
                sortColumn = WebHelper.GetQueryInt("sortColumn");
            }
            //排序方向
            int sortDirection = GetRouteInt("sortDirection");

            if (sortDirection == 0)
            {
                sortDirection = WebHelper.GetQueryInt("sortDirection");
            }
            //当前页数
            int page = GetRouteInt("page");

            if (page == 0)
            {
                page = WebHelper.GetQueryInt("page");
            }

            //满赠促销活动
            FullSendPromotionInfo fullSendPromotionInfo = Promotions.GetFullSendPromotionByPmIdAndTime(pmId, DateTime.Now);

            if (fullSendPromotionInfo == null)
            {
                return(PromptView(Url.Action("index"), "促销活动不存在"));
            }

            PageModel pageModel = new PageModel(20, page, Promotions.GetFullSendMainProductCount(pmId, startPrice, endPrice));

            FullSendMainProductListModel model = new FullSendMainProductListModel()
            {
                PmId             = pmId,
                StartPrice       = startPrice,
                EndPrice         = endPrice,
                SortColumn       = sortColumn,
                SortDirection    = sortDirection,
                PageModel        = pageModel,
                ProductList      = Promotions.GetFullSendMainProductList(pageModel.PageSize, pageModel.PageNumber, pmId, startPrice, endPrice, sortColumn, sortDirection),
                OrderProductList = Carts.GetCartProductList(WorkContext.Uid, WorkContext.Sid)
            };

            return(View(model));
        }