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/Parceiro.cs | 528 ++++++++++++++++++++++++++ 1 file changed, 528 insertions(+) create mode 100644 Gestor.Model/Model.Domain.Seguros/Parceiro.cs (limited to 'Gestor.Model/Model.Domain.Seguros/Parceiro.cs') diff --git a/Gestor.Model/Model.Domain.Seguros/Parceiro.cs b/Gestor.Model/Model.Domain.Seguros/Parceiro.cs new file mode 100644 index 0000000..16bbdaf --- /dev/null +++ b/Gestor.Model/Model.Domain.Seguros/Parceiro.cs @@ -0,0 +1,528 @@ +using Gestor.Model.Attributes; +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.Collections.ObjectModel; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text.RegularExpressions; + +namespace Gestor.Model.Domain.Seguros +{ + public class Parceiro : DomainBase, IDomain + { + private string _nome; + + private string _cep; + + private string _endereco; + + private string _numero; + + private string _complemento; + + private string _bairro; + + private string _cidade; + + private string _uf; + + private string _cgccpf; + + private string _contato; + + private string _email; + + private string _ddd1; + + private string _telefone1; + + private string _ddd2; + + private string _telefone2; + + private string _ddd3; + + private string _telefone3; + + private string _obs; + + [Log(true)] + public string Bairro + { + get + { + string str = this._bairro; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._bairro = value; + } + } + + [Log(true)] + public string Cep + { + get + { + if (this._cep == null || !Regex.IsMatch(this._cep, "[0-9]+")) + { + return ""; + } + return this._cep.Trim(); + } + set + { + this._cep = value; + } + } + + [Description("DOCUMENTO")] + [Log(true)] + public string Cgccpf + { + get + { + string str = this._cgccpf; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._cgccpf = value; + } + } + + [Log(true)] + public string Cidade + { + get + { + string str = this._cidade; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._cidade = value; + } + } + + [Log(true)] + public string Complemento + { + get + { + string str = this._complemento; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._complemento = value; + } + } + + [Log(true)] + public string Contato + { + get + { + string str = this._contato; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._contato = value; + } + } + + [Description("PREFIXO 1")] + [Log(true)] + public string Ddd1 + { + get + { + string str = this._ddd1; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._ddd1 = value; + } + } + + [Description("PREFIXO 2")] + [Log(true)] + public string Ddd2 + { + get + { + string str = this._ddd2; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._ddd2 = value; + } + } + + [Description("PREFIXO 3")] + [Log(true)] + public string Ddd3 + { + get + { + string str = this._ddd3; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._ddd3 = value; + } + } + + [Log(true)] + public string Email + { + get + { + string str = this._email; + if (str == null) + { + return null; + } + return str.ToLower().Trim(); + } + set + { + this._email = value; + } + } + + [Log(true)] + public string Endereco + { + get + { + string str = this._endereco; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._endereco = value; + } + } + + [Log(true)] + [Name(true)] + public string Nome + { + get + { + string str = this._nome; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._nome = value; + } + } + + [Description("NÚMERO")] + [Log(true)] + public string Numero + { + get + { + string str = this._numero; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._numero = value; + } + } + + [Description("OBSERVAÇÃO")] + [Log(true)] + public string Obs + { + get + { + string str = this._obs; + if (str != null) + { + return str.ToUpper(); + } + return null; + } + set + { + this._obs = value; + } + } + + [Description("TELEFONE 1")] + [Log(true)] + public string Telefone1 + { + get + { + string str = this._telefone1; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._telefone1 = value; + } + } + + [Description("TELEFONE 2")] + [Log(true)] + public string Telefone2 + { + get + { + string str = this._telefone2; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._telefone2 = value; + } + } + + [Description("TELEFONE 3")] + [Log(true)] + public string Telefone3 + { + get + { + string str = this._telefone3; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._telefone3 = value; + } + } + + public Gestor.Model.Common.TipoPerda? TipoPerda + { + get; + set; + } + + [Description("ESTADO")] + [Log(true)] + public string Uf + { + get + { + string str = this._uf; + if (str == null) + { + return null; + } + return str.ToUpper().Trim(); + } + set + { + this._uf = value; + } + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + Parceiro parceiro = this; + return new Func>>(parceiro.Validate); + } + } + + public Parceiro() + { + } + + public List Log() + { + return new List() + { + new TupleList() + { + Tuples = new ObservableCollection>() + { + new Tuple("NOME", (string.IsNullOrWhiteSpace(this.Nome) ? "" : this.Nome), ""), + new Tuple("DOCUMENTO", (string.IsNullOrWhiteSpace(this.Cgccpf) ? "" : this.Cgccpf), ""), + new Tuple("PRIMEIRO PREFIXO", (string.IsNullOrWhiteSpace(this.Ddd1) ? "" : this.Ddd1), ""), + new Tuple("PRIMEIRO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone1) ? "" : this.Telefone1), ""), + new Tuple("SEGUNDO PREFIXO", (string.IsNullOrWhiteSpace(this.Ddd2) ? "" : this.Ddd2), ""), + new Tuple("SEGUNDO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone2) ? "" : this.Telefone2), ""), + new Tuple("TERCEIRO PREFIXO", (string.IsNullOrWhiteSpace(this.Ddd3) ? "" : this.Ddd3), ""), + new Tuple("TERCEIRO TELEFONE", (string.IsNullOrWhiteSpace(this.Telefone3) ? "" : this.Telefone3), ""), + new Tuple("E-MAIL", (string.IsNullOrWhiteSpace(this.Email) ? "" : this.Email), ""), + new Tuple("CEP", (string.IsNullOrWhiteSpace(this.Cep) ? "" : this.Cep), ""), + new Tuple("ENDEREÇO", (string.IsNullOrWhiteSpace(this.Endereco) ? "" : this.Endereco), ""), + new Tuple("NÚMERO", (string.IsNullOrWhiteSpace(this.Numero) ? "" : this.Numero), ""), + new Tuple("COMPLEMENTO", (string.IsNullOrWhiteSpace(this.Complemento) ? "" : this.Complemento), ""), + new Tuple("BAIRRO", (string.IsNullOrWhiteSpace(this.Bairro) ? "" : this.Bairro), ""), + new Tuple("CIDADE", (string.IsNullOrWhiteSpace(this.Cidade) ? "" : this.Cidade), ""), + new Tuple("ESTADO", (string.IsNullOrWhiteSpace(this.Uf) ? "" : this.Uf), "") + } + } + }; + } + + public List> Validate() + { + int num; + int? nullable; + bool flag; + List> keyValuePairs = ValidationHelper.AddValue(); + string nome = this.Nome; + if (nome != null) + { + nullable = new int?((int)nome.Trim().Split(new char[] { ' ' }).Length); + } + else + { + nullable = null; + } + if (!nullable.HasValue) + { + keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); + } + else if (this.Nome.Length > 100) + { + keyValuePairs.AddValue("Nome", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (!string.IsNullOrEmpty(this.Cgccpf) && !this.Cgccpf.ValidacaoDocumento()) + { + keyValuePairs.AddValue("Cgccpf", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Ddd1) && !this.Ddd1.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("Ddd1|PRIMEIRO DDD", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Telefone1) && !this.Telefone1.ValidacaoTelefone()) + { + keyValuePairs.AddValue("Telefone1|PRIMEIRO TELEFONE", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Ddd2) && !this.Ddd2.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("Ddd2|SEGUNDO DDD", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Telefone2) && !this.Telefone2.ValidacaoTelefone()) + { + keyValuePairs.AddValue("Telefone2|SEGUNDO TELEFONE", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Ddd3) && !this.Ddd3.ValidacaoPrefixo()) + { + keyValuePairs.AddValue("Ddd3|TERCEIRO DDD", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.Telefone3) && !this.Telefone3.ValidacaoTelefone()) + { + keyValuePairs.AddValue("Telefone3|TERCEIRO TELEFONE", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(this.Email) && this.Email.Length > 100) + { + keyValuePairs.AddValue("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 100), true); + } + if (!string.IsNullOrEmpty(this.Email) && !this.Email.ValidacaoEmail()) + { + keyValuePairs.AddValue("Email|E-MAIL", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(this.Cep) && !this.Cep.ValidacaoCep()) + { + keyValuePairs.AddValue("Cep|CEP", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(this.Uf) && !this.Uf.ValidacaoEstado()) + { + keyValuePairs.AddValue("Uf|ESTADO", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(this.Numero) && !int.TryParse(this.Numero, out num)) + { + keyValuePairs.AddValue("Numero|NÚMERO", Messages.Invalido, true); + } + if (!string.IsNullOrEmpty(this.Numero)) + { + string numero = this.Numero; + if (numero != null) + { + flag = numero.Count() > 5; + } + else + { + flag = false; + } + if (flag) + { + keyValuePairs.AddValue("Numero|NÚMERO", Messages.Invalido, true); + } + } + return keyValuePairs; + } + } +} \ No newline at end of file -- cgit v1.2.3