summaryrefslogtreecommitdiff
path: root/Gestor.Model/Gestor.Model.Domain.Seguros/Documento.cs
blob: 4b6acf73037cfa1d1ff6b0f1fb68948e86ceebe3 (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
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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.CompilerServices;
using Gestor.Model.Attributes;
using Gestor.Model.Common;
using Gestor.Model.Domain.Aggilizador;
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;

namespace Gestor.Model.Domain.Seguros;

public class Documento : DomainBase, IDomain
{
	private bool _selecionado;

	private string _proposta;

	private string _propostaEndosso;

	private string _apoliceAnterior;

	private string _apolice;

	private string _endosso;

	private string _pasta;

	private string _agencia;

	private string _conta;

	private string _numeroCartao;

	private string _vencimentoCartao;

	private string _nomeProponente;

	private bool _isEndosso;

	private bool _vencimentoParcela;

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

	public bool ProtocoloTelefone { get; set; }

	public bool ProtocoloEmail { get; set; }

	public bool ProtocoloEndereco { get; set; }

	public bool ProtocoloParcela { get; set; }

	public bool ProtocoloVendedor { get; set; }

	public Controle Controle { get; set; }

	[Log(true)]
	[Description("NEGÓCIO CORRETORA")]
	public NegocioCorretora? NegocioCorretora { get; set; }

	public DateTime? DataCriacao { get; set; }

	[Log(true)]
	[Description("DATA DE CONTROLE")]
	public DateTime? DataControle { get; set; }

	public int Ordem { get; set; }

	public int Tipo { get; set; }

	[Log(true)]
	[Description("STATUS INTERNO")]
	public Status Status { get; set; }

	public string ObsProtocolo { get; set; }

	[Log(true)]
	public string Proposta
	{
		get
		{
			return _proposta?.ToUpper();
		}
		set
		{
			_proposta = value;
		}
	}

	[Log(true)]
	[Description("PROPOSTA DE ENDOSSO")]
	public string PropostaEndosso
	{
		get
		{
			return _propostaEndosso?.ToUpper();
		}
		set
		{
			_propostaEndosso = value;
		}
	}

	[Log(false)]
	public Usuario UsuarioCriacao { get; set; }

	[Log(true)]
	[Description("APÓLICE ANTERIOR")]
	public string ApoliceAnterior
	{
		get
		{
			return _apoliceAnterior?.ToUpper();
		}
		set
		{
			_apoliceAnterior = value;
		}
	}

	[Log(true)]
	[Description("APÓLICE")]
	public string Apolice
	{
		get
		{
			return _apolice?.ToUpper();
		}
		set
		{
			_apolice = value;
		}
	}

	[Log(true)]
	public string Endosso
	{
		get
		{
			return _endosso?.ToUpper();
		}
		set
		{
			_endosso = value;
		}
	}

	[Log(true)]
	[Description("TIPO DO ENDOSSO")]
	public TipoEndosso? TipoEndosso { get; set; }

	[Log(true)]
	[Description("COMISSÃO")]
	public decimal Comissao { get; set; }

	[Log(true)]
	[Description("PRÊMIO LÍQUIDO")]
	public decimal PremioLiquido { get; set; }

	[Log(true)]
	[Description("PRÊMIO ADICIONAL")]
	public decimal PremioAdicional { get; set; }

	[Log(true)]
	[Description("CUSTO DE EMISSÃO")]
	public decimal Custo { get; set; }

	[Log(true)]
	[Description("IOF")]
	public decimal Iof { get; set; }

	[Log(true)]
	[Description("DIFERENÇA")]
	public decimal Diferenca { get; set; }

	[Log(true)]
	[Description("PRÊMIO TOTAL")]
	public decimal PremioTotal { get; set; }

	[Log(true)]
	[Description("QUANTIDADE DE PARCELAS")]
	public decimal NumeroParcelas { get; set; }

	[Log(true)]
	public string Observacao { get; set; }

	[Log(true)]
	public string Pasta
	{
		get
		{
			return _pasta?.ToUpper();
		}
		set
		{
			_pasta = value;
		}
	}

	[Log(true)]
	public Banco Banco { get; set; }

	[Log(true)]
	[Description("AGÊNCIA")]
	public string Agencia
	{
		get
		{
			return _agencia?.ToUpper().Trim();
		}
		set
		{
			_agencia = value;
		}
	}

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

	[Log(true)]
	[Description("TIPO RECEBIMENTO")]
	public TipoRecebimento? TipoRecebimento { get; set; }

	[Log(false)]
	public Negocio? Negocio { get; set; }

	[Log(true)]
	[Description("SITUAÇÃO")]
	public TipoSeguro Situacao { get; set; }

	[Log(false)]
	public TipoSeguro? SituacaoAnterior { get; set; }

	[Log(true)]
	[Description("ADICIONAL DE COMISSÃO")]
	public bool AdicionalComiss { get; set; }

	public bool Excluido { get; set; }

	public bool AssinadaSiggner { get; set; }

	[Log(true)]
	public bool PropostaAssinada { get; set; }

	public StatusAssinatura StatusAssinatura { get; set; }

	[Log(true)]
	[Description("APÓLICE CONFERIDA")]
	public bool ApoliceConferida { get; set; }

	public bool FinalVigencia { get; set; }

	[Log(true)]
	public BandeiraCartao? Bandeira { get; set; }

	[Log(true)]
	[Description("NÚMERO CARTÃO")]
	public string NumeroCartao
	{
		get
		{
			return _numeroCartao?.ToUpper().Trim();
		}
		set
		{
			_numeroCartao = value;
		}
	}

	[Log(true)]
	[Description("VENCIMENTO CARTÃO")]
	public string VencimentoCartao
	{
		get
		{
			return _vencimentoCartao?.ToUpper().Trim();
		}
		set
		{
			_vencimentoCartao = value;
		}
	}

	[Log(true)]
	[Description("PROPONENTE")]
	public string NomeProponente
	{
		get
		{
			return _nomeProponente?.ToUpper();
		}
		set
		{
			_nomeProponente = value;
		}
	}

	[Log(true)]
	[Description("VIGÊNCIA INICIAL")]
	public DateTime Vigencia1 { get; set; }

	[Log(true)]
	[Description("VIGÊNCIA FINAL")]
	public DateTime? Vigencia2 { get; set; }

	[Log(true)]
	[Description("EMISSÃO")]
	public DateTime? Emissao { get; set; }

	[Log(true)]
	[Description("TRANSMISSÃO DA PROPOSTA")]
	public DateTime? Remessa { get; set; }

	[Log(true)]
	[Description("ESTIPULANTE 1")]
	public Estipulante Estipulante1 { get; set; }

	[Log(true)]
	[Description("ESTIPULANTE 2")]
	public Estipulante Estipulante2 { get; set; }

	[Log(true)]
	[Description("ESTIPULANTE 3")]
	public Estipulante Estipulante3 { get; set; }

	[Log(true)]
	[Description("ESTIPULANTE 4")]
	public Estipulante Estipulante4 { get; set; }

	[Log(true)]
	[Description("ESTIPULANTE 5")]
	public Estipulante Estipulante5 { get; set; }

	public string Estipulantes { get; set; }

	[Log(false)]
	public Vendedor VendedorPrincipal { get; set; }

	[Log(false)]
	public decimal? PercentualRepasse { get; set; }

	[Log(false)]
	public List<Item> ItensAtivo { get; set; }

	[Log(false)]
	public ObservableCollection<Parcela> Parcelas { get; set; }

	[Log(false)]
	public List<VendedorParcela> Pagamentos { get; set; }

	[Log(false)]
	public List<Vendedor> Vendedores { get; set; }

	[Log(false)]
	public bool Sinistro { get; set; }

	[Log(false)]
	public bool TemEndosso { get; set; }

	[Log(true)]
	[Description("FORMA DE PAGAMENTO")]
	public FormaPagamento? FormaPagamento { get; set; }

	[Log(false)]
	public List<StatusDocumentoAssinado> Assinaturas { get; set; }

	[Log(false)]
	public VinculoDocumento Vinculo { get; set; }

	[Log(false)]
	public List<Calculo> Calculos { get; set; }

	public decimal? ComissaoTotal { get; set; }

	[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 Documento DeepCopy()
	{
		return JsonConvert.DeserializeObject<Documento>(JsonConvert.SerializeObject((object)this));
	}

	public List<KeyValuePair<string, string>> Validate(bool isEndosso, bool vencimentoParcela)
	{
		_isEndosso = isEndosso;
		_vencimentoParcela = vencimentoParcela;
		return Validate();
	}

	public List<KeyValuePair<string, string>> Validate()
	{
		List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
		list.AddRange(Controle.Validate());
		if (!NegocioCorretora.HasValue)
		{
			list.AddValue("NegocioCorretora|NEGÓCIO CORRETORA", Messages.Obrigatorio);
		}
		if (string.IsNullOrWhiteSpace(Proposta) && !_isEndosso)
		{
			list.AddValue("Proposta", Messages.Obrigatorio);
		}
		else if (!string.IsNullOrEmpty(Proposta) && Proposta.Length > 50)
		{
			list.AddValue("Proposta", string.Format(Messages.MaiorQueLimite, 50));
		}
		if (!string.IsNullOrWhiteSpace(PropostaEndosso) && PropostaEndosso.Length > 50)
		{
			list.AddValue("PropostaEndosso|PROPOSTA DE ENDOSSO", string.Format(Messages.MaiorQueLimite, 50));
		}
		if (!string.IsNullOrWhiteSpace(ApoliceAnterior) && ApoliceAnterior.Length > 50)
		{
			list.AddValue("ApoliceAnterior|APÓLICE ANTERIOR", string.Format(Messages.MaiorQueLimite, 50));
		}
		if (!string.IsNullOrWhiteSpace(Endosso) && Endosso.Length > 30)
		{
			list.AddValue("Endosso", string.Format(Messages.MaiorQueLimite, 30));
		}
		if (!string.IsNullOrWhiteSpace(Pasta) && Pasta.Length > 15)
		{
			list.AddValue("Pasta", string.Format(Messages.MaiorQueLimite, 15));
		}
		if (!string.IsNullOrWhiteSpace(Agencia) && Agencia.Length > 10)
		{
			list.AddValue("Agencia|AGÊNCIA", string.Format(Messages.MaiorQueLimite, 10));
		}
		if (!string.IsNullOrWhiteSpace(Conta) && Conta.Length > 15)
		{
			list.AddValue("Conta", string.Format(Messages.MaiorQueLimite, 15));
		}
		if (!string.IsNullOrWhiteSpace(NumeroCartao) && NumeroCartao.Length > 20)
		{
			list.AddValue("NumeroCartao|NÚMERO DO CARTÃO", string.Format(Messages.MaiorQueLimite, 20));
		}
		if (!string.IsNullOrWhiteSpace(VencimentoCartao) && VencimentoCartao.Length > 5)
		{
			list.AddValue("VencimentoCartao|VENCIMENTO DO CARTÃO", string.Format(Messages.MaiorQueLimite, 5));
		}
		if (!string.IsNullOrWhiteSpace(NomeProponente) && NomeProponente.Length > 100)
		{
			list.AddValue("NomeProponente|PROPONENTE", string.Format(Messages.MaiorQueLimite, 100));
		}
		if (Emissao.HasValue && (DateTime.Compare(Emissao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Emissao.Value, new DateTime(9999, 12, 31)) > 0))
		{
			list.AddValue("Emissao|" + (_isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE"), string.Format(Messages.DataInvalida));
		}
		if (Remessa.HasValue && (DateTime.Compare(Remessa.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Remessa.Value, new DateTime(9999, 12, 31)) > 0))
		{
			list.AddValue("Remessa|" + (_isEndosso ? "TRANSMISSÃO DA PROPOSTA DE ENDOSSO" : "TRANSMISSÃO DA PROPOSTA"), string.Format(Messages.DataInvalida));
		}
		_ = Vigencia1;
		if (DateTime.Compare(Vigencia1, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Vigencia1, new DateTime(9999, 12, 31)) > 0)
		{
			list.AddValue("Vigencia1|VIGÊNCIA INICIAL", string.Format(Messages.DataInvalida));
		}
		if (Vigencia2.HasValue && (DateTime.Compare(Vigencia2.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Vigencia2.Value, new DateTime(9999, 12, 31)) > 0))
		{
			list.AddValue("Vigencia2|VIGÊNCIA FINAL", string.Format(Messages.DataInvalida));
		}
		_ = Vigencia1;
		if (Vigencia2.HasValue)
		{
			DateTime vigencia = Vigencia1;
			DateTime? vigencia2 = Vigencia2;
			if (vigencia > vigencia2)
			{
				list.AddValue("Vigencia2|VIGÊNCIA FINAL", "A DATA DE VIGÊNCIA FINAL NÃO PODE SER ANTERIOR A DATA DE VIGÊNCIA INCIAL");
			}
		}
		if (Tipo == 0)
		{
			if (string.IsNullOrWhiteSpace(Apolice) && Emissao.HasValue)
			{
				list.AddValue("Apolice|APÓLICE", Messages.Obrigatorio);
			}
			if (!string.IsNullOrWhiteSpace(Apolice) && !Emissao.HasValue)
			{
				list.AddValue("Emissao|" + (_isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE"), Messages.Obrigatorio);
			}
			if (!string.IsNullOrWhiteSpace(Apolice) && Apolice.Length > 50)
			{
				list.AddValue("Apolice|APÓLICE", string.Format(Messages.MaiorQueLimite, 50));
			}
		}
		if (Tipo > 0)
		{
			if (string.IsNullOrWhiteSpace(PropostaEndosso))
			{
				list.AddValue("PropostaEndosso|PROPOSTA DE ENDOSSO", Messages.Obrigatorio);
			}
			else if (PropostaEndosso.Length > 30)
			{
				list.AddValue("PropostaEndosso|PROPOSTA DE ENDOSSO", string.Format(Messages.MaiorQueLimite, 30));
			}
			if (string.IsNullOrWhiteSpace(Endosso))
			{
				if (Emissao.HasValue)
				{
					list.AddValue("Endosso", Messages.Obrigatorio);
				}
			}
			else
			{
				if (Endosso.Length > 30)
				{
					list.AddValue("Endosso", string.Format(Messages.MaiorQueLimite, 30));
				}
				if (!Emissao.HasValue && Tipo > 0)
				{
					list.AddValue("Emissao|" + (_isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE"), Messages.Obrigatorio);
				}
			}
		}
		if (Tipo > 0 && !TipoEndosso.HasValue)
		{
			list.AddValue("TipoEndosso|TIPO DE ENDOSSO", Messages.Obrigatorio);
		}
		if (TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Parcela && !Vigencia2.HasValue)
		{
			list.AddValue("Vigencia2|VIGÊNCIA FINAL", Messages.Obrigatorio);
		}
		if (TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Parcela && Tipo == 0)
		{
			list.AddRange(ObrigarValores());
		}
		if (TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Fatura && Tipo == 0)
		{
			list.AddRange(ObrigarValores(valores: false));
		}
		if (TipoEndosso.GetValueOrDefault() == Gestor.Model.Common.TipoEndosso.Cancelamento && (PremioLiquido != 0m || Comissao != 0m) && NumeroParcelas == 0m)
		{
			list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Obrigatorio);
		}
		if (TipoEndosso.GetValueOrDefault() == Gestor.Model.Common.TipoEndosso.Cancelamento && (PremioLiquido != 0.0m || NumeroParcelas != 0m))
		{
			if (Comissao == 0m)
			{
				list.AddValue("Comissao|COMISSÃO", Messages.Obrigatorio);
			}
			if (NumeroParcelas == 0m)
			{
				list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Obrigatorio);
			}
			if (PremioLiquido == 0m)
			{
				list.AddValue("PremioLiquido|PRÊMIO LÍQUID", Messages.Obrigatorio);
			}
		}
		long num = 10000000000L;
		if (PremioTotal > (decimal)num)
		{
			list.AddValue("PremioTotal|PRÊMIO TOTAL", Messages.Invalido);
		}
		if (PremioLiquido > (decimal)num)
		{
			list.AddValue("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Invalido);
		}
		if (NumeroParcelas > 1000m)
		{
			list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", "NUMERO DE PARCELAS ESTA NO FORMATO INCORRETO");
		}
		if (Tipo > 0)
		{
			switch (TipoEndosso)
			{
			default:
				if (PremioTotal == 0m && Comissao == 0m)
				{
					return list;
				}
				list.AddRange(ObrigarValores());
				break;
			case Gestor.Model.Common.TipoEndosso.SemMovimento:
			case Gestor.Model.Common.TipoEndosso.Cancelamento:
				return list;
			case Gestor.Model.Common.TipoEndosso.ComMovimento:
				list.AddRange(ObrigarValores());
				break;
			}
		}
		return list;
	}

	private List<KeyValuePair<string, string>> ObrigarValores(bool valores = true)
	{
		List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
		if (valores)
		{
			if (Comissao <= 0m)
			{
				list.AddValue("Comissao|COMISSÃO", Messages.Obrigatorio);
			}
			if (PremioLiquido == 0m)
			{
				list.AddValue("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Obrigatorio);
			}
			if (PremioTotal == 0m)
			{
				list.AddValue("PremioTotal|PRÊMIO TOTAL", Messages.Obrigatorio);
			}
			if (NumeroParcelas <= 0m)
			{
				list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Obrigatorio);
			}
			if (!_vencimentoParcela)
			{
				if (NumeroParcelas > 0m && NumeroParcelas < 998m)
				{
					DateTime vigencia = Vigencia1;
					DateTime dateTime = ((NumeroParcelas == 1m || vigencia == DateTime.MinValue) ? vigencia : vigencia.AddMonths(int.Parse(NumeroParcelas.ToString(new CultureInfo("pt-BR"))) - 1));
					DateTime? vigencia2 = Vigencia2;
					if (vigencia2.HasValue && dateTime > vigencia2.GetValueOrDefault() && (Controle.Ramo == null || Controle.Ramo.Id != 23))
					{
						list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.VencimentoParcela);
					}
				}
				else if (NumeroParcelas > 1000m)
				{
					list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", "NUMERO DE PARCELAS ESTA NO FORMATO INCORRETO");
				}
			}
		}
		if (!valores)
		{
			if (PremioLiquido != 0m)
			{
				list.AddValue("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Invalido);
			}
			if (PremioAdicional != 0m)
			{
				list.AddValue("PremioAdicional|PRÊMIO ADICIONAL", Messages.Invalido);
			}
			if (Iof != 0m)
			{
				list.AddValue("Iof", Messages.Invalido);
			}
			if (Diferenca != 0m)
			{
				list.AddValue("Diferenca|DIFERÊNÇA", Messages.Invalido);
			}
			if (PremioTotal != 0m)
			{
				list.AddValue("PremioTotal|PRÊMIO TOTAL", Messages.Invalido);
			}
			if (NumeroParcelas != 0m)
			{
				list.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Invalido);
			}
		}
		return list;
	}

	public List<TupleList> Log(bool restricaoComissao)
	{
		List<Tuple<string, string, string>> obj = new List<Tuple<string, string, string>>
		{
			new Tuple<string, string, string>("SEGURADORA", string.IsNullOrWhiteSpace(Controle?.Seguradora?.Nome) ? "" : Controle.Seguradora.Nome.ToUpper(), ""),
			new Tuple<string, string, string>("RAMO", string.IsNullOrWhiteSpace(Controle?.Ramo?.Nome) ? "" : Controle.Ramo.Nome.ToUpper(), ""),
			new Tuple<string, string, string>("PRODUTO", string.IsNullOrWhiteSpace(Controle?.Produto?.Nome) ? "" : Controle.Produto.Nome.ToUpper(), "")
		};
		object item;
		if (NegocioCorretora.HasValue)
		{
			NegocioCorretora? negocioCorretora = NegocioCorretora;
			item = (negocioCorretora.HasValue ? negocioCorretora.GetValueOrDefault().GetDescription() : null);
		}
		else
		{
			item = "";
		}
		obj.Add(new Tuple<string, string, string>("NEGÓCIO CORRETORA", (string)item, ""));
		obj.Add(new Tuple<string, string, string>("STATUS DO SEGURO", Situacao.GetDescription(), ""));
		object item2;
		if (TipoRecebimento.HasValue)
		{
			TipoRecebimento? tipoRecebimento = TipoRecebimento;
			item2 = (tipoRecebimento.HasValue ? tipoRecebimento.GetValueOrDefault().GetDescription() : null);
		}
		else
		{
			item2 = "";
		}
		obj.Add(new Tuple<string, string, string>("TIPO DE RECEBIMENTO", (string)item2, ""));
		object item3;
		if (TipoEndosso.HasValue)
		{
			TipoEndosso? tipoEndosso = TipoEndosso;
			item3 = (tipoEndosso.HasValue ? tipoEndosso.GetValueOrDefault().GetDescription() : null);
		}
		else
		{
			item3 = "";
		}
		obj.Add(new Tuple<string, string, string>("TIPO ENDOSSO", (string)item3, ""));
		obj.Add(new Tuple<string, string, string>("PROPOSTA", string.IsNullOrWhiteSpace(Proposta) ? "" : Proposta.ToUpper(), ""));
		obj.Add(new Tuple<string, string, string>("PROPOSTA ENDOSSO", string.IsNullOrWhiteSpace(PropostaEndosso) ? "" : PropostaEndosso.ToUpper(), ""));
		obj.Add(new Tuple<string, string, string>("APÓLICE", string.IsNullOrWhiteSpace(Apolice) ? "" : Apolice.ToUpper(), ""));
		obj.Add(new Tuple<string, string, string>("ENDOSSO", string.IsNullOrWhiteSpace(Endosso) ? "" : Endosso.ToUpper(), ""));
		obj.Add(new Tuple<string, string, string>("VIGÊNCIA INICIAL", Vigencia1.ToShortDateString(), ""));
		obj.Add(new Tuple<string, string, string>("VIGÊNCIA FINAL", (!Vigencia2.HasValue) ? "" : Vigencia2?.ToShortDateString(), ""));
		obj.Add(new Tuple<string, string, string>("TRANSMISSÃO DA PROPOSTA", (!Remessa.HasValue) ? "" : Remessa?.ToShortDateString(), ""));
		obj.Add(new Tuple<string, string, string>("EMISSÃO DA APÓLICE", (!Emissao.HasValue) ? "" : Emissao?.ToShortDateString(), ""));
		obj.Add(new Tuple<string, string, string>("SEGURADORA ANTERIOR", string.IsNullOrWhiteSpace(Controle?.SeguradoraAnterior?.Nome) ? "" : Controle.SeguradoraAnterior.Nome.ToUpper(), ""));
		obj.Add(new Tuple<string, string, string>("APÓLICE ANTERIOR", string.IsNullOrWhiteSpace(ApoliceAnterior) ? "" : ApoliceAnterior.ToUpper(), ""));
		object item4;
		if (FormaPagamento.HasValue)
		{
			FormaPagamento? formaPagamento = FormaPagamento;
			item4 = (formaPagamento.HasValue ? formaPagamento.GetValueOrDefault().GetDescription() : null);
		}
		else
		{
			item4 = "";
		}
		obj.Add(new Tuple<string, string, string>("FORMA DE PAGAMENTO", (string)item4, ""));
		obj.Add(new Tuple<string, string, string>("PROPOSTA ASSINADA", PropostaAssinada ? "SIM" : "NÃO", ""));
		obj.Add(new Tuple<string, string, string>("APÓLICE CONFERIDA", ApoliceConferida ? "SIM" : "NÃO", ""));
		obj.Add(new Tuple<string, string, string>("ADICIONAL DE COMISSÃO", AdicionalComiss ? "SIM" : "NÃO", ""));
		List<Tuple<string, string, string>> list = obj;
		if (!restricaoComissao)
		{
			list.Add(new Tuple<string, string, string>("COMISSÃO", (Comissao / 100m).ToString("P", new CultureInfo("pt-BR", useUserOverride: false)), ""));
		}
		List<Tuple<string, string, string>> obj2 = new List<Tuple<string, string, string>>
		{
			new Tuple<string, string, string>("COMISSÃO", (Comissao / 100m).ToString("P", new CultureInfo("pt-BR", useUserOverride: false)), ""),
			new Tuple<string, string, string>("PRÊMIO LÍQUIDO", PremioLiquido.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""),
			new Tuple<string, string, string>("PRÊMIO ADICIONAL", PremioAdicional.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""),
			new Tuple<string, string, string>("I.O.F.", Iof.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""),
			new Tuple<string, string, string>("DIFERENÇA", Diferenca.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""),
			new Tuple<string, string, string>("PRÊMIO TOTAL", PremioTotal.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), ""),
			new Tuple<string, string, string>("NÚMERO DE PARCELAS", decimal.ToInt32(NumeroParcelas).ToString(), ""),
			new Tuple<string, string, string>("BANCO", (Banco == null) ? "" : Banco.Nome.ToUpper(), ""),
			new Tuple<string, string, string>("AGÊNCIA", string.IsNullOrWhiteSpace(Agencia) ? "" : Agencia.ToUpper(), ""),
			new Tuple<string, string, string>("CONTA", string.IsNullOrWhiteSpace(Conta) ? "" : Conta.ToUpper(), ""),
			new Tuple<string, string, string>("CARTÃO DE CRÉDITO", string.IsNullOrWhiteSpace(NumeroCartao) ? "" : NumeroCartao.ToUpper(), "")
		};
		object item5;
		if (Bandeira.HasValue)
		{
			BandeiraCartao? bandeira = Bandeira;
			item5 = (bandeira.HasValue ? bandeira.GetValueOrDefault().GetDescription() : null);
		}
		else
		{
			item5 = "";
		}
		obj2.Add(new Tuple<string, string, string>("BANDEIRA", (string)item5, ""));
		obj2.Add(new Tuple<string, string, string>("PROPONENTE", string.IsNullOrWhiteSpace(NomeProponente) ? "" : NomeProponente.ToUpper(), ""));
		obj2.Add(new Tuple<string, string, string>("VENCIMENTO DO CARTÃO", string.IsNullOrWhiteSpace(VencimentoCartao?.Replace("/", "")) ? "" : VencimentoCartao.ToUpper(), ""));
		obj2.Add(new Tuple<string, string, string>("PASTA", string.IsNullOrWhiteSpace(Pasta) ? "" : Pasta.ToUpper(), ""));
		obj2.Add(new Tuple<string, string, string>("ESTIPULANTE 1", (Estipulante1 == null) ? "" : Estipulante1.Nome.ToUpper(), ""));
		obj2.Add(new Tuple<string, string, string>("ESTIPULANTE 2", (Estipulante2 == null) ? "" : Estipulante2.Nome.ToUpper(), ""));
		obj2.Add(new Tuple<string, string, string>("ESTIPULANTE 3", (Estipulante3 == null) ? "" : Estipulante3.Nome.ToUpper(), ""));
		obj2.Add(new Tuple<string, string, string>("ESTIPULANTE 4", (Estipulante4 == null) ? "" : Estipulante4.Nome.ToUpper(), ""));
		obj2.Add(new Tuple<string, string, string>("ESTIPULANTE 5", (Estipulante5 == null) ? "" : Estipulante5.Nome.ToUpper(), ""));
		obj2.Add(new Tuple<string, string, string>("STATUS", (Status == null) ? "" : Status.Nome.ToUpper(), ""));
		obj2.Add(new Tuple<string, string, string>("DATA DE CONTROLE", (!DataControle.HasValue) ? "" : DataControle?.ToShortDateString(), ""));
		obj2.Add(new Tuple<string, string, string>("ANOTAÇÕES", string.IsNullOrWhiteSpace(Observacao) ? "" : Observacao.ToUpper(), ""));
		list.AddRange(obj2);
		return new List<TupleList>
		{
			new TupleList
			{
				Tuples = new ObservableCollection<Tuple<string, string, string>>(list)
			}
		};
	}

	public List<KeyValuePair<string, string>> ValidateEndossar()
	{
		List<KeyValuePair<string, string>> list = ValidationHelper.AddValue();
		if (string.IsNullOrWhiteSpace(Proposta))
		{
			list.AddValue("Proposta", Messages.Obrigatorio);
		}
		if (Emissao.HasValue && (DateTime.Compare(Emissao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Emissao.Value, new DateTime(9999, 12, 31)) > 0))
		{
			list.AddValue("Emissao|EMISSÃO DA APÓLICE", string.Format(Messages.DataInvalida));
		}
		if (Remessa.HasValue && (DateTime.Compare(Remessa.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Remessa.Value, new DateTime(9999, 12, 31)) > 0))
		{
			list.AddValue("Remessa|TRANSMISSÃO DA PROPOSTA", string.Format(Messages.DataInvalida));
		}
		if (string.IsNullOrWhiteSpace(Apolice) && Emissao.HasValue)
		{
			list.AddValue("Apolice|APÓLICE", Messages.Obrigatorio);
		}
		if (!string.IsNullOrWhiteSpace(Apolice) && !Emissao.HasValue)
		{
			list.AddValue("Emissao|" + (_isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE"), Messages.Obrigatorio);
		}
		if (string.IsNullOrWhiteSpace(Apolice) && !Emissao.HasValue)
		{
			list.AddValue("Apolice|EMISSÃO DA APÓLICE", "NÃO É POSSÍVEL ENDOSSAR UM DOCUMENTO SEM EMISSÃO DE APÓLICE");
		}
		return list;
	}
}