internal override StoreObjectValidationError Validate(ValidationContext context, IValidatablePropertyBag validatablePropertyBag)
        {
            string text = validatablePropertyBag.TryGetProperty(InternalSchema.ItemClass) as string;

            if (!string.IsNullOrEmpty(text) && (ObjectClass.IsCalendarItem(text) || ObjectClass.IsRecurrenceException(text)) && validatablePropertyBag.IsPropertyDirty(InternalSchema.CalendarOriginatorId))
            {
                object obj = validatablePropertyBag.TryGetProperty(InternalSchema.CalendarOriginatorId);
                if (obj is string)
                {
                    string text2 = (string)obj;
                    PropertyValueTrackingData originalPropertyInformation = validatablePropertyBag.GetOriginalPropertyInformation(InternalSchema.CalendarOriginatorId);
                    if (originalPropertyInformation.PropertyValueState == PropertyTrackingInformation.Modified)
                    {
                        MailboxSession mailboxSession = context.Session as MailboxSession;
                        if (mailboxSession != null && originalPropertyInformation.OriginalPropertyValue != null && !PropertyError.IsPropertyNotFound(originalPropertyInformation.OriginalPropertyValue))
                        {
                            string text3 = (string)originalPropertyInformation.OriginalPropertyValue;
                            int?   num   = CalendarOriginatorIdProperty.Compare(text2, text3);
                            if (num != null && num < 0 && !mailboxSession.Capabilities.CanSetCalendarAPIProperties && mailboxSession.LogonType != LogonType.Transport)
                            {
                                ExTraceGlobals.MeetingMessageTracer.TraceError <string, string>((long)this.GetHashCode(), "CalendarOriginatorIdConstraint::Validate. calendar originator value changed. Original = {0}, Current = {1}", text3, text2);
                                return(new StoreObjectValidationError(context, InternalSchema.CalendarOriginatorId, text2, this));
                            }
                        }
                    }
                }
            }
            return(null);
        }
        internal override StoreObjectValidationError Validate(ValidationContext context, IValidatablePropertyBag validatablePropertyBag)
        {
            string text = validatablePropertyBag.TryGetProperty(InternalSchema.ItemClass) as string;

            if (!string.IsNullOrEmpty(text) && (ObjectClass.IsCalendarItem(text) || ObjectClass.IsRecurrenceException(text) || ObjectClass.IsMeetingMessage(text)) && validatablePropertyBag.IsPropertyDirty(InternalSchema.AppointmentStateInternal))
            {
                object obj = validatablePropertyBag.TryGetProperty(InternalSchema.AppointmentStateInternal);
                if (obj is int)
                {
                    AppointmentStateFlags appointmentStateFlags = (AppointmentStateFlags)obj;
                    if (EnumValidator <AppointmentStateFlags> .IsValidValue(appointmentStateFlags))
                    {
                        PropertyValueTrackingData originalPropertyInformation = validatablePropertyBag.GetOriginalPropertyInformation(InternalSchema.AppointmentStateInternal);
                        if (originalPropertyInformation.PropertyValueState == PropertyTrackingInformation.Modified && originalPropertyInformation.OriginalPropertyValue != null && !PropertyError.IsPropertyNotFound(originalPropertyInformation.OriginalPropertyValue))
                        {
                            AppointmentStateFlags appointmentStateFlags2 = (AppointmentStateFlags)originalPropertyInformation.OriginalPropertyValue;
                            bool flag  = (appointmentStateFlags2 & AppointmentStateFlags.Received) == AppointmentStateFlags.None;
                            bool flag2 = (appointmentStateFlags & AppointmentStateFlags.Received) == AppointmentStateFlags.None;
                            if (flag != flag2)
                            {
                                return(new StoreObjectValidationError(context, InternalSchema.AppointmentStateInternal, obj, this));
                            }
                        }
                    }
                }
            }
            return(null);
        }
 private void AddTrackingInformation(StorePropertyDefinition propertyDefinition, PropertyTrackingInformation changeType, object originalValue)
 {
     if ((propertyDefinition.PropertyFlags & PropertyFlags.TrackChange) == PropertyFlags.TrackChange && !this.TrackedPropertyInformation.ContainsKey(propertyDefinition))
     {
         PropertyValueTrackingData value = new PropertyValueTrackingData(changeType, originalValue);
         this.TrackedPropertyInformation.Add(propertyDefinition, value);
     }
 }
        private object GetOriginalPropertyValueForLogging(CoreItem item, StorePropertyDefinition interestingProperty)
        {
            if ((interestingProperty.PropertyFlags & PropertyFlags.Streamable) == PropertyFlags.Streamable)
            {
                COWContactLogging.Tracer.TraceDebug <string>((long)this.GetHashCode(), "COWContactLogging.GetOriginalPropertyValueForLogging: Skipping retrieval of value for streamable property {0}", interestingProperty.Name);
                return(null);
            }
            IValidatablePropertyBag validatablePropertyBag = item.PropertyBag as IValidatablePropertyBag;

            if (validatablePropertyBag == null)
            {
                COWContactLogging.Tracer.TraceDebug((long)this.GetHashCode(), "COWContactLogging.GetOriginalPropertyValueForLogging: Skipping retrieval of value as property bag doesn't track original values.");
                return(null);
            }
            PropertyValueTrackingData originalPropertyInformation = validatablePropertyBag.GetOriginalPropertyInformation(interestingProperty);

            return(originalPropertyInformation.OriginalPropertyValue);
        }