summaryrefslogtreecommitdiff
path: root/Gestor.Model/Gestor.Model.Domain.Seguros/Extrato.cs
blob: 0ddb505112b5f1c45940597f0fdc7c9fc99328f6 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using System;
using System.Collections.Generic;
using Gestor.Model.Common;
using Gestor.Model.Domain.Generic;
using Gestor.Model.Helper;
using Gestor.Model.Resources;
using Newtonsoft.Json;

namespace Gestor.Model.Domain.Seguros;

public class Extrato : DomainBase, IDomain
{
	private string _numero;

	private string _historico;

	private string _observacao;

	public long IdEmpresa { get; set; }

	public Seguradora Seguradora { get; set; }

	public StatusExtrato Status { get; set; }

	public bool Selecionado { get; set; }

	public string Numero
	{
		get
		{
			return _numero?.ToUpper();
		}
		set
		{
			_numero = value;
		}
	}

	public string Historico
	{
		get
		{
			return _historico?.ToUpper();
		}
		set
		{
			_historico = value;
		}
	}

	public DateTime? Data { get; set; }

	public DateTime? DataCredito { get; set; }

	public decimal? Bruto { get; set; }

	public decimal? Liquido { get; set; }

	public decimal? Ir { get; set; }

	public decimal? Iss { get; set; }

	public decimal? Outro { get; set; }

	public bool Completo { get; set; }

	public string Observacao
	{
		get
		{
			return _observacao?.ToUpper();
		}
		set
		{
			_observacao = value;
		}
	}

	public virtual long IdUsuario { get; set; }

	[JsonIgnore]
	public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;

	public List<KeyValuePair<string, string>> Validate()
	{
		List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
		if (!string.IsNullOrWhiteSpace(Numero) && Numero.Length > 50)
		{
			list.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 50));
		}
		if (Data.HasValue && (DateTime.Compare(Data.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Data.Value, new DateTime(9999, 12, 31)) > 0))
		{
			list.AddValue("Data", string.Format(Messages.DataInvalida));
		}
		return list;
	}
}