public GetItemListResult GetInformationItemList(GetInformationItemListArgs args) { List <CommandParameter> parameterList = new List <CommandParameter>(); parameterList.Add(new CommandParameter("@categoryId", args.CategoryId)); parameterList.Add(new CommandParameter("@keyword", args.Keyword)); parameterList.Add(new CommandParameter("@page", args.Page)); parameterList.Add(new CommandParameter("@pageSize", args.PageSize)); DataSet dsResult = _dataBase.ExecuteDataSet(CommandType.StoredProcedure, "GetInformationItemList", parameterList, new string[] { "result" }); if (dsResult.Tables[0].Rows.Count == 0 && args.Page > 1) { args.Page--; return(GetInformationItemList(args)); } GetItemListResult result = new GetItemListResult(); result.ItemList = dsResult.Tables[0]; int totalCount = int.Parse(dsResult.Tables[1].Rows[0][0].ToString()); result.TotalPage = totalCount / args.PageSize; if (totalCount % args.PageSize > 0) { result.TotalPage++; } result.Page = args.Page; return(result); }
public ActionResult GetInformationItemList() { GetInformationItemListArgs args = RequestArgs <GetInformationItemListArgs>(); if (args == null) { return(RespondResult(false, "参数无效。")); } GetItemListResult result = _informationManager.GetInformationItemList(args); return(RespondDataResult(result)); }