Ejemplo n.º 1
0
        public CalendarEntry(
            Tenant tenant,
            CalendarId calendarId,
            CalendarEntryId calendarEntryId,
            string description,
            string location,
            Owner owner,
            DateRange timeSpan,
            Repetition repetition,
            Alarm alarm,
            IEnumerable <Participant> invitees = null)
        {
            AssertionConcern.AssertArgumentNotNull(tenant, "The tenant must be provided.");
            AssertionConcern.AssertArgumentNotNull(calendarId, "The calendar id must be provided.");
            AssertionConcern.AssertArgumentNotNull(calendarEntryId, "The calendar entry id must be provided.");
            AssertionConcern.AssertArgumentNotEmpty(description, "The description must be provided.");
            AssertionConcern.AssertArgumentNotEmpty(location, "The location must be provided.");
            AssertionConcern.AssertArgumentNotNull(owner, "The owner must be provided.");
            AssertionConcern.AssertArgumentNotNull(timeSpan, "The time span must be provided.");
            AssertionConcern.AssertArgumentNotNull(repetition, "The repetition must be provided.");
            AssertionConcern.AssertArgumentNotNull(alarm, "The alarm must be provided.");

            if (repetition.Repeats == RepeatType.DoesNotRepeat)
            {
                repetition = Repetition.DoesNotRepeat(timeSpan.Ends);
            }

            AssertTimeSpans(repetition, timeSpan);

            Apply(new CalendarEntryScheduled(tenant, calendarId, calendarEntryId, description, location, owner, timeSpan, repetition, alarm, invitees));
        }
Ejemplo n.º 2
0
        public void Reschedule(string description, string location, DateRange timeSpan, Repetition repetition, Alarm alarm)
        {
            AssertionConcern.AssertArgumentNotNull(timeSpan, "The time span must be provided.");
            AssertionConcern.AssertArgumentNotNull(repetition, "The repetition must be provided.");
            AssertionConcern.AssertArgumentNotNull(alarm, "The alarm must be provided.");

            if (repetition.Repeats == RepeatType.DoesNotRepeat)
            {
                repetition = Repetition.DoesNotRepeat(timeSpan.Ends);
            }

            AssertTimeSpans(repetition, timeSpan);

            ChangeDescription(description);
            Relocate(location);

            Apply(new CalendarEntryRescheduled(this.tenant, this.calendarId, this.calendarEntryId, timeSpan, repetition, alarm));
        }