public static RecurringEvent CreateEvent(RecurringEvent revent) { var args = new RecurringEventCreatingEventArgs { RecurringEvent = revent }; OnCreating(args); if (args.Cancel) { return revent; } ApplicationContext.Current.DatabaseContext.Database.Save(revent); //Create the new descriptions for the new event revent.descriptions = DescriptionService.GetDescriptionsForEvent(revent.calendarId, revent.Id, EventType.Normal).ToList(); var ls = ApplicationContext.Current.Services.LocalizationService; foreach (var lang in ls.GetAllLanguages()) { if (revent.descriptions.SingleOrDefault(x => x.CultureCode == lang.CultureInfo.ToString()) == null) { revent.descriptions.Add(new EventDescription() { CalendarId = revent.calendarId, EventId = revent.Id, CultureCode = lang.CultureInfo.ToString(), Id = 0, Type = (int)EventType.Recurring }); } } var args2 = new RecurringEventCreatedEventArgs { RecurringEvent = revent }; OnCreated(args2); return revent; }
public static void OnCreated(RecurringEventCreatedEventArgs e) { EventHandler<RecurringEventCreatedEventArgs> handler = Created; if (handler != null) { handler(null, e); } }