From 674ca83ba9243a9e95a7568c797668dab6aee26a Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:35:25 -0300 Subject: feat: upload files --- .../Model.Domain.Financeiro/Transferencia.cs | 76 ++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 Gestor.Model/Model.Domain.Financeiro/Transferencia.cs (limited to 'Gestor.Model/Model.Domain.Financeiro/Transferencia.cs') diff --git a/Gestor.Model/Model.Domain.Financeiro/Transferencia.cs b/Gestor.Model/Model.Domain.Financeiro/Transferencia.cs new file mode 100644 index 0000000..8a12c2c --- /dev/null +++ b/Gestor.Model/Model.Domain.Financeiro/Transferencia.cs @@ -0,0 +1,76 @@ +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.Financeiro +{ + public class Transferencia + { + public DateTime Data + { + get; + set; + } + + public BancosContas Destino + { + get; + set; + } + + public BancosContas Origem + { + get; + set; + } + + [JsonIgnore] + public Func>> ValidationEvent + { + get + { + return new Func>>(this.Validate); + } + } + + public decimal Valor + { + get; + set; + } + + public Transferencia() + { + } + + public List> Validate() + { + List> keyValuePairs = ValidationHelper.AddValue(); + if (this.Origem == null) + { + keyValuePairs.AddValue("Origem", Messages.Obrigatorio, true); + } + if (this.Destino == null) + { + keyValuePairs.AddValue("Destino", Messages.Obrigatorio, true); + } + if (this.Origem != null && this.Destino != null && this.Origem.Id == this.Destino.Id) + { + keyValuePairs.AddValue("CONTAS", "A CONTA DE ORIGEM NÃO PODE SER A MESMA QUE A DESTINO.", true); + } + if (DateTime.Compare(this.Data, new DateTime(1753, 1, 1)) < 0 || DateTime.Compare(this.Data, new DateTime(9999, 12, 31)) > 0) + { + keyValuePairs.AddValue("Data", string.Format(Messages.DataInvalida, Array.Empty()), true); + } + if (this.Valor <= decimal.Zero) + { + keyValuePairs.AddValue("Valor", Messages.Obrigatorio, true); + } + return keyValuePairs; + } + } +} \ No newline at end of file -- cgit v1.2.3