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
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
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 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 bool Selecionado
{
get
{
return _selecionado;
}
set
{
_selecionado = value;
OnPropertyChanged("Selecionado");
}
}
public Extrato Extrato { get; set; }
public long? Documento { get; set; }
public long? Parcela { get; set; }
public StatusParcela? Status { get; set; }
public SubTipo? SubTipo { get; set; }
public bool Corrigir { get; set; }
public string Cliente
{
get
{
return _cliente?.ToUpper();
}
set
{
_cliente = value;
}
}
public string Apolice
{
get
{
return _apolice?.ToUpper().Trim();
}
set
{
_apolice = value;
}
}
public string Endosso
{
get
{
return _endosso?.ToUpper().Trim();
}
set
{
_endosso = value;
}
}
public string NumeroParcela
{
get
{
return _numeroParcela?.ToUpper().Trim();
}
set
{
_numeroParcela = value;
}
}
public DateTime? Recebimento { get; set; }
public DateTime? Credito { get; set; }
public decimal? Valor { get; set; }
public decimal? Comissao { get; set; }
public decimal? ValorComissao { get; set; }
public string Historico
{
get
{
return _historico?.ToUpper();
}
set
{
_historico = value;
}
}
[JsonIgnore]
public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public List<KeyValuePair<string, string>> Validate()
{
List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
if (Recebimento.HasValue && (DateTime.Compare(Recebimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Recebimento.Value, new DateTime(9999, 12, 31)) > 0))
{
list.AddValue("Recebimento", string.Format(Messages.DataInvalida));
}
if (Credito.HasValue && (DateTime.Compare(Credito.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Credito.Value, new DateTime(9999, 12, 31)) > 0))
{
list.AddValue("Credito", string.Format(Messages.DataInvalida));
}
if (string.IsNullOrWhiteSpace(Cliente) && Cliente.Length > 100)
{
list.AddValue("Cliente", string.Format(Messages.MaiorQueLimite, 100));
}
if (string.IsNullOrWhiteSpace(Apolice) && Apolice.Length > 30)
{
list.AddValue("Apolice", string.Format(Messages.MaiorQueLimite, 30));
}
if (string.IsNullOrWhiteSpace(Endosso) && Endosso.Length > 20)
{
list.AddValue("Endosso", string.Format(Messages.MaiorQueLimite, 20));
}
if (string.IsNullOrWhiteSpace(NumeroParcela) && NumeroParcela.Length > 4)
{
list.AddValue("NumeroParcela", string.Format(Messages.MaiorQueLimite, 4));
}
return list;
}
}
|