Esempio n. 1
0
        public ActionResult NoticeManage(string usercode, int pageIndex = 1)
        {
            NoticeMabageListModel model = new NoticeMabageListModel();


            //查询数据
            NewsPageResult newsModel = new NewsPageResult();

            newsModel = NewsService.GetPageList(pageIndex, PageSize);

            model.newsList = newsModel.News;
            //分页
            Pagination pager = new Pagination();

            pager.PageIndex  = pageIndex;
            pager.PageSize   = PageSize;
            pager.TotalCount = newsModel.TotalCount;

            if (newsModel.TotalCount <= PageSize)
            {
                model.Page = "";
            }
            else
            {
                model.Page = pager.GetPagerHtml();
            }
            return(Json(new AjaxResult {
                Status = "1", Data = model
            }));
        }
Esempio n. 2
0
        //公告列表
        public ActionResult NoticeManage()
        {
            NoticeMabageListModel model = new NoticeMabageListModel();

            //查询数据
            NewsPageResult newsModel = new NewsPageResult();

            newsModel = NewsService.GetPageList(1, PageSize);

            model.newsList = newsModel.News;
            //分页
            Pagination pager = new Pagination();

            pager.PageIndex  = 1;
            pager.PageSize   = PageSize;
            pager.TotalCount = newsModel.TotalCount;

            if (newsModel.TotalCount <= PageSize)
            {
                model.Page = "";
            }
            else
            {
                model.Page = pager.GetPagerHtml();
            }
            return(View(model));
        }
Esempio n. 3
0
        //前台新闻公告列表
        /// <summary>
        /// 前台查询未开通会员
        /// </summary>
        /// <param name="Id"></param>
        /// <param name="GetLoginID">GetLoginID 推荐会员</param>
        /// <param name="usercode"></param>
        /// <param name="Level"></param>
        /// <param name="Strat"></param>
        /// <param name="End"></param>
        /// <param name="PageIndex"></param>
        /// <param name="PageSize"></param>
        /// <param name="i">i=0就是查询未开通会员 2 是开通会员   3是注册会员</param>
        /// <returns></returns>
        public NewsPageResult GetNewsList(int NewType, string Title, DateTime?Strat, DateTime?End, int PageIndex, int PageSize)
        {
            using (MyDbContext dbc = new MyDbContext())
            {
                CommonService <NewsEntity> cs         = new CommonService <NewsEntity>(dbc);
                NewsPageResult             NewsSearch = new NewsPageResult();
                var naws = cs.GetAll();

                if (Strat != null)
                {
                    naws = naws.Where(p => p.CreateTime >= Strat);
                }
                if (End != null)
                {
                    naws = naws.Where(p => p.CreateTime <= End);
                }
                if (NewType > 0)
                {
                    naws = naws.Where(p => p.NewType == NewType);
                }

                if (Title != "")
                {
                    naws = naws.Where(p => p.NewsTitle.Contains(Title));
                }
                NewsSearch.TotalCount = naws.LongCount();
                NewsSearch.News       = naws.OrderByDescending(p => p.ID).ToList().Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList().Select(p => ToDTO(p)).ToArray();
                return(NewsSearch);
            }
        }
        //新闻列表

        public ActionResult NoticeManage(string Title, DateTime?Strat, DateTime?End, int PageIndex = 1)
        {
            int NewType = 0;

            NoticeMabageListModel model = new NoticeMabageListModel();

            //查询数据
            NewsPageResult newsModel = new NewsPageResult();

            newsModel = NewsService.GetNewsList(NewType, Title, Strat, End, PageIndex, pageSize);

            model.newsList = newsModel.News;
            //分页
            Pagination pager = new Pagination();

            pager.PageIndex  = PageIndex;
            pager.PageSize   = pageSize;
            pager.TotalCount = newsModel.TotalCount;

            if (newsModel.TotalCount <= pageSize)
            {
                model.Page = "";
            }
            else
            {
                model.Page = pager.GetPagerHtml();
            }
            return(View(model));
        }
Esempio n. 5
0
 public NewsPageResult GetPageList(int PageIndex, int PageSize)
 {
     using (MyDbContext dbcontext = new MyDbContext())
     {
         CommonService <NewsEntity> csr        = new CommonService <NewsEntity>(dbcontext);
         NewsPageResult             PageResult = new NewsPageResult();
         var NewsQuery = csr.GetAll();
         PageResult.TotalCount = NewsQuery.LongCount();
         PageResult.News       = NewsQuery.OrderByDescending(p => p.CreateTime).Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList().Select(p => ToDTO(p)).ToArray();
         return(PageResult);
     }
 }
Esempio n. 6
0
        /// <summary>
        /// 获取新闻Type名字
        /// </summary>
        /// <returns></returns>
        public NewsPageResult getdata()
        {
            using (MyDbContext dbc = new MyDbContext())
            {
                CommonService <NewsTypeEntity> cs = new CommonService <NewsTypeEntity>(dbc);
                var            user   = cs.GetAll();
                NewsPageResult Result = new NewsPageResult();

                Result.NewsTypeList = user.ToList().Select(p => NewsType(p)).ToArray();
                return(Result);
            }
        }