Esempio n. 1
0
        public static void OnCreated(EventCreatedEventArgs e)
        {
            EventHandler <EventCreatedEventArgs> handler = Created;

            if (handler != null)
            {
                handler(null, e);
            }
        }
Esempio n. 2
0
        public static Event CreateEvent(Event e)
        {
            var args = new EventCreatingEventArgs {
                Event = e
            };

            OnCreating(args);

            if (args.Cancel)
            {
                return(e);
            }
            ApplicationContext.Current.DatabaseContext.Database.Save(e);

            //Create the new descriptions for the new event
            e.descriptions = DescriptionService.GetDescriptionsForEvent(e.calendarId, e.Id, EventType.Normal).ToList();

            var ls = ApplicationContext.Current.Services.LocalizationService;

            foreach (var lang in ls.GetAllLanguages())
            {
                if (e.descriptions.SingleOrDefault(x => x.CultureCode == lang.CultureInfo.ToString()) == null)
                {
                    e.descriptions.Add(new EventDescription()
                    {
                        CalendarId = e.calendarId, EventId = e.Id, CultureCode = lang.CultureInfo.ToString(), Id = 0, Type = (int)EventType.Normal
                    });
                }
            }

            var args2 = new EventCreatedEventArgs {
                Event = e
            };

            OnCreated(args2);

            return(e);
        }