diff options
Diffstat (limited to 'Decompiler/Gestor.Application.ViewModels.Financeiro/InfoExtratoViewModel.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.ViewModels.Financeiro/InfoExtratoViewModel.cs | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.ViewModels.Financeiro/InfoExtratoViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Financeiro/InfoExtratoViewModel.cs new file mode 100644 index 0000000..1cf33dc --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Financeiro/InfoExtratoViewModel.cs @@ -0,0 +1,64 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Servicos.Financeiro; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Financeiro; +using Gestor.Model.Domain.Generic; + +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 _selectedSaldo; + } + set + { + if (value != null && !_telaBancos) + { + value.DataFinal = null; + value.ValorFinal = null; + } + _selectedSaldo = value; + OnPropertyChanged("SelectedSaldo"); + ((DomainBase)SelectedSaldo).Initialize(); + } + } + + public InfoExtratoViewModel(bool telaBancos) + { + _telaBancos = telaBancos; + _saldoServico = new BancosContasServico(); + } + + public async Task<List<KeyValuePair<string, string>>> Salvar() + { + List<KeyValuePair<string, string>> list = SelectedSaldo.Validate(); + if (list.Count > 0) + { + return list; + } + if (!_telaBancos) + { + SelectedSaldo.DataFinal = null; + SelectedSaldo.ValorFinal = null; + } + SelectedSaldo = await _saldoServico.Save(SelectedSaldo); + if (!_saldoServico.Sucesso) + { + return null; + } + Alterar(alterar: false); + ToggleSnackBar("SALDO SALVO COM SUCESSO"); + return null; + } +} |