Ejemplo n.º 1
0
        public IQueryable <NoticeVtual> QueryNotice(NoticeSearch search, Page page, out int count)
        {
            var query = from A in DataContext.Notice
                        join B in DataContext.System_Users on A.Creator_UID equals B.Account_UID
                        where A.State == "进行中" || A.State == "未开始"
                        orderby A.Creat_Time descending
                        select new NoticeVtual
            {
                UID            = A.UID,
                Notice_Content = A.Notice_Content,
                Start_Time     = A.Start_Time,
                End_Time       = A.End_Time,
                Color          = A.Color,
                Scope          = A.Scope,
                State          = A.State,
                Creator_User   = B.User_Name,
                Creat_Time     = A.Creat_Time,
                RepeatTime     = A.RepeatTime
            };


            count = query.Count();

            query = query.GetPage(page);
            return(query);
        }
Ejemplo n.º 2
0
        public ActionResult QueryNotice(NoticeSearch search, Page page)
        {
            var apiUrl = "Chart/QueryNoticeAPI";
            HttpResponseMessage responMessage = APIHelper.APIPostAsync(search, page, apiUrl);
            var result = responMessage.Content.ReadAsStringAsync().Result;

            return(Content(result, "application/json"));
        }
Ejemplo n.º 3
0
        public PagedListModel <NoticeVM> QueryNotice(NoticeSearch search, Page page)
        {
            var totalCount           = 0;
            var list                 = NoticeRepository.QueryNotice(search, page, out totalCount);
            IList <NoticeVM> listDTO = new List <NoticeVM>();

            foreach (var item in list)
            {
                var ent = new NoticeVM();
                ent.Creator_User   = item.Creator_User;
                ent.Creat_Time     = item.Creat_Time;
                ent.Notice_Content = item.Notice_Content;
                ent.Period         = item.Start_Time.ToLocalTime() + "~" + item.End_Time.ToLocalTime();
                ent.Scope          = item.Scope;
                ent.State          = item.State;
                ent.UID            = item.UID;
                listDTO.Add(ent);
            }
            return(new PagedListModel <NoticeVM>(totalCount, listDTO));
        }
Ejemplo n.º 4
0
        public ActionResult QueryORTImg(NoticeSearch search, Page page)
        {
            var dirPath = Server.MapPath("~/Upload/ORTImg");

            //若无文件夹则创建
            if (!Directory.Exists(dirPath))
            {
                Directory.CreateDirectory(dirPath);
            }
            var dir    = new DirectoryInfo(dirPath);
            var imgVMs = dir.EnumerateFiles("*.*").Where(s => s.Name.ToLower().EndsWith(".jpg") || s.Name.ToLower().EndsWith(".jpeg") || s.Name.ToLower().EndsWith(".png")).Select(f => new ORTImgVM()
            {
                Name = f.Name, FullPath = f.FullName, LastWriteTime = f.LastWriteTime
            });
            var orderedImgVMs = imgVMs.OrderByDescending(f => f.LastWriteTime).Skip(page.Skip).Take(page.PageSize);
            var ORTImagList   = new List <ORTImgVM>();

            foreach (var item in orderedImgVMs)
            {
                var buildingName = item.Name.Split('.')[0];

                if (buildingName.Contains("_"))
                {
                    buildingName = buildingName.Split('_')[0];
                }
                ORTImagList.Add(new ORTImgVM()
                {
                    Name = item.Name, FullPath = item.FullPath, BuildingName = buildingName, LastWriteTime = item.LastWriteTime
                });
            }
            //var serializeStr = JsonConvert.SerializeObject(orderedImgVMs);
            var pagedImgVMs  = new PagedListModel <ORTImgVM>(imgVMs.Count(), ORTImagList);
            var serializeStr = JsonConvert.SerializeObject(pagedImgVMs);

            return(Content(serializeStr, "application/json"));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> OnPostDataAsync(int page, int rows, NoticeSearch where)
        {
            var data = await _service.GetListAsync(page, rows, where, null);

            return(PagerData(data.items, page, rows, data.count));
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> GetList(int page, int rows, NoticeSearch where)
        {
            var data = await _service.GetListAsync(page, rows, where, new { StickyNum = "desc", PublishedTime = "desc" });

            return(PagerData(data.items, page, rows, data.count));
        }