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/PlanoViewModel.cs | 147 --------------------- 1 file changed, 147 deletions(-) delete mode 100644 Gestor.Application/ViewModels/Financeiro/PlanoViewModel.cs (limited to 'Gestor.Application/ViewModels/Financeiro/PlanoViewModel.cs') 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>> Salvar() - { - List> keyValuePairs; - List> keyValuePairs1 = this.SelectedPlano.Validate(); - List> 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>> Validate() - { - List> keyValuePairs = new List>(); - bool flag = true; - List 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("Descricao", "UM PLANO COM ESSE NOME JÁ EXISTE.")); - } - List> keyValuePairs1 = keyValuePairs; - keyValuePairs = null; - return keyValuePairs1; - } - } -} \ No newline at end of file -- cgit v1.2.3