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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
|
using Gestor.Model.Attributes;
using Gestor.Model.Common;
using Gestor.Model.Domain.Common;
using Gestor.Model.Domain.Generic;
using Gestor.Model.Helper;
using Gestor.Model.Resources;
using Gestor.Model.Validation;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Threading;
namespace Gestor.Model.Domain.Seguros
{
public class Vendedor : EnderecoBase, IDomain, INotifyPropertyChanged
{
private bool _selecionado;
private string _nome;
private string _documento;
private string _conta;
private string _agencia;
private string _observacao;
private string _titularConta;
private string _documentoTitular;
public string Agencia
{
get
{
string str = this._agencia;
if (str == null)
{
return null;
}
return str.ToUpper().Trim();
}
set
{
this._agencia = value;
}
}
public bool Ativo
{
get;
set;
}
public Gestor.Model.Domain.Common.Banco Banco
{
get;
set;
}
public string Conta
{
get
{
string str = this._conta;
if (str == null)
{
return null;
}
return str.ToUpper().Trim();
}
set
{
this._conta = value;
}
}
public Gestor.Model.Domain.Seguros.Controle Controle
{
get;
set;
}
public bool Corretora
{
get;
set;
}
public decimal? Desconto
{
get;
set;
}
public string Documento
{
get
{
string str = this._documento;
if (str == null)
{
return null;
}
return str.ToUpper().Trim();
}
set
{
this._documento = value;
}
}
public long IdEmpresa
{
get;
set;
}
[Log(true)]
[Name(true)]
public string Nome
{
get
{
string str = this._nome;
if (str != null)
{
return str.ToUpper();
}
return null;
}
set
{
this._nome = value;
}
}
public string Observacao
{
get
{
string str = this._observacao;
if (str != null)
{
return str.ToUpper();
}
return null;
}
set
{
this._observacao = value;
}
}
public bool Selecionado
{
get
{
return this._selecionado;
}
set
{
if (value == this._selecionado)
{
return;
}
this._selecionado = value;
this.OnPropertyChanged("Selecionado");
}
}
public List<VendedorTelefone> Telefones
{
get;
set;
}
public Gestor.Model.Common.TipoConta TipoConta
{
get;
set;
}
public Gestor.Model.Common.TipoIncidenciaDesconto TipoIncidenciaDesconto
{
get;
set;
}
public string TitularConta
{
get
{
string str = this._titularConta;
if (str != null)
{
return str.ToUpper();
}
return null;
}
set
{
this._titularConta = value;
}
}
public string TitularDocumento
{
get
{
string str = this._documentoTitular;
if (str == null)
{
return null;
}
return str.ToUpper().Trim();
}
set
{
this._documentoTitular = value;
}
}
[JsonIgnore]
public Func<List<KeyValuePair<string, string>>> ValidationEvent
{
get
{
Vendedor vendedor = this;
return new Func<List<KeyValuePair<string, string>>>(vendedor.Validate);
}
}
public Vendedor()
{
}
public List<TupleList> Log()
{
decimal? nullable;
string str;
string description;
decimal? nullable1;
List<TupleList> tupleLists = new List<TupleList>();
TupleList tupleList = new TupleList();
ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>()
{
new Tuple<string, string, string>("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""),
new Tuple<string, string, string>("CPF", (string.IsNullOrWhiteSpace(this.Documento) ? "" : this.Documento), ""),
new Tuple<string, string, string>("ATIVO", (this.Ativo ? "SIM" : "NÃO"), ""),
new Tuple<string, string, string>("BANCO", (this.Banco == null ? "" : this.Banco.Nome), ""),
new Tuple<string, string, string>("AGÊNCIA", (string.IsNullOrWhiteSpace(this.Agencia) ? "" : this.Agencia), ""),
new Tuple<string, string, string>("CONTA CORRENTE/POUPANÇA", (string.IsNullOrWhiteSpace(this.Conta) ? "" : this.Conta), ""),
new Tuple<string, string, string>("TITULAR DA CONTA", (string.IsNullOrWhiteSpace(this.TitularConta) ? "" : this.TitularConta), ""),
new Tuple<string, string, string>("DOCUMENTO TITULAR DA CONTA", (string.IsNullOrWhiteSpace(this.TitularDocumento) ? "" : this.TitularDocumento), ""),
new Tuple<string, string, string>("TIPO CONTA", (string.IsNullOrWhiteSpace(this.TipoConta.GetDescription()) ? "" : this.TipoConta.GetDescription()), "")
};
decimal? desconto = this.Desconto;
if (!desconto.HasValue)
{
str = "";
}
else
{
desconto = this.Desconto;
decimal num = 100;
if (desconto.HasValue)
{
nullable1 = new decimal?(desconto.GetValueOrDefault() / num);
}
else
{
nullable = null;
nullable1 = nullable;
}
nullable = nullable1;
if (nullable.HasValue)
{
decimal valueOrDefault = nullable.GetValueOrDefault();
str = valueOrDefault.ToString("P", new CultureInfo("pt-BR", false));
}
else
{
str = null;
}
}
observableCollection.Add(new Tuple<string, string, string>("DESCONTO", str, ""));
tupleList.Tuples = observableCollection;
tupleLists.Add(tupleList);
List<TupleList> tupleLists1 = tupleLists;
ObservableCollection<Tuple<string, string, string>> observableCollection1 = new ObservableCollection<Tuple<string, string, string>>()
{
new Tuple<string, string, string>("CONTATOS$", "", "")
};
if (this.Telefones != null && this.Telefones.Count != 0)
{
foreach (VendedorTelefone telefone in this.Telefones)
{
observableCollection1.Add(new Tuple<string, string, string>(string.Format(" CONTATO {0}$", this.Telefones.IndexOf(telefone) + 1), "", ""));
observableCollection1.Add(new Tuple<string, string, string>(" NOME", (string.IsNullOrWhiteSpace(telefone.Nome) ? "" : telefone.Nome), ""));
ObservableCollection<Tuple<string, string, string>> observableCollection2 = observableCollection1;
TipoTelefone? tipo = telefone.Tipo;
if (!tipo.HasValue)
{
description = "";
}
else
{
tipo = telefone.Tipo;
if (tipo.HasValue)
{
description = tipo.GetValueOrDefault().GetDescription();
}
else
{
description = null;
}
}
observableCollection2.Add(new Tuple<string, string, string>(" TIPO DE TELEFONE", description, ""));
observableCollection1.Add(new Tuple<string, string, string>(" PREFIXO", (string.IsNullOrWhiteSpace(telefone.Prefixo) ? "" : telefone.Prefixo), ""));
observableCollection1.Add(new Tuple<string, string, string>(" NÚMERO DE TELEFONE", (string.IsNullOrWhiteSpace(telefone.Numero) ? "" : telefone.Numero), ""));
observableCollection1.Add(new Tuple<string, string, string>(" E-MAIL", (string.IsNullOrWhiteSpace(telefone.Email) ? "" : telefone.Email), ""));
}
tupleLists1.Add(new TupleList()
{
Tuples = observableCollection1
});
}
return tupleLists1;
}
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 (string.IsNullOrEmpty(this.Nome))
{
keyValuePairs.AddValue<string, string>("Nome", Messages.Obrigatorio, true);
}
if (!string.IsNullOrWhiteSpace(this.Documento) && !this.Documento.ValidacaoDocumento())
{
keyValuePairs.AddValue<string, string>("Documento", Messages.Invalido, true);
}
if (!string.IsNullOrWhiteSpace(this.TitularDocumento) && !this.TitularDocumento.ValidacaoDocumento())
{
keyValuePairs.AddValue<string, string>("TitularDocumento", Messages.Invalido, true);
}
if (this.Telefones == null)
{
return keyValuePairs;
}
foreach (VendedorTelefone telefone in this.Telefones)
{
keyValuePairs.AddRange(telefone.Validate());
}
return keyValuePairs;
}
public event PropertyChangedEventHandler PropertyChanged;
}
}
|