summaryrefslogtreecommitdiff
path: root/Gestor.Model/Gestor.Model.Domain.Seguros/ClienteTelefone.cs
blob: 6ca47cee6ee1ffc1cb8927564a8222799d03917d (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
using System;
using System.Collections.Generic;
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 ClienteTelefone : TelefoneBase, IDomain
{
	private string _observacao;

	public Cliente Cliente { get; set; }

	public int? Ordem { get; set; }

	[Log(true)]
	public string Observacao
	{
		get
		{
			return _observacao?.ToUpper();
		}
		set
		{
			_observacao = value;
		}
	}

	[JsonIgnore]
	public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate;

	public List<KeyValuePair<string, string>> Validate()
	{
		List<KeyValuePair<string, string>> list = ValidateBase();
		if (!string.IsNullOrWhiteSpace(Observacao) && Observacao.Length > 30)
		{
			list.AddValue("Observacao", string.Format(Messages.MaiorQueLimite, 30));
		}
		if (string.IsNullOrWhiteSpace(base.Numero))
		{
			list.AddValue("Numero", Messages.Obrigatorio);
		}
		if (string.IsNullOrWhiteSpace(base.Prefixo))
		{
			list.AddValue("Prefixo", Messages.Obrigatorio);
		}
		if (!base.Tipo.HasValue)
		{
			list.AddValue("Tipo", Messages.Obrigatorio);
		}
		return list;
	}
}