From 0440c722a221b8068bbf388c1c0c51f0faff0451 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 14:17:46 -0300 Subject: some dlls --- .../Gestor.Model.Domain.Seguros/ClienteEndereco.cs | 123 +++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 Gestor.Model/Gestor.Model.Domain.Seguros/ClienteEndereco.cs (limited to 'Gestor.Model/Gestor.Model.Domain.Seguros/ClienteEndereco.cs') diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteEndereco.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteEndereco.cs new file mode 100644 index 0000000..c2086be --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteEndereco.cs @@ -0,0 +1,123 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using Gestor.Model.Attributes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Seguros; + +public class ClienteEndereco : EnderecoBase, IDomain, INotifyPropertyChanged +{ + private bool _selecionado; + + private string _observacao; + + public bool Selecionado + { + get + { + return _selecionado; + } + set + { + if (value != _selecionado) + { + _selecionado = value; + OnPropertyChanged("Selecionado"); + } + } + } + + [Log(true)] + public string Observacao + { + get + { + return _observacao?.ToUpper(); + } + set + { + _observacao = value; + } + } + + public Cliente Cliente { get; set; } + + public int? Ordem { get; set; } + + [JsonIgnore] + public Func>> ValidationEvent => Validate; + + public event PropertyChangedEventHandler PropertyChanged; + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) + { + this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + } + + public List> Validate() + { + List> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(base.Cep)) + { + list.AddValue("Cep", Messages.Obrigatorio); + } + else if (!base.Cep.ValidacaoCep()) + { + list.AddValue("Cep", Messages.Invalido); + } + if (string.IsNullOrWhiteSpace(base.Endereco)) + { + list.AddValue("Endereco", Messages.Obrigatorio); + } + else if (base.Endereco.Length > 150) + { + list.AddValue("Endereco", string.Format(Messages.MaiorQueLimite, 150)); + } + if (string.IsNullOrWhiteSpace(base.Numero)) + { + list.AddValue("Numero", Messages.Obrigatorio); + } + else if (base.Numero.Length > 6) + { + list.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 6)); + } + if (!string.IsNullOrWhiteSpace(base.Complemento) && base.Complemento.Length > 45) + { + list.AddValue("Complemento", string.Format(Messages.MaiorQueLimite, 45)); + } + if (string.IsNullOrWhiteSpace(base.Bairro)) + { + list.AddValue("Bairro", Messages.Obrigatorio); + } + else if (base.Bairro.Length > 100) + { + list.AddValue("Bairro", string.Format(Messages.MaiorQueLimite, 100)); + } + if (string.IsNullOrWhiteSpace(base.Cidade)) + { + list.AddValue("Cidade", Messages.Obrigatorio); + } + else if (base.Cidade.Length > 50) + { + list.AddValue("Cidade", string.Format(Messages.MaiorQueLimite, 50)); + } + if (string.IsNullOrWhiteSpace(base.Estado)) + { + list.AddValue("Estado", Messages.Obrigatorio); + } + else if (!base.Estado.ValidacaoEstado()) + { + list.AddValue("Estado", Messages.Invalido); + } + if (!string.IsNullOrWhiteSpace(Observacao) && Observacao.Length > 255) + { + list.AddValue("Observacao", string.Format(Messages.MaiorQueLimite, 255)); + } + return list; + } +} -- cgit v1.2.3