private void BindList() { HelpQuery helpQuery = this.GetHelpQuery(); DbQueryResult dbQueryResult = new DbQueryResult(); dbQueryResult = CommentBrowser.GetHelpList(helpQuery); this.rptHelps.DataSource = dbQueryResult.Data; this.rptHelps.DataBind(); this.pager.TotalRecords = dbQueryResult.TotalRecords; }
public IHttpActionResult HelpByCategory(int categoryId, string accessToken, int channel, int platform, string ver) { Logger.WriterLogger("Common.HelpByCategory, Params: " + string.Format("accessToken={0}&channel={1}&platform={2}&ver={3}&categoryId={4}", accessToken, channel, platform, ver, categoryId), LoggerType.Info); // 保存访问信息 base.SaveVisitInfo("", channel, platform, ver); // 验证令牌 int accessTookenCode = VerifyAccessToken(accessToken); if (accessTookenCode > 0) { return(base.JsonFaultResult(new CommonException(accessTookenCode).GetMessage(), "Common.HelpByCategory")); } IList <HelpCategoryInfo> categories = CommentBrowser.GetHelpCategorys(); HelpQuery helpQuery = new HelpQuery(); if (categoryId > 0) { helpQuery.CategoryId = categoryId; } helpQuery.PageIndex = 1; helpQuery.PageSize = int.MaxValue; helpQuery.SortBy = "AddedDate"; helpQuery.SortOrder = EcShop.Core.Enums.SortAction.Desc; List <HelpListItem> items = new List <HelpListItem>(); DbQueryResult dbQueryResult = CommentBrowser.GetHelpList(helpQuery); DataTable dt = dbQueryResult.Data as DataTable; if (dt != null) { HelpListItem item = null; foreach (DataRow row in dt.Rows) { item = new HelpListItem(); item.CategoryId = (int)row["CategoryId"]; item.Id = (int)row["HelpId"]; item.Title = (string)row["Title"]; item.Description = ""; if (row["Description"] != DBNull.Value) { item.Description = (string)row["Description"]; } item.AddedDate = ""; if (row["AddedDate"] != DBNull.Value) { item.AddedDate = ((DateTime)row["AddedDate"]).ToString("yyyy-MM-dd HH:mm:ss"); } items.Add(item); } } return(base.JsonActionResult(new StandardResult <ListResult <HelpListItem> >() { code = 0, msg = "", data = new ListResult <HelpListItem>() { TotalNumOfRecords = items.Count, Results = items } })); }