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/Perfil.cs | |
| parent | 225aa1499e37faf9d38257caabbadc68d78b427e (diff) | |
| download | gestor-0440c722a221b8068bbf388c1c0c51f0faff0451.tar.gz gestor-0440c722a221b8068bbf388c1c0c51f0faff0451.zip | |
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Seguros/Perfil.cs')
| -rw-r--r-- | Gestor.Model/Gestor.Model.Domain.Seguros/Perfil.cs | 147 |
1 files changed, 147 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/Perfil.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/Perfil.cs new file mode 100644 index 0000000..ed3772c --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Seguros/Perfil.cs @@ -0,0 +1,147 @@ +using System; +using System.Collections.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Seguros; + +public class Perfil : DomainBase, IDomain +{ + private string _nome; + + private string _cepCirculacao; + + private string _cepPernoite; + + public Cliente Cliente { get; set; } + + public Controle Controle { get; set; } + + public bool? UsoProfissional { get; set; } + + public bool? SeguroVida { get; set; } + + public Antifurto? AntiFurto { get; set; } + + public bool? EstenderCobertura { get; set; } + + public int? VeiculoResidencia { get; set; } + + public string Cpf { get; set; } + + public string Habilitacao { get; set; } + + public DateTime? Nascimento { get; set; } + + public string Nome + { + get + { + return _nome?.ToUpper(); + } + set + { + _nome = value; + } + } + + public Relacao? Relacao { get; set; } + + public GaragemTrabalhoEstudo? GaragemTrabalho { get; set; } + + public GaragemTrabalhoEstudo? GaragemEstudo { get; set; } + + public GaragemResidencia? GaragemResidencia { get; set; } + + public TipoResidencia? TipoResidencia { get; set; } + + public UsoDependetes? UsoDependentes { get; set; } + + public DistanciaTrabalho? DistanciaResidenciaTrabalho { get; set; } + + public Ocupacao? Ocupacao { get; set; } + + public Sexo? Sexo { get; set; } + + public TempoHabilitacao? TempoHabilitacao { get; set; } + + public EstadoCivil? EstadoCivil { get; set; } + + public string KmMensal { get; set; } + + public string CepPernoite + { + get + { + return _cepPernoite; + } + set + { + _cepPernoite = value; + } + } + + public string CepCirculacao + { + get + { + return _cepCirculacao; + } + set + { + _cepCirculacao = value; + } + } + + public bool? Isencao { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + 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", string.Format(Messages.DataInvalida)); + } + if (string.IsNullOrWhiteSpace(Nome)) + { + list.AddValue("Nome", Messages.Obrigatorio); + } + else if (Nome.Length > 255) + { + list.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 255)); + } + string kmMensal = KmMensal; + if (kmMensal != null && kmMensal.Length > 5) + { + list.AddValue("KmMensal", string.Format(Messages.MaiorQueLimite, 5)); + } + string habilitacao = Habilitacao; + if (habilitacao != null && habilitacao.Length > 15) + { + list.AddValue("Habilitacao", string.Format(Messages.MaiorQueLimite, 15)); + } + if (!Relacao.HasValue) + { + list.AddValue("Relacao", Messages.Obrigatorio); + } + if (!string.IsNullOrWhiteSpace(Cpf) && !Cpf.ValidacaoDocumento()) + { + list.AddValue("Cpf", Messages.Invalido); + } + if (!string.IsNullOrWhiteSpace(CepPernoite) && !CepPernoite.FormataCep().ValidacaoCep()) + { + list.AddValue("CepPernoite", Messages.Invalido); + } + if (!string.IsNullOrWhiteSpace(CepCirculacao) && !CepCirculacao.FormataCep().ValidacaoCep()) + { + list.AddValue("CepCirculacao", Messages.Invalido); + } + return list; + } +} |