diff options
Diffstat (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros/Perfil.cs')
| -rw-r--r-- | Codemerx/Gestor.Model/Model.Domain.Seguros/Perfil.cs | 275 |
1 files changed, 275 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Perfil.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Perfil.cs new file mode 100644 index 0000000..e9113b8 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Perfil.cs @@ -0,0 +1,275 @@ +using Gestor.Model.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Runtime.CompilerServices;
+
+namespace Gestor.Model.Domain.Seguros
+{
+ public class Perfil : DomainBase, IDomain
+ {
+ private string _nome;
+
+ private string _cepCirculacao;
+
+ private string _cepPernoite;
+
+ public Antifurto? AntiFurto
+ {
+ get;
+ set;
+ }
+
+ public string CepCirculacao
+ {
+ get
+ {
+ return this._cepCirculacao;
+ }
+ set
+ {
+ this._cepCirculacao = value;
+ }
+ }
+
+ public string CepPernoite
+ {
+ get
+ {
+ return this._cepPernoite;
+ }
+ set
+ {
+ this._cepPernoite = value;
+ }
+ }
+
+ public Gestor.Model.Domain.Seguros.Cliente Cliente
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Domain.Seguros.Controle Controle
+ {
+ get;
+ set;
+ }
+
+ public string Cpf
+ {
+ get;
+ set;
+ }
+
+ public DistanciaTrabalho? DistanciaResidenciaTrabalho
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Common.EstadoCivil? EstadoCivil
+ {
+ get;
+ set;
+ }
+
+ public bool? EstenderCobertura
+ {
+ get;
+ set;
+ }
+
+ public GaragemTrabalhoEstudo? GaragemEstudo
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Common.GaragemResidencia? GaragemResidencia
+ {
+ get;
+ set;
+ }
+
+ public GaragemTrabalhoEstudo? GaragemTrabalho
+ {
+ get;
+ set;
+ }
+
+ public string Habilitacao
+ {
+ get;
+ set;
+ }
+
+ public bool? Isencao
+ {
+ get;
+ set;
+ }
+
+ public string KmMensal
+ {
+ get;
+ set;
+ }
+
+ public DateTime? Nascimento
+ {
+ get;
+ set;
+ }
+
+ public string Nome
+ {
+ get
+ {
+ string str = this._nome;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._nome = value;
+ }
+ }
+
+ public Gestor.Model.Common.Ocupacao? Ocupacao
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Common.Relacao? Relacao
+ {
+ get;
+ set;
+ }
+
+ public bool? SeguroVida
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Common.Sexo? Sexo
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Common.TempoHabilitacao? TempoHabilitacao
+ {
+ get;
+ set;
+ }
+
+ public Gestor.Model.Common.TipoResidencia? TipoResidencia
+ {
+ get;
+ set;
+ }
+
+ public UsoDependetes? UsoDependentes
+ {
+ get;
+ set;
+ }
+
+ public bool? UsoProfissional
+ {
+ get;
+ set;
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent
+ {
+ get
+ {
+ Perfil perfil = this;
+ return new Func<List<KeyValuePair<string, string>>>(perfil.Validate);
+ }
+ }
+
+ public int? VeiculoResidencia
+ {
+ get;
+ set;
+ }
+
+ public Perfil()
+ {
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ bool length;
+ bool flag;
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ if (this.Nascimento.HasValue && (DateTime.Compare(this.Nascimento.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Nascimento.Value, new DateTime(9999, 12, 31)) > 0))
+ {
+ keyValuePairs.AddValue<string, string>("Nascimento", string.Format(Messages.DataInvalida, Array.Empty<object>()), true);
+ }
+ if (string.IsNullOrWhiteSpace(this.Nome))
+ {
+ keyValuePairs.AddValue<string, string>("Nome", Messages.Obrigatorio, true);
+ }
+ else if (this.Nome.Length > 255)
+ {
+ keyValuePairs.AddValue<string, string>("Nome", string.Format(Messages.MaiorQueLimite, 255), true);
+ }
+ string kmMensal = this.KmMensal;
+ if (kmMensal != null)
+ {
+ length = kmMensal.Length > 5;
+ }
+ else
+ {
+ length = false;
+ }
+ if (length)
+ {
+ keyValuePairs.AddValue<string, string>("KmMensal", string.Format(Messages.MaiorQueLimite, 5), true);
+ }
+ string habilitacao = this.Habilitacao;
+ if (habilitacao != null)
+ {
+ flag = habilitacao.Length > 15;
+ }
+ else
+ {
+ flag = false;
+ }
+ if (flag)
+ {
+ keyValuePairs.AddValue<string, string>("Habilitacao", string.Format(Messages.MaiorQueLimite, 15), true);
+ }
+ if (!this.Relacao.HasValue)
+ {
+ keyValuePairs.AddValue<string, string>("Relacao", Messages.Obrigatorio, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Cpf) && !this.Cpf.ValidacaoDocumento())
+ {
+ keyValuePairs.AddValue<string, string>("Cpf", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.CepPernoite) && !this.CepPernoite.FormataCep().ValidacaoCep())
+ {
+ keyValuePairs.AddValue<string, string>("CepPernoite", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.CepCirculacao) && !this.CepCirculacao.FormataCep().ValidacaoCep())
+ {
+ keyValuePairs.AddValue<string, string>("CepCirculacao", Messages.Invalido, true);
+ }
+ return keyValuePairs;
+ }
+ }
+}
\ No newline at end of file |