예제 #1
0
        public override bool Validate(RuleValidation validation)
        {
            if (validation == null)
            {
                throw new ArgumentNullException("validation");
            }

            bool valid = true;

            if (_expression == null)
            {
                valid = false;

                string          message = string.Format(CultureInfo.CurrentCulture, Messages.ConditionExpressionNull, typeof(CodePrimitiveExpression).ToString());
                ValidationError error   = new ValidationError(message, ErrorNumbers.Error_EmptyExpression);
                error.UserData[RuleUserDataKeys.ErrorObject] = this;
                validation.AddError(error);
            }
            else
            {
                valid = validation.ValidateConditionExpression(_expression);
            }

            return(valid);
        }
        public override bool Validate(RuleValidation validation)
        {
            if (validation == null)
            {
                throw new ArgumentNullException("validation");
            }
            bool flag = true;

            if (this._expression == null)
            {
                flag = false;
                ValidationError error = new ValidationError(string.Format(CultureInfo.CurrentCulture, Messages.ConditionExpressionNull, new object[] { typeof(CodePrimitiveExpression).ToString() }), 400);
                error.UserData["ErrorObject"] = this;
                validation.AddError(error);
                return(flag);
            }
            return(validation.ValidateConditionExpression(this._expression));
        }
        public override bool Validate(RuleValidation validation)
        {
            if (validation == null)
                throw new ArgumentNullException("validation");

            bool valid = true;

            if (_expression == null)
            {
                valid = false;

                string message = string.Format(CultureInfo.CurrentCulture, Messages.ConditionExpressionNull, typeof(CodePrimitiveExpression).ToString());
                ValidationError error = new ValidationError(message, ErrorNumbers.Error_EmptyExpression);
                error.UserData[RuleUserDataKeys.ErrorObject] = this;
                validation.AddError(error);

            }
            else
            {
                valid = validation.ValidateConditionExpression(_expression);
            }

            return valid;
        }
 public override bool Validate(RuleValidation validation)
 {
     if (validation == null)
     {
         throw new ArgumentNullException("validation");
     }
     bool flag = true;
     if (this._expression == null)
     {
         flag = false;
         ValidationError error = new ValidationError(string.Format(CultureInfo.CurrentCulture, Messages.ConditionExpressionNull, new object[] { typeof(CodePrimitiveExpression).ToString() }), 400);
         error.UserData["ErrorObject"] = this;
         validation.AddError(error);
         return flag;
     }
     return validation.ValidateConditionExpression(this._expression);
 }