Ejemplo n.º 1
0
        private void SetRuleWithPriorityChange(ADRuleStorageManager storedRules)
        {
            TransportRule transportRule;
            int           priority;

            storedRules.GetRule(this.DataObject.Identity, out transportRule, out priority);
            if (transportRule == null)
            {
                base.WriteError(new ArgumentException(Strings.RuleNotFound(this.Identity.ToString()), "Identity"), ErrorCategory.InvalidArgument, this.Identity);
            }
            HygieneFilterRule hygieneFilterRule = this.CreateTaskRuleFromInternalRule(transportRule, priority);

            this.UpdateRuleFromParameters(hygieneFilterRule);
            this.ValidateRuleEsnCompatibility(hygieneFilterRule);
            transportRule = hygieneFilterRule.ToInternalRule();
            try
            {
                storedRules.UpdateRule(transportRule, hygieneFilterRule.Identity, hygieneFilterRule.Priority);
            }
            catch (RulesValidationException)
            {
                base.WriteError(new ArgumentException(Strings.RuleNameAlreadyExist, "Name"), ErrorCategory.InvalidArgument, this.Name);
            }
        }