Esempio n. 1
0
        internal static QueryFilter MailboxPlanReleaseFilterBuilder(SinglePropertyFilter filter)
        {
            if (!(filter is ComparisonFilter))
            {
                throw new ADFilterException(DirectoryStrings.ExceptionUnsupportedFilterForProperty(filter.Property.Name, filter.GetType(), typeof(ComparisonFilter)));
            }
            ComparisonFilter comparisonFilter = (ComparisonFilter)filter;

            if (comparisonFilter.ComparisonOperator != ComparisonOperator.Equal && ComparisonOperator.NotEqual != comparisonFilter.ComparisonOperator)
            {
                throw new ADFilterException(DirectoryStrings.ExceptionUnsupportedOperatorForProperty(comparisonFilter.Property.Name, comparisonFilter.ComparisonOperator.ToString()));
            }
            if (!(comparisonFilter.PropertyValue is MailboxPlanRelease))
            {
                throw new ArgumentException("filter.PropertyValue");
            }
            MailboxPlanRelease mailboxPlanRelease = (MailboxPlanRelease)comparisonFilter.PropertyValue;

            if (mailboxPlanRelease != MailboxPlanRelease.AllReleases)
            {
                if (mailboxPlanRelease != MailboxPlanRelease.CurrentRelease)
                {
                    if (mailboxPlanRelease != MailboxPlanRelease.NonCurrentRelease)
                    {
                        throw new ArgumentException("filter.PropertyValue");
                    }
                    if (comparisonFilter.ComparisonOperator == ComparisonOperator.Equal)
                    {
                        return(Microsoft.Exchange.Data.Directory.Management.MailboxPlan.NonCurrentReleaseFilter);
                    }
                    return(new NotFilter(Microsoft.Exchange.Data.Directory.Management.MailboxPlan.NonCurrentReleaseFilter));
                }
                else
                {
                    if (comparisonFilter.ComparisonOperator == ComparisonOperator.Equal)
                    {
                        return(Microsoft.Exchange.Data.Directory.Management.MailboxPlan.CurrentReleaseFilter);
                    }
                    return(new NotFilter(Microsoft.Exchange.Data.Directory.Management.MailboxPlan.CurrentReleaseFilter));
                }
            }
            else
            {
                QueryFilter queryFilter = new OrFilter(new QueryFilter[]
                {
                    Microsoft.Exchange.Data.Directory.Management.MailboxPlan.CurrentReleaseFilter,
                    Microsoft.Exchange.Data.Directory.Management.MailboxPlan.NonCurrentReleaseFilter
                });
                if (ComparisonOperator.NotEqual == comparisonFilter.ComparisonOperator)
                {
                    return(queryFilter);
                }
                return(new NotFilter(queryFilter));
            }
        }
Esempio n. 2
0
 protected override void StampChangesOn(IConfigurable dataObject)
 {
     base.StampChangesOn(dataObject);
     if (base.Fields.IsModified("IsDefault"))
     {
         ADUser aduser = (ADUser)dataObject;
         aduser.IsDefault = this.IsDefault;
     }
     if (base.Fields.IsModified("IsDefaultForPreviousVersion"))
     {
         ADUser aduser2 = (ADUser)dataObject;
         aduser2[MailboxPlanSchema.IsDefault_R3] = this.IsDefaultForPreviousVersion;
     }
     if (base.Fields.IsModified("MailboxPlanRelease"))
     {
         MailboxPlanRelease mailboxPlanRelease  = (MailboxPlanRelease)((ADUser)dataObject)[MailboxPlanSchema.MailboxPlanRelease];
         MailboxPlanRelease mailboxPlanRelease2 = mailboxPlanRelease;
         if (mailboxPlanRelease2 != MailboxPlanRelease.AllReleases)
         {
             if (mailboxPlanRelease2 != MailboxPlanRelease.CurrentRelease)
             {
                 if (mailboxPlanRelease2 == MailboxPlanRelease.NonCurrentRelease)
                 {
                     if (this.MailboxPlanRelease != MailboxPlanRelease.CurrentRelease)
                     {
                         ((ADUser)dataObject)[MailboxPlanSchema.MailboxPlanRelease] = this.MailboxPlanRelease;
                     }
                     else
                     {
                         base.WriteError(new TaskInvalidOperationException(Strings.ErrorMbxPlanReleaseTransition(((ADUser)dataObject).Name, mailboxPlanRelease.ToString(), this.MailboxPlanRelease.ToString())), ExchangeErrorCategory.Client, null);
                     }
                 }
             }
             else if (this.MailboxPlanRelease != MailboxPlanRelease.NonCurrentRelease)
             {
                 ((ADUser)dataObject)[MailboxPlanSchema.MailboxPlanRelease] = this.MailboxPlanRelease;
             }
             else
             {
                 base.WriteError(new TaskInvalidOperationException(Strings.ErrorMbxPlanReleaseTransition(((ADUser)dataObject).Name, mailboxPlanRelease.ToString(), this.MailboxPlanRelease.ToString())), ExchangeErrorCategory.Client, null);
             }
         }
         else
         {
             ((ADUser)dataObject)[MailboxPlanSchema.MailboxPlanRelease] = this.MailboxPlanRelease;
         }
     }
     if (base.ApplyMandatoryProperties)
     {
         ADUser aduser3 = (ADUser)dataObject;
         aduser3.Database = this.DatabasesContainerId;
     }
 }