diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
| commit | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch) | |
| tree | e1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Codemerx/Gestor.Model/Model.Domain.Seguros/Estipulante.cs | |
| parent | 674ca83ba9243a9e95a7568c797668dab6aee26a (diff) | |
| download | gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip | |
chore: location
Diffstat (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros/Estipulante.cs')
| -rw-r--r-- | Codemerx/Gestor.Model/Model.Domain.Seguros/Estipulante.cs | 373 |
1 files changed, 373 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/Estipulante.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/Estipulante.cs new file mode 100644 index 0000000..76976ea --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/Estipulante.cs @@ -0,0 +1,373 @@ +using Gestor.Model.Attributes;
+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.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Threading;
+
+namespace Gestor.Model.Domain.Seguros
+{
+ public class Estipulante : EnderecoBase, IDomain, INotifyPropertyChanged
+ {
+ private bool _selecionado;
+
+ private string _nome;
+
+ private string _documento;
+
+ private string _primeiroPrefixo;
+
+ private string _primeiroTelefone;
+
+ private string _segundoPrefixo;
+
+ private string _segundoTelefone;
+
+ private string _email;
+
+ private string _observacao;
+
+ [Log(true)]
+ public bool Ativo
+ {
+ 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;
+ }
+ }
+
+ [Log(true)]
+ public string Email
+ {
+ get
+ {
+ string str = this._email;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToLower().Trim();
+ }
+ set
+ {
+ this._email = value;
+ }
+ }
+
+ public long IdEmpresa
+ {
+ get;
+ set;
+ }
+
+ [Log(true)]
+ [Name(true)]
+ public string Nome
+ {
+ get
+ {
+ string str = this._nome;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._nome = value;
+ }
+ }
+
+ [Log(true)]
+ public string Observacao
+ {
+ get
+ {
+ string str = this._observacao;
+ if (str != null)
+ {
+ return str.ToUpper();
+ }
+ return null;
+ }
+ set
+ {
+ this._observacao = value;
+ }
+ }
+
+ [Description("PREFIXO")]
+ [Log(true)]
+ public string PrimeiroPrefixo
+ {
+ get
+ {
+ string str = this._primeiroPrefixo;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._primeiroPrefixo = value;
+ }
+ }
+
+ [Description("TELEFONE")]
+ [Log(true)]
+ public string PrimeiroTelefone
+ {
+ get
+ {
+ string str = this._primeiroTelefone;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._primeiroTelefone = value;
+ }
+ }
+
+ [Description("TIPO TELEFONE")]
+ [Log(true)]
+ public TipoTelefone? PrimeiroTipo
+ {
+ get;
+ set;
+ }
+
+ [Description("PREFIXO")]
+ [Log(true)]
+ public string SegundoPrefixo
+ {
+ get
+ {
+ string str = this._segundoPrefixo;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._segundoPrefixo = value;
+ }
+ }
+
+ [Description("TELEFONE")]
+ [Log(true)]
+ public string SegundoTelefone
+ {
+ get
+ {
+ string str = this._segundoTelefone;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._segundoTelefone = value;
+ }
+ }
+
+ [Description("TIPO TELEFONE")]
+ [Log(true)]
+ public TipoTelefone? SegundoTipo
+ {
+ get;
+ set;
+ }
+
+ public bool Selecionado
+ {
+ get
+ {
+ return this._selecionado;
+ }
+ set
+ {
+ if (value == this._selecionado)
+ {
+ return;
+ }
+ this._selecionado = value;
+ this.OnPropertyChanged("Selecionado");
+ }
+ }
+
+ [JsonIgnore]
+ public Func<List<KeyValuePair<string, string>>> ValidationEvent
+ {
+ get
+ {
+ Estipulante estipulante = this;
+ return new Func<List<KeyValuePair<string, string>>>(estipulante.Validate);
+ }
+ }
+
+ public Estipulante()
+ {
+ }
+
+ public List<TupleList> Log()
+ {
+ string description;
+ string str;
+ List<TupleList> tupleLists = new List<TupleList>();
+ TupleList tupleList = new TupleList();
+ ObservableCollection<Tuple<string, string, string>> observableCollection = new ObservableCollection<Tuple<string, string, string>>()
+ {
+ new Tuple<string, string, string>("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""),
+ new Tuple<string, string, string>("CPF", (string.IsNullOrWhiteSpace(this.Documento) ? "" : this.Documento), ""),
+ new Tuple<string, string, string>("ATIVO", (this.Ativo ? "SIM" : "NÃO"), "")
+ };
+ TipoTelefone? primeiroTipo = this.PrimeiroTipo;
+ if (!primeiroTipo.HasValue)
+ {
+ description = "";
+ }
+ else
+ {
+ primeiroTipo = this.PrimeiroTipo;
+ if (primeiroTipo.HasValue)
+ {
+ description = primeiroTipo.GetValueOrDefault().GetDescription();
+ }
+ else
+ {
+ description = null;
+ }
+ }
+ observableCollection.Add(new Tuple<string, string, string>("PRIMEIRO TIPO", description, ""));
+ observableCollection.Add(new Tuple<string, string, string>("PRIMEIRO PREFIXO", (string.IsNullOrWhiteSpace(this.PrimeiroPrefixo) ? "" : this.PrimeiroPrefixo), ""));
+ observableCollection.Add(new Tuple<string, string, string>("PRIMEIRO TELEFONE", (string.IsNullOrWhiteSpace(this.PrimeiroTelefone) ? "" : this.PrimeiroTelefone), ""));
+ primeiroTipo = this.SegundoTipo;
+ if (!primeiroTipo.HasValue)
+ {
+ str = "";
+ }
+ else
+ {
+ primeiroTipo = this.SegundoTipo;
+ if (primeiroTipo.HasValue)
+ {
+ str = primeiroTipo.GetValueOrDefault().GetDescription();
+ }
+ else
+ {
+ str = null;
+ }
+ }
+ observableCollection.Add(new Tuple<string, string, string>("SEGUNDO TIPO", str, ""));
+ observableCollection.Add(new Tuple<string, string, string>("SEGUNDO PREFIXO", (string.IsNullOrWhiteSpace(this.SegundoPrefixo) ? "" : this.SegundoPrefixo), ""));
+ observableCollection.Add(new Tuple<string, string, string>("SEGUNDO TELEFONE", (string.IsNullOrWhiteSpace(this.SegundoTelefone) ? "" : this.SegundoTelefone), ""));
+ observableCollection.Add(new Tuple<string, string, string>("E-MAIL", (string.IsNullOrWhiteSpace(this.Email) ? "" : this.Email), ""));
+ observableCollection.Add(new Tuple<string, string, string>("CEP", (string.IsNullOrWhiteSpace(base.Cep) ? "" : base.Cep), ""));
+ observableCollection.Add(new Tuple<string, string, string>("ENDEREÇO", (string.IsNullOrWhiteSpace(base.Endereco) ? "" : base.Endereco), ""));
+ observableCollection.Add(new Tuple<string, string, string>("NÚMERO", (string.IsNullOrWhiteSpace(base.Numero) ? "" : base.Numero), ""));
+ observableCollection.Add(new Tuple<string, string, string>("COMPLEMENTO", (string.IsNullOrWhiteSpace(base.Complemento) ? "" : base.Complemento), ""));
+ observableCollection.Add(new Tuple<string, string, string>("BAIRRO", (string.IsNullOrWhiteSpace(base.Bairro) ? "" : base.Bairro), ""));
+ observableCollection.Add(new Tuple<string, string, string>("CIDADE", (string.IsNullOrWhiteSpace(base.Cidade) ? "" : base.Cidade), ""));
+ observableCollection.Add(new Tuple<string, string, string>("ESTADO", (string.IsNullOrWhiteSpace(base.Estado) ? "" : base.Estado), ""));
+ tupleList.Tuples = observableCollection;
+ tupleLists.Add(tupleList);
+ return tupleLists;
+ }
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChangedEventHandler propertyChangedEventHandler = this.PropertyChanged;
+ if (propertyChangedEventHandler == null)
+ {
+ return;
+ }
+ propertyChangedEventHandler(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public List<KeyValuePair<string, string>> Validate()
+ {
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ if (string.IsNullOrEmpty(this.Nome))
+ {
+ keyValuePairs.AddValue<string, string>("Nome", Messages.Obrigatorio, true);
+ }
+ else if (this.Nome.Length > 100)
+ {
+ keyValuePairs.AddValue<string, string>("Nome", string.Format(Messages.MaiorQueLimite, 100), true);
+ }
+ if (!string.IsNullOrEmpty(this.Documento) && !this.Documento.ValidacaoDocumento())
+ {
+ keyValuePairs.AddValue<string, string>("Documento", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.PrimeiroPrefixo) && !this.PrimeiroPrefixo.ValidacaoPrefixo())
+ {
+ keyValuePairs.AddValue<string, string>("PrimeiroPrefixo|PRIMEIRO DDD", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.PrimeiroTelefone) && !this.PrimeiroTelefone.ValidacaoTelefone())
+ {
+ keyValuePairs.AddValue<string, string>("PrimeiroTelefone|PRIMEIRO TELEFONE", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.SegundoPrefixo) && !this.SegundoPrefixo.ValidacaoPrefixo())
+ {
+ keyValuePairs.AddValue<string, string>("SegundoPrefixo|SEGUNDO DDD", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.SegundoTelefone) && !this.SegundoTelefone.ValidacaoTelefone())
+ {
+ keyValuePairs.AddValue<string, string>("SegundoTelefone|SEGUNDO TELEFONE", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrEmpty(this.Email) && this.Email.Length > 100)
+ {
+ keyValuePairs.AddValue<string, string>("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 100), true);
+ }
+ if (!string.IsNullOrEmpty(this.Email) && !this.Email.ValidacaoEmail())
+ {
+ keyValuePairs.AddValue<string, string>("Email|E-MAIL", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrEmpty(base.Cep) && !base.Cep.ValidacaoCep())
+ {
+ keyValuePairs.AddValue<string, string>("Cep|CEP", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrEmpty(base.Estado) && !base.Estado.ValidacaoEstado())
+ {
+ keyValuePairs.AddValue<string, string>("Estado|ESTADO", Messages.Invalido, true);
+ }
+ return keyValuePairs;
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ }
+}
\ No newline at end of file |