blob: 2eaa3f2ebae8e2635580b65be8d8b8d2889dfd97 (
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
62
|
using System;
using System.Collections.Generic;
using Gestor.Model.Domain.Generic;
using Gestor.Model.Helper;
using Gestor.Model.Resources;
using Newtonsoft.Json;
namespace Gestor.Model.Domain.Seguros;
public class VendedorTelefone : TelefoneBase, IDomain
{
private string _nome;
private string _email;
public Vendedor Vendedor { get; set; }
public string Nome
{
get
{
return _nome?.ToUpper();
}
set
{
_nome = value;
}
}
public string Email
{
get
{
return _email?.ToLower().Trim();
}
set
{
_email = value;
}
}
[JsonIgnore]
public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;
public List<KeyValuePair<string, string>> Validate()
{
List<KeyValuePair<string, string>> list = ValidateBase(obrigatorio: false);
if (string.IsNullOrWhiteSpace(Nome))
{
list.AddValue("Nome", Messages.Obrigatorio);
}
if (!string.IsNullOrEmpty(Email) && Email.Length > 100)
{
list.AddValue("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 100));
}
if (!string.IsNullOrEmpty(Email) && !Email.ValidacaoEmail())
{
list.AddValue("Email|E-MAIL", Messages.Invalido);
}
return list;
}
}
|