summaryrefslogtreecommitdiff
path: root/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorTelefone.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Seguros/VendedorTelefone.cs')
-rw-r--r--Gestor.Model/Gestor.Model.Domain.Seguros/VendedorTelefone.cs62
1 files changed, 62 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorTelefone.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorTelefone.cs
new file mode 100644
index 0000000..2eaa3f2
--- /dev/null
+++ b/Gestor.Model/Gestor.Model.Domain.Seguros/VendedorTelefone.cs
@@ -0,0 +1,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;
+ }
+}