Ejemplo n.º 1
0
        public VPageBootstrapTable <NoticeInfo> GetNoticePageInfo(VNoticeInfoCondition searchInfo)
        {
            var list = _repoNoticeInfo.GetList();

            if (!string.IsNullOrEmpty(searchInfo.NoticeTitle))
            {
                list = list.Where(w => w.NoticeTitle.Contains(searchInfo.NoticeTitle));
            }
            if (!string.IsNullOrEmpty(searchInfo.InsertPersonNum))
            {
                list = list.Where(w => w.InsertPersonNum == searchInfo.InsertPersonNum);
            }
            if (!string.IsNullOrEmpty(searchInfo.NoticeType))
            {
                list = list.Where(w => w.ContentType == searchInfo.NoticeType);
            }
            var rows  = list.OrderByDescending(o => o.InsertDate).Skip(searchInfo.offset).Take(searchInfo.limit).ToList();
            var total = list.Count();

            return(new VPageBootstrapTable <NoticeInfo> {
                rows = rows, total = total
            });
        }
        public JsonResult List()
        {
            try
            {
                VNoticeInfoCondition input = new VNoticeInfoCondition();
                var limit = 0;
                int.TryParse(Request.Form["limit"], out limit);
                input.limit = limit;
                var offSet = 0;
                int.TryParse(Request.Form["offset"], out offSet);
                input.offset          = offSet;
                input.NoticeTitle     = Request["title"];
                input.InsertPersonNum = Request["userNum"];
                input.NoticeType      = Request["type"];
                var list = _serviceNotice.GetNoticePageInfo(input);

                return(Json(list));
            }
            catch (Exception ex)
            {
                return(Json(ex.Message));
            }
        }