public ActionResult MyCalendar() { CalendarViewFormat format= new CalendarViewFormat(CalendarViewType.week, DateTime.Now, DayOfWeek.Monday); List<Calendar> list = _service.QueryCalendars(format.StartDate, format.EndDate, UserId); return View(list); }
public JsonResult GetPersonalCalViewData(FormCollection form) { CalendarViewType viewType = (CalendarViewType)Enum.Parse(typeof(CalendarViewType), form["viewtype"]); string strshowday = form["showdate"]; DateTime showdate; int clientzone = Convert.ToInt32(form["timezone"]); int serverzone = TimeHelper.GetTimeZone(); var zonediff = serverzone - clientzone; bool b = DateTime.TryParse(strshowday, out showdate); if (!b) { var ret = new JsonCalendarViewData(new JsonError("NotVolidDateTimeFormat", this.Resource("lang,notvoliddatetimeformat"))); return Json(ret); } var format = new CalendarViewFormat(viewType, showdate, DayOfWeek.Monday); var qstart = format.StartDate.AddHours(zonediff); var qend = format.EndDate.AddHours(zonediff); List<Calendar> list = _service.QueryCalendars(qstart, qend, UserId); var data = new JsonCalendarViewData(ConvertToStringArray(list), format.StartDate, format.EndDate); return Json(data); }