/// <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); }
public ActionResult Ajax_QueryGroupbuying() { int category = 0; int pageIndex = 0; int.TryParse(Request["category"], out category); int.TryParse(Request["page"], out pageIndex); GroupBuyingQueryInfo queryInfo = new GroupBuyingQueryInfo() { PageInfo = new Entity.PageInfo() { PageIndex = pageIndex, PageSize = int.Parse(Request["size"]) }, SortType = 0, GroupBuyingTypeSysNo = 0 }; if (category > 0) { queryInfo.CategorySysNo = category; } else { queryInfo.CategorySysNo = null; } var data = GroupBuyingFacade.QueryGroupBuyingInfo(queryInfo); data.ResultList.ForEach(p => { p.DefaultImage = ProductFacade.BuildProductImage(ImageSize.P200, p.DefaultImage); }); var result = new AjaxResult { Success = true, Data = data }; return(Json(result, JsonRequestBehavior.AllowGet)); }
/// <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)); }