예제 #1
0
        private Inconsistency GetAttendeeMissingItemInconsistency(CalendarValidationContext context, string fullDescription, ClientIntentQuery.QueryResult inconsistencyIntent, ClientIntentFlags declineIntent, ClientIntentFlags deleteIntent)
        {
            Inconsistency inconsistency = null;

            if (ClientIntentQuery.CheckDesiredClientIntent(inconsistencyIntent.Intent, new ClientIntentFlags[]
            {
                declineIntent
            }))
            {
                inconsistency        = ResponseInconsistency.CreateInstance(fullDescription, ResponseType.Decline, context.Attendee.ResponseType, ExDateTime.MinValue, context.Attendee.ReplyTime, context);
                inconsistency.Intent = inconsistencyIntent.Intent;
            }
            else if (ClientIntentQuery.CheckDesiredClientIntent(inconsistencyIntent.Intent, new ClientIntentFlags[]
            {
                deleteIntent
            }))
            {
                inconsistency = null;
            }
            else if (inconsistencyIntent.SourceVersionId != null)
            {
                int?deletedItemVersion = null;
                using (CalendarItemBase calendarItemBase = CalendarItemBase.Bind(this.session, inconsistencyIntent.SourceVersionId))
                {
                    deletedItemVersion = calendarItemBase.GetValueAsNullable <int>(CalendarItemBaseSchema.ItemVersion);
                }
                if (deletedItemVersion != null)
                {
                    inconsistency        = MissingItemInconsistency.CreateAttendeeMissingItemInstance(fullDescription, inconsistencyIntent.Intent, deletedItemVersion, context);
                    inconsistency.Intent = inconsistencyIntent.Intent;
                }
            }
            return(inconsistency);
        }
예제 #2
0
 private bool ShouldSendRum(CalendarValidationContext context, Inconsistency inconsistency)
 {
     if (context.BaseRole == RoleType.Attendee && CalendarItemBase.IsTenantToBeFixed(context.BaseItem.Session as MailboxSession))
     {
         return(false);
     }
     if (inconsistency.Owner == context.BaseRole)
     {
         return(false);
     }
     if (!this.Policy.ContainsRepairFlag(inconsistency.Flag))
     {
         return(false);
     }
     if (context.AttendeeItem != null && context.OrganizerItem != null && context.AttendeeItem.CalendarItemType == CalendarItemType.Occurrence && context.OrganizerItem.CalendarItemType == CalendarItemType.Occurrence)
     {
         return(false);
     }
     if (context.RemoteUser.ExchangePrincipal == null)
     {
         return(false);
     }
     if (this.CheckServerVersion(context, inconsistency))
     {
         CalendarProcessingFlags?calendarConfig = context.CalendarInstance.GetCalendarConfig();
         return(calendarConfig != null && (inconsistency.Flag != CalendarInconsistencyFlag.MissingItem || !context.HasSentUpdateForItemOrMaster) && calendarConfig.Value == CalendarProcessingFlags.AutoUpdate);
     }
     return(false);
 }
예제 #3
0
        private Inconsistency GetAttendeeMissingItemInconsistency(CalendarValidationContext context, string fullDescription, ClientIntentFlags?inconsistencyIntent, ClientIntentFlags declineIntent, ClientIntentFlags deleteIntent)
        {
            Inconsistency inconsistency = null;

            if (ClientIntentQuery.CheckDesiredClientIntent(inconsistencyIntent, new ClientIntentFlags[]
            {
                declineIntent
            }))
            {
                inconsistency        = ResponseInconsistency.CreateInstance(fullDescription, ResponseType.Decline, context.Attendee.ResponseType, ExDateTime.MinValue, context.Attendee.ReplyTime, context);
                inconsistency.Intent = inconsistencyIntent;
            }
            else if (ClientIntentQuery.CheckDesiredClientIntent(inconsistencyIntent, new ClientIntentFlags[]
            {
                deleteIntent
            }))
            {
                inconsistency = null;
            }
            else if (this.calendarIntent != null && this.calendarIntent.ItemVersion > 0)
            {
                inconsistency        = MissingItemInconsistency.CreateAttendeeMissingItemInstance(fullDescription, inconsistencyIntent, new int?(this.calendarIntent.ItemVersion), context);
                inconsistency.Intent = inconsistencyIntent;
            }
            return(inconsistency);
        }
예제 #4
0
 internal RumInfo CreateRumInfo(CalendarValidationContext context, Inconsistency inconsistency)
 {
     this.CheckInitialized();
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     if (inconsistency == null)
     {
         throw new ArgumentNullException("inconsistency");
     }
     if (this.ShouldSendRum(context, inconsistency))
     {
         IList <Attendee> list = new List <Attendee>(1);
         if (context.BaseRole == RoleType.Organizer && context.Attendee != null)
         {
             if (context.Attendee.Attendee == null)
             {
                 context.Attendee.Attendee = context.OrganizerItem.AttendeeCollection.Add(context.Attendee.Participant, AttendeeType.Required, null, null, false);
             }
             list.Add(context.Attendee.Attendee);
         }
         RumInfo rumInfo = inconsistency.CreateRumInfo(context, list);
         if (!rumInfo.IsNullOp && rumInfo is OrganizerRumInfo && context.AttendeeItem != null)
         {
             ((OrganizerRumInfo)rumInfo).AttendeeRequiredSequenceNumber = context.AttendeeItem.AppointmentSequenceNumber;
         }
         return(rumInfo);
     }
     return(NullOpRumInfo.CreateInstance());
 }
 private void FailCheck(MeetingExistenceConsistencyCheckResult result, Inconsistency inconsistency)
 {
     result.Status = CheckStatusType.Failed;
     if (inconsistency != null)
     {
         result.AddInconsistency(base.Context, inconsistency);
     }
 }
예제 #6
0
 private void CheckAnomaly(ConsistencyCheckResult result, AnomaliesFlags existingAnomalies, AnomaliesFlags anomaly)
 {
     if (anomaly != AnomaliesFlags.None && (existingAnomalies & anomaly) != AnomaliesFlags.None)
     {
         result.Status = CheckStatusType.Failed;
         result.AddInconsistency(base.Context, Inconsistency.CreateInstance(RoleType.Attendee, anomaly.ToString(), CalendarInconsistencyFlag.RecurrenceAnomaly, base.Context));
     }
 }
예제 #7
0
        private void FailCheck(ConsistencyCheckResult result, RoleType checkingRole, UserObject checkingUser, RecurrenceFormatException exception)
        {
            result.Status = CheckStatusType.Failed;
            string text = string.Format("RecurrenceBlobsConsistentCheck: RecurrenceFormatException for {0} ({1}), exception = {2}", checkingRole, checkingUser, exception.GetType());

            Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text);
            if (checkingRole == RoleType.Attendee)
            {
                result.AddInconsistency(base.Context, Inconsistency.CreateInstance(RoleType.Attendee, text, CalendarInconsistencyFlag.RecurrenceBlob, base.Context));
            }
        }
예제 #8
0
        private bool CheckServerVersion(CalendarValidationContext context, Inconsistency inconsistency)
        {
            ServerVersion serverVersion = new ServerVersion(context.RemoteUser.ExchangePrincipal.MailboxInfo.Location.ServerVersion);

            if (serverVersion.Major <= 8)
            {
                return(false);
            }
            if (inconsistency.Flag == CalendarInconsistencyFlag.OrphanedMeeting)
            {
                return(ServerVersion.Compare(serverVersion, this.supportsMeetingInquiryAfter) > 0);
            }
            return(ServerVersion.Compare(serverVersion, this.supportsRumsAfter) > 0);
        }
예제 #9
0
        private PrimaryConsistencyCheckResult GetResult(ICollection <StoreObjectValidationError> errorList)
        {
            PrimaryConsistencyCheckResult primaryConsistencyCheckResult = PrimaryConsistencyCheckResult.CreateInstance(base.Type, base.Description, true);

            if (errorList != null && errorList.Count != 0)
            {
                primaryConsistencyCheckResult.Status = CheckStatusType.Failed;
                foreach (StoreObjectValidationError storeObjectValidationError in errorList)
                {
                    primaryConsistencyCheckResult.AddInconsistency(base.Context, Inconsistency.CreateInstance(base.Context.BaseRole, storeObjectValidationError.ToString(), CalendarInconsistencyFlag.StoreObjectValidation, base.Context));
                }
            }
            return(primaryConsistencyCheckResult);
        }
        private bool CheckFoundItem(CalendarFolder folder, CalendarItemBase item, MeetingExistenceConsistencyCheckResult result, string itemQueryError)
        {
            bool flag = false;

            if (item != null)
            {
                CalendarItemType calendarItemType  = base.Context.BaseItem.CalendarItemType;
                CalendarItemType calendarItemType2 = item.CalendarItemType;
                if ((calendarItemType == CalendarItemType.Single || calendarItemType == CalendarItemType.RecurringMaster) && (calendarItemType2 == CalendarItemType.Occurrence || calendarItemType2 == CalendarItemType.Exception))
                {
                    result.ItemIsFound = false;
                    string description = string.Format("Item type mismatch. [BaseType|BaseGoid - FoundType|FoundGoid] ({0}|{1} - {2}|{3})", new object[]
                    {
                        calendarItemType,
                        base.Context.BaseItem.GlobalObjectId,
                        calendarItemType2,
                        item.GlobalObjectId
                    });
                    this.FailCheck(result, this.GetInconsistencyFullDescription(description, itemQueryError));
                    flag = true;
                }
                else
                {
                    result.ItemIsFound = true;
                }
            }
            else
            {
                result.ItemIsFound = false;
                if (this.FailOnAbsence)
                {
                    string description2 = string.Format("Could not find the matching meeting in {0}'s calendar.", base.Context.OppositeRole.ToString().ToLower());
                    try
                    {
                        string inconsistencyFullDescription = this.GetInconsistencyFullDescription(description2, itemQueryError);
                        this.FailCheck(result, base.Context.CalendarInstance.GetInconsistency(base.Context, inconsistencyFullDescription));
                    }
                    catch (CalendarVersionStoreNotPopulatedException ex)
                    {
                        this.FailCheck(result, Inconsistency.CreateInstance(base.Context.OppositeRole, string.Format("The Calendar Version Store is not fully populated yet (Wait Time: {0}).", ex.WaitTimeBeforeThrow), CalendarInconsistencyFlag.MissingCvs, base.Context));
                    }
                    flag = true;
                }
            }
            return(!flag);
        }
 private void FailCheck(ConsistencyCheckResult result, Inconsistency inconsistency)
 {
     result.Status = CheckStatusType.Failed;
     result.AddInconsistency(base.Context, inconsistency);
 }
예제 #12
0
 private void RegisterStorageException(ConsistencyCheckResult result, LocalizedException exception)
 {
     result.Status = CheckStatusType.CheckError;
     result.AddInconsistency(base.Context, Inconsistency.CreateInstance(RoleType.Organizer, exception.ToString(), CalendarInconsistencyFlag.StorageException, base.Context));
 }
        internal override void ValidateMeetings(ref Dictionary <GlobalObjectId, List <Attendee> > organizerRumsSent, Action <long> onItemRepaired)
        {
            bool shouldProcessMailbox = CalendarParticipant.InternalShouldProcessMailbox(this.ExchangePrincipal);

            SessionManager.SessionData sessionData = this.sessionManager[this.ExchangePrincipal];
            foreach (CalendarInstanceContext calendarInstanceContext in base.ItemList.Values)
            {
                string            empty             = string.Empty;
                CalendarLocalItem calendarLocalItem = new CalendarLocalItem(this.ExchangePrincipal, sessionData.Session);
                calendarInstanceContext.ValidationContext.CalendarInstance = calendarLocalItem;
                calendarInstanceContext.ValidationContext.CalendarInstance.ShouldProcessMailbox = shouldProcessMailbox;
                try
                {
                    using (CalendarFolder calendarFolder = CalendarFolder.Bind(sessionData.Session, DefaultFolderType.Calendar, null))
                    {
                        calendarLocalItem.CalendarFolderId = calendarFolder.Id.ObjectId.ProviderLevelItemId;
                        CalendarItemBase calendarItemBase = CalendarQuery.FindMatchingItem(sessionData.Session, calendarFolder, calendarInstanceContext.ValidationContext.BaseItem.CalendarItemType, calendarInstanceContext.ValidationContext.BaseItem.GlobalObjectId.Bytes, ref empty);
                        if (calendarInstanceContext.ValidationContext.OppositeRole == RoleType.Organizer)
                        {
                            if (calendarItemBase != null)
                            {
                                calendarInstanceContext.ValidationContext.OppositeRoleOrganizerIsValid = calendarItemBase.IsOrganizer();
                            }
                            else
                            {
                                calendarInstanceContext.ValidationContext.OppositeRoleOrganizerIsValid = this.IsOrganizerValid(sessionData.Session, calendarInstanceContext);
                            }
                            calendarInstanceContext.ValidationContext.OppositeItem = (calendarInstanceContext.ValidationContext.OppositeRoleOrganizerIsValid ? calendarItemBase : null);
                        }
                        else
                        {
                            calendarInstanceContext.ValidationContext.OppositeItem = calendarItemBase;
                        }
                        calendarInstanceContext.ValidationContext.ErrorString = empty;
                    }
                }
                catch (StorageTransientException ex)
                {
                    string text = string.Format("Could not open item store session or calendar, exception = {0}", ex.GetType());
                    Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text);
                    calendarInstanceContext.ValidationContext.CalendarInstance.LoadInconsistency = Inconsistency.CreateInstance(calendarInstanceContext.ValidationContext.OppositeRole, text, CalendarInconsistencyFlag.StorageException, calendarInstanceContext.ValidationContext);
                }
                catch (RecurrenceFormatException ex2)
                {
                    string text2 = string.Format("Could not open item store session or calendar due recurrence format error, exception = {0}", ex2.GetType());
                    Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text2);
                    calendarInstanceContext.ValidationContext.CalendarInstance.LoadInconsistency = ((calendarInstanceContext.ValidationContext.OppositeRole == RoleType.Attendee) ? Inconsistency.CreateInstance(calendarInstanceContext.ValidationContext.OppositeRole, text2, CalendarInconsistencyFlag.RecurrenceBlob, calendarInstanceContext.ValidationContext) : null);
                }
                catch (StoragePermanentException ex3)
                {
                    string text3 = string.Format("Could not open item store session or calendar, exception = {0}", ex3.GetType());
                    Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text3);
                    calendarInstanceContext.ValidationContext.CalendarInstance.LoadInconsistency = Inconsistency.CreateInstance(calendarInstanceContext.ValidationContext.OppositeRole, text3, CalendarInconsistencyFlag.StorageException, calendarInstanceContext.ValidationContext);
                }
                catch (ArgumentException arg)
                {
                    Globals.ConsistencyChecksTracer.TraceError <RoleType, ArgumentException>((long)this.GetHashCode(), "Could not open item store session or calendar for {0}, exception = {1}", calendarInstanceContext.ValidationContext.OppositeRole, arg);
                }
                finally
                {
                    base.ValidateInstance(calendarInstanceContext, organizerRumsSent, onItemRepaired);
                    if (calendarInstanceContext.ValidationContext.OppositeItem != null)
                    {
                        calendarInstanceContext.ValidationContext.OppositeItem.Dispose();
                        calendarInstanceContext.ValidationContext.OppositeItem = null;
                    }
                }
            }
        }
예제 #14
0
        internal override Inconsistency GetInconsistency(CalendarValidationContext context, string fullDescription)
        {
            Inconsistency inconsistency = null;

            if (base.LoadInconsistency != null)
            {
                return(base.LoadInconsistency);
            }
            bool isCleanGlobalObjectId = context.BaseItem.GlobalObjectId.IsCleanGlobalObjectId;

            try
            {
                ClientIntentFlags?missingItemIntent = this.GetMissingItemIntent(context, isCleanGlobalObjectId);
                if (context.OppositeRole == RoleType.Attendee)
                {
                    inconsistency = (isCleanGlobalObjectId ? this.GetAttendeeMissingItemInconsistency(context, fullDescription, missingItemIntent, ClientIntentFlags.RespondedDecline, ClientIntentFlags.DeletedWithNoResponse) : this.GetAttendeeMissingItemInconsistency(context, fullDescription, missingItemIntent, ClientIntentFlags.RespondedExceptionDecline, ClientIntentFlags.DeletedExceptionWithNoResponse));
                }
                else
                {
                    inconsistency = MissingItemInconsistency.CreateOrganizerMissingItemInstance(fullDescription, context);
                    if (RumFactory.Instance.Policy.RepairMode == CalendarRepairType.ValidateOnly)
                    {
                        inconsistency.Intent = missingItemIntent;
                    }
                }
            }
            catch (ProtocolViolationException exception)
            {
                this.HandleRemoteException(exception);
            }
            catch (SecurityException exception2)
            {
                this.HandleRemoteException(exception2);
            }
            catch (ArgumentException exception3)
            {
                this.HandleRemoteException(exception3);
            }
            catch (InvalidOperationException exception4)
            {
                this.HandleRemoteException(exception4);
            }
            catch (NotSupportedException exception5)
            {
                this.HandleRemoteException(exception5);
            }
            catch (XmlException exception6)
            {
                this.HandleRemoteException(exception6);
            }
            catch (XPathException exception7)
            {
                this.HandleRemoteException(exception7);
            }
            catch (SoapException exception8)
            {
                this.HandleRemoteException(exception8);
            }
            catch (IOException exception9)
            {
                this.HandleRemoteException(exception9);
            }
            return(inconsistency);
        }
예제 #15
0
 private void FailCheck(ConsistencyCheckResult result, RoleType inconsistentRole, CalendarInconsistencyFlag flag, string fullDescription)
 {
     result.Status = CheckStatusType.Failed;
     result.AddInconsistency(base.Context, Inconsistency.CreateInstance(inconsistentRole, fullDescription, flag, base.Context));
 }
        internal override void ValidateMeetings(ref Dictionary <GlobalObjectId, List <Attendee> > organizerRumsSent, Action <long> onItemRepaired)
        {
            bool shouldProcessMailbox = CalendarParticipant.InternalShouldProcessMailbox(this.ExchangePrincipal);

            try
            {
                List <SearchExpressionType> list = new List <SearchExpressionType>();
                foreach (CalendarInstanceContext calendarInstanceContext in base.ItemList.Values)
                {
                    calendarInstanceContext.ValidationContext.CalendarInstance = new CalendarRemoteItem(this.ExchangePrincipal, this.binding);
                    calendarInstanceContext.ValidationContext.CalendarInstance.ShouldProcessMailbox = shouldProcessMailbox;
                    GlobalObjectId       globalObjectId = calendarInstanceContext.ValidationContext.BaseItem.GlobalObjectId;
                    string               value          = Convert.ToBase64String(globalObjectId.CleanGlobalObjectIdBytes);
                    SearchExpressionType item           = new IsEqualToType
                    {
                        Item = CalendarItemFields.CleanGlobalObjectIdProp,
                        FieldURIOrConstant = new FieldURIOrConstantType
                        {
                            Item = new ConstantValueType
                            {
                                Value = value
                            }
                        }
                    };
                    list.Add(item);
                }
                ItemType[] remoteCalendarItems = this.GetRemoteCalendarItems(list);
                if (remoteCalendarItems != null)
                {
                    Dictionary <GlobalObjectId, CalendarItemType> dictionary = new Dictionary <GlobalObjectId, CalendarItemType>();
                    foreach (ItemType itemType in remoteCalendarItems)
                    {
                        CalendarItemType calendarItemType = itemType as CalendarItemType;
                        GlobalObjectId   globalObjectId2  = CalendarItemFields.GetGlobalObjectId(calendarItemType);
                        dictionary.Add(globalObjectId2, calendarItemType);
                    }
                    foreach (KeyValuePair <GlobalObjectId, CalendarInstanceContext> keyValuePair in base.ItemList)
                    {
                        if (dictionary.ContainsKey(keyValuePair.Key))
                        {
                            CalendarItemType        remoteItem = dictionary[keyValuePair.Key];
                            CalendarInstanceContext value2     = keyValuePair.Value;
                            try
                            {
                                try
                                {
                                    CalendarItemBase calendarItemBase = CalendarItem.Create(this.localSession, this.localSession.GetDefaultFolderId(DefaultFolderType.Calendar));
                                    Globals.ConsistencyChecksTracer.TraceDebug((long)this.GetHashCode(), "Converting the EWS item to XSO.");
                                    this.calendarConverter.ConvertItem(calendarItemBase, remoteItem);
                                    value2.ValidationContext.OppositeItem = calendarItemBase;
                                }
                                catch (FormatException ex)
                                {
                                    string text = string.Format("Could not convert the remote item, exception = {0}", ex.GetType());
                                    Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text);
                                    value2.ValidationContext.CalendarInstance.LoadInconsistency = Inconsistency.CreateInstance(value2.ValidationContext.OppositeRole, text, CalendarInconsistencyFlag.StorageException, value2.ValidationContext);
                                }
                                catch (CorruptDataException ex2)
                                {
                                    string text2 = string.Format("Could not convert the remote item, exception = {0}", ex2.GetType());
                                    Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text2);
                                    value2.ValidationContext.CalendarInstance.LoadInconsistency = Inconsistency.CreateInstance(value2.ValidationContext.OppositeRole, text2, CalendarInconsistencyFlag.StorageException, value2.ValidationContext);
                                }
                                catch (StorageTransientException ex3)
                                {
                                    string text3 = string.Format("Could not convert the remote item, exception = {0}", ex3.GetType());
                                    Globals.ConsistencyChecksTracer.TraceError((long)this.GetHashCode(), text3);
                                    value2.ValidationContext.CalendarInstance.LoadInconsistency = Inconsistency.CreateInstance(value2.ValidationContext.OppositeRole, text3, CalendarInconsistencyFlag.StorageException, value2.ValidationContext);
                                }
                                continue;
                            }
                            finally
                            {
                                base.ValidateInstance(value2, organizerRumsSent, onItemRepaired);
                                if (value2.ValidationContext.OppositeItem != null)
                                {
                                    value2.ValidationContext.OppositeItem.Dispose();
                                    value2.ValidationContext.OppositeItem = null;
                                }
                            }
                        }
                        Globals.ConsistencyChecksTracer.TraceDebug((long)this.GetHashCode(), "GetItem didn't return an expected GlobalObjectId.");
                    }
                }
                foreach (CalendarInstanceContext calendarInstanceContext2 in base.ItemList.Values)
                {
                    if (!calendarInstanceContext2.IsValidationDone)
                    {
                        if (calendarInstanceContext2.ValidationContext.OppositeRole == RoleType.Organizer && calendarInstanceContext2.ValidationContext.OppositeItem == null)
                        {
                            calendarInstanceContext2.ValidationContext.OppositeRoleOrganizerIsValid = true;
                        }
                        base.ValidateInstance(calendarInstanceContext2, organizerRumsSent, onItemRepaired);
                    }
                }
            }
            catch (ProtocolViolationException exception)
            {
                this.HandleRemoteException(exception);
            }
            catch (SecurityException exception2)
            {
                this.HandleRemoteException(exception2);
            }
            catch (ArgumentException exception3)
            {
                this.HandleRemoteException(exception3);
            }
            catch (InvalidOperationException exception4)
            {
                this.HandleRemoteException(exception4);
            }
            catch (NotSupportedException exception5)
            {
                this.HandleRemoteException(exception5);
            }
            catch (XmlException exception6)
            {
                this.HandleRemoteException(exception6);
            }
            catch (XPathException exception7)
            {
                this.HandleRemoteException(exception7);
            }
            catch (SoapException exception8)
            {
                this.HandleRemoteException(exception8);
            }
            catch (IOException exception9)
            {
                this.HandleRemoteException(exception9);
            }
        }
        protected override ConsistencyCheckResult DetectInconsistencies()
        {
            ConsistencyCheckResult result    = ConsistencyCheckResult.CreateInstance(base.Type, base.Description);
            ExDateTime             startTime = base.Context.OrganizerItem.StartTime;
            ExDateTime             endTime   = base.Context.OrganizerItem.EndTime;
            string     location   = base.Context.OrganizerItem.Location;
            ExDateTime startTime2 = base.Context.AttendeeItem.StartTime;
            ExDateTime endTime2   = base.Context.AttendeeItem.EndTime;
            string     location2  = base.Context.AttendeeItem.Location;
            int        appointmentSequenceNumber     = base.Context.OrganizerItem.AppointmentSequenceNumber;
            int        appointmentLastSequenceNumber = base.Context.OrganizerItem.AppointmentLastSequenceNumber;
            ExDateTime ownerCriticalChangeTime       = base.Context.OrganizerItem.OwnerCriticalChangeTime;
            ExDateTime attendeeCriticalChangeTime    = base.Context.OrganizerItem.AttendeeCriticalChangeTime;
            int        appointmentSequenceNumber2    = base.Context.AttendeeItem.AppointmentSequenceNumber;
            ExDateTime ownerCriticalChangeTime2      = base.Context.AttendeeItem.OwnerCriticalChangeTime;
            ExDateTime attendeeCriticalChangeTime2   = base.Context.AttendeeItem.AttendeeCriticalChangeTime;
            bool       flag = false;

            if (appointmentSequenceNumber == appointmentSequenceNumber2 || (appointmentSequenceNumber != appointmentLastSequenceNumber && appointmentLastSequenceNumber >= appointmentSequenceNumber2))
            {
                flag = true;
            }
            else if (ExDateTime.Compare(ownerCriticalChangeTime, ownerCriticalChangeTime2, MeetingPropertiesMatchCheck.DateTimeComparisonTreshold) == 0)
            {
                flag = true;
            }
            else if (ExDateTime.Compare(attendeeCriticalChangeTime, attendeeCriticalChangeTime2, MeetingPropertiesMatchCheck.DateTimeComparisonTreshold) == 0)
            {
                flag = true;
            }
            else
            {
                this.FailCheck(result, CalendarInconsistencyFlag.VersionInfo, "SequenceNumber", appointmentSequenceNumber, appointmentSequenceNumber2);
                this.FailCheck(result, CalendarInconsistencyFlag.VersionInfo, "OwnerCriticalChangeTime", ownerCriticalChangeTime, ownerCriticalChangeTime2);
                this.FailCheck(result, CalendarInconsistencyFlag.VersionInfo, "AttendeeCriticalChangeTime", attendeeCriticalChangeTime, attendeeCriticalChangeTime2);
            }
            if (!flag)
            {
                ExDateTime utcNow = ExDateTime.UtcNow;
                if (ExDateTime.Compare(ownerCriticalChangeTime, utcNow, TimeSpan.FromMinutes(120.0)) != 0)
                {
                    this.FailCheck(result, CalendarInconsistencyFlag.VersionInfo, "DelayedUpdates", ownerCriticalChangeTime.ToUtc().ToString(), utcNow.ToUtc().ToString());
                }
            }
            bool flag2 = MeetingPropertiesMatchCheck.CheckForMeetingOverlapInconsistency(startTime, endTime, startTime2, endTime2);

            if (flag2)
            {
                this.FailCheck(result, CalendarInconsistencyFlag.TimeOverlap, "MeetingOverlap", (startTime - endTime).TotalMinutes, 0);
            }
            bool flag3 = false;

            this.CheckTimeConsistency(result, MeetingPropertiesMatchCheck.TimeProperty.StartTime, ref flag3);
            this.CheckTimeConsistency(result, MeetingPropertiesMatchCheck.TimeProperty.EndTime, ref flag3);
            if (location != null && location2 != null && !location2.Contains(location))
            {
                try
                {
                    ClientIntentFlags?clientIntentFlags;
                    if (base.Context.BaseRole == RoleType.Attendee)
                    {
                        ICalendarItemStateDefinition initialState      = new LocationBasedCalendarItemStateDefinition(location);
                        ICalendarItemStateDefinition targetState       = new LocationBasedCalendarItemStateDefinition(location2);
                        ClientIntentQuery            clientIntentQuery = new TransitionalClientIntentQuery(base.Context.AttendeeItem.GlobalObjectId, initialState, targetState);
                        clientIntentFlags = clientIntentQuery.Execute((MailboxSession)base.Context.AttendeeItem.Session, base.Context.CvsGateway).Intent;
                    }
                    else
                    {
                        clientIntentFlags = base.Context.CalendarInstance.GetLocationIntent(base.Context, base.Context.AttendeeItem.GlobalObjectId, location, location2);
                    }
                    if (!ClientIntentQuery.CheckDesiredClientIntent(clientIntentFlags, new ClientIntentFlags[]
                    {
                        ClientIntentFlags.ModifiedLocation
                    }))
                    {
                        this.FailCheck(result, CalendarInconsistencyFlag.Location, "Location", location, location2, clientIntentFlags);
                    }
                }
                catch (CalendarVersionStoreNotPopulatedException exc)
                {
                    this.FailCheck(result, Inconsistency.CreateMissingCvsInconsistency(RoleType.Attendee, exc, base.Context));
                }
            }
            return(result);
        }
예제 #18
0
 internal static Inconsistency CreateMissingCvsInconsistency(RoleType owner, CalendarVersionStoreNotPopulatedException exc, CalendarValidationContext context)
 {
     return(Inconsistency.CreateInstance(owner, string.Format("The Calendar Version Store is not fully populated yet (Wait Time: {0}).", exc.WaitTimeBeforeThrow), CalendarInconsistencyFlag.MissingCvs, context));
 }