summaryrefslogtreecommitdiff
path: root/Gestor.Model/Gestor.Model.Domain.Seguros/Documento.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 17:17:46 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 17:17:46 +0000
commit0440c722a221b8068bbf388c1c0c51f0faff0451 (patch)
tree169cbf90c50ff7961db82ecb606c50c2a45a1688 /Gestor.Model/Gestor.Model.Domain.Seguros/Documento.cs
parent225aa1499e37faf9d38257caabbadc68d78b427e (diff)
downloadgestor-master.tar.gz
gestor-master.zip
some dllsHEADmaster
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Seguros/Documento.cs')
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/Documento.cs835
1 files changed, 835 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Documento.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Documento.cs
new file mode 100644
index 0000000..4b6acf7
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Documento.cs
@@ -0,0 +1,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;
+ }
+}