Beispiel #1
0
 public static EventSerie ToEventSerieDocument(this WeeklyEvent @event)
 {
     return(new EventSerie()
     {
         Id = Guid.NewGuid().ToString(),
         Frequency = (int)@event.Frequency,
         Range = new EventSerieRange()
         {
             Culture = @event.CreatedBy.Culture,
             TimeZone = @event.CreatedBy.Timezone,
             StartsAt = @event.From,
             EndsAt = new EndsAt()
             {
                 Never = @event.IsForever,
                 ParticularDate = @event.EndsAtParticularDate,
                 AfterTimes = @event.EndsAfterTimes
             }
         },
         WeeklyParams = new WeeklyParams()
         {
             Interval = @event.Interval,
             Occurences = (int)@event.Occurance
         },
         Changes = new Changes()
         {
             ParticularEvents = new List <Event>(),
             SubSeries = new List <EventSerie>()
         }
     });
 }
Beispiel #2
0
        public void Schedule(WeeklyEvent @event)
        {
            var preparedEventSerie = @event.ToEventSerieDocument();
            var preparedEvent      = @event.ToEventDocument(preparedEventSerie.Id);

            storage.Events.Add(preparedEvent);
            storage.EventSeries.Add(preparedEventSerie);
            storage.Store();
        }
Beispiel #3
0
 public static Event ToEventDocument(this WeeklyEvent @event, string eventSerieId = null)
 {
     return(new Event
     {
         AuthorId = @event.CreatedBy.Id,
         Id = Guid.NewGuid().ToString(),
         Name = @event.Name,
         Repeatable = @event.IsRepeable,
         Range = new OneTimeEventRange()
         {
             Culture = @event.CreatedBy.Culture,
             TimeZone = @event.CreatedBy.Timezone
         },
         IsFullDay = @event.IsFullDay,
         EventSerieId = eventSerieId
     });
 }
Beispiel #4
0
        private void UpdateParticularEvent(EventSerie serie, WeeklyEvent changes)
        {
            var @event = changes.ToEventDocument();

            serie.Changes.ParticularEvents.Add(@event);
        }