Ejemplo n.º 1
0
        public bool Validate(string propertyName, IRuleSet ruleSet)
        {
            if (ruleSet == null)
            {
                Errors[propertyName] = new List <IActionableErrorInfo>();
            }
            else
            {
                List <IActionableErrorInfo> errorsTos            = ruleSet.ValidateRules();
                List <IActionableErrorInfo> actionableErrorInfos =
                    errorsTos.ConvertAll <IActionableErrorInfo>(input => new ActionableErrorInfo(input, () =>
                {
                    //
                }));
                Errors[propertyName] = actionableErrorInfos;
            }
            OnPropertyChanged("Errors");
            List <IActionableErrorInfo> errorList;

            if (Errors.TryGetValue(propertyName, out errorList))
            {
                return(errorList.Count == 0);
            }
            return(false);
        }
Ejemplo n.º 2
0
        public bool Validate(string propertyName, IRuleSet ruleSet)
        {
            if (string.IsNullOrEmpty(propertyName))
            {
                return(true);
            }

            if (ruleSet == null)
            {
                Errors[propertyName] = new List <IActionableErrorInfo>();
            }
            else
            {
                var errorsTos = ruleSet.ValidateRules();
                Errors[propertyName] = errorsTos;
            }

            // ReSharper disable ExplicitCallerInfoArgument
            OnPropertyChanged("Errors");
            // ReSharper restore ExplicitCallerInfoArgument

            List <IActionableErrorInfo> errorList;

            if (Errors.TryGetValue(propertyName, out errorList))
            {
                return(errorList.Count == 0);
            }
            return(false);
        }
Ejemplo n.º 3
0
        public bool Validate(string propertyName, IRuleSet ruleSet)
        {
            if(string.IsNullOrEmpty(propertyName))
            {
                return true;
            }

            if(ruleSet == null)
            {
                Errors[propertyName] = new List<IActionableErrorInfo>();
            }
            else
            {
                var errorsTos = ruleSet.ValidateRules();
                Errors[propertyName] = errorsTos;
            }

            // ReSharper disable ExplicitCallerInfoArgument
            OnPropertyChanged("Errors");
            // ReSharper restore ExplicitCallerInfoArgument

            List<IActionableErrorInfo> errorList;
            if(Errors.TryGetValue(propertyName, out errorList))
            {
                return errorList.Count == 0;
            }
            return false;
        }
Ejemplo n.º 4
0
 public bool Validate(string propertyName, IRuleSet ruleSet)
 {
     if (ruleSet == null)
     {
         Errors[propertyName] = new List<IActionableErrorInfo>();
     }
     else
     {
         List<IActionableErrorInfo> errorsTos = ruleSet.ValidateRules();
         List<IActionableErrorInfo> actionableErrorInfos =
             errorsTos.ConvertAll<IActionableErrorInfo>(input => new ActionableErrorInfo(input, () =>
             {
                 //
             }));
         Errors[propertyName] = actionableErrorInfos;
     }
     OnPropertyChanged("Errors");
     List<IActionableErrorInfo> errorList;
     if (Errors.TryGetValue(propertyName, out errorList))
     {
         return errorList.Count == 0;
     }
     return false;
 }