From 0440c722a221b8068bbf388c1c0c51f0faff0451 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 14:17:46 -0300 Subject: some dlls --- .../Gestor.Model.Domain.Ferramentas/Recibo.cs | 134 +++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 Gestor.Model/Gestor.Model.Domain.Ferramentas/Recibo.cs (limited to 'Gestor.Model/Gestor.Model.Domain.Ferramentas/Recibo.cs') diff --git a/Gestor.Model/Gestor.Model.Domain.Ferramentas/Recibo.cs b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Recibo.cs new file mode 100644 index 0000000..e02140e --- /dev/null +++ b/Gestor.Model/Gestor.Model.Domain.Ferramentas/Recibo.cs @@ -0,0 +1,134 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Helper; +using Gestor.Model.Resources; +using Gestor.Model.Validation; +using Newtonsoft.Json; + +namespace Gestor.Model.Domain.Ferramentas; + +public class Recibo : DomainBase, IDomain +{ + [Log(true)] + public TipoRecibo? Tipo { get; set; } + + [Log(true)] + public TipoPagamento? Pagamento { get; set; } + + [Log(true)] + public decimal Valor { get; set; } + + [Log(true)] + [Description("DATA DO RECIBO")] + public DateTime? DataRecibo { get; set; } + + [Log(true)] + public string Pagante { get; set; } + + [Log(true)] + [Description("DOCUMENTO PAGANTE")] + public string DocumentoPagante { get; set; } + + [Log(true)] + public string Recebedor { get; set; } + + [Log(true)] + [Description("DOCUMENTO RECEBEDOR")] + public string DocumentoRecebedor { get; set; } + + [Log(true)] + public string Referente { get; set; } + + [JsonIgnore] + public Func>> ValidationEvent => Validate; + + public List> Validate() + { + List> list = ValidationHelper.AddValue(); + if (string.IsNullOrWhiteSpace(Referente)) + { + list.AddValue("Referente|REFERENTE À(AO)", Messages.Obrigatorio); + } + if (DataRecibo.HasValue && (DateTime.Compare(DataRecibo.Value, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(DataRecibo.Value, new DateTime(9999, 12, 31)) > 0)) + { + list.AddValue("DataRecibo|DATA DO RECIBO", Messages.Obrigatorio); + } + if (!DataRecibo.HasValue) + { + list.AddValue("DataRecibo|DATA DO RECIBO", Messages.Obrigatorio); + } + if (string.IsNullOrWhiteSpace(DocumentoPagante)) + { + list.AddValue("DocumentoPagante|DOCUMENTO DO PAGANTE", Messages.Obrigatorio); + } + else if (!DocumentoPagante.ValidacaoDocumento()) + { + list.AddValue("DocumentoPagante|DOCUMENTO DO PAGANTE", Messages.Invalido); + } + if (string.IsNullOrWhiteSpace(DocumentoRecebedor)) + { + list.AddValue("DocumentoRecebedor|DOCUMENTO DO RECEBEDOR", Messages.Obrigatorio); + } + else if (!DocumentoRecebedor.ValidacaoDocumento()) + { + list.AddValue("DocumentoRecebedor|DOCUMENTO DO RECEBEDOR", Messages.Invalido); + } + if (string.IsNullOrWhiteSpace(Recebedor)) + { + list.AddValue("Recebedor", Messages.Obrigatorio); + } + if (string.IsNullOrWhiteSpace(Pagante)) + { + list.AddValue("Pagante", Messages.Obrigatorio); + } + if (!Pagamento.HasValue) + { + list.AddValue("Pagamento|FORMA DE PAGAMENTO", Messages.Obrigatorio); + } + if (!string.IsNullOrWhiteSpace(Referente) && Referente.Length >= 255) + { + list.AddValue("Referente|REFERENTE À(AO)", string.Format(Messages.MaiorQueLimite, 255)); + } + return list; + } + + public List Log() + { + List list = new List(); + TupleList tupleList = new TupleList(); + ObservableCollection> obj = new ObservableCollection> + { + new Tuple("PAGANTE", string.IsNullOrWhiteSpace(Pagante) ? "" : Pagante, ""), + new Tuple("DOCUMENTO PAGANTE", string.IsNullOrWhiteSpace(DocumentoPagante) ? "" : DocumentoPagante, ""), + new Tuple("RECEBEDOR", string.IsNullOrWhiteSpace(Recebedor) ? "" : Recebedor, ""), + new Tuple("DOCUMENTO", string.IsNullOrWhiteSpace(DocumentoRecebedor) ? "" : DocumentoRecebedor, ""), + new Tuple("TIPO DO RECIBO", Tipo.GetDescription(), "") + }; + object item; + if (Pagamento.HasValue) + { + TipoPagamento? pagamento = Pagamento; + item = (pagamento.HasValue ? pagamento.GetValueOrDefault().GetDescription() : null); + } + else + { + item = ""; + } + obj.Add(new Tuple("PAGAMENTO", (string)item, "")); + obj.Add(new Tuple("VALOR", Valor.ToString(new CultureInfo("pt-BR")), "")); + obj.Add(new Tuple("DATA DO RECIBO", DataRecibo?.ToShortDateString(), "")); + obj.Add(new Tuple("PAGANTE", string.IsNullOrWhiteSpace(Pagante) ? "" : Pagante, "")); + obj.Add(new Tuple("RECEBEDOR", string.IsNullOrWhiteSpace(Recebedor) ? "" : Recebedor, "")); + obj.Add(new Tuple("REFERENTE", string.IsNullOrWhiteSpace(Referente) ? "" : Referente, "")); + tupleList.Tuples = obj; + list.Add(tupleList); + return list; + } +} -- cgit v1.2.3