Exemple #1
0
 public static Validation IsNotNull(this Validation validation, decimal theObject, string paramName)
 {
     return(theObject == 0 ? validation.AddException(ValidationException.IsRequired(paramName)) : validation);
 }
Exemple #2
0
 public static Validation IsNotNull(this Validation validation, DateTime theObject, string paramName)
 {
     return(Equals(theObject, DateTime.MinValue)
         ? validation.AddException(ValidationException.IsRequired(paramName))
         : validation);
 }
Exemple #3
0
 public static Validation IsNotNull <T>(this Validation validation, T theObject, string paramName) where T : class
 {
     return(theObject == null?validation.AddException(ValidationException.IsRequired(paramName)) : validation);
 }
Exemple #4
0
 public static Validation IsFalse(this Validation validation, bool?val, string message)
 {
     return(val.HasValue && val.Value == false? validation : validation.AddException(new ValidationException(message)));
 }
Exemple #5
0
 public static Validation IsTrue(this Validation validation, bool val, string message)
 {
     return(val ? validation : validation.AddException(new ValidationException(message)));
 }
Exemple #6
0
 public static Validation IsEqual <T>(this Validation validation, T left, T right, string message)
 {
     return(Equals(left, right) ? validation : validation.AddException(new ValidationException(message)));
 }
Exemple #7
0
 public static bool IsValid(this Validation validation)
 {
     return(validation?.Errors == null || !validation.Errors.Any());
 }