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 --- .../ViewModels/Financeiro/InfoExtratoViewModel.cs | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Codemerx/Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs (limited to 'Codemerx/Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs') diff --git a/Codemerx/Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs b/Codemerx/Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs new file mode 100644 index 0000000..d1a0c38 --- /dev/null +++ b/Codemerx/Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs @@ -0,0 +1,81 @@ +using Gestor.Application.Servicos.Financeiro; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Gestor.Application.ViewModels.Financeiro +{ + public class InfoExtratoViewModel : BaseFinanceiroViewModel + { + private readonly BancosContasServico _saldoServico; + + private Saldo _selectedSaldo; + + public bool _telaBancos + { + get; + set; + } + + public Saldo SelectedSaldo + { + get + { + return this._selectedSaldo; + } + set + { + if (value != null && !this._telaBancos) + { + value.set_DataFinal(null); + value.set_ValorFinal(null); + } + this._selectedSaldo = value; + base.OnPropertyChanged("SelectedSaldo"); + this.SelectedSaldo.Initialize(); + } + } + + public InfoExtratoViewModel(bool telaBancos) + { + this._telaBancos = telaBancos; + this._saldoServico = new BancosContasServico(); + } + + public async Task>> Salvar() + { + List> keyValuePairs; + List> keyValuePairs1 = this.SelectedSaldo.Validate(); + if (keyValuePairs1.Count <= 0) + { + if (!this._telaBancos) + { + this.SelectedSaldo.set_DataFinal(null); + this.SelectedSaldo.set_ValorFinal(null); + } + this.SelectedSaldo = await this._saldoServico.Save(this.SelectedSaldo); + if (this._saldoServico.Sucesso) + { + base.Alterar(false); + base.ToggleSnackBar("SALDO SALVO COM SUCESSO", true); + keyValuePairs = null; + } + else + { + keyValuePairs = null; + } + } + else + { + keyValuePairs = keyValuePairs1; + } + return keyValuePairs; + } + } +} \ No newline at end of file -- cgit v1.2.3