summaryrefslogtreecommitdiff
path: root/Gestor.Application/ViewModels/Drawer/ExpedicaoViewModel.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
commit1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch)
treee1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Gestor.Application/ViewModels/Drawer/ExpedicaoViewModel.cs
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Gestor.Application/ViewModels/Drawer/ExpedicaoViewModel.cs')
-rw-r--r--Gestor.Application/ViewModels/Drawer/ExpedicaoViewModel.cs196
1 files changed, 0 insertions, 196 deletions
diff --git a/Gestor.Application/ViewModels/Drawer/ExpedicaoViewModel.cs b/Gestor.Application/ViewModels/Drawer/ExpedicaoViewModel.cs
deleted file mode 100644
index 2aff10f..0000000
--- a/Gestor.Application/ViewModels/Drawer/ExpedicaoViewModel.cs
+++ /dev/null
@@ -1,196 +0,0 @@
-using Gestor.Application.Servicos.Generic;
-using Gestor.Application.Servicos.Seguros;
-using Gestor.Application.ViewModels.Generic;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Seguros;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.ViewModels.Drawer
-{
- public class ExpedicaoViewModel : BaseSegurosViewModel
- {
- private readonly ExpedicaoServico _servico;
-
- private readonly Documento _documento;
-
- private bool _carregando;
-
- private Expedicao _selectedExpedicao = new Expedicao();
-
- private ObservableCollection<Expedicao> _expedicoes = new ObservableCollection<Expedicao>();
-
- public bool Carregando
- {
- get
- {
- return this._carregando;
- }
- set
- {
- this._carregando = value;
- base.EnableMenu = !value;
- base.OnPropertyChanged("Carregando");
- }
- }
-
- public ObservableCollection<Expedicao> Expedicoes
- {
- get
- {
- return this._expedicoes;
- }
- set
- {
- this._expedicoes = value;
- base.OnPropertyChanged("Expedicoes");
- }
- }
-
- public Expedicao SelectedExpedicao
- {
- get
- {
- return this._selectedExpedicao;
- }
- set
- {
- long? nullable;
- this._selectedExpedicao = value;
- if (value != null)
- {
- nullable = new long?(value.get_Id());
- }
- else
- {
- nullable = null;
- }
- base.VerificarEnables(nullable);
- base.OnPropertyChanged("SelectedExpedicao");
- }
- }
-
- public ExpedicaoViewModel(Documento documento)
- {
- this._servico = new ExpedicaoServico();
- this._documento = documento;
- this.Seleciona(documento);
- }
-
- public async void CancelarAlteracao()
- {
- Expedicao expedicao;
- this.Carregando = true;
- long id = this.SelectedExpedicao.get_Id();
- await this.Carregar(this.SelectedExpedicao.get_Apolice());
- ExpedicaoViewModel expedicaoViewModel = this;
- if (this.Expedicoes.Count <= 0 || id <= (long)0)
- {
- expedicao = (this.Expedicoes.Count <= 0 || id != 0 ? new Expedicao() : this.Expedicoes.First<Expedicao>());
- }
- else
- {
- expedicao = this.Expedicoes.FirstOrDefault<Expedicao>((Expedicao x) => x.get_Id() == id);
- }
- expedicaoViewModel.SelectedExpedicao = expedicao;
- base.Alterar(false);
- this.Carregando = false;
- }
-
- private async Task Carregar(Documento documento)
- {
- this.Expedicoes = new ObservableCollection<Expedicao>(await this._servico.BuscarExpedicoes(documento));
- }
-
- public async Task<bool> Excluir()
- {
- bool flag;
- Expedicao expedicao;
- if (this.SelectedExpedicao == null || this.SelectedExpedicao.get_Id() == 0)
- {
- flag = false;
- }
- else if (await base.ShowMessage("DESEJA EXCLUIR?", "SIM", "NÃO", false))
- {
- this.Carregando = true;
- if (await this._servico.Delete(this.SelectedExpedicao))
- {
- int num = this.Expedicoes.IndexOf(this.SelectedExpedicao);
- this.Expedicoes.Remove(this.SelectedExpedicao);
- if (this.Expedicoes.Count <= 0)
- {
- this.SelectedExpedicao = new Expedicao();
- }
- else
- {
- ExpedicaoViewModel expedicaoViewModel = this;
- expedicao = (num < this.Expedicoes.Count ? this.Expedicoes.ElementAt<Expedicao>(num) : this.Expedicoes.Last<Expedicao>());
- expedicaoViewModel.SelectedExpedicao = expedicao;
- }
- this.Carregando = false;
- flag = true;
- }
- else
- {
- this.Carregando = false;
- flag = false;
- }
- }
- else
- {
- flag = false;
- }
- return flag;
- }
-
- public void Incluir()
- {
- Expedicao expedicao = new Expedicao();
- expedicao.set_Apolice(this._documento);
- this.SelectedExpedicao = expedicao;
- base.Alterar(true);
- }
-
- public async Task<List<KeyValuePair<string, string>>> Salvar()
- {
- List<KeyValuePair<string, string>> keyValuePairs;
- this.SelectedExpedicao = await this._servico.Save(this.SelectedExpedicao);
- if (this._servico.Sucesso)
- {
- long id = this.SelectedExpedicao.get_Id();
- await this.Carregar(this.SelectedExpedicao.get_Apolice());
- this.SelectedExpedicao = this.Expedicoes.FirstOrDefault<Expedicao>((Expedicao x) => x.get_Id() == id);
- base.Alterar(false);
- keyValuePairs = null;
- }
- else
- {
- keyValuePairs = null;
- }
- return keyValuePairs;
- }
-
- private async void Seleciona(Documento documento)
- {
- this.Carregando = true;
- await base.PermissaoTela(46);
- await this.Carregar(documento);
- if (this.Expedicoes.Count <= 0)
- {
- this.SelectedExpedicao = new Expedicao();
- base.Alterar(false);
- base.EnableMenu = false;
- }
- else
- {
- this.SelectedExpedicao = this.Expedicoes.First<Expedicao>();
- }
- this.Carregando = false;
- }
- }
-} \ No newline at end of file