Example #1
0
        public JsonResult List(int page, int rows, string BeginTime = "", string EndTime = "")
        {
            MeetingInfoQuery model = new MeetingInfoQuery();
            DateTime         dt;

            if (DateTime.TryParse(BeginTime, out dt) && DateTime.TryParse(EndTime, out dt))
            {
                model = new MeetingInfoQuery()
                {
                    BeginTime = DateTime.Parse(BeginTime),
                    EndTime   = DateTime.Parse(EndTime),
                    PageNo    = page,
                    PageSize  = rows
                };
            }
            else
            {
                model = new MeetingInfoQuery()
                {
                    PageNo   = page,
                    PageSize = rows
                };
            }
            PageModel <MeetingInfo> opModel = ServiceHelper.Create <IMeetInfoService>().GetMeetingInfos(model);
            var array =
                from item in opModel.Models.ToArray()
                select new { Id = item.Id, Title = item.Title, MeetingTime = item.MeetingTime, MeetingPlace = item.MeetingPlace, MeetingContent = item.MeetingContent };

            return(Json(new { rows = array, total = opModel.Total }));
        }
Example #2
0
        public PageModel <MeetingInfo> GetMeetingInfosByThreeMouth(MeetingInfoQuery model)
        {
            DateTime oldtime = DateTime.Now.AddDays(-90);
            DateTime nowtime = DateTime.Now;
            int      pageNum = 0;
            IQueryable <MeetingInfo> MeetingInfos = from item in base.context.MeetingInfo
                                                    where item.MeetingTime >= oldtime && item.MeetingTime <= nowtime
                                                    //where item.MeetingTime <= DateTime.Now && item.MeetingTime >= DateTime.Now.AddDays(-7)
                                                    select item;

            MeetingInfos = MeetingInfos.GetPage(out pageNum, model.PageNo, model.PageSize, (IQueryable <MeetingInfo> d) =>
                                                from o in d
                                                orderby o.MeetingTime descending
                                                select o);
            return(new PageModel <MeetingInfo>
            {
                Models = MeetingInfos,
                Total = pageNum
            });
        }
Example #3
0
        /// <summary>
        /// 获取会议信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public PageModel <MeetingInfo> GetMeetingInfos(MeetingInfoQuery model)
        {
            int pageNum = 0;
            IQueryable <MeetingInfo> MeetingInfos = from item in base.context.MeetingInfo
                                                    select item;
            string begin = model.BeginTime.ToString("yyyy/MM/dd");
            string end   = model.EndTime.ToString("yyyy/MM/dd");

            if (!string.IsNullOrWhiteSpace(begin) && !begin.Equals("0001/01/01") && !string.IsNullOrWhiteSpace(end) && !end.Equals("0001/01/01"))
            {
                MeetingInfos = (from a in MeetingInfos where a.MeetingTime <model.BeginTime && a.MeetingTime> model.EndTime select a);
            }
            MeetingInfos = MeetingInfos.GetPage(out pageNum, model.PageNo, model.PageSize, (IQueryable <MeetingInfo> d) =>
                                                from o in d
                                                orderby o.MeetingTime descending
                                                select o);
            return(new PageModel <MeetingInfo>
            {
                Models = MeetingInfos,
                Total = pageNum
            });
        }