public JsonResult GetCalendar() { var calendars = StdSchedulerManager.GetCalendarNames().ToList().Select(n => new { Name = n, Calendar = StdSchedulerManager.GetCalendar(n) }).ToDictionary(n => n.Name, n => n.Calendar); IList <SystemQuartzCalendarModel> calendarModels = calendars.Select(cal => new SystemQuartzCalendarModel { Description = cal.Value.Description, CalendarName = cal.Key }).ToList(); return(Json(calendarModels)); }
public async Task <JsonResult> GetCalendar() { var getCalendarNames = (await StdSchedulerManager.GetCalendarNames()).ToList(); var calendars = getCalendarNames.Select(n => new { Name = n, Calendar = StdSchedulerManager.GetCalendar(n) }).ToDictionary(n => n.Name, n => n.Calendar); IList <CalendarInput> calendarModels = calendars.Select(cal => new CalendarInput { Description = cal.Value.Result.Description, CalendarName = cal.Key }).ToList(); return(JsonForGridLoadOnce(calendarModels)); }
/// <summary> /// 日历 /// </summary> /// <param name="htmlHelper"></param> /// <param name="input"></param> /// <returns></returns> public static MvcHtmlString LoadQuartzCalendar(this HtmlHelper htmlHelper, BaseDropDownListInput input) { StringBuilder stringBuilder = new StringBuilder(2000); stringBuilder.Append("<select id='" + input.Id + "' name='" + input.Name + "'" + input.HtmlAttributes + ">"); if (input.NeedDefault) { stringBuilder.Append("<option value=''>===请选择===</option>"); } var calendars = StdSchedulerManager.GetCalendarNames().ToList().Select(n => new { Name = n, Calendar = StdSchedulerManager.GetCalendar(n) }).ToDictionary(n => n.Name, n => n.Calendar); foreach (var item in calendars) { if (input.SelectedVal != null) { if (item.Key == input.SelectedVal) { stringBuilder.Append(" <option value='" + item.Key + "' selected='selected'>" + item.Key + "</option> "); } else { stringBuilder.Append(" <option value='" + item.Key + "' >" + item.Key + "</option> "); } } else { stringBuilder.Append(" <option value='" + item.Key + "' >" + item.Key + "</option> "); } } stringBuilder.Append("</select>"); return(new MvcHtmlString(stringBuilder.ToString())); }