From 674ca83ba9243a9e95a7568c797668dab6aee26a Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:35:25 -0300 Subject: feat: upload files --- Gestor.Model/Model.Domain.Seguros/TitularesVida.cs | 269 +++++++++++++++++++++ 1 file changed, 269 insertions(+) create mode 100644 Gestor.Model/Model.Domain.Seguros/TitularesVida.cs (limited to 'Gestor.Model/Model.Domain.Seguros/TitularesVida.cs') diff --git a/Gestor.Model/Model.Domain.Seguros/TitularesVida.cs b/Gestor.Model/Model.Domain.Seguros/TitularesVida.cs new file mode 100644 index 0000000..3956270 --- /dev/null +++ b/Gestor.Model/Model.Domain.Seguros/TitularesVida.cs @@ -0,0 +1,269 @@ +using Gestor.Model.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.ComponentModel; +using System.Runtime.CompilerServices; +using System.Threading; + +namespace Gestor.Model.Domain.Seguros +{ + public class TitularesVida : DomainBase, IDomain, INotifyPropertyChanged + { + private string _codigo; + + private string _fatura; + + private string _nome; + + private string _observacao; + + private string _matricula; + + private decimal? _premio; + + private decimal? _capital; + + private bool _selecionado; + + public decimal? Capital + { + get + { + return new decimal?(this._capital.GetValueOrDefault()); + } + set + { + this._capital = value; + } + } + + public string Codigo + { + get + { + string str = this._codigo; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._codigo = value; + } + } + + public string Cpf + { + get; + set; + } + + public TitularesVida Dependente + { + get; + set; + } + + public string Fatura + { + get + { + string str = this._fatura; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._fatura = value; + } + } + + public DateTime? Fim + { + get; + set; + } + + public long IdItem + { + get; + set; + } + + public DateTime? Inicio + { + get; + set; + } + + public string Matricula + { + get + { + string str = this._matricula; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._matricula = value; + } + } + + 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 string Observacao + { + get + { + string str = this._observacao; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._observacao = value; + } + } + + public decimal? Premio + { + get + { + return new decimal?(this._premio.GetValueOrDefault()); + } + set + { + this._premio = value; + } + } + + public bool Selecionado + { + get + { + return this._selecionado; + } + set + { + if (value == this._selecionado) + { + return; + } + this._selecionado = value; + this.OnPropertyChanged("Selecionado"); + } + } + + public TipoTitular? Tipo + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + TitularesVida titularesVida = this; + return new Func>>(titularesVida.Validate); + } + } + + public TitularesVida() + { + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged; + if (propertyChangedEventHandler == null) + { + return; + } + propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.Nome)) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + else if (this.Nome.Length > 150) + { + keyValuePairs.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 150), true); + } + if (!this.Inicio.HasValue) + { + keyValuePairs.AddValue("Inicio|INÍCIO", Messages.Obrigatorio, true); + } + else if (DateTime.Compare(this.Inicio.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Inicio.Value, new DateTime(9999, 12, 31)) > 0) + { + keyValuePairs.AddValue("Inicio|INÍCIO", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.Fim.HasValue && (DateTime.Compare(this.Fim.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Fim.Value, new DateTime(9999, 12, 31)) > 0)) + { + keyValuePairs.AddValue("Fim", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + 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("Nascimento", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if ((!this.Nascimento.HasValue || Funcoes.GetAge(this.Nascimento.Value) >= 18) && !string.IsNullOrWhiteSpace(this.Cpf) && !this.Cpf.ValidacaoDocumento()) + { + keyValuePairs.AddValue("Cpf", Messages.Invalido, true); + } + if (!this.Tipo.HasValue) + { + keyValuePairs.AddValue("Tipo", Messages.Obrigatorio, true); + } + if (this.Tipo.GetValueOrDefault() == TipoTitular.Dependente && this.Dependente == null) + { + keyValuePairs.AddValue("Dependente", "OBRIGATÓRIO. PESQUISE POR UM DOS TITULARES\nQUE SEJA DO TIPO SÓCIO OU FUNCIONÁRIO", true); + } + return keyValuePairs; + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file -- cgit v1.2.3