summaryrefslogtreecommitdiff
path: root/Gestor.Model/Gestor.Model.Domain.Seguros/SinistroAuto.cs
blob: 0fac5553bc78b2ed398469954659d2fd60c1637e (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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
using System;
using System.Collections.Generic;
using System.ComponentModel;
using Gestor.Model.Attributes;
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 SinistroAuto : DomainBase, IDomain
{
	private string _numeroBo;

	private string _endereco;

	private string _envolvido;

	private string _motorista;

	private string _ddd;

	private string _telefone;

	private string _email;

	private string _cnh;

	public Sinistro Sinistro { get; set; }

	[Log(true)]
	[Name(true)]
	[Description("NUMERO B.O.")]
	public string NumeroBo
	{
		get
		{
			return _numeroBo?.ToUpper();
		}
		set
		{
			_numeroBo = value;
		}
	}

	[Log(true)]
	[Name(true)]
	[Description("TIPO PERDA")]
	public TipoPerda? TipoPerda { get; set; }

	[Log(true)]
	[Name(true)]
	[Description("DECLARA-SE CULPADO")]
	public bool? Culpado { get; set; }

	[Log(true)]
	[Name(true)]
	[Description("DATA ÚLTIMO DOC. ENVIADO")]
	public DateTime? UltimoDocEnviado { get; set; }

	[Log(true)]
	[Description("MECÂNICA")]
	public Parceiro ParceiroMecanica { get; set; }

	[Log(true)]
	[Description("FUNILARIA")]
	public Parceiro ParceiroFunilaria { get; set; }

	[Log(true)]
	[Name(true)]
	[Description("ENDEREÇO")]
	public string Endereco
	{
		get
		{
			return _endereco?.ToUpper();
		}
		set
		{
			_endereco = value;
		}
	}

	[Log(true)]
	[Name(true)]
	public string Envolvido
	{
		get
		{
			return _envolvido?.ToUpper();
		}
		set
		{
			_envolvido = value;
		}
	}

	[Log(true)]
	[Name(true)]
	public string Motorista
	{
		get
		{
			return _motorista?.ToUpper();
		}
		set
		{
			_motorista = value;
		}
	}

	[Log(true)]
	[Name(true)]
	[Description("PREFIXO")]
	public string Ddd
	{
		get
		{
			return _ddd?.ToUpper().Trim();
		}
		set
		{
			_ddd = value;
		}
	}

	[Log(true)]
	[Name(true)]
	[Description("TELEFONE")]
	public string Telefone
	{
		get
		{
			return _telefone?.ToUpper().Trim();
		}
		set
		{
			_telefone = value;
		}
	}

	[Log(true)]
	[Name(true)]
	[Description("E-MAIL")]
	public string Email
	{
		get
		{
			return _email?.ToLower().Trim();
		}
		set
		{
			_email = value;
		}
	}

	[Log(true)]
	[Name(true)]
	public string Cnh
	{
		get
		{
			return _cnh?.ToUpper().Trim();
		}
		set
		{
			_cnh = value;
		}
	}

	[Log(true)]
	[Name(true)]
	[Description("VALOR MECÂNICA")]
	public decimal ValorMecanica { get; set; }

	[Log(true)]
	[Name(true)]
	[Description("VALOR FINILARIA")]
	public decimal ValorFunilaria { 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 (Sinistro != null)
		{
			list.AddRange(Sinistro.Validate());
		}
		if (UltimoDocEnviado.HasValue && (DateTime.Compare(UltimoDocEnviado.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(UltimoDocEnviado.Value, new DateTime(9999, 12, 31)) > 0))
		{
			list.AddValue("UltimoDocEnviado", string.Format(Messages.DataInvalida));
		}
		return list;
	}
}