Пример #1
0
        /// <summary>
        /// 团购查询
        /// </summary>
        /// <param name="criteria">查询条件</param>
        /// <returns></returns>
        public GroupBuyQueryResult GetGroupBuyList(GroupBuyQueryModel criteria)
        {
            GroupBuyingQueryInfo queryInfo = new GroupBuyingQueryInfo()
            {
                PageInfo = new Entity.PageInfo()
                {
                    PageIndex = criteria.PageIndex,
                    PageSize  = criteria.PageSize
                },
                SortType = criteria.SortType
            };

            //仅查询普通团购
            queryInfo.GroupBuyingTypeSysNo = 0;
            if (criteria.CatSysNo > 0)
            {
                queryInfo.CategorySysNo = criteria.CatSysNo;
            }
            else
            {
                queryInfo.CategorySysNo = null;
            }

            GroupBuyQueryResult result = new GroupBuyQueryResult();

            if (criteria.GetFilters)
            {
                var categoryList = GroupBuyingFacade.GetGroupBuyingCategory();

                result.Filters = MapCatList(categoryList);
                if (result.Filters.Count > 0)
                {
                    //增加一个全部选项
                    GroupBuyCatModel allCat = new GroupBuyCatModel();
                    allCat.CateSysNo = 0;
                    allCat.Name      = "全部";
                    result.Filters.Insert(0, allCat);
                }
            }

            var groupBuyResult = GroupBuyingFacade.QueryGroupBuyingInfo(queryInfo);

            result.Result = MapItemList(groupBuyResult);

            return(result);
        }
Пример #2
0
        /// <summary>
        /// 团购频道页
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            int pageIndex = 0;

            if (int.TryParse(Request.Params["page"], out pageIndex))
            {
                pageIndex--;
            }
            int category = 0;

            int.TryParse(Request.Params["category"], out category);
            int sort = 0;

            int.TryParse(Request.Params["sort"], out sort);

            GroupBuyingQueryInfo queryInfo = new GroupBuyingQueryInfo()
            {
                PageInfo = new Entity.PageInfo()
                {
                    PageIndex = pageIndex,
                    PageSize  = 10
                },
                SortType = sort
            };

            if (category > 0)
            {
                queryInfo.CategorySysNo = category;
            }
            else
            {
                queryInfo.CategorySysNo = null;
            }

            GroupBuyingQueryResult result = new GroupBuyingQueryResult();

            result.QueryInfo    = queryInfo;
            result.CategoryList = GroupBuyingFacade.GetGroupBuyingCategory();
            result.Result       = GroupBuyingFacade.QueryGroupBuyingInfo(queryInfo);
            result.Result.PageInfo.PageIndex++;
            return(View(result));
        }