From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- Gestor.Model/Model.Domain.Seguros/Documento.cs | 1426 ------------------------ 1 file changed, 1426 deletions(-) delete mode 100644 Gestor.Model/Model.Domain.Seguros/Documento.cs (limited to 'Gestor.Model/Model.Domain.Seguros/Documento.cs') diff --git a/Gestor.Model/Model.Domain.Seguros/Documento.cs b/Gestor.Model/Model.Domain.Seguros/Documento.cs deleted file mode 100644 index 00ae7de..0000000 --- a/Gestor.Model/Model.Domain.Seguros/Documento.cs +++ /dev/null @@ -1,1426 +0,0 @@ -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 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 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 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 Pagamentos - { - get; - set; - } - - [Log(false)] - public ObservableCollection 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>> ValidationEvent - { - get - { - Documento documento = this; - return new Func>>(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 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(JsonConvert.SerializeObject(this)); - } - - public List 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> tuples = new List>(); - 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("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("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("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("NEGÓCIO CORRETORA", description, "")); - tuples.Add(new Tuple("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("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("TIPO ENDOSSO", str1, "")); - tuples.Add(new Tuple("PROPOSTA", (string.IsNullOrWhiteSpace(this.Proposta) ? "" : this.Proposta.ToUpper()), "")); - tuples.Add(new Tuple("PROPOSTA ENDOSSO", (string.IsNullOrWhiteSpace(this.PropostaEndosso) ? "" : this.PropostaEndosso.ToUpper()), "")); - tuples.Add(new Tuple("APÓLICE", (string.IsNullOrWhiteSpace(this.Apolice) ? "" : this.Apolice.ToUpper()), "")); - tuples.Add(new Tuple("ENDOSSO", (string.IsNullOrWhiteSpace(this.Endosso) ? "" : this.Endosso.ToUpper()), "")); - DateTime vigencia1 = this.Vigencia1; - tuples.Add(new Tuple("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("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("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("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("SEGURADORA ANTERIOR", (string.IsNullOrWhiteSpace(nome2) ? "" : this.Controle.SeguradoraAnterior.Nome.ToUpper()), "")); - tuples.Add(new Tuple("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("FORMA DE PAGAMENTO", description2, "")); - tuples.Add(new Tuple("PROPOSTA ASSINADA", (this.PropostaAssinada ? "SIM" : "NÃO"), "")); - tuples.Add(new Tuple("APÓLICE CONFERIDA", (this.ApoliceConferida ? "SIM" : "NÃO"), "")); - tuples.Add(new Tuple("ADICIONAL DE COMISSÃO", (this.AdicionalComiss ? "SIM" : "NÃO"), "")); - List> tuples1 = tuples; - if (!restricaoComissao) - { - comissao = this.Comissao / new decimal(100); - tuples1.Add(new Tuple("COMISSÃO", comissao.ToString("P", new CultureInfo("pt-BR", false)), "")); - } - List> tuples2 = tuples1; - List> tuples3 = new List>(); - comissao = this.Comissao / new decimal(100); - tuples3.Add(new Tuple("COMISSÃO", comissao.ToString("P", new CultureInfo("pt-BR", false)), "")); - comissao = this.PremioLiquido; - tuples3.Add(new Tuple("PRÊMIO LÍQUIDO", comissao.ToString("C", new CultureInfo("pt-BR", false)), "")); - comissao = this.PremioAdicional; - tuples3.Add(new Tuple("PRÊMIO ADICIONAL", comissao.ToString("C", new CultureInfo("pt-BR", false)), "")); - comissao = this.Iof; - tuples3.Add(new Tuple("I.O.F.", comissao.ToString("C", new CultureInfo("pt-BR", false)), "")); - comissao = this.Diferenca; - tuples3.Add(new Tuple("DIFERENÇA", comissao.ToString("C", new CultureInfo("pt-BR", false)), "")); - comissao = this.PremioTotal; - tuples3.Add(new Tuple("PRÊMIO TOTAL", comissao.ToString("C", new CultureInfo("pt-BR", false)), "")); - int num = decimal.ToInt32(this.NumeroParcelas); - tuples3.Add(new Tuple("NÚMERO DE PARCELAS", num.ToString(), "")); - tuples3.Add(new Tuple("BANCO", (this.Banco == null ? "" : this.Banco.Nome.ToUpper()), "")); - tuples3.Add(new Tuple("AGÊNCIA", (string.IsNullOrWhiteSpace(this.Agencia) ? "" : this.Agencia.ToUpper()), "")); - tuples3.Add(new Tuple("CONTA", (string.IsNullOrWhiteSpace(this.Conta) ? "" : this.Conta.ToUpper()), "")); - tuples3.Add(new Tuple("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("BANDEIRA", str2, "")); - tuples3.Add(new Tuple("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("VENCIMENTO DO CARTÃO", (string.IsNullOrWhiteSpace(str3) ? "" : this.VencimentoCartao.ToUpper()), "")); - tuples3.Add(new Tuple("PASTA", (string.IsNullOrWhiteSpace(this.Pasta) ? "" : this.Pasta.ToUpper()), "")); - tuples3.Add(new Tuple("ESTIPULANTE 1", (this.Estipulante1 == null ? "" : this.Estipulante1.Nome.ToUpper()), "")); - tuples3.Add(new Tuple("ESTIPULANTE 2", (this.Estipulante2 == null ? "" : this.Estipulante2.Nome.ToUpper()), "")); - tuples3.Add(new Tuple("ESTIPULANTE 3", (this.Estipulante3 == null ? "" : this.Estipulante3.Nome.ToUpper()), "")); - tuples3.Add(new Tuple("ESTIPULANTE 4", (this.Estipulante4 == null ? "" : this.Estipulante4.Nome.ToUpper()), "")); - tuples3.Add(new Tuple("ESTIPULANTE 5", (this.Estipulante5 == null ? "" : this.Estipulante5.Nome.ToUpper()), "")); - tuples3.Add(new Tuple("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("DATA DE CONTROLE", shortDateString3, "")); - tuples3.Add(new Tuple("ANOTAÇÕES", (string.IsNullOrWhiteSpace(this.Observacao) ? "" : this.Observacao.ToUpper()), "")); - tuples2.AddRange(tuples3); - return new List() - { - new TupleList() - { - Tuples = new ObservableCollection>(tuples1) - } - }; - } - - private List> ObrigarValores(bool valores = true) - { - DateTime dateTime; - List> keyValuePairs = ValidationHelper.AddValue(); - if (valores) - { - if (this.Comissao <= decimal.Zero) - { - keyValuePairs.AddValue("Comissao|COMISSÃO", Messages.Obrigatorio, true); - } - if (this.PremioLiquido == decimal.Zero) - { - keyValuePairs.AddValue("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Obrigatorio, true); - } - if (this.PremioTotal == decimal.Zero) - { - keyValuePairs.AddValue("PremioTotal|PRÊMIO TOTAL", Messages.Obrigatorio, true); - } - if (this.NumeroParcelas <= decimal.Zero) - { - keyValuePairs.AddValue("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("NumeroParcelas|NÚMERO DE PARCELAS", Messages.VencimentoParcela, true); - } - } - else if (this.NumeroParcelas > new decimal(1000)) - { - keyValuePairs.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", "NUMERO DE PARCELAS ESTA NO FORMATO INCORRETO", true); - } - } - } - if (!valores) - { - if (this.PremioLiquido != decimal.Zero) - { - keyValuePairs.AddValue("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Invalido, true); - } - if (this.PremioAdicional != decimal.Zero) - { - keyValuePairs.AddValue("PremioAdicional|PRÊMIO ADICIONAL", Messages.Invalido, true); - } - if (this.Iof != decimal.Zero) - { - keyValuePairs.AddValue("Iof", Messages.Invalido, true); - } - if (this.Diferenca != decimal.Zero) - { - keyValuePairs.AddValue("Diferenca|DIFERÊNÇA", Messages.Invalido, true); - } - if (this.PremioTotal != decimal.Zero) - { - keyValuePairs.AddValue("PremioTotal|PRÊMIO TOTAL", Messages.Invalido, true); - } - if (this.NumeroParcelas != decimal.Zero) - { - keyValuePairs.AddValue("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> Validate(bool isEndosso, bool vencimentoParcela) - { - this._isEndosso = isEndosso; - this._vencimentoParcela = vencimentoParcela; - return this.Validate(); - } - - public List> Validate() - { - Gestor.Model.Common.TipoEndosso? tipoEndosso; - Gestor.Model.Common.TipoEndosso valueOrDefault; - List> keyValuePairs = ValidationHelper.AddValue(); - keyValuePairs.AddRange(this.Controle.Validate()); - if (!this.NegocioCorretora.HasValue) - { - keyValuePairs.AddValue("NegocioCorretora|NEGÓCIO CORRETORA", Messages.Obrigatorio, true); - } - if (string.IsNullOrWhiteSpace(this.Proposta) && !this._isEndosso) - { - keyValuePairs.AddValue("Proposta", Messages.Obrigatorio, true); - } - else if (!string.IsNullOrEmpty(this.Proposta) && this.Proposta.Length > 50) - { - keyValuePairs.AddValue("Proposta", string.Format(Messages.MaiorQueLimite, 50), true); - } - if (!string.IsNullOrWhiteSpace(this.PropostaEndosso) && this.PropostaEndosso.Length > 50) - { - keyValuePairs.AddValue("PropostaEndosso|PROPOSTA DE ENDOSSO", string.Format(Messages.MaiorQueLimite, 50), true); - } - if (!string.IsNullOrWhiteSpace(this.ApoliceAnterior) && this.ApoliceAnterior.Length > 50) - { - keyValuePairs.AddValue("ApoliceAnterior|APÓLICE ANTERIOR", string.Format(Messages.MaiorQueLimite, 50), true); - } - if (!string.IsNullOrWhiteSpace(this.Endosso) && this.Endosso.Length > 30) - { - keyValuePairs.AddValue("Endosso", string.Format(Messages.MaiorQueLimite, 30), true); - } - if (!string.IsNullOrWhiteSpace(this.Pasta) && this.Pasta.Length > 15) - { - keyValuePairs.AddValue("Pasta", string.Format(Messages.MaiorQueLimite, 15), true); - } - if (!string.IsNullOrWhiteSpace(this.Agencia) && this.Agencia.Length > 10) - { - keyValuePairs.AddValue("Agencia|AGÊNCIA", string.Format(Messages.MaiorQueLimite, 10), true); - } - if (!string.IsNullOrWhiteSpace(this.Conta) && this.Conta.Length > 15) - { - keyValuePairs.AddValue("Conta", string.Format(Messages.MaiorQueLimite, 15), true); - } - if (!string.IsNullOrWhiteSpace(this.NumeroCartao) && this.NumeroCartao.Length > 20) - { - keyValuePairs.AddValue("NumeroCartao|NÚMERO DO CARTÃO", string.Format(Messages.MaiorQueLimite, 20), true); - } - if (!string.IsNullOrWhiteSpace(this.VencimentoCartao) && this.VencimentoCartao.Length > 5) - { - keyValuePairs.AddValue("VencimentoCartao|VENCIMENTO DO CARTÃO", string.Format(Messages.MaiorQueLimite, 5), true); - } - if (!string.IsNullOrWhiteSpace(this.NomeProponente) && this.NomeProponente.Length > 100) - { - keyValuePairs.AddValue("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.Concat("Emissao|", (this._isEndosso ? "EMISSÃO DO ENDOSSO" : "EMISSÃO DA APÓLICE")), string.Format(Messages.DataInvalida, Array.Empty()), 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.Concat("Remessa|", (this._isEndosso ? "TRANSMISSÃO DA PROPOSTA DE ENDOSSO" : "TRANSMISSÃO DA PROPOSTA")), string.Format(Messages.DataInvalida, Array.Empty()), 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("Vigencia1|VIGÊNCIA INICIAL", string.Format(Messages.DataInvalida, Array.Empty()), 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("Vigencia2|VIGÊNCIA FINAL", string.Format(Messages.DataInvalida, Array.Empty()), 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("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("Apolice|APÓLICE", Messages.Obrigatorio, true); - } - } - if (!string.IsNullOrWhiteSpace(this.Apolice)) - { - emissao = this.Emissao; - if (!emissao.HasValue) - { - keyValuePairs.AddValue(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("Apolice|APÓLICE", string.Format(Messages.MaiorQueLimite, 50), true); - } - } - if (this.Tipo > 0) - { - if (string.IsNullOrWhiteSpace(this.PropostaEndosso)) - { - keyValuePairs.AddValue("PropostaEndosso|PROPOSTA DE ENDOSSO", Messages.Obrigatorio, true); - } - else if (this.PropostaEndosso.Length > 30) - { - keyValuePairs.AddValue("PropostaEndosso|PROPOSTA DE ENDOSSO", string.Format(Messages.MaiorQueLimite, 30), true); - } - if (!string.IsNullOrWhiteSpace(this.Endosso)) - { - if (this.Endosso.Length > 30) - { - keyValuePairs.AddValue("Endosso", string.Format(Messages.MaiorQueLimite, 30), true); - } - emissao = this.Emissao; - if (!emissao.HasValue && this.Tipo > 0) - { - keyValuePairs.AddValue(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("Endosso", Messages.Obrigatorio, true); - } - } - } - if (this.Tipo > 0) - { - tipoEndosso = this.TipoEndosso; - if (!tipoEndosso.HasValue) - { - keyValuePairs.AddValue("TipoEndosso|TIPO DE ENDOSSO", Messages.Obrigatorio, true); - } - } - if (this.TipoRecebimento.GetValueOrDefault() == Gestor.Model.Common.TipoRecebimento.Parcela) - { - emissao = this.Vigencia2; - if (!emissao.HasValue) - { - keyValuePairs.AddValue("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("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("Comissao|COMISSÃO", Messages.Obrigatorio, true); - } - if (this.NumeroParcelas == decimal.Zero) - { - keyValuePairs.AddValue("NumeroParcelas|NÚMERO DE PARCELAS", Messages.Obrigatorio, true); - } - if (this.PremioLiquido == decimal.Zero) - { - keyValuePairs.AddValue("PremioLiquido|PRÊMIO LÍQUID", Messages.Obrigatorio, true); - } - } - long num = 10000000000L; - if (this.PremioTotal > num) - { - keyValuePairs.AddValue("PremioTotal|PRÊMIO TOTAL", Messages.Invalido, true); - } - if (this.PremioLiquido > num) - { - keyValuePairs.AddValue("PremioLiquido|PRÊMIO LÍQUIDO", Messages.Invalido, true); - } - if (this.NumeroParcelas > new decimal(1000)) - { - keyValuePairs.AddValue("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> ValidateEndossar() - { - List> keyValuePairs = ValidationHelper.AddValue(); - if (string.IsNullOrWhiteSpace(this.Proposta)) - { - keyValuePairs.AddValue("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("Emissao|EMISSÃO DA APÓLICE", string.Format(Messages.DataInvalida, Array.Empty()), 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("Remessa|TRANSMISSÃO DA PROPOSTA", string.Format(Messages.DataInvalida, Array.Empty()), true); - } - if (string.IsNullOrWhiteSpace(this.Apolice) && this.Emissao.HasValue) - { - keyValuePairs.AddValue("Apolice|APÓLICE", Messages.Obrigatorio, true); - } - if (!string.IsNullOrWhiteSpace(this.Apolice) && !this.Emissao.HasValue) - { - keyValuePairs.AddValue(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("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 -- cgit v1.2.3