summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Model/Model.Domain.Seguros/DetalheExtrato.cs
blob: c03bd402aaf8bc0371328ed206558f3f45a232c8 (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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
using Gestor.Model.Common;
using Gestor.Model.Domain.Generic;
using Gestor.Model.Helper;
using Gestor.Model.Resources;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Threading;

namespace Gestor.Model.Domain.Seguros
{
	public class DetalheExtrato : DomainBase, IDomain, INotifyPropertyChanged
	{
		private bool _selecionado;

		private string _cliente;

		private string _apolice;

		private string _endosso;

		private string _numeroParcela;

		private string _historico;

		public bool IsNormal = true;

		public string Apolice
		{
			get
			{
				string str = this._apolice;
				if (str == null)
				{
					return null;
				}
				return str.ToUpper().Trim();
			}
			set
			{
				this._apolice = value;
			}
		}

		public string Cliente
		{
			get
			{
				string str = this._cliente;
				if (str != null)
				{
					return str.ToUpper();
				}
				return null;
			}
			set
			{
				this._cliente = value;
			}
		}

		public decimal? Comissao
		{
			get;
			set;
		}

		public bool Corrigir
		{
			get;
			set;
		}

		public DateTime? Credito
		{
			get;
			set;
		}

		public long? Documento
		{
			get;
			set;
		}

		public string Endosso
		{
			get
			{
				string str = this._endosso;
				if (str == null)
				{
					return null;
				}
				return str.ToUpper().Trim();
			}
			set
			{
				this._endosso = value;
			}
		}

		public Gestor.Model.Domain.Seguros.Extrato Extrato
		{
			get;
			set;
		}

		public string Historico
		{
			get
			{
				string str = this._historico;
				if (str != null)
				{
					return str.ToUpper();
				}
				return null;
			}
			set
			{
				this._historico = value;
			}
		}

		public string NumeroParcela
		{
			get
			{
				string str = this._numeroParcela;
				if (str == null)
				{
					return null;
				}
				return str.ToUpper().Trim();
			}
			set
			{
				this._numeroParcela = value;
			}
		}

		public long? Parcela
		{
			get;
			set;
		}

		public DateTime? Recebimento
		{
			get;
			set;
		}

		public bool Selecionado
		{
			get
			{
				return this._selecionado;
			}
			set
			{
				this._selecionado = value;
				this.OnPropertyChanged("Selecionado");
			}
		}

		public StatusParcela? Status
		{
			get;
			set;
		}

		public Gestor.Model.Common.SubTipo? SubTipo
		{
			get;
			set;
		}

		[JsonIgnore]
		public Func<List<KeyValuePair<string, string>>> ValidationEvent
		{
			get
			{
				DetalheExtrato detalheExtrato = this;
				return new Func<List<KeyValuePair<string, string>>>(detalheExtrato.Validate);
			}
		}

		public decimal? Valor
		{
			get;
			set;
		}

		public decimal? ValorComissao
		{
			get;
			set;
		}

		public DetalheExtrato()
		{
		}

		protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
		{
			PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged;
			if (propertyChangedEventHandler == null)
			{
				return;
			}
			propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName));
		}

		public List<KeyValuePair<string, string>> Validate()
		{
			List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
			if (this.Recebimento.HasValue && (DateTime.Compare(this.Recebimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Recebimento.Value, new DateTime(9999, 12, 31)) > 0))
			{
				keyValuePairs.AddValue<string, string>("Recebimento", string.Format(Messages.DataInvalida, Array.Empty<object>()), true);
			}
			if (this.Credito.HasValue && (DateTime.Compare(this.Credito.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Credito.Value, new DateTime(9999, 12, 31)) > 0))
			{
				keyValuePairs.AddValue<string, string>("Credito", string.Format(Messages.DataInvalida, Array.Empty<object>()), true);
			}
			if (string.IsNullOrWhiteSpace(this.Cliente) && this.Cliente.Length > 100)
			{
				keyValuePairs.AddValue<string, string>("Cliente", string.Format(Messages.MaiorQueLimite, 100), true);
			}
			if (string.IsNullOrWhiteSpace(this.Apolice) && this.Apolice.Length > 30)
			{
				keyValuePairs.AddValue<string, string>("Apolice", string.Format(Messages.MaiorQueLimite, 30), true);
			}
			if (string.IsNullOrWhiteSpace(this.Endosso) && this.Endosso.Length > 20)
			{
				keyValuePairs.AddValue<string, string>("Endosso", string.Format(Messages.MaiorQueLimite, 20), true);
			}
			if (string.IsNullOrWhiteSpace(this.NumeroParcela) && this.NumeroParcela.Length > 4)
			{
				keyValuePairs.AddValue<string, string>("NumeroParcela", string.Format(Messages.MaiorQueLimite, 4), true);
			}
			return keyValuePairs;
		}

		public event PropertyChangedEventHandler PropertyChanged;
	}
}