Пример #1
0
        // Token: 0x06000953 RID: 2387 RVA: 0x0003E918 File Offset: 0x0003CB18
        public static CalendarInfo FromMasterCalendarItemAndOccurrenceInfo(ExDateTime creationRequestTime, ExTimeZone timeZoneAdjustment, CalendarItem masterItem, OccurrenceInfo occInfo)
        {
            CalendarInfo calendarInfo = CalendarInfo.FromCalendarItemBase(creationRequestTime, timeZoneAdjustment, masterItem);

            if (occInfo != null)
            {
                calendarInfo.CalendarItemOccurrenceIdentity = ((occInfo.VersionedId == null) ? null : occInfo.VersionedId.ObjectId);
                calendarInfo.StartTime = occInfo.StartTime;
                calendarInfo.EndTime   = occInfo.EndTime;
            }
            return(calendarInfo);
        }
Пример #2
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);
        }
        // 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());
        }