diff options
Diffstat (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros/Documento.cs')
| -rw-r--r-- | Codemerx/Gestor.Model/Model.Domain.Seguros/Documento.cs | 1426 |
1 files changed, 1426 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Documento.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Documento.cs new file mode 100644 index 0000000..00ae7de --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Documento.cs @@ -0,0 +1,1426 @@ +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;
+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 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;
+
+ [Description("ADICIONAL DE COMISSÃO")]
+ [Log(true)]
+ public bool AdicionalComiss
+ {
+ get;
+ set;
+ }
+
+ [Description("AGÊNCIA")]
+ [Log(true)]
+ public string Agencia
+ {
+ get
+ {
+ string str = this._agencia;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._agencia = value;
+ }
+ }
+
+ [Description("APÓLICE")]
+ [Log(true)]
+ public string Apolice
+ {
+ get
+ {
+ string str = this._apolice;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._apolice = value;
+ }
+ }
+
+ [Description("APÓLICE ANTERIOR")]
+ [Log(true)]
+ public string ApoliceAnterior
+ {
+ get
+ {
+ string str = this._apoliceAnterior;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._apoliceAnterior = value;
+ }
+ }
+
+ [Description("APÓLICE CONFERIDA")]
+ [Log(true)]
+ public bool ApoliceConferida
+ {
+ get;
+ set;
+ }
+
+ public bool AssinadaSiggner
+ {
+ get;
+ set;
+ }
+
+ [Log(false)]
+ public List<StatusDocumentoAssinado> Assinaturas
+ {
+ get;
+ set;
+ }
+
+ [Log(true)]
+ public Gestor.Model.Domain.Common.Banco Banco
+ {
+ get;
+ set;
+ }
+
+ [Log(true)]
+ public BandeiraCartao? Bandeira
+ {
+ get;
+ set;
+ }
+
+ [Log(false)]
+ public List<Calculo> Calculos
+ {
+ get;
+ set;
+ }
+
+ [Description("COMISSÃO")]
+ [Log(true)]
+ public decimal Comissao
+ {
+ get;
+ set;
+ }
+
+ public decimal? ComissaoTotal
+ {
+ get;
+ set;
+ }
+
+ [Log(true)]
+ 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;
+ }
+
+ [Description("CUSTO DE EMISSÃO")]
+ [Log(true)]
+ public decimal Custo
+ {
+ get;
+ set;
+ }
+
+ [Description("DATA DE CONTROLE")]
+ [Log(true)]
+ public DateTime? DataControle
+ {
+ get;
+ set;
+ }
+
+ public DateTime? DataCriacao
+ {
+ get;
+ set;
+ }
+
+ [Description("DIFERENÇA")]
+ [Log(true)]
+ public decimal Diferenca
+ {
+ get;
+ set;
+ }
+
+ [Description("EMISSÃO")]
+ [Log(true)]
+ public DateTime? Emissao
+ {
+ get;
+ set;
+ }
+
+ [Log(true)]
+ public string Endosso
+ {
+ get
+ {
+ string str = this._endosso;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._endosso = value;
+ }
+ }
+
+ [Description("ESTIPULANTE 1")]
+ [Log(true)]
+ public Estipulante Estipulante1
+ {
+ get;
+ set;
+ }
+
+ [Description("ESTIPULANTE 2")]
+ [Log(true)]
+ public Estipulante Estipulante2
+ {
+ get;
+ set;
+ }
+
+ [Description("ESTIPULANTE 3")]
+ [Log(true)]
+ public Estipulante Estipulante3
+ {
+ get;
+ set;
+ }
+
+ [Description("ESTIPULANTE 4")]
+ [Log(true)]
+ public Estipulante Estipulante4
+ {
+ get;
+ set;
+ }
+
+ [Description("ESTIPULANTE 5")]
+ [Log(true)]
+ public Estipulante Estipulante5
+ {
+ get;
+ set;
+ }
+
+ public string Estipulantes
+ {
+ get;
+ set;
+ }
+
+ public bool Excluido
+ {
+ get;
+ set;
+ }
+
+ public bool FinalVigencia
+ {
+ get;
+ set;
+ }
+
+ [Description("FORMA DE PAGAMENTO")]
+ [Log(true)]
+ public Gestor.Model.Common.FormaPagamento? FormaPagamento
+ {
+ get;
+ set;
+ }
+
+ [Description("IOF")]
+ [Log(true)]
+ public decimal Iof
+ {
+ get;
+ set;
+ }
+
+ [Log(false)]
+ public List<Item> ItensAtivo
+ {
+ get;
+ set;
+ }
+
+ [Log(false)]
+ public Gestor.Model.Common.Negocio? Negocio
+ {
+ get;
+ set;
+ }
+
+ [Description("NEGÓCIO CORRETORA")]
+ [Log(true)]
+ public Gestor.Model.Common.NegocioCorretora? NegocioCorretora
+ {
+ get;
+ set;
+ }
+
+ [Description("PROPONENTE")]
+ [Log(true)]
+ public string NomeProponente
+ {
+ get
+ {
+ string str = this._nomeProponente;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._nomeProponente = value;
+ }
+ }
+
+ [Description("NÚMERO CARTÃO")]
+ [Log(true)]
+ public string NumeroCartao
+ {
+ get
+ {
+ string str = this._numeroCartao;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._numeroCartao = value;
+ }
+ }
+
+ [Description("QUANTIDADE DE PARCELAS")]
+ [Log(true)]
+ public decimal NumeroParcelas
+ {
+ get;
+ set;
+ }
+
+ [Log(true)]
+ public string Observacao
+ {
+ get;
+ set;
+ }
+
+ public string ObsProtocolo
+ {
+ get;
+ set;
+ }
+
+ public int Ordem
+ {
+ get;
+ set;
+ }
+
+ [Log(false)]
+ public List<VendedorParcela> Pagamentos
+ {
+ get;
+ set;
+ }
+
+ [Log(false)]
+ public ObservableCollection<Parcela> Parcelas
+ {
+ get;
+ set;
+ }
+
+ [Log(true)]
+ public string Pasta
+ {
+ get
+ {
+ string str = this._pasta;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._pasta = value;
+ }
+ }
+
+ [Log(false)]
+ public decimal? PercentualRepasse
+ {
+ get;
+ set;
+ }
+
+ [Description("PRÊMIO ADICIONAL")]
+ [Log(true)]
+ public decimal PremioAdicional
+ {
+ get;
+ set;
+ }
+
+ [Description("PRÊMIO LÍQUIDO")]
+ [Log(true)]
+ public decimal PremioLiquido
+ {
+ get;
+ set;
+ }
+
+ [Description("PRÊMIO TOTAL")]
+ [Log(true)]
+ public decimal PremioTotal
+ {
+ get;
+ set;
+ }
+
+ [Log(true)]
+ public string Proposta
+ {
+ get
+ {
+ string str = this._proposta;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._proposta = value;
+ }
+ }
+
+ [Log(true)]
+ public bool PropostaAssinada
+ {
+ get;
+ set;
+ }
+
+ [Description("PROPOSTA DE ENDOSSO")]
+ [Log(true)]
+ public string PropostaEndosso
+ {
+ get
+ {
+ string str = this._propostaEndosso;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._propostaEndosso = value;
+ }
+ }
+
+ public bool ProtocoloEmail
+ {
+ get;
+ set;
+ }
+
+ public bool ProtocoloEndereco
+ {
+ get;
+ set;
+ }
+
+ public bool ProtocoloParcela
+ {
+ get;
+ set;
+ }
+
+ public bool ProtocoloTelefone
+ {
+ get;
+ set;
+ }
+
+ public bool ProtocoloVendedor
+ {
+ get;
+ set;
+ }
+
+ [Description("TRANSMISSÃO DA PROPOSTA")]
+ [Log(true)]
+ public DateTime? Remessa
+ {
+ get;
+ set;
+ }
+
+ public bool Selecionado
+ {
+ get
+ {
+ return this._selecionado;
+ }
+ set
+ {
+ if (value == this._selecionado)
+ {
+ return;
+ }
+ this._selecionado = value;
+ this.OnPropertyChanged("Selecionado");
+ }
+ }
+
+ [Log(false)]
+ public bool Sinistro
+ {
+ get;
+ set;
+ }
+
+ [Description("SITUAÇÃO")]
+ [Log(true)]
+ public TipoSeguro Situacao
+ {
+ get;
+ set;
+ }
+
+ [Log(false)]
+ public TipoSeguro? SituacaoAnterior
+ {
+ get;
+ set;
+ }
+
+ [Description("STATUS INTERNO")]
+ [Log(true)]
+ public Gestor.Model.Domain.Seguros.Status Status
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Common.StatusAssinatura StatusAssinatura
+ {
+ get;
+ set;
+ }
+
+ [Log(false)]
+ public bool TemEndosso
+ {
+ get;
+ set;
+ }
+
+ public int Tipo
+ {
+ get;
+ set;
+ }
+
+ [Description("TIPO DO ENDOSSO")]
+ [Log(true)]
+ public Gestor.Model.Common.TipoEndosso? TipoEndosso
+ {
+ get;
+ set;
+ }
+
+ [Description("TIPO RECEBIMENTO")]
+ [Log(true)]
+ public Gestor.Model.Common.TipoRecebimento? TipoRecebimento
+ {
+ get;
+ set;
+ }
+
+ [Log(false)]
+ public Usuario UsuarioCriacao
+ {
+ get;
+ set;
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent
+ {
+ get
+ {
+ Documento documento = this;
+ return new Func<List<KeyValuePair<string, string>>>(documento.Validate);
+ }
+ }
+
+ [Description("VENCIMENTO CARTÃO")]
+ [Log(true)]
+ public string VencimentoCartao
+ {
+ get
+ {
+ string str = this._vencimentoCartao;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._vencimentoCartao = value;
+ }
+ }
+
+ [Log(false)]
+ public List<Vendedor> Vendedores
+ {
+ get;
+ set;
+ }
+
+ [Log(false)]
+ public Vendedor VendedorPrincipal
+ {
+ get;
+ set;
+ }
+
+ [Description("VIGÊNCIA INICIAL")]
+ [Log(true)]
+ public DateTime Vigencia1
+ {
+ get;
+ set;
+ }
+
+ [Description("VIGÊNCIA FINAL")]
+ [Log(true)]
+ public DateTime? Vigencia2
+ {
+ get;
+ set;
+ }
+
+ [Log(false)]
+ public VinculoDocumento Vinculo
+ {
+ get;
+ set;
+ }
+
+ public Documento()
+ {
+ }
+
+ public Documento DeepCopy()
+ {
+ return JsonConvert.DeserializeObject<Documento>(JsonConvert.SerializeObject(this));
+ }
+
+ public List<TupleList> Log(bool restricaoComissao)
+ {
+ decimal comissao;
+ string nome;
+ string str;
+ string nome1;
+ string description;
+ string description1;
+ string str1;
+ string shortDateString;
+ string shortDateString1;
+ string shortDateString2;
+ string nome2;
+ string description2;
+ string str2;
+ string str3;
+ string shortDateString3;
+ List<Tuple<string, string, string>> tuples = new List<Tuple<string, string, string>>();
+ Gestor.Model.Domain.Seguros.Controle controle = this.Controle;
+ if (controle != null)
+ {
+ Seguradora seguradora = controle.Seguradora;
+ if (seguradora != null)
+ {
+ nome = seguradora.Nome;
+ }
+ else
+ {
+ nome = null;
+ }
+ }
+ else
+ {
+ nome = null;
+ }
+ tuples.Add(new Tuple<string, string, string>("SEGURADORA", (string.IsNullOrWhiteSpace(nome) ? "" : this.Controle.Seguradora.Nome.ToUpper()), ""));
+ Gestor.Model.Domain.Seguros.Controle controle1 = this.Controle;
+ if (controle1 != null)
+ {
+ Ramo ramo = controle1.Ramo;
+ if (ramo != null)
+ {
+ str = ramo.Nome;
+ }
+ else
+ {
+ str = null;
+ }
+ }
+ else
+ {
+ str = null;
+ }
+ tuples.Add(new Tuple<string, string, string>("RAMO", (string.IsNullOrWhiteSpace(str) ? "" : this.Controle.Ramo.Nome.ToUpper()), ""));
+ Gestor.Model.Domain.Seguros.Controle controle2 = this.Controle;
+ if (controle2 != null)
+ {
+ Produto produto = controle2.Produto;
+ if (produto != null)
+ {
+ nome1 = produto.Nome;
+ }
+ else
+ {
+ nome1 = null;
+ }
+ }
+ else
+ {
+ nome1 = null;
+ }
+ tuples.Add(new Tuple<string, string, string>("PRODUTO", (string.IsNullOrWhiteSpace(nome1) ? "" : this.Controle.Produto.Nome.ToUpper()), ""));
+ Gestor.Model.Common.NegocioCorretora? negocioCorretora = this.NegocioCorretora;
+ if (!negocioCorretora.HasValue)
+ {
+ description = "";
+ }
+ else
+ {
+ negocioCorretora = this.NegocioCorretora;
+ if (negocioCorretora.HasValue)
+ {
+ description = negocioCorretora.GetValueOrDefault().GetDescription();
+ }
+ else
+ {
+ description = null;
+ }
+ }
+ tuples.Add(new Tuple<string, string, string>("NEGÓCIO CORRETORA", description, ""));
+ tuples.Add(new Tuple<string, string, string>("STATUS DO SEGURO", this.Situacao.GetDescription(), ""));
+ Gestor.Model.Common.TipoRecebimento? tipoRecebimento = this.TipoRecebimento;
+ if (!tipoRecebimento.HasValue)
+ {
+ description1 = "";
+ }
+ else
+ {
+ tipoRecebimento = this.TipoRecebimento;
+ if (tipoRecebimento.HasValue)
+ {
+ description1 = tipoRecebimento.GetValueOrDefault().GetDescription();
+ }
+ else
+ {
+ description1 = null;
+ }
+ }
+ tuples.Add(new Tuple<string, string, string>("TIPO DE RECEBIMENTO", description1, ""));
+ Gestor.Model.Common.TipoEndosso? tipoEndosso = this.TipoEndosso;
+ if (!tipoEndosso.HasValue)
+ {
+ str1 = "";
+ }
+ else
+ {
+ tipoEndosso = this.TipoEndosso;
+ if (tipoEndosso.HasValue)
+ {
+ str1 = tipoEndosso.GetValueOrDefault().GetDescription();
+ }
+ else
+ {
+ str1 = null;
+ }
+ }
+ tuples.Add(new Tuple<string, string, string>("TIPO ENDOSSO", str1, ""));
+ tuples.Add(new Tuple<string, string, string>("PROPOSTA", (string.IsNullOrWhiteSpace(this.Proposta) ? "" : this.Proposta.ToUpper()), ""));
+ tuples.Add(new Tuple<string, string, string>("PROPOSTA ENDOSSO", (string.IsNullOrWhiteSpace(this.PropostaEndosso) ? "" : this.PropostaEndosso.ToUpper()), ""));
+ tuples.Add(new Tuple<string, string, string>("APÓLICE", (string.IsNullOrWhiteSpace(this.Apolice) ? "" : this.Apolice.ToUpper()), ""));
+ tuples.Add(new Tuple<string, string, string>("ENDOSSO", (string.IsNullOrWhiteSpace(this.Endosso) ? "" : this.Endosso.ToUpper()), ""));
+ DateTime vigencia1 = this.Vigencia1;
+ tuples.Add(new Tuple<string, string, string>("VIGÊNCIA INICIAL", vigencia1.ToShortDateString(), ""));
+ DateTime? vigencia2 = this.Vigencia2;
+ if (!vigencia2.HasValue)
+ {
+ shortDateString = "";
+ }
+ else
+ {
+ vigencia2 = this.Vigencia2;
+ if (vigencia2.HasValue)
+ {
+ shortDateString = vigencia2.GetValueOrDefault().ToShortDateString();
+ }
+ else
+ {
+ shortDateString = null;
+ }
+ }
+ tuples.Add(new Tuple<string, string, string>("VIGÊNCIA FINAL", shortDateString, ""));
+ vigencia2 = this.Remessa;
+ if (!vigencia2.HasValue)
+ {
+ shortDateString1 = "";
+ }
+ else
+ {
+ vigencia2 = this.Remessa;
+ if (vigencia2.HasValue)
+ {
+ shortDateString1 = vigencia2.GetValueOrDefault().ToShortDateString();
+ }
+ else
+ {
+ shortDateString1 = null;
+ }
+ }
+ tuples.Add(new Tuple<string, string, string>("TRANSMISSÃO DA PROPOSTA", shortDateString1, ""));
+ vigencia2 = this.Emissao;
+ if (!vigencia2.HasValue)
+ {
+ shortDateString2 = "";
+ }
+ else
+ {
+ vigencia2 = this.Emissao;
+ if (vigencia2.HasValue)
+ {
+ shortDateString2 = vigencia2.GetValueOrDefault().ToShortDateString();
+ }
+ else
+ {
+ shortDateString2 = null;
+ }
+ }
+ tuples.Add(new Tuple<string, string, string>("EMISSÃO DA APÓLICE", shortDateString2, ""));
+ Gestor.Model.Domain.Seguros.Controle controle3 = this.Controle;
+ if (controle3 != null)
+ {
+ Seguradora seguradoraAnterior = controle3.SeguradoraAnterior;
+ if (seguradoraAnterior != null)
+ {
+ nome2 = seguradoraAnterior.Nome;
+ }
+ else
+ {
+ nome2 = null;
+ }
+ }
+ else
+ {
+ nome2 = null;
+ }
+ tuples.Add(new Tuple<string, string, string>("SEGURADORA ANTERIOR", (string.IsNullOrWhiteSpace(nome2) ? "" : this.Controle.SeguradoraAnterior.Nome.ToUpper()), ""));
+ tuples.Add(new Tuple<string, string, string>("APÓLICE ANTERIOR", (string.IsNullOrWhiteSpace(this.ApoliceAnterior) ? "" : this.ApoliceAnterior.ToUpper()), ""));
+ Gestor.Model.Common.FormaPagamento? formaPagamento = this.FormaPagamento;
+ if (!formaPagamento.HasValue)
+ {
+ description2 = "";
+ }
+ else
+ {
+ formaPagamento = this.FormaPagamento;
+ if (formaPagamento.HasValue)
+ {
+ description2 = formaPagamento.GetValueOrDefault().GetDescription();
+ }
+ else
+ {
+ description2 = null;
+ }
+ }
+ tuples.Add(new Tuple<string, string, string>("FORMA DE PAGAMENTO", description2, ""));
+ tuples.Add(new Tuple<string, string, string>("PROPOSTA ASSINADA", (this.PropostaAssinada ? "SIM" : "NÃO"), ""));
+ tuples.Add(new Tuple<string, string, string>("APÓLICE CONFERIDA", (this.ApoliceConferida ? "SIM" : "NÃO"), ""));
+ tuples.Add(new Tuple<string, string, string>("ADICIONAL DE COMISSÃO", (this.AdicionalComiss ? "SIM" : "NÃO"), ""));
+ List<Tuple<string, string, string>> tuples1 = tuples;
+ if (!restricaoComissao)
+ {
+ comissao = this.Comissao / new decimal(100);
+ tuples1.Add(new Tuple<string, string, string>("COMISSÃO", comissao.ToString("P", new CultureInfo("pt-BR", false)), ""));
+ }
+ List<Tuple<string, string, string>> tuples2 = tuples1;
+ List<Tuple<string, string, string>> tuples3 = new List<Tuple<string, string, string>>();
+ comissao = this.Comissao / new decimal(100);
+ tuples3.Add(new Tuple<string, string, string>("COMISSÃO", comissao.ToString("P", new CultureInfo("pt-BR", false)), ""));
+ comissao = this.PremioLiquido;
+ tuples3.Add(new Tuple<string, string, string>("PRÊMIO LÍQUIDO", comissao.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ comissao = this.PremioAdicional;
+ tuples3.Add(new Tuple<string, string, string>("PRÊMIO ADICIONAL", comissao.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ comissao = this.Iof;
+ tuples3.Add(new Tuple<string, string, string>("I.O.F.", comissao.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ comissao = this.Diferenca;
+ tuples3.Add(new Tuple<string, string, string>("DIFERENÇA", comissao.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ comissao = this.PremioTotal;
+ tuples3.Add(new Tuple<string, string, string>("PRÊMIO TOTAL", comissao.ToString("C", new CultureInfo("pt-BR", false)), ""));
+ int num = decimal.ToInt32(this.NumeroParcelas);
+ tuples3.Add(new Tuple<string, string, string>("NÚMERO DE PARCELAS", num.ToString(), ""));
+ tuples3.Add(new Tuple<string, string, string>("BANCO", (this.Banco == null ? "" : this.Banco.Nome.ToUpper()), ""));
+ tuples3.Add(new Tuple<string, string, string>("AGÊNCIA", (string.IsNullOrWhiteSpace(this.Agencia) ? "" : this.Agencia.ToUpper()), ""));
+ tuples3.Add(new Tuple<string, string, string>("CONTA", (string.IsNullOrWhiteSpace(this.Conta) ? "" : this.Conta.ToUpper()), ""));
+ tuples3.Add(new Tuple<string, string, string>("CARTÃO DE CRÉDITO", (string.IsNullOrWhiteSpace(this.NumeroCartao) ? "" : this.NumeroCartao.ToUpper()), ""));
+ BandeiraCartao? bandeira = this.Bandeira;
+ if (!bandeira.HasValue)
+ {
+ str2 = "";
+ }
+ else
+ {
+ bandeira = this.Bandeira;
+ if (bandeira.HasValue)
+ {
+ str2 = bandeira.GetValueOrDefault().GetDescription();
+ }
+ else
+ {
+ str2 = null;
+ }
+ }
+ tuples3.Add(new Tuple<string, string, string>("BANDEIRA", str2, ""));
+ tuples3.Add(new Tuple<string, string, string>("PROPONENTE", (string.IsNullOrWhiteSpace(this.NomeProponente) ? "" : this.NomeProponente.ToUpper()), ""));
+ string vencimentoCartao = this.VencimentoCartao;
+ if (vencimentoCartao != null)
+ {
+ str3 = vencimentoCartao.Replace("/", "");
+ }
+ else
+ {
+ str3 = null;
+ }
+ tuples3.Add(new Tuple<string, string, string>("VENCIMENTO DO CARTÃO", (string.IsNullOrWhiteSpace(str3) ? "" : this.VencimentoCartao.ToUpper()), ""));
+ tuples3.Add(new Tuple<string, string, string>("PASTA", (string.IsNullOrWhiteSpace(this.Pasta) ? "" : this.Pasta.ToUpper()), ""));
+ tuples3.Add(new Tuple<string, string, string>("ESTIPULANTE 1", (this.Estipulante1 == null ? "" : this.Estipulante1.Nome.ToUpper()), ""));
+ tuples3.Add(new Tuple<string, string, string>("ESTIPULANTE 2", (this.Estipulante2 == null ? "" : this.Estipulante2.Nome.ToUpper()), ""));
+ tuples3.Add(new Tuple<string, string, string>("ESTIPULANTE 3", (this.Estipulante3 == null ? "" : this.Estipulante3.Nome.ToUpper()), ""));
+ tuples3.Add(new Tuple<string, string, string>("ESTIPULANTE 4", (this.Estipulante4 == null ? "" : this.Estipulante4.Nome.ToUpper()), ""));
+ tuples3.Add(new Tuple<string, string, string>("ESTIPULANTE 5", (this.Estipulante5 == null ? "" : this.Estipulante5.Nome.ToUpper()), ""));
+ tuples3.Add(new Tuple<string, string, string>("STATUS", (this.Status == null ? "" : this.Status.Nome.ToUpper()), ""));
+ vigencia2 = this.DataControle;
+ if (!vigencia2.HasValue)
+ {
+ shortDateString3 = "";
+ }
+ else
+ {
+ vigencia2 = this.DataControle;
+ if (vigencia2.HasValue)
+ {
+ shortDateString3 = vigencia2.GetValueOrDefault().ToShortDateString();
+ }
+ else
+ {
+ shortDateString3 = null;
+ }
+ }
+ tuples3.Add(new Tuple<string, string, string>("DATA DE CONTROLE", shortDateString3, ""));
+ tuples3.Add(new Tuple<string, string, string>("ANOTAÇÕES", (string.IsNullOrWhiteSpace(this.Observacao) ? "" : this.Observacao.ToUpper()), ""));
+ tuples2.AddRange(tuples3);
+ return new List<TupleList>()
+ {
+ new TupleList()
+ {
+ Tuples = new ObservableCollection<Tuple<string, string, string>>(tuples1)
+ }
+ };
+ }
+
+ private List<KeyValuePair<string, string>> ObrigarValores(bool valores = true)
+ {
+ DateTime dateTime;
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ if (valores)
+ {
+ if (this.Comissao <= decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("Comissao|COMISSÃO", Messages.Obrigatorio, true);
+ }
+ if (this.PremioLiquido == decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Obrigatorio, true);
+ }
+ if (this.PremioTotal == decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("PremioTotal|PRÊMIO TOTAL", Messages.Obrigatorio, true);
+ }
+ if (this.NumeroParcelas <= decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Obrigatorio, true);
+ }
+ if (!this._vencimentoParcela)
+ {
+ if (this.NumeroParcelas > decimal.Zero && this.NumeroParcelas < new decimal(998))
+ {
+ DateTime vigencia1 = this.Vigencia1;
+ if (this.NumeroParcelas == decimal.One || vigencia1 == DateTime.MinValue)
+ {
+ dateTime = vigencia1;
+ }
+ else
+ {
+ decimal numeroParcelas = this.NumeroParcelas;
+ dateTime = vigencia1.AddMonths(int.Parse(numeroParcelas.ToString(new CultureInfo("pt-BR"))) - 1);
+ }
+ DateTime dateTime1 = dateTime;
+ DateTime? vigencia2 = this.Vigencia2;
+ if ((vigencia2.HasValue ? dateTime1 > vigencia2.GetValueOrDefault() : false) && (this.Controle.Ramo == null || this.Controle.Ramo.Id != (long)23))
+ {
+ keyValuePairs.AddValue<string, string>("NumeroParcelas|NÚMERO DE PARCELAS", Messages.VencimentoParcela, true);
+ }
+ }
+ else if (this.NumeroParcelas > new decimal(1000))
+ {
+ keyValuePairs.AddValue<string, string>("NumeroParcelas|NÚMERO DE PARCELAS", "NUMERO DE PARCELAS ESTA NO FORMATO INCORRETO", true);
+ }
+ }
+ }
+ if (!valores)
+ {
+ if (this.PremioLiquido != decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Invalido, true);
+ }
+ if (this.PremioAdicional != decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("PremioAdicional|PRÊMIO ADICIONAL", Messages.Invalido, true);
+ }
+ if (this.Iof != decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("Iof", Messages.Invalido, true);
+ }
+ if (this.Diferenca != decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("Diferenca|DIFERÊNÇA", Messages.Invalido, true);
+ }
+ if (this.PremioTotal != decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("PremioTotal|PRÊMIO TOTAL", Messages.Invalido, true);
+ }
+ if (this.NumeroParcelas != decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Invalido, true);
+ }
+ }
+ return keyValuePairs;
+ }
+
+ 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(bool isEndosso, bool vencimentoParcela)
+ {
+ this._isEndosso = isEndosso;
+ this._vencimentoParcela = vencimentoParcela;
+ return this.Validate();
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ Gestor.Model.Common.TipoEndosso? tipoEndosso;
+ Gestor.Model.Common.TipoEndosso valueOrDefault;
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ keyValuePairs.AddRange(this.Controle.Validate());
+ if (!this.NegocioCorretora.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("NegocioCorretora|NEGÓCIO CORRETORA", Messages.Obrigatorio, true);
+ }
+ if (string.IsNullOrWhiteSpace(this.Proposta) && !this._isEndosso)
+ {
+ keyValuePairs.AddValue<string, string>("Proposta", Messages.Obrigatorio, true);
+ }
+ else if (!string.IsNullOrEmpty(this.Proposta) && this.Proposta.Length > 50)
+ {
+ keyValuePairs.AddValue<string, string>("Proposta", string.Format(Messages.MaiorQueLimite, 50), true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.PropostaEndosso) && this.PropostaEndosso.Length > 50)
+ {
+ keyValuePairs.AddValue<string, string>("PropostaEndosso|PROPOSTA DE ENDOSSO", string.Format(Messages.MaiorQueLimite, 50), true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.ApoliceAnterior) && this.ApoliceAnterior.Length > 50)
+ {
+ keyValuePairs.AddValue<string, string>("ApoliceAnterior|APÓLICE ANTERIOR", string.Format(Messages.MaiorQueLimite, 50), true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Endosso) && this.Endosso.Length > 30)
+ {
+ keyValuePairs.AddValue<string, string>("Endosso", string.Format(Messages.MaiorQueLimite, 30), true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Pasta) && this.Pasta.Length > 15)
+ {
+ keyValuePairs.AddValue<string, string>("Pasta", string.Format(Messages.MaiorQueLimite, 15), true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Agencia) && this.Agencia.Length > 10)
+ {
+ keyValuePairs.AddValue<string, string>("Agencia|AGÊNCIA", string.Format(Messages.MaiorQueLimite, 10), true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Conta) && this.Conta.Length > 15)
+ {
+ keyValuePairs.AddValue<string, string>("Conta", string.Format(Messages.MaiorQueLimite, 15), true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.NumeroCartao) && this.NumeroCartao.Length > 20)
+ {
+ keyValuePairs.AddValue<string, string>("NumeroCartao|NÚMERO DO CARTÃO", string.Format(Messages.MaiorQueLimite, 20), true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.VencimentoCartao) && this.VencimentoCartao.Length > 5)
+ {
+ keyValuePairs.AddValue<string, string>("VencimentoCartao|VENCIMENTO DO CARTÃO", string.Format(Messages.MaiorQueLimite, 5), true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.NomeProponente) && this.NomeProponente.Length > 100)
+ {
+ keyValuePairs.AddValue<string, string>("NomeProponente|PROPONENTE", string.Format(Messages.MaiorQueLimite, 100), true);
+ }
+ DateTime? emissao = this.Emissao;
+ if (emissao.HasValue)
+ {
+ emissao = this.Emissao;
+ if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0)
+ {
+ emissao = this.Emissao;
+ if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0)
+ {
+ goto Label0;
+ }
+ }
+ keyValuePairs.AddValue<string, string>(string.Concat("Emissao|", (this._isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE")), string.Format(Messages.DataInvalida, Array.Empty<object>()), true);
+ }
+ Label0:
+ emissao = this.Remessa;
+ if (emissao.HasValue)
+ {
+ emissao = this.Remessa;
+ if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0)
+ {
+ emissao = this.Remessa;
+ if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0)
+ {
+ goto Label1;
+ }
+ }
+ keyValuePairs.AddValue<string, string>(string.Concat("Remessa|", (this._isEndosso ? "TRANSMISSÃO DA PROPOSTA DE ENDOSSO" : "TRANSMISSÃO DA PROPOSTA")), string.Format(Messages.DataInvalida, Array.Empty<object>()), true);
+ }
+ Label1:
+ DateTime vigencia1 = this.Vigencia1;
+ if (DateTime.Compare(this.Vigencia1, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Vigencia1, new DateTime(9999, 12, 31)) > 0)
+ {
+ keyValuePairs.AddValue<string, string>("Vigencia1|VIGÊNCIA INICIAL", string.Format(Messages.DataInvalida, Array.Empty<object>()), true);
+ }
+ emissao = this.Vigencia2;
+ if (emissao.HasValue)
+ {
+ emissao = this.Vigencia2;
+ if (DateTime.Compare(emissao.Value, new DateTime(1753, 1, 1)) >= 0)
+ {
+ emissao = this.Vigencia2;
+ if (DateTime.Compare(emissao.Value, new DateTime(9999, 12, 31)) <= 0)
+ {
+ goto Label2;
+ }
+ }
+ keyValuePairs.AddValue<string, string>("Vigencia2|VIGÊNCIA FINAL", string.Format(Messages.DataInvalida, Array.Empty<object>()), true);
+ }
+ Label2:
+ DateTime dateTime = this.Vigencia1;
+ emissao = this.Vigencia2;
+ if (emissao.HasValue)
+ {
+ DateTime vigencia11 = this.Vigencia1;
+ emissao = this.Vigencia2;
+ if ((emissao.HasValue ? vigencia11 > emissao.GetValueOrDefault() : false))
+ {
+ keyValuePairs.AddValue<string, string>("Vigencia2|VIGÊNCIA FINAL", "A DATA DE VIGÊNCIA FINAL NÃO PODE SER ANTERIOR A DATA DE VIGÊNCIA INCIAL", true);
+ }
+ }
+ if (this.Tipo == 0)
+ {
+ if (string.IsNullOrWhiteSpace(this.Apolice))
+ {
+ emissao = this.Emissao;
+ if (emissao.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Apolice|APÓLICE", Messages.Obrigatorio, true);
+ }
+ }
+ if (!string.IsNullOrWhiteSpace(this.Apolice))
+ {
+ emissao = this.Emissao;
+ if (!emissao.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>(string.Concat("Emissao|", (this._isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE")), Messages.Obrigatorio, true);
+ }
+ }
+ if (!string.IsNullOrWhiteSpace(this.Apolice) && this.Apolice.Length > 50)
+ {
+ keyValuePairs.AddValue<string, string>("Apolice|APÓLICE", string.Format(Messages.MaiorQueLimite, 50), true);
+ }
+ }
+ if (this.Tipo > 0)
+ {
+ if (string.IsNullOrWhiteSpace(this.PropostaEndosso))
+ {
+ keyValuePairs.AddValue<string, string>("PropostaEndosso|PROPOSTA DE ENDOSSO", Messages.Obrigatorio, true);
+ }
+ else if (this.PropostaEndosso.Length > 30)
+ {
+ keyValuePairs.AddValue<string, string>("PropostaEndosso|PROPOSTA DE ENDOSSO", string.Format(Messages.MaiorQueLimite, 30), true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Endosso))
+ {
+ if (this.Endosso.Length > 30)
+ {
+ keyValuePairs.AddValue<string, string>("Endosso", string.Format(Messages.MaiorQueLimite, 30), true);
+ }
+ emissao = this.Emissao;
+ if (!emissao.HasValue && this.Tipo > 0)
+ {
+ keyValuePairs.AddValue<string, string>(string.Concat("Emissao|", (this._isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE")), Messages.Obrigatorio, true);
+ }
+ }
+ else
+ {
+ emissao = this.Emissao;
+ if (emissao.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Endosso", Messages.Obrigatorio, true);
+ }
+ }
+ }
+ if (this.Tipo > 0)
+ {
+ tipoEndosso = this.TipoEndosso;
+ if (!tipoEndosso.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("TipoEndosso|TIPO DE ENDOSSO", Messages.Obrigatorio, true);
+ }
+ }
+ if (this.TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Parcela)
+ {
+ emissao = this.Vigencia2;
+ if (!emissao.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Vigencia2|VIGÊNCIA FINAL", Messages.Obrigatorio, true);
+ }
+ }
+ if (this.TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Parcela && this.Tipo == 0)
+ {
+ keyValuePairs.AddRange(this.ObrigarValores(true));
+ }
+ if (this.TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Fatura && this.Tipo == 0)
+ {
+ keyValuePairs.AddRange(this.ObrigarValores(false));
+ }
+ tipoEndosso = this.TipoEndosso;
+ if (tipoEndosso.GetValueOrDefault() == Gestor.Model.Common.TipoEndosso.Cancelamento && (this.PremioLiquido != decimal.Zero || this.Comissao != decimal.Zero) && this.NumeroParcelas == decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Obrigatorio, true);
+ }
+ tipoEndosso = this.TipoEndosso;
+ if (tipoEndosso.GetValueOrDefault() == Gestor.Model.Common.TipoEndosso.Cancelamento && (this.PremioLiquido != new decimal(0, 0, 0, false, 1) || this.NumeroParcelas != decimal.Zero))
+ {
+ if (this.Comissao == decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("Comissao|COMISSÃO", Messages.Obrigatorio, true);
+ }
+ if (this.NumeroParcelas == decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Obrigatorio, true);
+ }
+ if (this.PremioLiquido == decimal.Zero)
+ {
+ keyValuePairs.AddValue<string, string>("PremioLiquido|PRÊMIO LÍQUID", Messages.Obrigatorio, true);
+ }
+ }
+ long num = 10000000000L;
+ if (this.PremioTotal > num)
+ {
+ keyValuePairs.AddValue<string, string>("PremioTotal|PRÊMIO TOTAL", Messages.Invalido, true);
+ }
+ if (this.PremioLiquido > num)
+ {
+ keyValuePairs.AddValue<string, string>("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Invalido, true);
+ }
+ if (this.NumeroParcelas > new decimal(1000))
+ {
+ keyValuePairs.AddValue<string, string>("NumeroParcelas|NÚMERO DE PARCELAS", "NUMERO DE PARCELAS ESTA NO FORMATO INCORRETO", true);
+ }
+ if (this.Tipo > 0)
+ {
+ tipoEndosso = this.TipoEndosso;
+ if (tipoEndosso.HasValue)
+ {
+ valueOrDefault = tipoEndosso.GetValueOrDefault();
+ if (valueOrDefault != Gestor.Model.Common.TipoEndosso.ComMovimento)
+ {
+ goto Label4;
+ }
+ keyValuePairs.AddRange(this.ObrigarValores(true));
+ return keyValuePairs;
+ }
+ Label5:
+ if (this.PremioTotal == decimal.Zero && this.Comissao == decimal.Zero)
+ {
+ return keyValuePairs;
+ }
+ keyValuePairs.AddRange(this.ObrigarValores(true));
+ }
+ return keyValuePairs;
+ Label4:
+ if ((int)valueOrDefault - (int)Gestor.Model.Common.TipoEndosso.SemMovimento <= (int)Gestor.Model.Common.TipoEndosso.SemMovimento)
+ {
+ return keyValuePairs;
+ }
+ else
+ {
+ goto Label5;
+ }
+ }
+
+ public List<KeyValuePair<string, string>> ValidateEndossar()
+ {
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ if (string.IsNullOrWhiteSpace(this.Proposta))
+ {
+ keyValuePairs.AddValue<string, string>("Proposta", Messages.Obrigatorio, true);
+ }
+ if (this.Emissao.HasValue && (DateTime.Compare(this.Emissao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Emissao.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ keyValuePairs.AddValue<string, string>("Emissao|EMISSÃO DA APÓLICE", string.Format(Messages.DataInvalida, Array.Empty<object>()), true);
+ }
+ if (this.Remessa.HasValue && (DateTime.Compare(this.Remessa.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Remessa.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ keyValuePairs.AddValue<string, string>("Remessa|TRANSMISSÃO DA PROPOSTA", string.Format(Messages.DataInvalida, Array.Empty<object>()), true);
+ }
+ if (string.IsNullOrWhiteSpace(this.Apolice) && this.Emissao.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Apolice|APÓLICE", Messages.Obrigatorio, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Apolice) && !this.Emissao.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>(string.Concat("Emissao|", (this._isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE")), Messages.Obrigatorio, true);
+ }
+ if (string.IsNullOrWhiteSpace(this.Apolice) && !this.Emissao.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Apolice|EMISSÃO DA APÓLICE", "NÃO É POSSÍVEL ENDOSSAR UM DOCUMENTO SEM EMISSÃO DE APÓLICE", true);
+ }
+ return keyValuePairs;
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ }
+}
\ No newline at end of file |