diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 17:17:46 +0000 |
| commit | 0440c722a221b8068bbf388c1c0c51f0faff0451 (patch) | |
| tree | 169cbf90c50ff7961db82ecb606c50c2a45a1688 /Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaGranizo.cs | |
| parent | 225aa1499e37faf9d38257caabbadc68d78b427e (diff) | |
| download | gestor-master.tar.gz gestor-master.zip | |
Diffstat (limited to 'Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaGranizo.cs')
| -rw-r--r-- | Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaGranizo.cs | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaGranizo.cs b/Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaGranizo.cs new file mode 100644 index 0000000..fe689b3 --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Seguros/CoberturaGranizo.cs @@ -0,0 +1,74 @@ +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 CoberturaGranizo : DomainBase, IDomain +{ + private string _variedade; + + private string _quadra; + + public Item Item { get; set; } + + public Granizo Granizo { get; set; } + + public string Variedade + { + get + { + return _variedade?.ToUpper(); + } + set + { + _variedade = value; + } + } + + public string Quadra + { + get + { + return _quadra?.ToUpper(); + } + set + { + _quadra = value; + } + } + + public decimal? Produtividade { get; set; } + + public decimal? Lmi { get; set; } + + public decimal? Premio { get; set; } + + public decimal? Area { get; set; } + + public DateTime? Plantio { get; set; } + + [JsonIgnore] + public Func<List<KeyValuePair<string, string>>> ValidationEvent => Validate; + + public List<KeyValuePair<string, string>> Validate() + { + List<KeyValuePair<string, string>> list = ValidationHelper.AddValue(); + if (Plantio.HasValue && (DateTime.Compare(Plantio.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Plantio.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("Plantio", string.Format(Messages.DataInvalida)); + } + if (string.IsNullOrWhiteSpace(Variedade) && Variedade.Length > 60) + { + list.AddValue("Variedade", string.Format(Messages.MaiorQueLimite, 60)); + } + if (string.IsNullOrWhiteSpace(Quadra) && Quadra.Length > 30) + { + list.AddValue("Quadra", string.Format(Messages.MaiorQueLimite, 30)); + } + return list; + } +} |