private EventTimeAdjuster.TimeProperties AdjustTimeProperties(EventTimeAdjuster.TimeProperties initialValues, ExTimeZone sessionTimeZone)
 {
     if (initialValues.IsAllDay)
     {
         ExDateTime time = this.FloatTime(initialValues.Start, initialValues.IntendedStartTimeZone, sessionTimeZone);
         initialValues.Start = EventDataProvider.EnforceMidnightTime(time, MidnightEnforcementOption.MoveBackward);
         ExDateTime time2 = this.FloatTime(initialValues.End, initialValues.IntendedEndTimeZone, sessionTimeZone);
         initialValues.End = EventDataProvider.EnforceMidnightTime(time2, MidnightEnforcementOption.MoveForward);
         initialValues.IntendedStartTimeZone = initialValues.Start.TimeZone;
         initialValues.IntendedEndTimeZone   = initialValues.Start.TimeZone;
     }
     return(initialValues);
 }
 public virtual void AdjustTimeProperties(ICalendarItemBase calendarItem)
 {
     EventTimeAdjuster.TimeProperties initialValues = new EventTimeAdjuster.TimeProperties
     {
         IsAllDay = this.GetValue <ICalendarItemBase, bool>(calendarItem, CalendarItemAccessors.IsAllDay),
         Start    = this.GetValue <ICalendarItemBase, ExDateTime>(calendarItem, CalendarItemAccessors.StartTime),
         End      = this.GetValue <ICalendarItemBase, ExDateTime>(calendarItem, CalendarItemAccessors.EndTime),
         IntendedStartTimeZone = this.GetValue <ICalendarItemBase, ExTimeZone>(calendarItem, CalendarItemAccessors.StartTimeZone),
         IntendedEndTimeZone   = this.GetValue <ICalendarItemBase, ExTimeZone>(calendarItem, CalendarItemAccessors.EndTimeZone)
     };
     EventTimeAdjuster.TimeProperties timeProperties = this.AdjustTimeProperties(initialValues, calendarItem.Session.ExTimeZone);
     CalendarItemAccessors.IsAllDay.Set(calendarItem, timeProperties.IsAllDay);
     CalendarItemAccessors.StartTime.Set(calendarItem, timeProperties.Start);
     CalendarItemAccessors.EndTime.Set(calendarItem, timeProperties.End);
     CalendarItemAccessors.StartTimeZone.Set(calendarItem, timeProperties.IntendedStartTimeZone);
     CalendarItemAccessors.EndTimeZone.Set(calendarItem, timeProperties.IntendedEndTimeZone);
 }
        public virtual Event AdjustTimeProperties(Event theEvent, ExTimeZone sessionTimeZone)
        {
            ExTimeZone timeZoneOrDefault  = this.DateTimeHelper.GetTimeZoneOrDefault(theEvent.IntendedStartTimeZoneId, ExTimeZone.UtcTimeZone);
            ExTimeZone timeZoneOrDefault2 = this.DateTimeHelper.GetTimeZoneOrDefault(theEvent.IntendedEndTimeZoneId, timeZoneOrDefault);

            EventTimeAdjuster.TimeProperties initialValues = new EventTimeAdjuster.TimeProperties
            {
                IsAllDay = theEvent.IsAllDay,
                Start    = theEvent.Start,
                End      = theEvent.End,
                IntendedStartTimeZone = timeZoneOrDefault,
                IntendedEndTimeZone   = timeZoneOrDefault2
            };
            EventTimeAdjuster.TimeProperties timeProperties = this.AdjustTimeProperties(initialValues, sessionTimeZone);
            theEvent.IsAllDay = timeProperties.IsAllDay;
            theEvent.Start    = timeProperties.Start;
            theEvent.End      = timeProperties.End;
            theEvent.IntendedStartTimeZoneId = timeProperties.IntendedStartTimeZone.Id;
            theEvent.IntendedEndTimeZoneId   = timeProperties.IntendedEndTimeZone.Id;
            return(theEvent);
        }