diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
| commit | 0440c722a221b8068bbf388c1c0c51f0faff0451 (patch) | |
| tree | 169cbf90c50ff7961db82ecb606c50c2a45a1688 /Gestor.Model/Gestor.Model.Domain.Seguros/Cliente.cs | |
| parent | 225aa1499e37faf9d38257caabbadc68d78b427e (diff) | |
| download | gestor-master.tar.gz gestor-master.zip | |
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Seguros/Cliente.cs')
| -rw-r--r-- | Gestor.Model/Gestor.Model.Domain.Seguros/Cliente.cs | 695 |
1 files changed, 695 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Cliente.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Cliente.cs new file mode 100644 index 0000000..04a5fe4 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Cliente.cs @@ -0,0 +1,695 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +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; + +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 = true; + + private string _nomeSocialRg; + + public long IdEmpresa { get; set; } + + [Log(true)] + [Name(true)] + public string Nome + { + get + { + return _nome?.ToUpper(); + } + set + { + _nome = value; + NomeSocial = $"{value?.ToUpper()} - {base.Id}"; + } + } + + public string NomeSocial { get; set; } + + [Log(true)] + public DateTime? Nascimento { get; set; } + + [Log(true)] + public Sexo? Sexo { get; set; } + + [Log(true)] + [Description("ESTADO CIVIL")] + public EstadoCivil? EstadoCivil { get; set; } + + [Log(true)] + [Description("DOCUMENTO PRINCIPAL")] + public TipoDocumento? DocumentoPrincipal { get; set; } + + [Log(true)] + public string Documento + { + get + { + return _documento?.ToUpper().Trim(); + } + set + { + _documento = value; + } + } + + [Log(true)] + public string Identidade + { + get + { + return _identidade?.ToUpper().Trim(); + } + set + { + _identidade = value; + } + } + + [Log(true)] + public string Emissor + { + get + { + return _emissor?.ToUpper().Trim(); + } + set + { + _emissor = value; + } + } + + [Log(true)] + [Description("ESTADO EMISSOR")] + public string EstadoEmissor + { + get + { + return _estadoEmissor?.ToUpper().Trim(); + } + set + { + _estadoEmissor = value; + } + } + + [Log(true)] + [Description("EXPEDIÇÃO")] + public DateTime? Expedicao { get; set; } + + [Log(true)] + [Description("HABILITAÇÃO")] + public string Habilitacao + { + get + { + return _habilitacao?.ToUpper().Trim(); + } + set + { + _habilitacao = value; + } + } + + [Log(true)] + [Description("PRIMEIRA HABILITAÇÃO")] + public DateTime? PrimeiraHabilitacao { get; set; } + + [Log(true)] + [Description("VENCIMENTO HABILITAÇÃO")] + public DateTime? VencimentoHabilitacao { get; set; } + + [Log(true)] + [Description("CATEGORIA HABILITAÇÃO")] + public string CategoriaHabilitacao + { + get + { + return _categoriaHabilitacao?.ToUpper().Trim(); + } + set + { + _categoriaHabilitacao = value; + } + } + + [Log(true)] + [Description("CLIENTE DESDE")] + public DateTime? ClienteDesde { get; set; } + + [Log(true)] + public string Pasta + { + get + { + return _pasta?.ToUpper(); + } + set + { + _pasta = value; + } + } + + [Log(true)] + public string Cei + { + get + { + return _cei?.ToUpper().Trim(); + } + set + { + _cei = value; + } + } + + [Log(true)] + public string Rne + { + get + { + return _rne?.ToUpper().Trim(); + } + set + { + _rne = value; + } + } + + [Log(true)] + public string Caepf + { + get + { + return _caepf?.ToUpper().Trim(); + } + set + { + _caepf = value; + } + } + + public Atividade Atividade { get; set; } + + [Description("PROFISSÃO")] + public Profissao Profissao { get; set; } + + public Banco Banco { get; set; } + + [Log(true)] + [Description("AGÊNCIA")] + public string Agencia + { + get + { + return _agencia?.ToUpper().Trim(); + } + set + { + _agencia = value; + } + } + + [Log(true)] + [Description("TIPO CONTA")] + public string TipoConta + { + get + { + return _tipoConta?.ToUpper(); + } + set + { + _tipoConta = value; + } + } + + [Log(true)] + public string Conta + { + get + { + return _conta?.ToUpper().Trim(); + } + set + { + _conta = value; + } + } + + [Log(true)] + [Description("RENDA MENSAL")] + public decimal RendaMensal { get; set; } + + [Log(true)] + public bool Falecido { get; set; } + + public ObservableCollection<ClienteTelefone> Telefones { get; set; } + + public ObservableCollection<ClienteEmail> Emails { get; set; } + + public ObservableCollection<ClienteEndereco> Enderecos { get; set; } + + public ObservableCollection<MaisContato> Contatos { get; set; } + + public ObservableCollection<ClienteVinculo> Vinculos { get; set; } + + public List<OrigemCliente> Origens { get; set; } + + [Log(true)] + [Description("OBSERVAÇÃO")] + public string Observacao { get; set; } + + [Log(true)] + public bool Excluido { get; set; } + + [Log(true)] + public string Status { get; set; } + + [Log(true)] + public ResponsavelAssinatura ResponsavelAssinatura { get; set; } + + [Log(true)] + [Description("DESEJA RECEBER MALA DIRETA")] + public bool? MalaDireta + { + get + { + return _malaDireta.GetValueOrDefault(true); + } + set + { + _malaDireta = value.GetValueOrDefault(true); + } + } + + public string NomeSocialRg + { + get + { + return _nomeSocialRg?.ToUpper(); + } + set + { + _nomeSocialRg = value; + } + } + + public bool EstaNaCentralSegurado { get; set; } + + public bool PessoaFisica => Documento.Clear().Length < 12; + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + int? num = Nome?.Trim().Split(new char[1] { ' ' }).Length; + if (!num.HasValue) + { + list.AddValue("Nome", Messages.Obrigatorio); + } + else if (num <= 1) + { + list.AddValue("Nome", Messages.NomeInvalido); + } + if (!DocumentoPrincipal.HasValue) + { + list.AddValue("DocumentoPrincipal|DOCUMENTO PRINCIPAL", string.Format(Messages.Obrigatorio)); + } + if (ClienteDesde.HasValue && (DateTime.Compare(ClienteDesde.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(ClienteDesde.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("ClienteDesde|CLIENTE DESDE", string.Format(Messages.DataInvalida)); + } + DateTime date = Funcoes.GetNetworkTime().Date; + if (Nascimento.HasValue && Nascimento > date) + { + list.AddValue("Nascimento|" + ((Documento.OnlyNumber().Length > 11) ? "FUNDAÇÃO" : "NASCIMENTO"), Messages.Invalido); + } + if (Nascimento.HasValue && (DateTime.Compare(Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Nascimento.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("Nascimento|" + ((Documento.OnlyNumber().Length > 11) ? "FUNDAÇÃO" : "NASCIMENTO"), string.Format(Messages.DataInvalida)); + } + if (string.IsNullOrWhiteSpace(Documento)) + { + list.AddValue("Documento", Messages.Obrigatorio); + } + else if (!Documento.ValidacaoDocumento()) + { + list.AddValue("Documento", Messages.Invalido); + } + switch (DocumentoPrincipal) + { + case TipoDocumento.Rne: + if (string.IsNullOrWhiteSpace(Rne)) + { + list.AddValue("Rne", Messages.Obrigatorio); + } + else if (!Rne.ValidacaoRne()) + { + list.AddValue("Rne", Messages.Invalido); + } + break; + case TipoDocumento.Cei: + if (string.IsNullOrWhiteSpace(Cei)) + { + list.AddValue("Cei", Messages.Obrigatorio); + } + else if (!Cei.ValidacaoCei()) + { + list.AddValue("Cei", Messages.Invalido); + } + break; + case TipoDocumento.Caepf: + if (string.IsNullOrWhiteSpace(Caepf)) + { + list.AddValue("Caepf", Messages.Obrigatorio); + } + else if (!Caepf.ValidateCaepf()) + { + list.AddValue("Caepf", Messages.Invalido); + } + break; + } + if (Documento == null || Documento.OnlyNumber().Length <= 11) + { + if (PrimeiraHabilitacao.HasValue && PrimeiraHabilitacao > date) + { + list.AddValue("PrimeiraHabilitacao|PRIMEIRA HABILITAÇÃO", Messages.Invalido); + } + if (PrimeiraHabilitacao.HasValue && (DateTime.Compare(PrimeiraHabilitacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(PrimeiraHabilitacao.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("PrimeiraHabilitacao|PRIMEIRA HABILITAÇÃO", string.Format(Messages.DataInvalida)); + } + if (VencimentoHabilitacao.HasValue && VencimentoHabilitacao <= PrimeiraHabilitacao) + { + list.AddValue("VencimentoHabilitacao|VENCIMENTO HABILITAÇÃO", Messages.Invalido); + } + if (VencimentoHabilitacao.HasValue && (DateTime.Compare(VencimentoHabilitacao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(VencimentoHabilitacao.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("VencimentoHabilitacao|VENCIMENTO HABILITAÇÃO", string.Format(Messages.DataInvalida)); + } + if (Expedicao.HasValue && (DateTime.Compare(Expedicao.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Expedicao.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("Expedicao|EXPEDIÇÃO", string.Format(Messages.DataInvalida)); + } + if (Expedicao.HasValue && Expedicao > date) + { + list.AddValue("Expedicao|EXPEDIÇÃO", Messages.Invalido); + } + if (!string.IsNullOrWhiteSpace(Identidade) && Identidade.Length > 14) + { + list.AddValue("Identidade", string.Format(Messages.MaiorQueLimite, 14)); + } + if (!string.IsNullOrWhiteSpace(Habilitacao) && Habilitacao.Length > 15) + { + list.AddValue("Habilitacao|HABILITAÇÃO", string.Format(Messages.MaiorQueLimite, 15)); + } + if (!string.IsNullOrWhiteSpace(CategoriaHabilitacao) && CategoriaHabilitacao.Length > 10) + { + list.AddValue("CategoriaHabilitacao|CATEGORIA HABILITAÇÃO", string.Format(Messages.MaiorQueLimite, 10)); + } + if (!string.IsNullOrWhiteSpace(Emissor) && !Emissor.ValidacaoOrgao()) + { + list.AddValue("Emissor|EMISSOR", string.Format(Messages.MaiorQueLimite, 6)); + } + if (!string.IsNullOrWhiteSpace(EstadoEmissor) && !EstadoEmissor.ValidacaoEstado()) + { + list.AddValue("EstadoEmissor|ESTADO EMISSOR", Messages.Invalido); + } + } + if (!string.IsNullOrWhiteSpace(Pasta) && Pasta.Length > 8) + { + list.AddValue("Pasta", string.Format(Messages.MaiorQueLimite, 8)); + } + if (!string.IsNullOrWhiteSpace(Agencia) && Agencia.Length > 8) + { + list.AddValue("Agencia|AGÊNCIA", string.Format(Messages.MaiorQueLimite, 8)); + } + if (!string.IsNullOrWhiteSpace(TipoConta) && TipoConta.Length > 20) + { + list.AddValue("TipoConta|TIPO CONTA", string.Format(Messages.MaiorQueLimite, 20)); + } + if (!string.IsNullOrWhiteSpace(Conta) && Conta.Length > 12) + { + list.AddValue("Conta", string.Format(Messages.MaiorQueLimite, 12)); + } + if (ResponsavelAssinatura != null) + { + list.AddRange(ResponsavelAssinatura.Validate()); + } + return list; + } + + public List<TupleList> Log() + { + List<TupleList> list = new List<TupleList>(); + TupleList tupleList = new TupleList(); + ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>(); + object item; + if (DocumentoPrincipal.HasValue) + { + TipoDocumento? documentoPrincipal = DocumentoPrincipal; + item = (documentoPrincipal.HasValue ? documentoPrincipal.GetValueOrDefault().GetDescription() : null); + } + else + { + item = ""; + } + observableCollection.Add(new Tuple<string, string, string>("TIPO DO DOCUMENTO PRINCIPAL", (string)item, "")); + observableCollection.Add(new Tuple<string, string, string>("DOCUMENTO PRINCIPAL", string.IsNullOrWhiteSpace(Documento) ? "" : Documento, "")); + observableCollection.Add(new Tuple<string, string, string>("CLIENTE", string.IsNullOrWhiteSpace(Nome) ? "" : Nome.ToUpper(), "")); + observableCollection.Add(new Tuple<string, string, string>((Documento.OnlyNumber().Length > 11) ? "FUNDAÇÃO" : "NASCIMENTO", (!Nascimento.HasValue) ? "" : Nascimento?.ToShortDateString(), "")); + tupleList.Tuples = observableCollection; + list.Add(tupleList); + List<TupleList> list2 = list; + if (Documento != null && Documento.OnlyNumber().Length > 11) + { + list2[0].Tuples.Add(new Tuple<string, string, string>("RAMO DE ATIVIDADE", string.IsNullOrWhiteSpace(Atividade.Nome) ? "" : Atividade.Nome, "")); + } + else + { + list2[0].Tuples.Add(new Tuple<string, string, string>("IDENTIDADE", string.IsNullOrWhiteSpace(Identidade) ? "" : Identidade, "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("ÓRGÃO EMISSOR", string.IsNullOrWhiteSpace(Emissor) ? "" : Emissor.ToUpper(), "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("ESTADO EMISSOR", string.IsNullOrWhiteSpace(EstadoEmissor) ? "" : EstadoEmissor.ToUpper(), "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("DATA DE EXPEDIÇÃO", (!Expedicao.HasValue) ? "" : Expedicao?.ToShortDateString(), "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("HABILITAÇÃO", string.IsNullOrWhiteSpace(Habilitacao) ? "" : Habilitacao.ToUpper(), "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("CATEGORIA", string.IsNullOrWhiteSpace(CategoriaHabilitacao) ? "" : CategoriaHabilitacao.ToUpper(), "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("PRIMEIRA HABILITAÇÃO", (!PrimeiraHabilitacao.HasValue) ? "" : PrimeiraHabilitacao?.ToShortDateString(), "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("VENCIMENTO DA HABILITAÇÃO", (!VencimentoHabilitacao.HasValue) ? "" : VencimentoHabilitacao?.ToShortDateString(), "")); + ObservableCollection<Tuple<string, string, string>> tuples = list2[0].Tuples; + object item2; + if (Sexo.HasValue) + { + Sexo? sexo = Sexo; + item2 = (sexo.HasValue ? sexo.GetValueOrDefault().GetDescription() : null); + } + else + { + item2 = ""; + } + tuples.Add(new Tuple<string, string, string>("SEXO", (string)item2, "")); + ObservableCollection<Tuple<string, string, string>> tuples2 = list2[0].Tuples; + object item3; + if (EstadoCivil.HasValue) + { + EstadoCivil? estadoCivil = EstadoCivil; + item3 = (estadoCivil.HasValue ? estadoCivil.GetValueOrDefault().GetDescription() : null); + } + else + { + item3 = ""; + } + tuples2.Add(new Tuple<string, string, string>("ESTADO CIVIL", (string)item3, "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("PROFISSÃO DO CLIENTE", (Profissao == null) ? "" : Profissao.Nome.ToUpper(), "")); + } + list2[0].Tuples.Add(new Tuple<string, string, string>("CLIENTE DESDE", (!ClienteDesde.HasValue) ? "" : ClienteDesde?.ToShortDateString(), "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("PASTA", string.IsNullOrWhiteSpace(Pasta) ? "" : Pasta.ToUpper(), "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("BANCO", (Banco == null) ? "" : Banco.Nome.ToUpper(), "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("AGÊNCIA", string.IsNullOrWhiteSpace(Agencia) ? "" : Agencia.ToUpper(), "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("TIPO DE CONTA", string.IsNullOrWhiteSpace(TipoConta) ? "" : TipoConta.ToUpper(), "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("NÚMERO DA CONTA", string.IsNullOrWhiteSpace(Conta) ? "" : Conta.ToUpper(), "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("FALECIDO", Falecido ? "SIM" : "NÃO", "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("ÓRGÃO EMISSOR", string.IsNullOrWhiteSpace(Emissor) ? "" : Emissor.ToUpper(), "")); + list2[0].Tuples.Add(new Tuple<string, string, string>("RENDA MENSAL", RendaMensal.ToString("C", new CultureInfo("pt-BR", useUserOverride: false)), "")); + ObservableCollection<Tuple<string, string, string>> observableCollection2 = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("TELEFONES$", "", "") + }; + if (Telefones != null && Telefones.Count > 0) + { + foreach (ClienteTelefone telefone in Telefones) + { + observableCollection2.Add(new Tuple<string, string, string>($" TELEFONE {Telefones.IndexOf(telefone) + 1}$", "", "")); + object item4; + if (telefone.Tipo.HasValue) + { + TipoTelefone? tipo = telefone.Tipo; + item4 = (tipo.HasValue ? tipo.GetValueOrDefault().GetDescription() : null); + } + else + { + item4 = ""; + } + observableCollection2.Add(new Tuple<string, string, string>(" TIPO", (string)item4, "")); + observableCollection2.Add(new Tuple<string, string, string>(" PREFIXO", string.IsNullOrWhiteSpace(telefone.Prefixo) ? "" : telefone.Prefixo.ToUpper(), "")); + observableCollection2.Add(new Tuple<string, string, string>(" NÚMERO", string.IsNullOrWhiteSpace(telefone.Numero) ? "" : telefone.Numero, "")); + observableCollection2.Add(new Tuple<string, string, string>(" ORDEM", (!telefone.Ordem.HasValue) ? "" : telefone.Ordem.ToString(), "")); + } + } + list2.Add(new TupleList + { + Tuples = observableCollection2 + }); + ObservableCollection<Tuple<string, string, string>> observableCollection3 = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("EMAILS$", "", "") + }; + if (Emails != null && Emails.Count > 0) + { + foreach (ClienteEmail email in Emails) + { + observableCollection3.Add(new Tuple<string, string, string>($" EMAIL {Emails.IndexOf(email) + 1}$", "", "")); + observableCollection3.Add(new Tuple<string, string, string>(" ENDEREÇO DE EMAIL", string.IsNullOrWhiteSpace(email.Email) ? "" : email.Email, "")); + observableCollection3.Add(new Tuple<string, string, string>(" ORDEM", (!email.Ordem.HasValue) ? "" : email.Ordem.ToString(), "")); + } + } + list2.Add(new TupleList + { + Tuples = observableCollection3 + }); + ObservableCollection<Tuple<string, string, string>> observableCollection4 = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("ENDEREÇOS$", "", "") + }; + if (Enderecos != null && Enderecos.Count > 0) + { + foreach (ClienteEndereco endereco in Enderecos) + { + observableCollection4.Add(new Tuple<string, string, string>($" ENDEREÇO {Enderecos.IndexOf(endereco) + 1}$", "", "")); + observableCollection4.Add(new Tuple<string, string, string>(" LOGRADOURO", string.IsNullOrWhiteSpace(endereco.Endereco) ? "" : endereco.Endereco, "")); + observableCollection4.Add(new Tuple<string, string, string>(" NÚMERO", string.IsNullOrWhiteSpace(endereco.Numero) ? "" : endereco.Numero, "")); + observableCollection4.Add(new Tuple<string, string, string>(" COMPLEMENTO", string.IsNullOrWhiteSpace(endereco.Complemento) ? "" : endereco.Complemento, "")); + observableCollection4.Add(new Tuple<string, string, string>(" BAIRRO", string.IsNullOrWhiteSpace(endereco.Bairro) ? "" : endereco.Bairro, "")); + observableCollection4.Add(new Tuple<string, string, string>(" CIDADE", string.IsNullOrWhiteSpace(endereco.Cidade) ? "" : endereco.Cidade, "")); + observableCollection4.Add(new Tuple<string, string, string>(" ESTADO", string.IsNullOrWhiteSpace(endereco.Estado) ? "" : endereco.Estado, "")); + observableCollection4.Add(new Tuple<string, string, string>(" CEP", string.IsNullOrWhiteSpace(endereco.Cep) ? "" : endereco.Cep, "")); + observableCollection4.Add(new Tuple<string, string, string>(" ORDEM", (!endereco.Ordem.HasValue) ? "" : endereco.Ordem.ToString(), "")); + } + } + list2.Add(new TupleList + { + Tuples = observableCollection4 + }); + ObservableCollection<Tuple<string, string, string>> observableCollection5 = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("CONTATOS$", "", "") + }; + if (Contatos != null && Contatos.Count > 0) + { + foreach (MaisContato contato in Contatos) + { + observableCollection5.Add(new Tuple<string, string, string>($" CONTATO {Contatos.IndexOf(contato) + 1}$", "", "")); + observableCollection5.Add(new Tuple<string, string, string>(" DOCUMENTO", string.IsNullOrWhiteSpace(contato.Documento) ? "" : contato.Documento, "")); + observableCollection5.Add(new Tuple<string, string, string>(" NASCIMENTO", (!contato.Nascimento.HasValue) ? "" : contato.Nascimento?.ToShortDateString(), "")); + object item5; + if (contato.Parentesco.HasValue) + { + Parentesco? parentesco = contato.Parentesco; + item5 = (parentesco.HasValue ? parentesco.GetValueOrDefault().GetDescription() : null); + } + else + { + item5 = ""; + } + observableCollection5.Add(new Tuple<string, string, string>(" PARENTESCO", (string)item5, "")); + observableCollection5.Add(new Tuple<string, string, string>(" BANCO", string.IsNullOrWhiteSpace(contato.Banco) ? "" : contato.Banco, "")); + observableCollection5.Add(new Tuple<string, string, string>(" AGÊNCIA", string.IsNullOrWhiteSpace(contato.Agencia) ? "" : contato.Agencia, "")); + observableCollection5.Add(new Tuple<string, string, string>(" CONTA", string.IsNullOrWhiteSpace(contato.Conta) ? "" : contato.Conta, "")); + object item6; + if (contato.Tipo.HasValue) + { + TipoTelefone? tipo = contato.Tipo; + item6 = (tipo.HasValue ? tipo.GetValueOrDefault().GetDescription() : null); + } + else + { + item6 = ""; + } + observableCollection5.Add(new Tuple<string, string, string>(" TIPO DO TELEFONE", (string)item6, "")); + observableCollection5.Add(new Tuple<string, string, string>(" PREFIXO", string.IsNullOrWhiteSpace(contato.Prefixo) ? "" : contato.Prefixo, "")); + observableCollection5.Add(new Tuple<string, string, string>(" NÚMERO", string.IsNullOrWhiteSpace(contato.Telefone) ? "" : contato.Telefone, "")); + observableCollection5.Add(new Tuple<string, string, string>(" EMAIL", string.IsNullOrWhiteSpace(contato.Email) ? "" : contato.Email, "")); + } + } + list2.Add(new TupleList + { + Tuples = observableCollection5 + }); + ObservableCollection<Tuple<string, string, string>> observableCollection6 = new ObservableCollection<Tuple<string, string, string>> + { + new Tuple<string, string, string>("VÍNCULOS$", "", "") + }; + if (Vinculos == null) + { + Vinculos = new ObservableCollection<ClienteVinculo>(); + } + if (Vinculos != null && Vinculos.Count > 0) + { + foreach (ClienteVinculo vinculo in Vinculos) + { + observableCollection6.Add(new Tuple<string, string, string>($" VÍNCULO {Vinculos.IndexOf(vinculo) + 1}$", "", "")); + observableCollection6.Add(new Tuple<string, string, string>(" COM CLIENTE", (vinculo.Cliente1.Id != base.Id) ? vinculo.Cliente1.Nome : vinculo.Cliente2.Nome, "")); + observableCollection6.Add(new Tuple<string, string, string>(" PARENTESCO", (vinculo.Cliente1.Id == base.Id) ? vinculo.Parentesco.GetDescription() : Funcoes.ParentescoInverso(vinculo.Parentesco).GetDescription(), "")); + } + } + list2.Add(new TupleList + { + Tuples = observableCollection6 + }); + return list2; + } +} |