using Gestor.Model.Attributes; using Gestor.Model.Common; using Gestor.Model.Domain.Common; using Gestor.Model.Domain.Ferramentas; 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; namespace Gestor.Model.Domain.Seguros { public class Cliente : DomainBase, IDomain { private string _nome; private string _documento; private string _identidade; private string _emissor; private string _estadoEmissor; private string _habilitacao; private string _categoriaHabilitacao; private string _pasta; private string _cei; private string _rne; private string _agencia; private string _tipoConta; private string _conta; private string _caepf; private bool? _malaDireta = new bool?(true); private string _nomeSocialRg; [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; } } public Gestor.Model.Domain.Common.Atividade Atividade { get; set; } public Gestor.Model.Domain.Common.Banco Banco { get; set; } [Log(true)] public string Caepf { get { string str = this._caepf; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._caepf = value; } } [Description("CATEGORIA HABILITAÇÃO")] [Log(true)] public string CategoriaHabilitacao { get { string str = this._categoriaHabilitacao; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._categoriaHabilitacao = value; } } [Log(true)] public string Cei { get { string str = this._cei; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._cei = value; } } [Description("CLIENTE DESDE")] [Log(true)] public DateTime? ClienteDesde { 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 ObservableCollection Contatos { get; set; } [Log(true)] public string Documento { get { string str = this._documento; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._documento = value; } } [Description("DOCUMENTO PRINCIPAL")] [Log(true)] public TipoDocumento? DocumentoPrincipal { get; set; } public ObservableCollection Emails { get; set; } [Log(true)] public string Emissor { get { string str = this._emissor; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._emissor = value; } } public ObservableCollection Enderecos { get; set; } [Description("ESTADO CIVIL")] [Log(true)] public Gestor.Model.Common.EstadoCivil? EstadoCivil { get; set; } [Description("ESTADO EMISSOR")] [Log(true)] public string EstadoEmissor { get { string str = this._estadoEmissor; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._estadoEmissor = value; } } public bool EstaNaCentralSegurado { get; set; } [Log(true)] public bool Excluido { get; set; } [Description("EXPEDIÇÃO")] [Log(true)] public DateTime? Expedicao { get; set; } [Log(true)] public bool Falecido { get; set; } [Description("HABILITAÇÃO")] [Log(true)] public string Habilitacao { get { string str = this._habilitacao; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._habilitacao = value; } } public long IdEmpresa { get; set; } [Log(true)] public string Identidade { get { string str = this._identidade; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._identidade = value; } } [Description("DESEJA RECEBER MALA DIRETA")] [Log(true)] public bool? MalaDireta { get { return new bool?(this._malaDireta.GetValueOrDefault(true)); } set { this._malaDireta = new bool?(value.GetValueOrDefault(true)); } } [Log(true)] public DateTime? Nascimento { get; set; } [Log(true)] [Name(true)] public string Nome { get { string str = this._nome; if (str != null) { return str.ToUpper(); } return null; } set { object upper; this._nome = value; if (value != null) { upper = value.ToUpper(); } else { upper = null; } this.NomeSocial = string.Format("{0} - {1}", upper, base.Id); } } public string NomeSocial { get; set; } public string NomeSocialRg { get { string str = this._nomeSocialRg; if (str != null) { return str.ToUpper(); } return null; } set { this._nomeSocialRg = value; } } [Description("OBSERVAÇÃO")] [Log(true)] public string Observacao { get; set; } public List Origens { get; set; } [Log(true)] public string Pasta { get { string str = this._pasta; if (str != null) { return str.ToUpper(); } return null; } set { this._pasta = value; } } public bool PessoaFisica { get { return this.Documento.Clear().Length < 12; } } [Description("PRIMEIRA HABILITAÇÃO")] [Log(true)] public DateTime? PrimeiraHabilitacao { get; set; } [Description("PROFISSÃO")] public Gestor.Model.Domain.Common.Profissao Profissao { get; set; } [Description("RENDA MENSAL")] [Log(true)] public decimal RendaMensal { get; set; } [Log(true)] public Gestor.Model.Domain.Seguros.ResponsavelAssinatura ResponsavelAssinatura { get; set; } [Log(true)] public string Rne { get { string str = this._rne; if (str == null) { return null; } return str.ToUpper().Trim(); } set { this._rne = value; } } [Log(true)] public Gestor.Model.Common.Sexo? Sexo { get; set; } [Log(true)] public string Status { get; set; } public ObservableCollection Telefones { get; set; } [Description("TIPO CONTA")] [Log(true)] public string TipoConta { get { string str = this._tipoConta; if (str != null) { return str.ToUpper(); } return null; } set { this._tipoConta = value; } } [JsonIgnore] public Func>> ValidationEvent { get { Cliente cliente = this; return new Func>>(cliente.Validate); } } [Description("VENCIMENTO HABILITAÇÃO")] [Log(true)] public DateTime? VencimentoHabilitacao { get; set; } public ObservableCollection Vinculos { get; set; } public Cliente() { } public List Log() { TipoTelefone? tipo; string description; string str; string shortDateString; string shortDateString1; string str1; string shortDateString2; string description1; string description2; string str2; string shortDateString3; string description3; string str3; string description4; List tupleLists = new List(); TupleList tupleList = new TupleList(); ObservableCollection> observableCollection = new ObservableCollection>(); TipoDocumento? documentoPrincipal = this.DocumentoPrincipal; if (!documentoPrincipal.HasValue) { description = ""; } else { documentoPrincipal = this.DocumentoPrincipal; if (documentoPrincipal.HasValue) { description = documentoPrincipal.GetValueOrDefault().GetDescription(); } else { description = null; } } observableCollection.Add(new Tuple("TIPO DO DOCUMENTO PRINCIPAL", description, "")); observableCollection.Add(new Tuple("DOCUMENTO PRINCIPAL", (string.IsNullOrWhiteSpace(this.Documento) ? "" : this.Documento), "")); observableCollection.Add(new Tuple("CLIENTE", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome.ToUpper()), "")); str = (this.Documento.OnlyNumber().Length > 11 ? "FUNDAÇÃO" : "NASCIMENTO"); DateTime? nascimento = this.Nascimento; if (!nascimento.HasValue) { shortDateString = ""; } else { nascimento = this.Nascimento; if (nascimento.HasValue) { shortDateString = nascimento.GetValueOrDefault().ToShortDateString(); } else { shortDateString = null; } } observableCollection.Add(new Tuple(str, shortDateString, "")); tupleList.Tuples = observableCollection; tupleLists.Add(tupleList); List tupleLists1 = tupleLists; if (this.Documento == null || this.Documento.OnlyNumber().Length <= 11) { tupleLists1[0].Tuples.Add(new Tuple("IDENTIDADE", (string.IsNullOrWhiteSpace(this.Identidade) ? "" : this.Identidade), "")); tupleLists1[0].Tuples.Add(new Tuple("ÓRGÃO EMISSOR", (string.IsNullOrWhiteSpace(this.Emissor) ? "" : this.Emissor.ToUpper()), "")); tupleLists1[0].Tuples.Add(new Tuple("ESTADO EMISSOR", (string.IsNullOrWhiteSpace(this.EstadoEmissor) ? "" : this.EstadoEmissor.ToUpper()), "")); ObservableCollection> tuples = tupleLists1[0].Tuples; nascimento = this.Expedicao; if (!nascimento.HasValue) { shortDateString1 = ""; } else { nascimento = this.Expedicao; if (nascimento.HasValue) { shortDateString1 = nascimento.GetValueOrDefault().ToShortDateString(); } else { shortDateString1 = null; } } tuples.Add(new Tuple("DATA DE EXPEDIÇÃO", shortDateString1, "")); tupleLists1[0].Tuples.Add(new Tuple("HABILITAÇÃO", (string.IsNullOrWhiteSpace(this.Habilitacao) ? "" : this.Habilitacao.ToUpper()), "")); tupleLists1[0].Tuples.Add(new Tuple("CATEGORIA", (string.IsNullOrWhiteSpace(this.CategoriaHabilitacao) ? "" : this.CategoriaHabilitacao.ToUpper()), "")); ObservableCollection> tuples1 = tupleLists1[0].Tuples; nascimento = this.PrimeiraHabilitacao; if (!nascimento.HasValue) { str1 = ""; } else { nascimento = this.PrimeiraHabilitacao; if (nascimento.HasValue) { str1 = nascimento.GetValueOrDefault().ToShortDateString(); } else { str1 = null; } } tuples1.Add(new Tuple("PRIMEIRA HABILITAÇÃO", str1, "")); ObservableCollection> observableCollection1 = tupleLists1[0].Tuples; nascimento = this.VencimentoHabilitacao; if (!nascimento.HasValue) { shortDateString2 = ""; } else { nascimento = this.VencimentoHabilitacao; if (nascimento.HasValue) { shortDateString2 = nascimento.GetValueOrDefault().ToShortDateString(); } else { shortDateString2 = null; } } observableCollection1.Add(new Tuple("VENCIMENTO DA HABILITAÇÃO", shortDateString2, "")); ObservableCollection> tuples2 = tupleLists1[0].Tuples; Gestor.Model.Common.Sexo? sexo = this.Sexo; if (!sexo.HasValue) { description1 = ""; } else { sexo = this.Sexo; if (sexo.HasValue) { description1 = sexo.GetValueOrDefault().GetDescription(); } else { description1 = null; } } tuples2.Add(new Tuple("SEXO", description1, "")); ObservableCollection> observableCollection2 = tupleLists1[0].Tuples; Gestor.Model.Common.EstadoCivil? estadoCivil = this.EstadoCivil; if (!estadoCivil.HasValue) { description2 = ""; } else { estadoCivil = this.EstadoCivil; if (estadoCivil.HasValue) { description2 = estadoCivil.GetValueOrDefault().GetDescription(); } else { description2 = null; } } observableCollection2.Add(new Tuple("ESTADO CIVIL", description2, "")); tupleLists1[0].Tuples.Add(new Tuple("PROFISSÃO DO CLIENTE", (this.Profissao == null ? "" : this.Profissao.Nome.ToUpper()), "")); } else { tupleLists1[0].Tuples.Add(new Tuple("RAMO DE ATIVIDADE", (string.IsNullOrWhiteSpace(this.Atividade.Nome) ? "" : this.Atividade.Nome), "")); } ObservableCollection> tuples3 = tupleLists1[0].Tuples; nascimento = this.ClienteDesde; if (!nascimento.HasValue) { str2 = ""; } else { nascimento = this.ClienteDesde; if (nascimento.HasValue) { str2 = nascimento.GetValueOrDefault().ToShortDateString(); } else { str2 = null; } } tuples3.Add(new Tuple("CLIENTE DESDE", str2, "")); tupleLists1[0].Tuples.Add(new Tuple("PASTA", (string.IsNullOrWhiteSpace(this.Pasta) ? "" : this.Pasta.ToUpper()), "")); tupleLists1[0].Tuples.Add(new Tuple("BANCO", (this.Banco == null ? "" : this.Banco.Nome.ToUpper()), "")); tupleLists1[0].Tuples.Add(new Tuple("AGÊNCIA", (string.IsNullOrWhiteSpace(this.Agencia) ? "" : this.Agencia.ToUpper()), "")); tupleLists1[0].Tuples.Add(new Tuple("TIPO DE CONTA", (string.IsNullOrWhiteSpace(this.TipoConta) ? "" : this.TipoConta.ToUpper()), "")); tupleLists1[0].Tuples.Add(new Tuple("NÚMERO DA CONTA", (string.IsNullOrWhiteSpace(this.Conta) ? "" : this.Conta.ToUpper()), "")); tupleLists1[0].Tuples.Add(new Tuple("FALECIDO", (this.Falecido ? "SIM" : "NÃO"), "")); tupleLists1[0].Tuples.Add(new Tuple("ÓRGÃO EMISSOR", (string.IsNullOrWhiteSpace(this.Emissor) ? "" : this.Emissor.ToUpper()), "")); ObservableCollection> observableCollection3 = tupleLists1[0].Tuples; decimal rendaMensal = this.RendaMensal; observableCollection3.Add(new Tuple("RENDA MENSAL", rendaMensal.ToString("C", new CultureInfo("pt-BR", false)), "")); ObservableCollection> observableCollection4 = new ObservableCollection>() { new Tuple("TELEFONES$", "", "") }; if (this.Telefones != null && this.Telefones.Count > 0) { foreach (ClienteTelefone telefone in this.Telefones) { observableCollection4.Add(new Tuple(string.Format(" TELEFONE {0}$", this.Telefones.IndexOf(telefone) + 1), "", "")); ObservableCollection> observableCollection5 = observableCollection4; tipo = telefone.Tipo; if (!tipo.HasValue) { description4 = ""; } else { tipo = telefone.Tipo; if (tipo.HasValue) { description4 = tipo.GetValueOrDefault().GetDescription(); } else { description4 = null; } } observableCollection5.Add(new Tuple(" TIPO", description4, "")); observableCollection4.Add(new Tuple(" PREFIXO", (string.IsNullOrWhiteSpace(telefone.Prefixo) ? "" : telefone.Prefixo.ToUpper()), "")); observableCollection4.Add(new Tuple(" NÚMERO", (string.IsNullOrWhiteSpace(telefone.Numero) ? "" : telefone.Numero), "")); observableCollection4.Add(new Tuple(" ORDEM", (!telefone.Ordem.HasValue ? "" : telefone.Ordem.ToString()), "")); } } tupleLists1.Add(new TupleList() { Tuples = observableCollection4 }); ObservableCollection> observableCollection6 = new ObservableCollection>() { new Tuple("EMAILS$", "", "") }; if (this.Emails != null && this.Emails.Count > 0) { foreach (ClienteEmail email in this.Emails) { observableCollection6.Add(new Tuple(string.Format(" EMAIL {0}$", this.Emails.IndexOf(email) + 1), "", "")); observableCollection6.Add(new Tuple(" ENDEREÇO DE EMAIL", (string.IsNullOrWhiteSpace(email.Email) ? "" : email.Email), "")); observableCollection6.Add(new Tuple(" ORDEM", (!email.Ordem.HasValue ? "" : email.Ordem.ToString()), "")); } } tupleLists1.Add(new TupleList() { Tuples = observableCollection6 }); ObservableCollection> observableCollection7 = new ObservableCollection>() { new Tuple("ENDEREÇOS$", "", "") }; if (this.Enderecos != null && this.Enderecos.Count > 0) { foreach (ClienteEndereco endereco in this.Enderecos) { observableCollection7.Add(new Tuple(string.Format(" ENDEREÇO {0}$", this.Enderecos.IndexOf(endereco) + 1), "", "")); observableCollection7.Add(new Tuple(" LOGRADOURO", (string.IsNullOrWhiteSpace(endereco.Endereco) ? "" : endereco.Endereco), "")); observableCollection7.Add(new Tuple(" NÚMERO", (string.IsNullOrWhiteSpace(endereco.Numero) ? "" : endereco.Numero), "")); observableCollection7.Add(new Tuple(" COMPLEMENTO", (string.IsNullOrWhiteSpace(endereco.Complemento) ? "" : endereco.Complemento), "")); observableCollection7.Add(new Tuple(" BAIRRO", (string.IsNullOrWhiteSpace(endereco.Bairro) ? "" : endereco.Bairro), "")); observableCollection7.Add(new Tuple(" CIDADE", (string.IsNullOrWhiteSpace(endereco.Cidade) ? "" : endereco.Cidade), "")); observableCollection7.Add(new Tuple(" ESTADO", (string.IsNullOrWhiteSpace(endereco.Estado) ? "" : endereco.Estado), "")); observableCollection7.Add(new Tuple(" CEP", (string.IsNullOrWhiteSpace(endereco.Cep) ? "" : endereco.Cep), "")); observableCollection7.Add(new Tuple(" ORDEM", (!endereco.Ordem.HasValue ? "" : endereco.Ordem.ToString()), "")); } } tupleLists1.Add(new TupleList() { Tuples = observableCollection7 }); ObservableCollection> observableCollection8 = new ObservableCollection>() { new Tuple("CONTATOS$", "", "") }; if (this.Contatos != null && this.Contatos.Count > 0) { foreach (MaisContato contato in this.Contatos) { observableCollection8.Add(new Tuple(string.Format(" CONTATO {0}$", this.Contatos.IndexOf(contato) + 1), "", "")); observableCollection8.Add(new Tuple(" DOCUMENTO", (string.IsNullOrWhiteSpace(contato.Documento) ? "" : contato.Documento), "")); ObservableCollection> observableCollection9 = observableCollection8; nascimento = contato.Nascimento; if (!nascimento.HasValue) { shortDateString3 = ""; } else { nascimento = contato.Nascimento; if (nascimento.HasValue) { shortDateString3 = nascimento.GetValueOrDefault().ToShortDateString(); } else { shortDateString3 = null; } } observableCollection9.Add(new Tuple(" NASCIMENTO", shortDateString3, "")); ObservableCollection> observableCollection10 = observableCollection8; Parentesco? parentesco = contato.Parentesco; if (!parentesco.HasValue) { description3 = ""; } else { parentesco = contato.Parentesco; if (parentesco.HasValue) { description3 = parentesco.GetValueOrDefault().GetDescription(); } else { description3 = null; } } observableCollection10.Add(new Tuple(" PARENTESCO", description3, "")); observableCollection8.Add(new Tuple(" BANCO", (string.IsNullOrWhiteSpace(contato.Banco) ? "" : contato.Banco), "")); observableCollection8.Add(new Tuple(" AGÊNCIA", (string.IsNullOrWhiteSpace(contato.Agencia) ? "" : contato.Agencia), "")); observableCollection8.Add(new Tuple(" CONTA", (string.IsNullOrWhiteSpace(contato.Conta) ? "" : contato.Conta), "")); ObservableCollection> observableCollection11 = observableCollection8; tipo = contato.Tipo; if (!tipo.HasValue) { str3 = ""; } else { tipo = contato.Tipo; if (tipo.HasValue) { str3 = tipo.GetValueOrDefault().GetDescription(); } else { str3 = null; } } observableCollection11.Add(new Tuple(" TIPO DO TELEFONE", str3, "")); observableCollection8.Add(new Tuple(" PREFIXO", (string.IsNullOrWhiteSpace(contato.Prefixo) ? "" : contato.Prefixo), "")); observableCollection8.Add(new Tuple(" NÚMERO", (string.IsNullOrWhiteSpace(contato.Telefone) ? "" : contato.Telefone), "")); observableCollection8.Add(new Tuple(" EMAIL", (string.IsNullOrWhiteSpace(contato.Email) ? "" : contato.Email), "")); } } tupleLists1.Add(new TupleList() { Tuples = observableCollection8 }); ObservableCollection> observableCollection12 = new ObservableCollection>() { new Tuple("VÍNCULOS$", "", "") }; if (this.Vinculos == null) { this.Vinculos = new ObservableCollection(); } if (this.Vinculos != null && this.Vinculos.Count > 0) { foreach (ClienteVinculo vinculo in this.Vinculos) { observableCollection12.Add(new Tuple(string.Format(" VÍNCULO {0}$", this.Vinculos.IndexOf(vinculo) + 1), "", "")); observableCollection12.Add(new Tuple(" COM CLIENTE", (vinculo.Cliente1.Id != base.Id ? vinculo.Cliente1.Nome : vinculo.Cliente2.Nome), "")); observableCollection12.Add(new Tuple(" PARENTESCO", (vinculo.Cliente1.Id == base.Id ? vinculo.Parentesco.GetDescription() : Funcoes.ParentescoInverso(vinculo.Parentesco).GetDescription()), "")); } } tupleLists1.Add(new TupleList() { Tuples = observableCollection12 }); return tupleLists1; } public List> Validate() { int? nullable; DateTime? primeiraHabilitacao; int? nullable1; List> keyValuePairs = ValidationHelper.AddValue(); string nome = this.Nome; if (nome != null) { nullable1 = new int?((int)nome.Trim().Split(new char[] { ' ' }).Length); } else { nullable = null; nullable1 = nullable; } int? nullable2 = nullable1; if (nullable2.HasValue) { nullable = nullable2; if (nullable.GetValueOrDefault() <= 1 & nullable.HasValue) { keyValuePairs.AddValue("Nome", Messages.NomeInvalido, true); } } else { keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); } TipoDocumento? documentoPrincipal = this.DocumentoPrincipal; if (!documentoPrincipal.HasValue) { keyValuePairs.AddValue("DocumentoPrincipal|DOCUMENTO PRINCIPAL", string.Format(Messages.Obrigatorio, Array.Empty()), true); } DateTime? clienteDesde = this.ClienteDesde; if (clienteDesde.HasValue) { clienteDesde = this.ClienteDesde; if (DateTime.Compare(clienteDesde.Value, new DateTime(1753, 1, 1)) >= 0) { clienteDesde = this.ClienteDesde; if (DateTime.Compare(clienteDesde.Value, new DateTime(9999, 12, 31)) <= 0) { goto Label0; } } keyValuePairs.AddValue("ClienteDesde|CLIENTE DESDE", string.Format(Messages.DataInvalida, Array.Empty()), true); } Label0: DateTime networkTime = Funcoes.GetNetworkTime(); DateTime date = networkTime.Date; clienteDesde = this.Nascimento; if (clienteDesde.HasValue) { clienteDesde = this.Nascimento; networkTime = date; if ((clienteDesde.HasValue ? clienteDesde.GetValueOrDefault() > networkTime : false)) { keyValuePairs.AddValue(string.Concat("Nascimento|", (this.Documento.OnlyNumber().Length > 11 ? "FUNDAÇÃO" : "NASCIMENTO")), Messages.Invalido, true); } } clienteDesde = this.Nascimento; if (clienteDesde.HasValue) { clienteDesde = this.Nascimento; if (DateTime.Compare(clienteDesde.Value, new DateTime(1753, 1, 1)) >= 0) { clienteDesde = this.Nascimento; if (DateTime.Compare(clienteDesde.Value, new DateTime(9999, 12, 31)) <= 0) { goto Label1; } } keyValuePairs.AddValue(string.Concat("Nascimento|", (this.Documento.OnlyNumber().Length > 11 ? "FUNDAÇÃO" : "NASCIMENTO")), string.Format(Messages.DataInvalida, Array.Empty()), true); } if (string.IsNullOrWhiteSpace(this.Documento)) { keyValuePairs.AddValue("Documento", Messages.Obrigatorio, true); } else if (!this.Documento.ValidacaoDocumento()) { keyValuePairs.AddValue("Documento", Messages.Invalido, true); } documentoPrincipal = this.DocumentoPrincipal; if (documentoPrincipal.HasValue) { switch (documentoPrincipal.GetValueOrDefault()) { case TipoDocumento.Rne: { if (!string.IsNullOrWhiteSpace(this.Rne)) { if (this.Rne.ValidacaoRne()) { break; } keyValuePairs.AddValue("Rne", Messages.Invalido, true); break; } else { keyValuePairs.AddValue("Rne", Messages.Obrigatorio, true); break; } } case TipoDocumento.Cei: { if (!string.IsNullOrWhiteSpace(this.Cei)) { if (this.Cei.ValidacaoCei()) { break; } keyValuePairs.AddValue("Cei", Messages.Invalido, true); break; } else { keyValuePairs.AddValue("Cei", Messages.Obrigatorio, true); break; } } case TipoDocumento.Caepf: { if (!string.IsNullOrWhiteSpace(this.Caepf)) { if (this.Caepf.ValidateCaepf()) { break; } keyValuePairs.AddValue("Caepf", Messages.Invalido, true); break; } else { keyValuePairs.AddValue("Caepf", Messages.Obrigatorio, true); break; } } } } if (this.Documento == null || this.Documento.OnlyNumber().Length <= 11) { clienteDesde = this.PrimeiraHabilitacao; if (clienteDesde.HasValue) { clienteDesde = this.PrimeiraHabilitacao; networkTime = date; if ((clienteDesde.HasValue ? clienteDesde.GetValueOrDefault() > networkTime : false)) { keyValuePairs.AddValue("PrimeiraHabilitacao|PRIMEIRA HABILITAÇÃO", Messages.Invalido, true); } } clienteDesde = this.PrimeiraHabilitacao; if (clienteDesde.HasValue) { clienteDesde = this.PrimeiraHabilitacao; if (DateTime.Compare(clienteDesde.Value, new DateTime(1753, 1, 1)) >= 0) { clienteDesde = this.PrimeiraHabilitacao; if (DateTime.Compare(clienteDesde.Value, new DateTime(9999, 12, 31)) <= 0) { goto Label2; } } keyValuePairs.AddValue("PrimeiraHabilitacao|PRIMEIRA HABILITAÇÃO", string.Format(Messages.DataInvalida, Array.Empty()), true); } Label2: clienteDesde = this.VencimentoHabilitacao; if (clienteDesde.HasValue) { clienteDesde = this.VencimentoHabilitacao; primeiraHabilitacao = this.PrimeiraHabilitacao; if ((clienteDesde.HasValue & primeiraHabilitacao.HasValue ? clienteDesde.GetValueOrDefault() <= primeiraHabilitacao.GetValueOrDefault() : false)) { keyValuePairs.AddValue("VencimentoHabilitacao|VENCIMENTO HABILITAÇÃO", Messages.Invalido, true); } } primeiraHabilitacao = this.VencimentoHabilitacao; if (primeiraHabilitacao.HasValue) { primeiraHabilitacao = this.VencimentoHabilitacao; if (DateTime.Compare(primeiraHabilitacao.Value, new DateTime(1753, 1, 1)) >= 0) { primeiraHabilitacao = this.VencimentoHabilitacao; if (DateTime.Compare(primeiraHabilitacao.Value, new DateTime(9999, 12, 31)) <= 0) { goto Label3; } } keyValuePairs.AddValue("VencimentoHabilitacao|VENCIMENTO HABILITAÇÃO", string.Format(Messages.DataInvalida, Array.Empty()), true); } Label3: primeiraHabilitacao = this.Expedicao; if (primeiraHabilitacao.HasValue) { primeiraHabilitacao = this.Expedicao; if (DateTime.Compare(primeiraHabilitacao.Value, new DateTime(1753, 1, 1)) >= 0) { primeiraHabilitacao = this.Expedicao; if (DateTime.Compare(primeiraHabilitacao.Value, new DateTime(9999, 12, 31)) <= 0) { goto Label4; } } keyValuePairs.AddValue("Expedicao|EXPEDIÇÃO", string.Format(Messages.DataInvalida, Array.Empty()), true); } Label4: primeiraHabilitacao = this.Expedicao; if (primeiraHabilitacao.HasValue) { primeiraHabilitacao = this.Expedicao; networkTime = date; if ((primeiraHabilitacao.HasValue ? primeiraHabilitacao.GetValueOrDefault() > networkTime : false)) { keyValuePairs.AddValue("Expedicao|EXPEDIÇÃO", Messages.Invalido, true); } } if (!string.IsNullOrWhiteSpace(this.Identidade) && this.Identidade.Length > 14) { keyValuePairs.AddValue("Identidade", string.Format(Messages.MaiorQueLimite, 14), true); } if (!string.IsNullOrWhiteSpace(this.Habilitacao) && this.Habilitacao.Length > 15) { keyValuePairs.AddValue("Habilitacao|HABILITAÇÃO", string.Format(Messages.MaiorQueLimite, 15), true); } if (!string.IsNullOrWhiteSpace(this.CategoriaHabilitacao) && this.CategoriaHabilitacao.Length > 10) { keyValuePairs.AddValue("CategoriaHabilitacao|CATEGORIA HABILITAÇÃO", string.Format(Messages.MaiorQueLimite, 10), true); } if (!string.IsNullOrWhiteSpace(this.Emissor) && !this.Emissor.ValidacaoOrgao()) { keyValuePairs.AddValue("Emissor|EMISSOR", string.Format(Messages.MaiorQueLimite, 6), true); } if (!string.IsNullOrWhiteSpace(this.EstadoEmissor) && !this.EstadoEmissor.ValidacaoEstado()) { keyValuePairs.AddValue("EstadoEmissor|ESTADO EMISSOR", Messages.Invalido, true); } } if (!string.IsNullOrWhiteSpace(this.Pasta) && this.Pasta.Length > 8) { keyValuePairs.AddValue("Pasta", string.Format(Messages.MaiorQueLimite, 8), true); } if (!string.IsNullOrWhiteSpace(this.Agencia) && this.Agencia.Length > 8) { keyValuePairs.AddValue("Agencia|AGÊNCIA", string.Format(Messages.MaiorQueLimite, 8), true); } if (!string.IsNullOrWhiteSpace(this.TipoConta) && this.TipoConta.Length > 20) { keyValuePairs.AddValue("TipoConta|TIPO CONTA", string.Format(Messages.MaiorQueLimite, 20), true); } if (!string.IsNullOrWhiteSpace(this.Conta) && this.Conta.Length > 12) { keyValuePairs.AddValue("Conta", string.Format(Messages.MaiorQueLimite, 12), true); } if (this.ResponsavelAssinatura != null) { keyValuePairs.AddRange(this.ResponsavelAssinatura.Validate()); } return keyValuePairs; } } }