summaryrefslogtreecommitdiff
path: root/Gestor.Common/Gestor.Common.Validation/ValidacaoDataMaior.cs
blob: 4345958766c1bb5cda4e33c9ebc0290a5216bfe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Windows.Controls;

namespace Gestor.Common.Validation
{
	public class ValidacaoDataMaior : ValidationRule
	{
		public DateTime BaseDate
		{
			get;
			set;
		}

		public ValidacaoDataMaior()
		{
		}

		public override ValidationResult Validate(object value, CultureInfo cultureInfo)
		{
			object obj = value;
			if (obj == null)
			{
				obj = "";
			}
			if (string.IsNullOrWhiteSpace(obj.ToString()))
			{
				return new ValidationResult(false, "Obrigatório");
			}
			if ((DateTime)value >= this.BaseDate)
			{
				return ValidationResult.ValidResult;
			}
			return new ValidationResult(false, "Data Inválida");
		}
	}
}