private void ValidatePopupReminderSettings(Event entity, bool isNew)
        {
            IList <EventPopupReminderSetting> popupReminderSettings = entity.PopupReminderSettings;

            if (popupReminderSettings == null)
            {
                throw new NullPopupReminderSettingsException();
            }
            if (popupReminderSettings.Count != 1)
            {
                throw new InvalidPopupReminderSettingsCountException(popupReminderSettings.Count);
            }
            EventPopupReminderSetting eventPopupReminderSetting = popupReminderSettings[0];

            if (eventPopupReminderSetting == null)
            {
                throw new NullPopupReminderSettingsException();
            }
            if (isNew)
            {
                if (!string.IsNullOrEmpty(eventPopupReminderSetting.Id))
                {
                    throw new InvalidNewReminderSettingIdException();
                }
            }
            else if (eventPopupReminderSetting.Id != EventPopupReminderSettingsRules.GetDefaultPopupReminderSettingId(entity))
            {
                throw new InvalidReminderSettingIdException();
            }
        }
        public void FromLeftToRightType(ICalendarItemBase calendarItem, IEvent evt)
        {
            ExAssert.RetailAssert(evt != null, "evt is null");
            ExAssert.RetailAssert(calendarItem != null, "calendarItem is null");
            EventPopupReminderSetting item = new EventPopupReminderSetting
            {
                Id            = EventPopupReminderSettingsRules.GetDefaultPopupReminderSettingId(evt),
                ChangeKey     = evt.ChangeKey,
                IsReminderSet = calendarItem.IsReminderSet,
                ReminderMinutesBeforeStart = calendarItem.ReminderMinutesBeforeStart
            };

            evt.PopupReminderSettings = new List <EventPopupReminderSetting>
            {
                item
            };
        }
        public void FromRightToLeftType(ICalendarItemBase calendarItem, IEvent evt)
        {
            ExAssert.RetailAssert(evt != null, "evt is null");
            ExAssert.RetailAssert(calendarItem != null, "calendarItem is null");
            IList <EventPopupReminderSetting> popupReminderSettings = evt.PopupReminderSettings;

            if (popupReminderSettings != null)
            {
                ExAssert.RetailAssert(popupReminderSettings.Count == 1, "reminderSettings.Count is not 1, actual count is {0}", new object[]
                {
                    popupReminderSettings.Count
                });
                EventPopupReminderSetting eventPopupReminderSetting = popupReminderSettings[0];
                calendarItem.IsReminderSet = eventPopupReminderSetting.IsReminderSet;
                calendarItem.ReminderMinutesBeforeStart = eventPopupReminderSetting.ReminderMinutesBeforeStart;
            }
        }
示例#4
0
 internal static void MergeMasterAndInstanceProperties(this Event occurrence, Event master, bool isNew, Func <Event, Event, PropertyDefinition, bool> shouldCopyProperty)
 {
     if (shouldCopyProperty(master, occurrence, master.Schema.AttachmentsProperty))
     {
         occurrence.Attachments = master.Attachments;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.AttendeesProperty))
     {
         occurrence.Attendees = master.Attendees;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.BodyProperty))
     {
         occurrence.Body = master.Body;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.CalendarProperty))
     {
         occurrence.Calendar = master.Calendar;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.CategoriesProperty))
     {
         occurrence.Categories = master.Categories;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.HasAttachmentsProperty))
     {
         occurrence.HasAttachments = master.HasAttachments;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.IntendedEndTimeZoneIdProperty))
     {
         occurrence.IntendedEndTimeZoneId = master.IntendedEndTimeZoneId;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.IntendedStartTimeZoneIdProperty))
     {
         occurrence.IntendedStartTimeZoneId = master.IntendedStartTimeZoneId;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.ImportanceProperty))
     {
         occurrence.Importance = master.Importance;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.LocationProperty))
     {
         occurrence.Location = master.Location;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.PreviewProperty))
     {
         occurrence.Preview = master.Preview;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.ResponseRequestedProperty))
     {
         occurrence.ResponseRequested = master.ResponseRequested;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.SensitivityProperty))
     {
         occurrence.Sensitivity = master.Sensitivity;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.SeriesIdProperty))
     {
         occurrence.SeriesId = master.SeriesId;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.ShowAsProperty))
     {
         occurrence.ShowAs = master.ShowAs;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.SubjectProperty))
     {
         occurrence.Subject = master.Subject;
     }
     if (isNew)
     {
         occurrence.ClientId = master.ClientId;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.InternalIsReceived))
     {
         ((IEventInternal)occurrence).IsReceived = ((IEventInternal)master).IsReceived;
     }
     if (shouldCopyProperty(master, occurrence, master.Schema.PopupReminderSettingsProperty) && master.PopupReminderSettings != null && master.PopupReminderSettings.Count == 1 && master.PopupReminderSettings[0] != null)
     {
         EventPopupReminderSetting eventPopupReminderSetting = master.PopupReminderSettings[0];
         occurrence.PopupReminderSettings = new List <EventPopupReminderSetting>
         {
             new EventPopupReminderSetting
             {
                 Id            = (isNew ? null : EventPopupReminderSettingsRules.GetDefaultPopupReminderSettingId(occurrence)),
                 IsReminderSet = eventPopupReminderSetting.IsReminderSet,
                 ReminderMinutesBeforeStart = eventPopupReminderSetting.ReminderMinutesBeforeStart
             }
         };
     }
 }