using Gestor.Model.Domain.Generic; using Gestor.Model.Helper; using Gestor.Model.Resources; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Runtime.CompilerServices; namespace Gestor.Model.Domain.Seguros { public class VendedorTelefone : TelefoneBase, IDomain { private string _nome; private string _email; public string Email { get { string str = this._email; if (str == null) { return null; } return str.ToLower().Trim(); } set { this._email = value; } } public string Nome { get { string str = this._nome; if (str != null) { return str.ToUpper(); } return null; } set { this._nome = value; } } [JsonIgnore] public Func>> ValidationEvent { get { VendedorTelefone vendedorTelefone = this; return new Func>>(vendedorTelefone.Validate); } } public Gestor.Model.Domain.Seguros.Vendedor Vendedor { get; set; } public VendedorTelefone() { } public List> Validate() { List> keyValuePairs = base.ValidateBase(false); if (string.IsNullOrWhiteSpace(this.Nome)) { keyValuePairs.AddValue("Nome", Messages.Obrigatorio, true); } if (!string.IsNullOrEmpty(this.Email) && this.Email.Length > 100) { keyValuePairs.AddValue("Email|E-MAIL", string.Format(Messages.MaiorQueLimite, 100), true); } if (!string.IsNullOrEmpty(this.Email) && !this.Email.ValidacaoEmail()) { keyValuePairs.AddValue("Email|E-MAIL", Messages.Invalido, true); } return keyValuePairs; } } }