public EventList GetCalendar(string eventID, Options options) { EventList calendar; Item item = StaticSettings.EventSourceDatabase.GetItem(ID.Parse(eventID)); if (item == null) { return null; } if (item.TemplateID != StaticSettings.EventTemplate.ID) { throw new EventCalendarException( String.Format(String.Format(ResourceManager.Localize("UNSUPPORT_TEMPLATE"), item.Name, item.TemplateName, StaticSettings.EventTemplate.Name))); } Item settingsItem = StaticSettings.EventSourceDatabase.GetItem(options.ControlSettingsPath); Item[] eventList = Utilities.GetEventListForView(settingsItem, options.SiteSettingsPath); var EventListMgr = new EventListManager(eventList, options.SiteSettingsPath); calendar = EventListMgr.GetCalendar(item); return calendar; }
public static void CreateRecurrence(Event ev, Schedule schedule, Options options) { Message message = Message.Parse(ev, "recurrence:" + schedule.Recurrence.ToString().ToLower()); var context = new EventCommandContext(ev, schedule, options); Dispatcher.Dispatch(message, context); }
public EventCommandContext(Event evt, Schedule schedule, Options options, BranchItem branch) { Assert.ArgumentNotNull(evt, "evt"); Event = evt; Schedule = schedule; Options = options; this.branch = branch; }
public static void UpdateEvent(Event evnt, Schedule schedule, Options options, bool updateSeries) { if (RemoteSettings.Service != null) { RemoteSettings.Service.SaveEventInfo(evnt.ToXml(), schedule == null ? string.Empty : schedule.ToXml(), options.ToXml(), updateSeries, RemoteSettings.ServiceCredentials); CacheManager.ClearAllCaches(); } else { CalendarActions.UpdateEvent(evnt, schedule, options, updateSeries); } }
public static void CreateEvent(Event ev, Schedule schedule, Options options) { if (RemoteSettings.Service != null) { RemoteSettings.Service.CreateEvent(ev.ToXml(), schedule == null ? string.Empty : schedule.ToXml(), options.ToXml(), RemoteSettings.ServiceCredentials); CacheManager.ClearAllCaches(); } else { CalendarActions.CreateEvent(ev, schedule, options); } }
public ArrayList GetCalendarsList(bool canWrite, Options options) { var list = new ArrayList(); Item settingsItem = StaticSettings.EventSourceDatabase.GetItem(options.ControlSettingsPath); Item[] eventList = Utilities.GetEventListForView(settingsItem, options.SiteSettingsPath); var EventListMgr = new EventListManager(eventList, options.SiteSettingsPath); foreach (var cal in EventListMgr.ActiveEventLists) { if (cal.Value.Selected && (!canWrite || cal.Value.CanWrite)) { list.Add(cal.Value.Title); list.Add(cal.Value.ID.ToString()); } } return list; }
public static void CreateSchedule(Event ev, Schedule schedule, Options options) { Message message = Message.Parse(ev, "schedule:create"); var context = new EventCommandContext(ev, schedule, options); Dispatcher.Dispatch(message, context); }
public static void CreateEvent(Event ev, Schedule schedule, Options options, BranchItem branch) { Message message = Message.Parse(ev, "event:create"); var calendarContext = new EventCommandContext(ev, schedule, options, branch); Dispatcher.Dispatch(message, calendarContext); }
public static void CreateEvent(Event ev, Schedule schedule, Options options) { CreateEvent(ev, schedule, options, null); }
public string GetHTMLDayInMonthView(string date, Options options, int startHour, int hour) { if ((HttpContext.Current.Request.UserLanguages != null) && (!String.IsNullOrEmpty(HttpContext.Current.Request.UserLanguages[0]))) { Utilities.SetCurrentCulture(HttpContext.Current.Request.UserLanguages[0]); } var moduleSettings = new ModuleSettings(options.SiteSettingsPath); Item site_settings = moduleSettings.GetSettingsItem(); Item settingsItem = moduleSettings.GetActiveDatabase().GetItem(options.ControlSettingsPath); var stringWriter = new StringWriter(); var writer = new HtmlTextWriter(stringWriter); MonthView view; if (Utilities.IsTemplateSettingsEqual(settingsItem, site_settings, ModuleSettings.MonthViewField)) { view = new MonthView(options.CalendarID, settingsItem, options.SiteSettingsPath); } else { view = new MonthView(options.CalendarID, moduleSettings.MonthViewSettings, options.SiteSettingsPath); view.SetSettings(settingsItem, options.SiteSettingsPath); } view.IsReinitNeed = true; view.Attributes["startHour"] = startHour.ToString(); view.Attributes["numHours"] = hour.ToString(); view.CurrentDate = Utilities.StringToDate(options.Date); view.RenderDayCell(writer, Utilities.StringToDate(date)); return stringWriter.ToString(); }
public void SaveEventInfo(Event evnt, Schedule schedule, bool updateSeries, Options options) { RemoteActionWrapper.UpdateEvent(evnt, schedule, options, updateSeries); }
public void CreateEvent(Event ev, Schedule schedule, Options options) { RemoteActionWrapper.CreateEvent(ev, schedule, options); }
public string GetViewHTML(int num, int startHour, string viewName, string currentView, int hour, Options options) { if ((HttpContext.Current.Request.UserLanguages != null) && (!String.IsNullOrEmpty(HttpContext.Current.Request.UserLanguages[0]))) { Utilities.SetCurrentCulture(HttpContext.Current.Request.UserLanguages[0]); } var stringWriter = new StringWriter(); var writer = new HtmlTextWriter(stringWriter); if (num > -1) { writer.Write(string.Format("<calendarNum>{0}</calendarNum>", num)); } var moduleSettings = new ModuleSettings(options.SiteSettingsPath); Item site_settings = moduleSettings.GetSettingsItem(); Item settingsItem = moduleSettings.GetActiveDatabase().GetItem(options.ControlSettingsPath); if (viewName == "day") { if (HttpContext.Current.Session[options.CalendarID] == null) { HttpContext.Current.Session.Add(options.CalendarID, currentView); } DayView view; if (Utilities.IsTemplateSettingsEqual(settingsItem, site_settings, ModuleSettings.DayViewField)) { view = new DayView(options.CalendarID, settingsItem, options.SiteSettingsPath); } else { view = new DayView(options.CalendarID, moduleSettings.DayViewSettings, options.SiteSettingsPath); view.SetSettings(settingsItem, options.SiteSettingsPath); } view.IsReinitNeed = true; view.CurrentDate = Utilities.StringToDate(options.Date); if (startHour > -1) { view.NumHoursDisplayed = hour; view.StartHour = startHour; } view.RenderControl(writer); } else { if (HttpContext.Current.Session[options.CalendarID] != null) { HttpContext.Current.Session.Remove(options.CalendarID); } if (viewName == "week") { WeekView view; if (Utilities.IsTemplateSettingsEqual(settingsItem, site_settings, ModuleSettings.WeekViewField)) { view = new WeekView(options.CalendarID, settingsItem, options.SiteSettingsPath); } else { view = new WeekView(options.CalendarID, moduleSettings.WeekViewSettings, options.SiteSettingsPath); view.SetSettings(settingsItem, options.SiteSettingsPath); } view.IsReinitNeed = true; view.CurrentDate = Utilities.StringToDate(options.Date); if (startHour > -1) { view.NumHoursDisplayed = hour; view.StartHour = startHour; } view.RenderControl(writer); } else if (viewName == "month") { MonthView view; if (Utilities.IsTemplateSettingsEqual(settingsItem, site_settings, ModuleSettings.MonthViewField)) { view = new MonthView(options.CalendarID, settingsItem, options.SiteSettingsPath); } else { view = new MonthView(options.CalendarID, moduleSettings.MonthViewSettings, options.SiteSettingsPath); view.SetSettings(settingsItem, options.SiteSettingsPath); } view.IsReinitNeed = true; view.CurrentDate = Utilities.StringToDate(options.Date); view.Attributes["startHour"] = startHour.ToString(); view.Attributes["numHours"] = hour.ToString(); view.RenderControl(writer); } else if (viewName == "agenda") { settingsItem = (viewName == currentView) ? settingsItem : moduleSettings.AgendaViewSettings; var view = new AgendaView(options.CalendarID, settingsItem, options.SiteSettingsPath); view.CurrentDate = Utilities.StringToDate(options.Date); view.RenderControl(writer); } } return stringWriter.ToString(); }
public UpdateCommandContext(Event evt, Schedule schedule, Options options, bool updateSeries) : base(evt, schedule, options, null) { UpdateSeries = updateSeries; }
public static void UpdateEvent(Event evnt, Schedule schedule, Options options) { UpdateEvent(evnt, schedule, options, false); }
public static void UpdateEvent(Event evnt, Schedule schedule, Options options, bool updateSeries) { var context = new UpdateCommandContext(evnt, schedule, options, updateSeries); Message message = Message.Parse(evnt, "event:update"); Dispatcher.Dispatch(message, context); }
private static void CreateEndUserTrainingEvents(EventListManager eventManager) { DateTime start = FindNextDayOfWeek(DateTime.Today, DeveloperDay); var evt = new Event { Description = string.Empty, StartDate = Utilities.NormalizeDate(start), EndDate = Utilities.NormalizeDate(start.AddMonths(2)), StartTime = "09:00", EndTime = "17:00", Location = EndUserLocationDefault, Title = EndUserDefaultTitle }; var scheduler = new Schedule { DaysOfWeek = (Utils.DaysOfWeek.Monday | Utils.DaysOfWeek.Friday), StartDate = Utilities.NormalizeDate(start), EndDate = Utilities.NormalizeDate(start.AddMonths(2)), Recurrence = Recurrence.Weekly, Frequency = 1 }; var options = new Options { CalendarID = EndUserTrainingList, ControlSettingsPath = DeveloperViewSettings, SiteSettingsPath = DefaultModuleSettings }; CalendarActions.CreateEvent(evt, scheduler, options); }
public EventCommandContext(Event evt, Schedule schedule, Options options) : this(evt, schedule, options, null) { }