blob: 04cbea583022850a22fa9c2ab6d85bd5ff125ca2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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<KeyValuePair<string, string>> ValidateBase(bool obrigatorio = true)
{
List<KeyValuePair<string, string>> 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;
}
}
|