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.Generic/TelefoneBase.cs | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 Gestor.Model/Gestor.Model.Domain.Generic/TelefoneBase.cs (limited to 'Gestor.Model/Gestor.Model.Domain.Generic/TelefoneBase.cs') diff --git a/Gestor.Model/Gestor.Model.Domain.Generic/TelefoneBase.cs b/Gestor.Model/Gestor.Model.Domain.Generic/TelefoneBase.cs new file mode 100644 index 0000000..04cbea5 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Generic/TelefoneBase.cs @@ -0,0 +1,61 @@ +using System.Collections.Generic; +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Helper; +using Gestor.Model.Resources; + +namespace Gestor.Model.Domain.Generic; + +public class TelefoneBase : DomainBase +{ + private string _numero; + + private string _prefixo; + + [Log(true)] + public TipoTelefone? Tipo { get; set; } + + [Log(true)] + public string Prefixo + { + get + { + return _prefixo?.ToUpper().Trim(); + } + set + { + _prefixo = value; + } + } + + [Log(true)] + public string Numero + { + get + { + return _numero?.ToUpper().Trim(); + } + set + { + _numero = value; + } + } + + public List> ValidateBase(bool obrigatorio = true) + { + List> list = ValidationHelper.AddValue(); + if (Tipo.HasValue && Tipo.GetValueOrDefault() != TipoTelefone.Gratuita && Tipo.GetValueOrDefault() != TipoTelefone.Internacional && Tipo.GetValueOrDefault() != TipoTelefone.Outros && Tipo.GetValueOrDefault() != TipoTelefone.Whatsapp && Tipo.GetValueOrDefault() != TipoTelefone.TarifaUnica && Tipo.GetValueOrDefault() != TipoTelefone.Comercial) + { + if (!string.IsNullOrWhiteSpace(Prefixo) && !Prefixo.ValidacaoPrefixo()) + { + list.AddValue("Prefixo|DDD", Messages.Invalido); + } + if (!string.IsNullOrWhiteSpace(Numero) && !Numero.ValidacaoTelefone()) + { + list.AddValue("Numero|TELEFONE", Messages.Invalido); + } + return list; + } + return list; + } +} -- cgit v1.2.3