diff options
Diffstat (limited to 'Gestor.Common/Gestor.Common.Validation/ValidacaoPlaca.cs')
| -rw-r--r-- | Gestor.Common/Gestor.Common.Validation/ValidacaoPlaca.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Gestor.Common/Gestor.Common.Validation/ValidacaoPlaca.cs b/Gestor.Common/Gestor.Common.Validation/ValidacaoPlaca.cs new file mode 100644 index 0000000..b1825e1 --- /dev/null +++ b/Gestor.Common/Gestor.Common.Validation/ValidacaoPlaca.cs @@ -0,0 +1,27 @@ +using System;
+using System.Globalization;
+using System.Windows.Controls;
+
+namespace Gestor.Common.Validation
+{
+ public class ValidacaoPlaca : ValidationRule
+ {
+ public ValidacaoPlaca()
+ {
+ }
+
+ public override ValidationResult Validate(object value, CultureInfo cultureInfo)
+ {
+ object obj = value;
+ if (obj == null)
+ {
+ obj = "";
+ }
+ if (string.IsNullOrWhiteSpace(obj.ToString()) || value.ToString().ValidatePlate())
+ {
+ return ValidationResult.ValidResult;
+ }
+ return new ValidationResult(false, "Placa Inválida");
+ }
+ }
+}
\ No newline at end of file |