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
|
using Gestor.Model.Attributes;
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;
namespace Gestor.Model.Domain.Seguros
{
public class VendedorParcela : DomainBase, IDomain
{
private string _vCondRep;
public bool CoCorretagem
{
get;
set;
}
public Gestor.Model.Domain.Seguros.CondicaoRepasse CondicaoRepasse
{
get;
set;
}
[Description("DATA DO PAGAMENTO")]
[Log(true)]
public DateTime? DataPagamento
{
get;
set;
}
[Description("DATA PREVISÃO DE PAGAMENTO")]
[Log(true)]
public DateTime? DataPrePagamento
{
get;
set;
}
[Log(false)]
public Gestor.Model.Domain.Seguros.Documento Documento
{
get;
set;
}
[Log(false)]
public Gestor.Model.Domain.Seguros.Parcela Parcela
{
get;
set;
}
[Description("PORCENTAGEM REPASSE")]
[Log(true)]
public decimal? PorcentagemRepasse
{
get;
set;
}
public decimal? PorcentagemRepasseB
{
get;
set;
}
public string RecebidoPorCompleto
{
get;
set;
}
public Gestor.Model.Domain.Seguros.Repasse Repasse
{
get;
set;
}
public bool Selecionado
{
get;
set;
}
public Gestor.Model.Domain.Seguros.TipoVendedor TipoVendedor
{
get;
set;
}
[JsonIgnore]
public Func<List<KeyValuePair<string, string>>> ValidationEvent
{
get
{
VendedorParcela vendedorParcela = this;
return new Func<List<KeyValuePair<string, string>>>(vendedorParcela.Validate);
}
}
[Description("VALOR REPASSE")]
[Log(true)]
public decimal? ValorRepasse
{
get;
set;
}
public decimal? ValorRepasseB
{
get;
set;
}
public decimal? ValorTotal
{
get;
set;
}
public decimal? ValorTotalPago
{
get;
set;
}
public string VCondRep
{
get
{
string str = this._vCondRep;
if (str != null)
{
return str.ToUpper();
}
return null;
}
set
{
this._vCondRep = value;
}
}
[Log(true)]
public Gestor.Model.Domain.Seguros.Vendedor Vendedor
{
get;
set;
}
public VendedorParcela()
{
}
public List<KeyValuePair<string, string>> Validate()
{
decimal num;
List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
if (this.DataPagamento.HasValue && (DateTime.Compare(this.DataPagamento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.DataPagamento.Value, new DateTime(9999, 12, 31)) > 0))
{
keyValuePairs.AddValue<string, string>("DataPagamento", string.Format(Messages.DataInvalida, Array.Empty<object>()), true);
}
if (this.DataPrePagamento.HasValue && (DateTime.Compare(this.DataPrePagamento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.DataPrePagamento.Value, new DateTime(9999, 12, 31)) > 0))
{
keyValuePairs.AddValue<string, string>("DataPrePagamento", string.Format(Messages.DataInvalida, Array.Empty<object>()), true);
}
if (this.Vendedor == null)
{
keyValuePairs.AddValue<string, string>("Vendedor", Messages.Obrigatorio, true);
}
if (this.Documento == null)
{
keyValuePairs.AddValue<string, string>("Documento", Messages.Obrigatorio, true);
}
if (this.Documento != null && this.Documento.Id > (long)0 && this.Parcela == null)
{
keyValuePairs.AddValue<string, string>("Parcela", Messages.Obrigatorio, true);
}
if (this.Repasse == null)
{
keyValuePairs.AddValue<string, string>("Repasse", Messages.Obrigatorio, true);
}
if (this.TipoVendedor == null && !this.CoCorretagem)
{
keyValuePairs.AddValue<string, string>("TipoVendedor", Messages.Obrigatorio, true);
}
decimal? porcentagemRepasse = this.PorcentagemRepasse;
if (!porcentagemRepasse.HasValue && !this.CoCorretagem)
{
keyValuePairs.AddValue<string, string>("PorcentagemRepasse", Messages.Obrigatorio, true);
}
porcentagemRepasse = this.ValorRepasse;
if (!porcentagemRepasse.HasValue)
{
keyValuePairs.AddValue<string, string>("ValorRepasse", Messages.Obrigatorio, true);
}
if (this.Vendedor == null || this.Vendedor.Corretora)
{
return keyValuePairs;
}
porcentagemRepasse = this.PorcentagemRepasse;
if (porcentagemRepasse.HasValue)
{
porcentagemRepasse = this.PorcentagemRepasse;
num = new decimal();
if ((porcentagemRepasse.GetValueOrDefault() <= num) & porcentagemRepasse.HasValue)
{
keyValuePairs.AddValue<string, string>("PorcentagemRepasse", Messages.Invalido, true);
}
}
porcentagemRepasse = this.ValorRepasse;
if (porcentagemRepasse.HasValue)
{
porcentagemRepasse = this.ValorRepasse;
num = new decimal();
if ((porcentagemRepasse.GetValueOrDefault() == num) & porcentagemRepasse.HasValue && !this.CoCorretagem)
{
keyValuePairs.AddValue<string, string>("ValorRepasse", Messages.Invalido, true);
}
}
if (this.Repasse != null && this.Documento != null && this.Documento.TipoRecebimento.GetValueOrDefault() == TipoRecebimento.Parcela && this.Repasse.Base.GetValueOrDefault() == BaseRepasse.Transmissao && (!this.Documento.Remessa.HasValue || DateTime.Compare(this.Documento.Remessa.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Documento.Remessa.Value, new DateTime(9999, 12, 31)) > 0))
{
keyValuePairs.AddValue<string, string>("TRANSMISSÃO DA PROPOSTA", string.Format(Messages.DataInvalida, Array.Empty<object>()), true);
}
return keyValuePairs;
}
}
}
|