diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
| commit | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch) | |
| tree | e1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Gestor.Application/ViewModels/Financeiro/PlanoViewModel.cs | |
| parent | 674ca83ba9243a9e95a7568c797668dab6aee26a (diff) | |
| download | gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip | |
chore: location
Diffstat (limited to 'Gestor.Application/ViewModels/Financeiro/PlanoViewModel.cs')
| -rw-r--r-- | Gestor.Application/ViewModels/Financeiro/PlanoViewModel.cs | 147 |
1 files changed, 0 insertions, 147 deletions
diff --git a/Gestor.Application/ViewModels/Financeiro/PlanoViewModel.cs b/Gestor.Application/ViewModels/Financeiro/PlanoViewModel.cs deleted file mode 100644 index e62f957..0000000 --- a/Gestor.Application/ViewModels/Financeiro/PlanoViewModel.cs +++ /dev/null @@ -1,147 +0,0 @@ -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 PlanoViewModel : BaseFinanceiroViewModel
- {
- private readonly PlanoServico _planoServico;
-
- private Plano _selectedPlano;
-
- public Plano Cancel;
-
- public Plano SelectedPlano
- {
- get
- {
- return this._selectedPlano;
- }
- set
- {
- long? nullable;
- this._selectedPlano = value;
- if (value != null)
- {
- nullable = new long?(value.get_Id());
- }
- else
- {
- nullable = null;
- }
- base.VerificarEnables(nullable);
- base.OnPropertyChanged("SelectedPlano");
- }
- }
-
- public PlanoViewModel(Plano plano)
- {
- this._planoServico = new PlanoServico();
- this.Seleciona(plano);
- }
-
- public void Cancelar()
- {
- base.Loading(true);
- if (this.SelectedPlano.get_Id() != 0)
- {
- base.Alterar(false);
- base.Loading(false);
- return;
- }
- this.SelectedPlano = new Plano();
- base.Alterar(false);
- base.Loading(false);
- }
-
- public void Incluir()
- {
- Plano plano = new Plano();
- plano.set_Ativo(true);
- this.SelectedPlano = plano;
- base.Alterar(true);
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- List<KeyValuePair<string, string>> keyValuePairs1 = this.SelectedPlano.Validate();
- List<KeyValuePair<string, string>> keyValuePairs2 = keyValuePairs1;
- keyValuePairs2.AddRange(await this.Validate());
- keyValuePairs2 = null;
- if (keyValuePairs1.Count <= 0)
- {
- this.SelectedPlano = await this._planoServico.Save(this.SelectedPlano);
- if (this._planoServico.Sucesso)
- {
- base.Alterar(false);
- base.ToggleSnackBar("PLANO SALVO COM SUCESSO", true);
- keyValuePairs = null;
- }
- else
- {
- keyValuePairs = null;
- }
- }
- else
- {
- keyValuePairs = keyValuePairs1;
- }
- keyValuePairs1 = null;
- return keyValuePairs;
- }
-
- private async void Seleciona(Plano plano)
- {
- base.Loading(true);
- await base.PermissaoTela(27);
- if (plano != null)
- {
- this.SelectedPlano = plano;
- }
- else
- {
- Plano plano1 = new Plano();
- plano1.set_Descricao("");
- plano1.set_Ativo(true);
- this.SelectedPlano = plano1;
- }
- base.Loading(false);
- }
-
- public async Task<List<KeyValuePair<string, string>>> Validate()
- {
- List<KeyValuePair<string, string>> keyValuePairs = new List<KeyValuePair<string, string>>();
- bool flag = true;
- List<Plano> planos = await (new BaseServico()).BuscarPlanoAsync();
- if (planos.Count > 0)
- {
- planos.ForEach((Plano x) => {
- if (x.get_Id() == this.SelectedPlano.get_Id())
- {
- return;
- }
- if (x.get_Descricao() == this.SelectedPlano.get_Descricao())
- {
- flag = false;
- }
- });
- }
- if (!flag)
- {
- keyValuePairs.Add(new KeyValuePair<string, string>("Descricao", "UM PLANO COM ESSE NOME JÁ EXISTE."));
- }
- List<KeyValuePair<string, string>> keyValuePairs1 = keyValuePairs;
- keyValuePairs = null;
- return keyValuePairs1;
- }
- }
-}
\ No newline at end of file |