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>> ValidationEvent => Validate; public List> Validate() { List> 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; } }