From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../Model.Domain.Seguros/ResponsavelAssinatura.cs | 109 +++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 Codemerx/Gestor.Model/Model.Domain.Seguros/ResponsavelAssinatura.cs (limited to 'Codemerx/Gestor.Model/Model.Domain.Seguros/ResponsavelAssinatura.cs') diff --git a/Codemerx/Gestor.Model/Model.Domain.Seguros/ResponsavelAssinatura.cs b/Codemerx/Gestor.Model/Model.Domain.Seguros/ResponsavelAssinatura.cs new file mode 100644 index 0000000..6896680 --- /dev/null +++ b/Codemerx/Gestor.Model/Model.Domain.Seguros/ResponsavelAssinatura.cs @@ -0,0 +1,109 @@ +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 ResponsavelAssinatura : DomainBase, IDomain + { + public string DocumentoResponsavel + { + get; + set; + } + + public string EmailResponsavel + { + get; + set; + } + + public long IdCliente + { + get; + set; + } + + public string NomeResponsavel + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + ResponsavelAssinatura responsavelAssinatura = this; + return new Func>>(responsavelAssinatura.Validate); + } + } + + public ResponsavelAssinatura() + { + } + + public List> Validate() + { + int? nullable; + int? nullable1; + List> keyValuePairs = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(this.NomeResponsavel)) + { + nullable = null; + nullable1 = nullable; + } + else + { + string nomeResponsavel = this.NomeResponsavel; + if (nomeResponsavel != null) + { + nullable1 = new int?((int)nomeResponsavel.Trim().Split(new char[] { ' ' }).Length); + } + else + { + nullable = null; + nullable1 = nullable; + } + } + int? nullable2 = nullable1; + if (nullable2.HasValue) + { + nullable = nullable2; + if (nullable.GetValueOrDefault() <= 1 & nullable.HasValue) + { + keyValuePairs.AddValue("NomeResponsavel", Messages.NomeInvalido, true); + } + } + if (!string.IsNullOrWhiteSpace(this.DocumentoResponsavel) && !this.DocumentoResponsavel.ValidacaoDocumento()) + { + keyValuePairs.AddValue("DocumentoResponsavel", Messages.Invalido, true); + } + if (!string.IsNullOrWhiteSpace(this.EmailResponsavel) && !this.EmailResponsavel.ValidacaoEmail()) + { + keyValuePairs.AddValue("EmailResponsavel", Messages.Invalido, true); + } + if (nullable2.HasValue || !string.IsNullOrWhiteSpace(this.DocumentoResponsavel) || !string.IsNullOrWhiteSpace(this.EmailResponsavel)) + { + if (!nullable2.HasValue) + { + keyValuePairs.AddValue("NomeResponsavel", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.DocumentoResponsavel)) + { + keyValuePairs.AddValue("DocumentoResponsavel", Messages.Obrigatorio, true); + } + if (string.IsNullOrWhiteSpace(this.EmailResponsavel)) + { + keyValuePairs.AddValue("EmailResponsavel", Messages.Obrigatorio, true); + } + } + return keyValuePairs; + } + } +} \ No newline at end of file -- cgit v1.2.3