Ejemplo n.º 1
0
        /// <summary>
        ///  加载新闻内容列表
        /// </summary>
        /// Author  : Napoleon
        /// Created : 2015-06-19 10:22:55
        public ActionResult LoadContentGrid(string newsMenuId, string newsTitle, string newsType,
                                            int page, int rows)
        {
            int       count    = _newsContentsService.GetNewsContentsCount(newsMenuId, newsTitle, newsType);
            DataTable contents = _newsContentsService.GetNewsContents(newsMenuId, newsTitle, newsType,
                                                                      rows * (page - 1), rows * page);
            string json = contents.ConvertTableToGridJson(count);

            return(Content(json));
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  加载内容分页列表
        /// </summary>
        /// <param name="id">菜单ID</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页个数</param>
        /// Author  : Napoleon
        /// Created : 2015-08-05 20:29:59
        public ActionResult LoadList(string id, int currentPage, int pageSize)
        {
            int       start                = (currentPage - 1) * pageSize;
            int       end                  = currentPage * pageSize;
            DataTable content              = _newsContents.GetNewsContents(id, "", "", start, end);
            int       total                = _newsContents.GetNewsContentsCount(id, "", "");
            int       pageCount            = total % pageSize != 0 ? total / pageSize + 1 : total / pageSize;//总页数
            JsonSerializerSettings setting = new JsonSerializerSettings();

            setting.DateFormatString = "yyyy-MM-dd";
            string json = "{\"PageCount\":" + pageCount + ",\"CurrentPage\":" + currentPage + ",\"List\":" + JsonConvert.SerializeObject(content, setting) + "}";

            return(Content(json));
        }