Ejemplo n.º 1
0
        protected override void InternalSave(TObject configObj)
        {
            base.InternalSave(configObj);
            StoreObjectId       defaultFolderId     = base.Session.GetDefaultFolderId(DefaultFolderType.Calendar);
            StorageWorkingHours storageWorkingHours = StorageWorkingHours.LoadFrom(base.Session, defaultFolderId);

            if (storageWorkingHours == null)
            {
                ExTimeZone timeZone = (configObj.WorkingHoursTimeZone != null) ? configObj.WorkingHoursTimeZone.ExTimeZone : ExTimeZone.CurrentTimeZone;
                storageWorkingHours = StorageWorkingHours.Create(timeZone, (int)configObj.WorkDays, (int)configObj.WorkingHoursStartTime.TotalMinutes, (int)configObj.WorkingHoursEndTime.TotalMinutes);
            }
            else
            {
                if (configObj.IsModified(WorkingHoursSchema.WorkingHoursTimeZone))
                {
                    storageWorkingHours.TimeZone = configObj.WorkingHoursTimeZone.ExTimeZone;
                }
                if (configObj.IsModified(WorkingHoursSchema.WorkDays) || configObj.IsModified(WorkingHoursSchema.WorkingHoursStartTime) || configObj.IsModified(WorkingHoursSchema.WorkingHoursEndTime))
                {
                    storageWorkingHours.UpdateWorkingPeriod(configObj.WorkDays, (int)configObj.WorkingHoursStartTime.TotalMinutes, (int)configObj.WorkingHoursEndTime.TotalMinutes);
                }
            }
            try
            {
                storageWorkingHours.SaveTo(base.Session, defaultFolderId);
            }
            catch (ObjectExistedException)
            {
                storageWorkingHours.SaveTo(base.Session, defaultFolderId);
            }
        }
Ejemplo n.º 2
0
        // Token: 0x06001666 RID: 5734 RVA: 0x0007E244 File Offset: 0x0007C444
        private StorageWorkingHours LoadWorkingHours()
        {
            ExTraceGlobals.HeuristicsTracer.TraceFunction(0L, "ReminderTimeCalculatorContext.LoadWorkingHours");
            StorageWorkingHours result = null;

            try
            {
                result = StorageWorkingHours.LoadFrom(this.session as MailboxSession, this.session.GetDefaultFolderId(DefaultFolderType.Calendar));
            }
            catch (AccessDeniedException ex)
            {
                ExTraceGlobals.HeuristicsTracer.TraceError <string>(0L, "AccessDenied in a call of loading working hours : {0}", ex.Message);
            }
            catch (ArgumentNullException ex2)
            {
                ExTraceGlobals.HeuristicsTracer.TraceError <string>(0L, "Argument exception in a call of loading working hours : {0}", ex2.Message);
            }
            catch (ObjectNotFoundException ex3)
            {
                ExTraceGlobals.HeuristicsTracer.TraceError <string>(0L, "ObjectNotFoundException exception in a call of loading working hours : {0}", ex3.Message);
            }
            catch (WorkingHoursXmlMalformedException ex4)
            {
                ExTraceGlobals.HeuristicsTracer.TraceError <string>(0L, "WorkingHoursXmlMalformedException exception in a call of loading working hours : {0}", ex4.Message);
            }
            catch (CorruptDataException ex5)
            {
                ExTraceGlobals.HeuristicsTracer.TraceError <string>(0L, "CorruptDataException exception in a call of loading working hours : {0}", ex5.Message);
            }
            return(result);
        }
        // Token: 0x060009E9 RID: 2537 RVA: 0x000418EC File Offset: 0x0003FAEC
        internal static string BuildTextSettingsItemBody(TextNotificationSettings settings)
        {
            StringBuilder stringBuilder = new StringBuilder(128);

            stringBuilder.AppendLine("V1.2");
            MailboxRegionalConfiguration regionalConfiguration = settings.RegionalConfiguration;

            stringBuilder.AppendLine(regionalConfiguration.TimeZone.ExTimeZone.Id);
            stringBuilder.AppendLine((regionalConfiguration.Language != null) ? regionalConfiguration.Language.LCID.ToString() : "0");
            stringBuilder.AppendLine(regionalConfiguration.TimeFormat);
            stringBuilder.AppendLine(regionalConfiguration.DateFormat);
            CalendarNotification textNotification = settings.TextNotification;

            stringBuilder.AppendLine(textNotification.MeetingReminderNotification ? "1" : "0");
            stringBuilder.AppendLine(textNotification.MeetingReminderSendDuringWorkHour ? "1" : "0");
            stringBuilder.AppendLine(textNotification.NextDays.ToString());
            stringBuilder.AppendLine(textNotification.CalendarUpdateNotification ? "1" : "0");
            stringBuilder.AppendLine(textNotification.CalendarUpdateSendDuringWorkHour ? "1" : "0");
            stringBuilder.AppendLine(textNotification.DailyAgendaNotification ? "1" : "0");
            stringBuilder.AppendLine(((int)textNotification.DailyAgendaNotificationSendTime.TotalSeconds).ToString());
            stringBuilder.AppendLine(textNotification.TextMessagingPhoneNumber.ToString());
            StorageWorkingHours workingHours = settings.WorkingHours;

            stringBuilder.AppendLine(workingHours.TimeZone.Id);
            stringBuilder.AppendLine(((int)workingHours.DaysOfWeek).ToString());
            stringBuilder.AppendLine(workingHours.StartTimeInMinutes.ToString());
            stringBuilder.AppendLine(workingHours.EndTimeInMinutes.ToString());
            SettingsItemBodyParser.CheckSettingsItemBodyLength(stringBuilder.Length);
            return(stringBuilder.ToString());
        }
Ejemplo n.º 4
0
 private WorkingHours(ExTimeZone timeZone, DaysOfWeek daysOfWeek, int startTimeInMinutes, int endTimeInMinutes)
 {
     if (timeZone == null)
     {
         throw new ArgumentException("timeZone");
     }
     this.storageWorkingHours = StorageWorkingHours.Create(timeZone, (int)WorkingHours.ToStorageDaysOfWeek(daysOfWeek), startTimeInMinutes, endTimeInMinutes);
 }
Ejemplo n.º 5
0
        // Token: 0x06000A6B RID: 2667 RVA: 0x000448F8 File Offset: 0x00042AF8
        internal static bool AreInterestedFieldsEqual(StorageWorkingHours value1, StorageWorkingHours value2)
        {
            bool result;

            if (Utils.CheckMembers(value1, value2, out result))
            {
                return(value1.TimeZone == value2.TimeZone && value1.DaysOfWeek == value2.DaysOfWeek && value1.StartTimeInMinutes == value2.StartTimeInMinutes && value1.EndTimeInMinutes == value2.EndTimeInMinutes);
            }
            return(result);
        }
Ejemplo n.º 6
0
        internal static WorkingHours LoadFrom(MailboxSession session, StoreId folderId)
        {
            StorageWorkingHours storageWorkingHours = StorageWorkingHours.LoadFrom(session, folderId);

            if (storageWorkingHours == null)
            {
                return(null);
            }
            return(new WorkingHours
            {
                storageWorkingHours = storageWorkingHours
            });
        }
Ejemplo n.º 7
0
        protected override void InternalFill(TObject configObject)
        {
            base.InternalFill(configObject);
            StorageWorkingHours storageWorkingHours = StorageWorkingHours.LoadFrom(base.Session, base.Session.GetDefaultFolderId(DefaultFolderType.Calendar));

            if (storageWorkingHours == null)
            {
                return;
            }
            configObject.WorkDays = storageWorkingHours.DaysOfWeek;
            configObject.WorkingHoursStartTime = TimeSpan.FromMinutes((double)storageWorkingHours.StartTimeInMinutes);
            configObject.WorkingHoursEndTime   = TimeSpan.FromMinutes((double)storageWorkingHours.EndTimeInMinutes);
            configObject.WorkingHoursTimeZone  = new ExTimeZoneValue(storageWorkingHours.TimeZone);
        }
Ejemplo n.º 8
0
        // Token: 0x06001970 RID: 6512 RVA: 0x0009491C File Offset: 0x00092B1C
        internal bool CommitChanges(MailboxSession mailboxSession)
        {
            StorageWorkingHours storageWorkingHours = StorageWorkingHours.Create(this.timeZone, this.workDays, this.workDayStartTimeInWorkingHoursTimeZone, this.workDayEndTimeInWorkingHoursTimeZone);

            try
            {
                StoreObjectId defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Calendar);
                storageWorkingHours.SaveTo(mailboxSession, defaultFolderId);
            }
            catch (WorkingHoursSaveFailedException)
            {
                return(false);
            }
            return(true);
        }
        // Token: 0x060009EC RID: 2540 RVA: 0x00041B98 File Offset: 0x0003FD98
        internal static TextNotificationSettings ParseTextSettingsItemBody(string body)
        {
            TextNotificationSettings result;

            using (StringReader stringReader = new StringReader(body))
            {
                if (SettingsItemBodyParser.GetNextLine(stringReader) != "V1.2")
                {
                    SettingsItemBodyParser.Tracer.TraceDebug(0L, "Unknown user settings version, skipped");
                    throw new FormatException();
                }
                MailboxRegionalConfiguration mailboxRegionalConfiguration = new MailboxRegionalConfiguration();
                mailboxRegionalConfiguration.TimeZone = new ExTimeZoneValue(SettingsItemBodyParser.GetNextTimeZone(stringReader));
                int nextInteger = SettingsItemBodyParser.GetNextInteger(stringReader);
                if (nextInteger != 0)
                {
                    mailboxRegionalConfiguration.Language = new CultureInfo(nextInteger);
                }
                mailboxRegionalConfiguration.TimeFormat = SettingsItemBodyParser.GetNextLine(stringReader);
                mailboxRegionalConfiguration.DateFormat = SettingsItemBodyParser.GetNextLine(stringReader);
                CalendarNotification calendarNotification = new CalendarNotification();
                calendarNotification.MeetingReminderNotification       = SettingsItemBodyParser.GetNextBoolean(stringReader);
                calendarNotification.MeetingReminderSendDuringWorkHour = SettingsItemBodyParser.GetNextBoolean(stringReader);
                calendarNotification.NextDays = SettingsItemBodyParser.GetNextInteger(stringReader);
                calendarNotification.CalendarUpdateNotification       = SettingsItemBodyParser.GetNextBoolean(stringReader);
                calendarNotification.CalendarUpdateSendDuringWorkHour = SettingsItemBodyParser.GetNextBoolean(stringReader);
                calendarNotification.DailyAgendaNotification          = SettingsItemBodyParser.GetNextBoolean(stringReader);
                calendarNotification.DailyAgendaNotificationSendTime  = TimeSpan.FromSeconds((double)SettingsItemBodyParser.GetNextInteger(stringReader));
                E164Number textMessagingPhoneNumber;
                if (!E164Number.TryParse(SettingsItemBodyParser.GetNextLine(stringReader), out textMessagingPhoneNumber))
                {
                    SettingsItemBodyParser.Tracer.TraceDebug(0L, "Invalid phone number, skipped");
                    throw new FormatException();
                }
                calendarNotification.TextMessagingPhoneNumber = textMessagingPhoneNumber;
                ExTimeZone          nextTimeZone = SettingsItemBodyParser.GetNextTimeZone(stringReader);
                int                 nextInteger2 = SettingsItemBodyParser.GetNextInteger(stringReader);
                int                 nextInteger3 = SettingsItemBodyParser.GetNextInteger(stringReader);
                int                 nextInteger4 = SettingsItemBodyParser.GetNextInteger(stringReader);
                StorageWorkingHours workingHours = StorageWorkingHours.Create(nextTimeZone, nextInteger2, nextInteger3, nextInteger4);
                result = new TextNotificationSettings(mailboxRegionalConfiguration, calendarNotification, workingHours);
            }
            return(result);
        }
Ejemplo n.º 10
0
 // Token: 0x06000A65 RID: 2661 RVA: 0x00044620 File Offset: 0x00042820
 internal static bool TryLoadWorkingHours(MailboxSession session, out StorageWorkingHours workingHours)
 {
     workingHours = null;
     try
     {
         StoreObjectId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.Calendar);
         if (defaultFolderId != null)
         {
             workingHours = StorageWorkingHours.LoadFrom(session, defaultFolderId);
         }
         else
         {
             Utils.Tracer.TraceError <string>((long)typeof(MailboxData).GetHashCode(), "User {0}'s working hours data could not be retrieved - folderId is null", session.MailboxOwnerLegacyDN);
         }
     }
     catch (CorruptDataException)
     {
         Utils.Tracer.TraceError <string>((long)typeof(MailboxData).GetHashCode(), "User {0}'s working hours data is corrupted", session.MailboxOwnerLegacyDN);
         workingHours = StorageWorkingHours.Create(((ExTimeZoneValue)WorkingHoursSchema.WorkingHoursTimeZone.DefaultValue).ExTimeZone, (int)WorkingHoursSchema.WorkDays.DefaultValue, (int)((TimeSpan)WorkingHoursSchema.WorkingHoursStartTime.DefaultValue).TotalMinutes, (int)((TimeSpan)WorkingHoursSchema.WorkingHoursEndTime.DefaultValue).TotalMinutes);
     }
     return(workingHours != null);
 }
Ejemplo n.º 11
0
        // Token: 0x06001963 RID: 6499 RVA: 0x00094764 File Offset: 0x00092964
        private static WorkingHours.LoadResult LoadFromMailbox(MailboxSession mailboxSession, out WorkingHours workingHours)
        {
            StorageWorkingHours storageWorkingHours = null;

            try
            {
                storageWorkingHours = StorageWorkingHours.LoadFrom(mailboxSession, mailboxSession.GetDefaultFolderId(DefaultFolderType.Calendar));
            }
            catch (AccessDeniedException)
            {
                workingHours = null;
                return(WorkingHours.LoadResult.AccessDenied);
            }
            catch (ArgumentNullException)
            {
                workingHours = null;
                return(WorkingHours.LoadResult.AccessDenied);
            }
            catch (ObjectNotFoundException)
            {
                workingHours = null;
                return(WorkingHours.LoadResult.AccessDenied);
            }
            catch (WorkingHoursXmlMalformedException)
            {
                workingHours = null;
                return(WorkingHours.LoadResult.Corrupt);
            }
            if (storageWorkingHours == null)
            {
                workingHours = null;
                return(WorkingHours.LoadResult.Missing);
            }
            workingHours = new WorkingHours(storageWorkingHours.StartTimeInMinutes, storageWorkingHours.EndTimeInMinutes, (int)storageWorkingHours.DaysOfWeek, storageWorkingHours.TimeZone);
            return(WorkingHours.LoadResult.Success);
        }
 // Token: 0x06000A35 RID: 2613 RVA: 0x000436D9 File Offset: 0x000418D9
 internal TextNotificationSettings(MailboxRegionalConfiguration regionalConfiguration, CalendarNotification textNotification, StorageWorkingHours workingHours)
 {
     this.RegionalConfiguration = regionalConfiguration;
     this.TextNotification      = textNotification;
     this.WorkingHours          = workingHours;
 }
Ejemplo n.º 13
0
        // Token: 0x06000A71 RID: 2673 RVA: 0x00044AD0 File Offset: 0x00042CD0
        internal static bool InWorkingHours(ExDateTime startTime, ExDateTime endTime, StorageWorkingHours workingHours)
        {
            if (startTime > endTime)
            {
                ExTraceGlobals.AssistantTracer.TraceDebug <ExDateTime, ExDateTime>((long)typeof(CalendarChangeProcessor).GetHashCode(), "processing invalid start time / end time. start: {0}, end:{1}", startTime, endTime);
                return(false);
            }
            ExDateTime d          = workingHours.TimeZone.ConvertDateTime(startTime);
            ExDateTime t          = workingHours.TimeZone.ConvertDateTime(endTime);
            ExDateTime exDateTime = d + TimeSpan.FromDays(1.0);

            while (exDateTime < t)
            {
                if ((1 << (int)exDateTime.DayOfWeek & (int)workingHours.DaysOfWeek) != 0)
                {
                    return(true);
                }
                exDateTime += TimeSpan.FromDays(1.0);
            }
            bool flag  = 0 != (1 << (int)d.DayOfWeek & (int)workingHours.DaysOfWeek);
            bool flag2 = 0 != (1 << (int)t.DayOfWeek & (int)workingHours.DaysOfWeek);

            if (!flag && !flag2)
            {
                return(false);
            }
            bool flag3 = d.Date == t.Date;
            List <Interval <long> > list  = new List <Interval <long> >();
            List <Interval <long> > list2 = new List <Interval <long> >();
            long ticks  = d.TimeOfDay.Ticks;
            long ticks2 = t.TimeOfDay.Ticks;

            if (flag3)
            {
                list.Add(new Interval <long>(ticks, false, ticks2, ticks < ticks2));
            }
            else
            {
                if (flag)
                {
                    list.Add(new Interval <long>(ticks, false, TimeSpan.FromDays(1.0).Ticks, false));
                }
                if (flag2)
                {
                    list.Add(new Interval <long>(0L, false, ticks2, 0L < ticks2));
                }
            }
            long ticks3 = TimeSpan.FromMinutes((double)workingHours.StartTimeInMinutes).Ticks;
            long ticks4 = TimeSpan.FromMinutes((double)workingHours.EndTimeInMinutes).Ticks;

            if (ticks3 <= ticks4)
            {
                list2.Add(new Interval <long>(ticks3, false, ticks4, ticks3 < ticks4));
            }
            else
            {
                list2.Add(new Interval <long>(ticks3, false, (long)((int)TimeSpan.FromDays(1.0).TotalMinutes), false));
                list2.Add(new Interval <long>(0L, false, ticks4, 0L < ticks4));
            }
            foreach (Interval <long> interval in list)
            {
                foreach (Interval <long> other in list2)
                {
                    if (interval.IsOverlapped(other))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 14
0
 // Token: 0x06001669 RID: 5737 RVA: 0x0007E37F File Offset: 0x0007C57F
 internal WorkingHoursAwareReminderTimeCalculator(ReminderTimeCalculatorContext context, StorageWorkingHours workingHours)
 {
     ArgumentValidator.ThrowIfNull("context", context);
     this.context      = context;
     this.workingHours = workingHours;
 }
Ejemplo n.º 15
0
 // Token: 0x0600165E RID: 5726 RVA: 0x0007E017 File Offset: 0x0007C217
 internal ReminderTimeCalculatorContext(StorageWorkingHours workingHours, DayOfWeek firstDayOfWeek, ExTimeZone timeZone)
 {
     this.workingHours = workingHours;
     this.startOfWeek  = firstDayOfWeek;
     this.timeZone     = timeZone;
 }
Ejemplo n.º 16
0
        // Token: 0x0600166C RID: 5740 RVA: 0x0007E508 File Offset: 0x0007C708
        internal static List <ExDateRange> ConvertHoursToDateRanges(ExDateTime referenceTime, Hours hours, StorageWorkingHours workingHours, int days)
        {
            ExTraceGlobals.HeuristicsTracer.TraceFunction(0L, "WorkingHoursAwareReminderTimeCalculator.ConvertHoursToDateRanges");
            ExTraceGlobals.HeuristicsTracer.TraceInformation <Hours, StorageWorkingHours, int>(0, 0L, "Hours: '{0}'; WorkingHours: '{1}'; Days: '{2}'", hours, workingHours, days);
            List <ExDateRange> list        = new List <ExDateRange>();
            ExDateRange        exDateRange = new ExDateRange(referenceTime.ToUtc(), referenceTime.AddDays((double)days).ToUtc());

            if (workingHours == null)
            {
                ExTraceGlobals.HeuristicsTracer.TraceInformation(0, 0L, "User WorkingHours unavailable");
                hours = Hours.Any;
            }
            switch (hours)
            {
            case Hours.Personal:
                list = ExDateRange.SubtractRanges(exDateRange, WorkingHoursAwareReminderTimeCalculator.ConvertHoursToDateRanges(referenceTime, Hours.Working, workingHours, days));
                break;

            case Hours.Working:
                for (int i = 0; i < days; i++)
                {
                    ExDateTime date = referenceTime.AddDays((double)i).Date;
                    if (workingHours.IsWorkingDay(date.DayOfWeek))
                    {
                        list.Add(new ExDateRange(date.AddMinutes((double)workingHours.StartTimeInMinutes).ToUtc(), date.AddMinutes((double)workingHours.EndTimeInMinutes).ToUtc()));
                    }
                }
                break;

            case Hours.Any:
                list.Add(exDateRange);
                break;
            }
            return(list);
        }
Ejemplo n.º 17
0
 public WorkingHours()
 {
     this.storageWorkingHours = StorageWorkingHours.Create(ExTimeZone.CurrentTimeZone);
 }
Ejemplo n.º 18
0
        // Token: 0x0600095D RID: 2397 RVA: 0x0003ED90 File Offset: 0x0003CF90
        public static IList <CalendarInfo> Load(ExDateTime creationRequestTime, ExTimeZone timeZoneAdjustment, MailboxSession session, StoreObjectId calFldrId, StorageWorkingHours workingHours, ExDateTime actualizationTime, ExDateTime endTime)
        {
            StoreObjectId defaultFolderId = session.GetDefaultFolderId(DefaultFolderType.Reminders);

            if (defaultFolderId == null)
            {
                ExTraceGlobals.AssistantTracer.TraceDebug <IExchangePrincipal, string>((long)typeof(ReminderLoader).GetHashCode(), "cannot open reminder folder for user {0}, Time {1}", session.MailboxOwner, ExDateTime.GetNow(timeZoneAdjustment).ToLongTimeString());
                return(new CalendarInfo[0]);
            }
            List <CalendarInfo> list          = new List <CalendarInfo>();
            StoreObjectId       storeObjectId = calFldrId;

            if (calFldrId.IsFolderId && StoreObjectType.Folder != calFldrId.ObjectType)
            {
                storeObjectId = calFldrId.Clone();
                storeObjectId.UpdateItemType(StoreObjectType.Folder);
            }
            QueryFilter queryFilter = new AndFilter(new QueryFilter[]
            {
                new ComparisonFilter(ComparisonOperator.GreaterThanOrEqual, ItemSchema.ReminderNextTime, actualizationTime),
                new ComparisonFilter(ComparisonOperator.LessThan, ItemSchema.ReminderNextTime, endTime),
                new ComparisonFilter(ComparisonOperator.Equal, ItemSchema.ReminderIsSet, true),
                new ComparisonFilter(ComparisonOperator.Equal, StoreObjectSchema.ParentItemId, storeObjectId)
            });

            SortBy[] sortColumns = new SortBy[]
            {
                new SortBy(ItemSchema.ReminderNextTime, SortOrder.Ascending)
            };
            new Interval <ExDateTime>(actualizationTime, false, endTime, true);
            using (SearchFolder searchFolder = SearchFolder.Bind(session, defaultFolderId))
            {
                using (QueryResult queryResult = searchFolder.ItemQuery(ItemQueryType.None, queryFilter, sortColumns, CalendarInfo.InterestedProperties))
                {
                    ExDateTime exDateTime = ExDateTime.MinValue;
                    foreach (object[] propVals in queryResult.GetRows(100))
                    {
                        CalendarInfo calendarInfo = CalendarInfo.FromInterestedProperties(creationRequestTime, timeZoneAdjustment, session, true, propVals);
                        if (CalendarItemType.RecurringMaster == calendarInfo.CalendarItemType)
                        {
                            using (CalendarItem calendarItem = CalendarItem.Bind(session, calendarInfo.CalendarItemIdentity))
                            {
                                using (CalendarItemOccurrence calendarItemOccurrence = (CalendarItemOccurrence)calendarItem.Reminder.GetPertinentItem(actualizationTime))
                                {
                                    if (calendarItemOccurrence != null)
                                    {
                                        calendarInfo = CalendarInfo.FromCalendarItemBase(creationRequestTime, timeZoneAdjustment, calendarItemOccurrence);
                                    }
                                }
                            }
                        }
                        if (!(calendarInfo.ReminderTime < actualizationTime) && calendarInfo.IsInteresting(CalendarNotificationType.Reminder) && (workingHours == null || Utils.InWorkingHours(calendarInfo.StartTime, calendarInfo.EndTime, workingHours)))
                        {
                            if (ExDateTime.MinValue == exDateTime)
                            {
                                exDateTime = calendarInfo.ReminderTime;
                            }
                            else if (calendarInfo.ReminderTime > exDateTime)
                            {
                                break;
                            }
                            list.Add(calendarInfo);
                        }
                    }
                }
            }
            return(list.AsReadOnly());
        }
Ejemplo n.º 19
0
        // Token: 0x0600095F RID: 2399 RVA: 0x0003F0D0 File Offset: 0x0003D2D0
        public static List <CalendarInfo> Load(ExDateTime creationRequestTime, ExTimeZone timeZoneAdjustment, MailboxSession session, MeetingRequest mtgReq, CalendarItemBase calItemBase, StorageWorkingHours workingHours, ExDateTime actualizationTime, ExDateTime endTime)
        {
            List <CalendarInfo>   list        = new List <CalendarInfo>();
            Interval <ExDateTime> timeslot    = new Interval <ExDateTime>(actualizationTime, false, endTime, true);
            ExDateTime?           exDateTime  = null;
            ExDateTime?           exDateTime2 = null;

            if (mtgReq != null)
            {
                CalendarInfo.GetOldFields(mtgReq, out exDateTime, out exDateTime2);
            }
            if (CalendarItemType.RecurringMaster != calItemBase.CalendarItemType || ((CalendarItem)calItemBase).Recurrence == null)
            {
                CalendarInfo calendarInfo = CalendarInfo.FromCalendarItemBase(creationRequestTime, timeZoneAdjustment, calItemBase);
                calendarInfo.UpdateOldFields(exDateTime, exDateTime2);
                if (OccurrenceLoader.IsInteresing(timeslot, calendarInfo.OldStartTime, calendarInfo.OldEndTime, calendarInfo.StartTime, calendarInfo.EndTime, workingHours))
                {
                    list.Add(calendarInfo);
                }
                else
                {
                    ExTraceGlobals.AssistantTracer.TraceDebug((long)typeof(ReminderLoader).GetHashCode(), "The calendar update/reminder is out of the valid scope. subj: {0}, calItemId: {1}, calItemOccId: {2}, event_t: {3}, rmd_t: {4}, s_t: {5}, e_t: {6}, S_T: {7} E_T: {8}, scope_s: {9}, scope_e: {10}", new object[]
                    {
                        calendarInfo.NormalizedSubject,
                        calendarInfo.CalendarItemIdentity,
                        calendarInfo.CalendarItemOccurrenceIdentity,
                        calendarInfo.CreationRequestTime,
                        calendarInfo.ReminderTime,
                        calendarInfo.OldStartTime,
                        calendarInfo.OldEndTime,
                        calendarInfo.StartTime,
                        calendarInfo.EndTime,
                        actualizationTime,
                        endTime
                    });
                }
                return(list);
            }
            foreach (OccurrenceInfo occurrenceInfo in ((CalendarItem)calItemBase).Recurrence.GetOccurrenceInfoList(actualizationTime, endTime))
            {
                if (!OccurrenceLoader.IsInteresing(timeslot, exDateTime, exDateTime2, occurrenceInfo.StartTime, occurrenceInfo.EndTime, workingHours))
                {
                    ExTraceGlobals.AssistantTracer.TraceDebug((long)typeof(ReminderLoader).GetHashCode(), "The calendar update/reminder is out of the valid scope.calItemId: {0}, calItemOccId: {1}, event_t: {2}, rmd_m: {3}, s_t: {4}, e_t: {5}, S_T: {6} E_T: {7}, scope_s: {8}, scope_e: {9}", new object[]
                    {
                        (calItemBase.Id == null) ? null : calItemBase.Id.ObjectId,
                        occurrenceInfo.OccurrenceDateId,
                        actualizationTime,
                        (calItemBase.Reminder == null) ? -1 : calItemBase.Reminder.MinutesBeforeStart,
                        exDateTime,
                        exDateTime2,
                        occurrenceInfo.StartTime,
                        occurrenceInfo.EndTime,
                        actualizationTime,
                        endTime
                    });
                }
                else
                {
                    CalendarInfo calendarInfo2 = null;
                    if (occurrenceInfo.VersionedId == null)
                    {
                        calendarInfo2 = CalendarInfo.FromMasterCalendarItemAndOccurrenceInfo(creationRequestTime, timeZoneAdjustment, (CalendarItem)calItemBase, occurrenceInfo);
                    }
                    else
                    {
                        using (CalendarItemOccurrence calendarItemOccurrence = ((CalendarItem)calItemBase).OpenOccurrenceByOriginalStartTime(occurrenceInfo.OriginalStartTime, new PropertyDefinition[0]))
                        {
                            calendarInfo2 = CalendarInfo.FromCalendarItemBase(creationRequestTime, timeZoneAdjustment, calendarItemOccurrence);
                        }
                    }
                    calendarInfo2.UpdateOldFields(exDateTime, exDateTime2);
                    list.Add(calendarInfo2);
                }
            }
            return(list);
        }
Ejemplo n.º 20
0
        // Token: 0x06000960 RID: 2400 RVA: 0x0003F400 File Offset: 0x0003D600
        private static bool IsInteresing(Interval <ExDateTime> timeslot, ExDateTime?oldStartTime, ExDateTime?oldEndTime, ExDateTime startTime, ExDateTime endTime, StorageWorkingHours workingHours)
        {
            Interval <ExDateTime> other = new Interval <ExDateTime>(startTime, false, endTime, startTime < endTime);
            bool flag  = timeslot.IsOverlapped(other);
            bool flag2 = workingHours == null || Utils.InWorkingHours(other.Minimum, other.Maximum, workingHours);
            bool flag3 = false;
            bool flag4 = false;

            if (oldStartTime != null && oldEndTime != null)
            {
                Interval <ExDateTime> other2 = new Interval <ExDateTime>(oldStartTime.Value, false, oldEndTime.Value, oldStartTime.Value < oldEndTime.Value);
                flag3 = timeslot.IsOverlapped(other2);
                flag4 = (workingHours == null || Utils.InWorkingHours(other2.Minimum, other2.Maximum, workingHours));
            }
            return((flag3 && flag4) || (flag && flag2));
        }
Ejemplo n.º 21
0
        // Token: 0x0600095E RID: 2398 RVA: 0x0003F034 File Offset: 0x0003D234
        public static IList <CalendarInfo> Load(ExDateTime creationRequestTime, ExTimeZone timeZoneAdjustment, MailboxSession session, StoreObjectId calFldrId, StorageWorkingHours workingHours, ExDateTime actualizationTime, ExDateTime endTime)
        {
            List <CalendarInfo> list = new List <CalendarInfo>();

            using (CalendarFolder calendarFolder = CalendarFolder.Bind(session, calFldrId))
            {
                foreach (object[] propVals in calendarFolder.GetCalendarView(actualizationTime, endTime, CalendarInfo.InterestedProperties))
                {
                    CalendarInfo calendarInfo = CalendarInfo.FromInterestedProperties(creationRequestTime, timeZoneAdjustment, session, true, propVals);
                    if (calendarInfo.IsInteresting(CalendarNotificationType.Summary) && (workingHours == null || Utils.InWorkingHours(calendarInfo.StartTime, calendarInfo.EndTime, workingHours)))
                    {
                        list.Add(calendarInfo);
                    }
                }
            }
            return(list.AsReadOnly());
        }