summaryrefslogtreecommitdiff
path: root/Gestor.Common/Gestor.Common.Validation/ValidacaoDataMaior.cs
blob: 88606a52cbc07d78d461bf98df41a1c84eb847f3 (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
using System;
using System.Globalization;
using System.Windows.Controls;

namespace Gestor.Common.Validation;

public class ValidacaoDataMaior : ValidationRule
{
	public DateTime BaseDate { get; set; }

	public override ValidationResult Validate(object value, CultureInfo cultureInfo)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Expected O, but got Unknown
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Expected O, but got Unknown
		if (!string.IsNullOrWhiteSpace((value ?? "").ToString()))
		{
			if (!((DateTime)value < BaseDate))
			{
				return ValidationResult.ValidResult;
			}
			return new ValidationResult(false, (object)"Data Inválida");
		}
		return new ValidationResult(false, (object)"Obrigatório");
	}
}