public ActionResult GetMeetingsByIds(string ids) { JavaScriptSerializer jser = new JavaScriptSerializer(); MeetingModel metModel = new MeetingModel(); int[] idList = jser.Deserialize <int[]>(ids); UserModel userModel = new UserModel(); user_info userInfo = userModel.GetUserInfo(User.Identity.Name); List <meeting_info_detail> source = metModel.GetMeetingsDetail(idList).ToList(); var result = source.OrderBy(r => r.mi_start_time).Select(r => new { id = r.id, title = r.mi_title, start = r.mi_start_time.ToString("yyyy-MM-ddTHH:mm:ss"), end = r.mi_end_time.ToString("yyyy-MM-ddTHH:mm:ss"), people = r.mi_people, memo = r.mi_memo, position = r.mi_position_id, creator = r.mi_creator_name, level = r.mi_level_id, createTime = r.mi_create_time.ToString("yyyy-MM-ddTHH:mm:ss"), className = r.mi_creator == userInfo.id ? "fc-event-mine" : "", editable = r.mi_creator == userInfo.id || userInfo.user_grade_catg.gc_level == 9 ? 1 : 0, isMine = r.mi_creator == userInfo.id ? 1 : 0 }); return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult MeetingList(string startDate, string endDate, int?creator, int p = 1) { MeetingModel meetingModel = new MeetingModel(); DateTime startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month - 1, 1); DateTime endTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 1); if (!string.IsNullOrEmpty(startDate)) { if (DateTime.TryParse(startDate, out startTime) == false) { startTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); } } if (!string.IsNullOrEmpty(endDate)) { if (DateTime.TryParse(endDate, out endTime) == false) { endTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); } } ViewBag.StartDateFilter = startTime.ToString("yyyy-MM-dd"); ViewBag.EndDateFilter = endTime.ToString("yyyy-MM-dd"); ViewBag.CreatorFilter = creator.HasValue ? creator.Value : -1; IQueryable <meeting_info_detail> meetings = meetingModel.GetMeetingsDetail(startTime, endTime, creator); ViewBag.MeetingsCount = meetings.Count(); UserModel userModel = new UserModel(); var creators = userModel.GetUserInfos().GroupBy(r => new { r.id, r.ui_name }).Select(r => new { r.Key.id, r.Key.ui_name }); ViewBag.CreatorSelectList = new SelectList(creators, "id", "ui_name"); meetings = meetings.OrderByDescending(r => r.mi_start_time); int pageSize = 10; Paging.ToPaging(p, ViewBag.MeetingsCount, this, pageSize); meetings = meetings.Skip((p - 1) * pageSize).Take(pageSize); return(View(meetings)); }