summaryrefslogtreecommitdiff
path: root/Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs')
-rw-r--r--Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs81
1 files changed, 81 insertions, 0 deletions
diff --git a/Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs b/Gestor.Application/ViewModels/Financeiro/InfoExtratoViewModel.cs
new file mode 100644
index 0000000..d1a0c38
--- /dev/null
+++ b/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<List<KeyValuePair<string, string>>> Salvar()
+ {
+ List<KeyValuePair<string, string>> keyValuePairs;
+ List<KeyValuePair<string, string>> 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