summaryrefslogtreecommitdiff
path: root/Codemerx/Gestor.Model/Model.Domain.Generic/TelefoneBase.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
commit1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch)
treee1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Codemerx/Gestor.Model/Model.Domain.Generic/TelefoneBase.cs
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Codemerx/Gestor.Model/Model.Domain.Generic/TelefoneBase.cs')
-rw-r--r--Codemerx/Gestor.Model/Model.Domain.Generic/TelefoneBase.cs82
1 files changed, 82 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Model/Model.Domain.Generic/TelefoneBase.cs b/Codemerx/Gestor.Model/Model.Domain.Generic/TelefoneBase.cs
new file mode 100644
index 0000000..23f0cbe
--- /dev/null
+++ b/Codemerx/Gestor.Model/Model.Domain.Generic/TelefoneBase.cs
@@ -0,0 +1,82 @@
+using Gestor.Model.Attributes;
+using Gestor.Model.Common;
+using Gestor.Model.Helper;
+using Gestor.Model.Resources;
+using System;
+using System.Collections.Generic;
+using System.Runtime.CompilerServices;
+
+namespace Gestor.Model.Domain.Generic
+{
+ public class TelefoneBase : DomainBase
+ {
+ private string _numero;
+
+ private string _prefixo;
+
+ [Log(true)]
+ public string Numero
+ {
+ get
+ {
+ string str = this._numero;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._numero = value;
+ }
+ }
+
+ [Log(true)]
+ public string Prefixo
+ {
+ get
+ {
+ string str = this._prefixo;
+ if (str == null)
+ {
+ return null;
+ }
+ return str.ToUpper().Trim();
+ }
+ set
+ {
+ this._prefixo = value;
+ }
+ }
+
+ [Log(true)]
+ public TipoTelefone? Tipo
+ {
+ get;
+ set;
+ }
+
+ public TelefoneBase()
+ {
+ }
+
+ public List<KeyValuePair<string, string>> ValidateBase(bool obrigatorio = true)
+ {
+ List<KeyValuePair<string, string>> keyValuePairs = ValidationHelper.AddValue();
+ if (!this.Tipo.HasValue || this.Tipo.GetValueOrDefault() == TipoTelefone.Gratuita || this.Tipo.GetValueOrDefault() == TipoTelefone.Internacional || this.Tipo.GetValueOrDefault() == TipoTelefone.Outros || this.Tipo.GetValueOrDefault() == TipoTelefone.Whatsapp || this.Tipo.GetValueOrDefault() == TipoTelefone.TarifaUnica || this.Tipo.GetValueOrDefault() == TipoTelefone.Comercial)
+ {
+ return keyValuePairs;
+ }
+ if (!string.IsNullOrWhiteSpace(this.Prefixo) && !this.Prefixo.ValidacaoPrefixo())
+ {
+ keyValuePairs.AddValue<string, string>("Prefixo|DDD", Messages.Invalido, true);
+ }
+ if (!string.IsNullOrWhiteSpace(this.Numero) && !this.Numero.ValidacaoTelefone())
+ {
+ keyValuePairs.AddValue<string, string>("Numero|TELEFONE", Messages.Invalido, true);
+ }
+ return keyValuePairs;
+ }
+ }
+} \ No newline at end of file