using System; using System.Collections.Generic; using Gestor.Model.Common; using Gestor.Model.Domain.Generic; using Gestor.Model.Helper; using Gestor.Model.Resources; using Newtonsoft.Json; namespace Gestor.Model.Domain.Seguros; public class Extrato : DomainBase, IDomain { private string _numero; private string _historico; private string _observacao; public long IdEmpresa { get; set; } public Seguradora Seguradora { get; set; } public StatusExtrato Status { get; set; } public bool Selecionado { get; set; } public string Numero { get { return _numero?.ToUpper(); } set { _numero = value; } } public string Historico { get { return _historico?.ToUpper(); } set { _historico = value; } } public DateTime? Data { get; set; } public DateTime? DataCredito { get; set; } public decimal? Bruto { get; set; } public decimal? Liquido { get; set; } public decimal? Ir { get; set; } public decimal? Iss { get; set; } public decimal? Outro { get; set; } public bool Completo { get; set; } public string Observacao { get { return _observacao?.ToUpper(); } set { _observacao = value; } } public virtual long IdUsuario { get; set; } [JsonIgnore] public Func>> ValidationEvent => Validate; public List> Validate() { List> list = ValidationHelper.AddValue(); if (!string.IsNullOrWhiteSpace(Numero) && Numero.Length > 50) { list.AddValue("Numero", string.Format(Messages.MaiorQueLimite, 50)); } if (Data.HasValue && (DateTime.Compare(Data.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(Data.Value, new DateTime(9999, 12, 31)) > 0)) { list.AddValue("Data", string.Format(Messages.DataInvalida)); } return list; } }