From 674ca83ba9243a9e95a7568c797668dab6aee26a Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:35:25 -0300 Subject: feat: upload files --- Gestor.Application/ViewModels/MenuItemViewModel.cs | 1048 ++++++++++++++++++++ 1 file changed, 1048 insertions(+) create mode 100644 Gestor.Application/ViewModels/MenuItemViewModel.cs (limited to 'Gestor.Application/ViewModels/MenuItemViewModel.cs') diff --git a/Gestor.Application/ViewModels/MenuItemViewModel.cs b/Gestor.Application/ViewModels/MenuItemViewModel.cs new file mode 100644 index 0000000..e51f2f6 --- /dev/null +++ b/Gestor.Application/ViewModels/MenuItemViewModel.cs @@ -0,0 +1,1048 @@ +using Gestor.Application.Actions; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Seguros.Itens; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; + +namespace Gestor.Application.ViewModels +{ + public class MenuItemViewModel : BaseSegurosViewModel + { + private readonly ItemServico _servico; + + private string _acaoItens = "MANTER"; + + private readonly Documento _documentoSelecionado; + + public bool AlterandoSelectedItem; + + private bool _endossoRenovacao; + + private ObservableCollection _itens = new ObservableCollection(); + + private ObservableCollection _itensFiltrados = new ObservableCollection(); + + private Item _selectedItem = new Item(); + + private bool _mostrarLista; + + private bool _isExpanded = true; + + private ManutencaoItem _manutencao; + + private object _view; + + private bool _allSelectedChanging; + + private bool? _allSelected = new bool?(false); + + private string _manterTodosText = "MANTER TODOS OS ITENS"; + + private string _manterText = "MANTER ITENS"; + + public bool? AllSelected + { + get + { + return this._allSelected; + } + set + { + bool? nullable = value; + bool? nullable1 = this._allSelected; + if (nullable.GetValueOrDefault() == nullable1.GetValueOrDefault() & nullable.HasValue == nullable1.HasValue) + { + return; + } + this._allSelected = value; + this.AllSelectedChanged(); + this.Itens = new ObservableCollection(this.Itens); + base.OnPropertyChanged("AllSelected"); + } + } + + private bool Carregando + { + get; + set; + } + + public bool EndossoRenovacao + { + get + { + return this._endossoRenovacao; + } + set + { + this._endossoRenovacao = value; + base.OnPropertyChanged("EndossoRenovacao"); + } + } + + public bool IsExpanded + { + get + { + return this._isExpanded; + } + set + { + this._isExpanded = value; + base.OnPropertyChanged("IsExpanded"); + } + } + + public ObservableCollection Itens + { + get + { + return this._itens; + } + set + { + this._itens = value; + base.OnPropertyChanged("Itens"); + } + } + + public ObservableCollection ItensFiltrados + { + get + { + return this._itensFiltrados; + } + set + { + this._itensFiltrados = value; + this.IsExpanded = (value != null ? value.Count > 0 : false); + foreach (Item itensFiltrado in this.ItensFiltrados) + { + itensFiltrado.add_PropertyChanged(new PropertyChangedEventHandler(this.EntryOnPropertyChanged)); + } + base.OnPropertyChanged("ItensFiltrados"); + } + } + + public string ManterText + { + get + { + return this._manterText; + } + set + { + this._manterText = value; + base.OnPropertyChanged("ManterText"); + } + } + + public string ManterTodosText + { + get + { + return this._manterTodosText; + } + set + { + this._manterTodosText = value; + base.OnPropertyChanged("ManterTodosText"); + } + } + + public ManutencaoItem Manutencao + { + get + { + return this._manutencao; + } + set + { + this._manutencao = value; + base.OnPropertyChanged("Manutencao"); + } + } + + public bool MostrarLista + { + get + { + return this._mostrarLista; + } + set + { + this._mostrarLista = value; + base.OnPropertyChanged("MostrarLista"); + } + } + + public long Ramo + { + get; + set; + } + + public Item SelectedItem + { + get + { + return this._selectedItem; + } + set + { + this.WorkOnSelectedItem(value); + this._selectedItem = value; + base.OnPropertyChanged("SelectedItem"); + } + } + + public object View + { + get + { + return this._view; + } + set + { + this._view = value; + base.OnPropertyChanged("View"); + } + } + + public MenuItemViewModel(long ramo, ManutencaoItem manutencao) + { + if (ramo == (long)6 || ramo == (long)7 || ramo == (long)9 || ramo == (long)10 || ramo == (long)53 || ramo == (long)66) + { + this._acaoItens = "MOVER"; + } + this._manterTodosText = string.Concat(this._acaoItens, " TODOS OS ITENS"); + this._manterText = string.Concat(this._acaoItens, " ITEM"); + this.Ramo = ramo; + this._servico = new ItemServico(); + this._documentoSelecionado = (manutencao == null ? ConsultaViewModel.DocumentoSelecionado : manutencao.get_Documento()); + if (manutencao != null && manutencao.get_Tipo() == 2) + { + ConsultaViewModel.FiltrarItens = 4; + } + this.Seleciona(manutencao == null); + if (manutencao == null) + { + return; + } + this.Manutencao = manutencao; + this.MostrarLista = true; + } + + private void AllSelectedChanged() + { + if (this._allSelectedChanging) + { + return; + } + try + { + this._allSelectedChanging = true; + if (this.AllSelected.HasValue) + { + this.ManterTodosText = (this.AllSelected.Value ? string.Concat(this._acaoItens, " ITENS SELECIONADOS") : string.Concat(this._acaoItens, " TODOS OS ITENS")); + foreach (Item iten in this.Itens) + { + iten.set_Selecionado(this.AllSelected.Value); + } + } + } + finally + { + this._allSelectedChanging = false; + } + } + + public async void CancelarItem(Item item) + { + if (item != null) + { + base.Loading(true); + await this._servico.Cancelar(item, string.Format("CANCELADO NO ENDOSSO ORDEM {0}", this.Manutencao.get_Documento().get_Ordem()), this.Manutencao.get_Documento().get_Id()); + base.ToggleSnackBar("ITEM CANCELADO COM SUCESSO", true); + base.Loading(false); + this.RecarregarItens(item); + } + } + + private void EntryOnPropertyChanged(object sender, PropertyChangedEventArgs args) + { + if (args.PropertyName == "Selecionado") + { + this.RecheckAllSelected(); + } + } + + internal async Task> Filtrar(string value) + { + List items = await Task.Run>(() => this.FiltrarItem(value)); + return items; + } + + public List FiltrarItem(string filter) + { + this.ItensFiltrados = (string.IsNullOrWhiteSpace(filter) ? this.Itens : new ObservableCollection( + from x in this.Itens + where ValidationHelper.RemoveDiacritics(x.get_Descricao().Trim()).ToUpper().Contains(ValidationHelper.RemoveDiacritics(filter)) + orderby x.get_Ordem() + select x)); + return this.ItensFiltrados.ToList(); + } + + private async void Load(bool substituir = false, ManutencaoItem manutencao = null) + { + long ramo = this.Ramo; + if (ramo <= (long)38) + { + long num = ramo - (long)1; + if (num <= (long)19) + { + switch ((uint)num) + { + case 0: + case 1: + case 2: + case 14: + case 17: + { + goto Label3; + } + case 3: + case 7: + case 10: + case 11: + case 13: + case 15: + case 16: + case 18: + { + if (this.View == null || !(this.View.GetType() == typeof(RiscosDiversosView))) + { + this.View = new RiscosDiversosView(this, false, substituir, manutencao, null, null, this.EndossoRenovacao); + } + else + { + await ((RiscosDiversosView)this.View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((RiscosDiversosView)this.View).Substituir(); + } + if (manutencao != null) + { + ((RiscosDiversosView)this.View).Manter(manutencao); + } + return; + } + base.IsVisible = Visibility.Visible; + return; + } + case 4: + { + goto Label5; + } + case 5: + case 6: + case 8: + case 9: + { + goto Label0; + } + case 12: + { + if (this.View == null || !(this.View.GetType() == typeof(AeronauticoView))) + { + this.View = new AeronauticoView(this, false, substituir, manutencao, null, null, this.EndossoRenovacao); + base.IsVisible = Visibility.Visible; + return; + } + else + { + await ((AeronauticoView)this.View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((AeronauticoView)this.View).Substituir(); + } + if (manutencao != null) + { + ((AeronauticoView)this.View).Manter(manutencao); + } + return; + } + } + case 19: + { + if (this.View == null || !(this.View.GetType() == typeof(GranizoView))) + { + this.View = new GranizoView(this, false, substituir, manutencao, null, null, this.EndossoRenovacao); + base.IsVisible = Visibility.Visible; + return; + } + else + { + await ((GranizoView)this.View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((GranizoView)this.View).Substituir(); + } + if (manutencao != null) + { + ((GranizoView)this.View).Manter(manutencao); + } + return; + } + } + } + } + else + { + } + if (ramo != (long)30) + { + long num1 = ramo - (long)36; + if (num1 <= (long)2) + { + switch ((uint)num1) + { + case 0: + { + if (this.View == null || !(this.View.GetType() == typeof(ConsorcioView))) + { + this.View = new ConsorcioView(this, false, substituir, manutencao, null, null, this.EndossoRenovacao); + base.IsVisible = Visibility.Visible; + return; + } + else + { + await ((ConsorcioView)this.View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((ConsorcioView)this.View).Substituir(); + } + if (manutencao != null) + { + ((ConsorcioView)this.View).Manter(manutencao); + } + return; + } + } + case 1: + { + goto Label5; + } + case 2: + { + break; + } + default: + { + if (this.View == null || !(this.View.GetType() == typeof(RiscosDiversosView))) + { + this.View = new RiscosDiversosView(this, false, substituir, manutencao, null, null, this.EndossoRenovacao); + } + else + { + await ((RiscosDiversosView)this.View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((RiscosDiversosView)this.View).Substituir(); + } + if (manutencao != null) + { + ((RiscosDiversosView)this.View).Manter(manutencao); + } + return; + } + base.IsVisible = Visibility.Visible; + return; + } + } + } + else + { + if (this.View == null || !(this.View.GetType() == typeof(RiscosDiversosView))) + { + this.View = new RiscosDiversosView(this, false, substituir, manutencao, null, null, this.EndossoRenovacao); + } + else + { + await ((RiscosDiversosView)this.View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((RiscosDiversosView)this.View).Substituir(); + } + if (manutencao != null) + { + ((RiscosDiversosView)this.View).Manter(manutencao); + } + return; + } + base.IsVisible = Visibility.Visible; + return; + } + } + Label3: + if (this.View == null || !(this.View.GetType() == typeof(PatrimonialView))) + { + this.View = new PatrimonialView(this, false, substituir, manutencao, null, null, this.EndossoRenovacao); + base.IsVisible = Visibility.Visible; + return; + } + else + { + await ((PatrimonialView)this.View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((PatrimonialView)this.View).Substituir(); + } + if (manutencao != null) + { + ((PatrimonialView)this.View).Manter(manutencao); + } + return; + } + } + else if (ramo == (long)47 || ramo == (long)53 || ramo == (long)66) + { + goto Label0; + } + if (this.View == null || !(this.View.GetType() == typeof(RiscosDiversosView))) + { + this.View = new RiscosDiversosView(this, false, substituir, manutencao, null, null, this.EndossoRenovacao); + } + else + { + await ((RiscosDiversosView)this.View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((RiscosDiversosView)this.View).Substituir(); + } + if (manutencao != null) + { + ((RiscosDiversosView)this.View).Manter(manutencao); + } + return; + } + base.IsVisible = Visibility.Visible; + return; + Label0: + if (this.View == null || !(this.View.GetType() == typeof(VidaView))) + { + this.View = new VidaView(this, false, substituir, manutencao, null, null, this.EndossoRenovacao); + base.IsVisible = Visibility.Visible; + return; + } + else + { + await ((VidaView)this.View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((VidaView)this.View).Substituir(); + } + if (manutencao != null) + { + ((VidaView)this.View).Manter(manutencao); + } + return; + } + Label5: + if (this.View == null || !(this.View.GetType() == typeof(AutoView))) + { + this.View = new AutoView(this, false, substituir, manutencao, null, null, this.EndossoRenovacao); + base.IsVisible = Visibility.Visible; + return; + } + else + { + await ((AutoView)this.View).Selecionar(ConsultaViewModel.ItemSelecionado); + if (substituir) + { + ((AutoView)this.View).Substituir(); + } + if (manutencao != null) + { + ((AutoView)this.View).Manter(manutencao); + } + return; + } + } + + public void Manter(Item item) + { + Action enableMenu = Gestor.Application.Actions.Actions.EnableMenu; + if (enableMenu != null) + { + enableMenu(false); + } + else + { + } + ConsultaViewModel.ItemSelecionado = item; + this.Load(false, this.Manutencao); + } + + public async void ManterItens() + { + Item item; + List items; + Item item1; + bool flag; + Item item2; + Action enableMenu = Gestor.Application.Actions.Actions.EnableMenu; + if (enableMenu != null) + { + enableMenu(false); + } + else + { + } + Action enableMainMenu = Gestor.Application.Actions.Actions.EnableMainMenu; + if (enableMainMenu != null) + { + enableMainMenu(false); + } + else + { + } + base.Loading(true); + int num = 1; + if (this.ManterTodosText == string.Concat(this._acaoItens, " TODOS OS ITENS")) + { + items = new List(this.Itens); + } + else + { + ObservableCollection itens = this.Itens; + items = new List( + from x in itens + where x.get_Selecionado() + select x); + } + Label6: + foreach (Item item3 in items) + { + item = await this._servico.BuscarItemPorIdAsync(item3.get_Id()); + item2 = item; + item1 = item2; + ObservableCollection observableCollection = await this._servico.BuscarCoberturasPorItemAsync(item3.get_Id()); + item1.set_Coberturas(observableCollection); + item1 = null; + flag = false; + item2.set_Id((long)0); + item2.set_Sinistrado(false); + item2.set_Sinistros(null); + item2.set_Documento(ConsultaViewModel.DocumentoSelecionado); + item2.set_Ordem(new int?(num)); + num++; + foreach (Cobertura cobertura in item2.get_Coberturas()) + { + cobertura.set_Id((long)0); + cobertura.set_Item(item2); + } + long ramo = this.Ramo; + if (ramo > (long)36) + { + if (ramo == (long)37) + { + goto Label1; + } + if (ramo == (long)53 || ramo == (long)66) + { + goto Label2; + } + } + else + { + long num1 = ramo - (long)1; + if (num1 <= (long)19) + { + switch ((uint)num1) + { + case 0: + case 1: + case 2: + case 14: + case 17: + { + item1 = item2; + Patrimonial patrimonial = await this._servico.BuscaPatrimonial(item3.get_Id()); + item1.set_Patrimonial(patrimonial); + item1 = null; + item2.get_Patrimonial().set_Item(item2); + item2.get_Patrimonial().set_Id((long)0); + goto Label3; + } + case 3: + case 7: + case 10: + case 11: + case 13: + case 15: + case 16: + case 18: + { + goto Label4; + } + case 4: + { + goto Label1; + } + case 5: + case 6: + case 8: + case 9: + { + goto Label2; + } + case 12: + { + item1 = item2; + Aeronautico aeronautico = await this._servico.BuscaAeronautico(item3.get_Id()); + item1.set_Aeronautico(aeronautico); + item1 = null; + item2.get_Aeronautico().set_Item(item2); + item2.get_Aeronautico().set_Id((long)0); + goto Label3; + } + case 19: + { + item1 = item2; + Granizo granizo = await this._servico.BuscaGranizo(item3.get_Id()); + item1.set_Granizo(granizo); + item1 = null; + item2.get_Granizo().set_Item(item2); + item2.get_Granizo().set_Id((long)0); + goto Label3; + } + } + } + else + { + } + if (ramo != (long)36) + { + goto Label4; + } + item1 = item2; + Consorcio consorcio = await this._servico.BuscaConsorcio(item3.get_Id()); + item1.set_Consorcio(consorcio); + item1 = null; + item2.get_Consorcio().set_Item(item2); + item2.get_Consorcio().set_Id((long)0); + goto Label3; + } + Label4: + item1 = item2; + RiscosDiversos riscosDiverso = await this._servico.BuscaRiscosDiversos(item3.get_Id()); + item1.set_RiscosDiversos(riscosDiverso); + item1 = null; + item2.get_RiscosDiversos().set_Item(item2); + item2.get_RiscosDiversos().set_Id((long)0); + goto Label3; + } + base.Loading(false); + Action action = Gestor.Application.Actions.Actions.EnableMenu; + if (action != null) + { + action(true); + } + else + { + } + Action enableMainMenu1 = Gestor.Application.Actions.Actions.EnableMainMenu; + if (enableMainMenu1 != null) + { + enableMainMenu1(true); + } + else + { + } + if (this.ItensFiltrados.Count != 0) + { + this.AllSelected = new bool?(false); + this.ManterTodosText = string.Concat(this._acaoItens, " TODOS OS ITENS"); + this.SelecionaItem(this.ItensFiltrados.First()); + } + else + { + Action acessaTela = Gestor.Application.Actions.Actions.AcessaTela; + if (acessaTela != null) + { + acessaTela(21, ""); + } + else + { + } + } + return; + Label1: + item1 = item2; + Auto auto = await this._servico.BuscaAuto(item3.get_Id()); + item1.set_Auto(auto); + item1 = null; + item2.get_Auto().set_Item(item2); + item2.get_Auto().set_Id((long)0); + if (item2.get_Auto() != null && item2.get_Auto().get_Placa() == null) + { + await base.ShowMessage(string.Format("ITEM {0} ENCONTRADO SEM PLACA.", item2.get_Ordem()), "OK", "", false); + base.Loading(false); + Action enableMenu1 = Gestor.Application.Actions.Actions.EnableMenu; + if (enableMenu1 != null) + { + enableMenu1(true); + } + else + { + } + Action action1 = Gestor.Application.Actions.Actions.EnableMainMenu; + if (action1 != null) + { + action1(true); + } + else + { + } + return; + } + Label3: + item2.set_Status(""); + item3.set_Substituido(null); + item = await this._servico.Save(item2); + item2 = item; + if (flag && item2.get_Id() != item3.get_Id()) + { + List titularesVidas = await this._servico.BuscaTitularesVida(item3.get_Id()); + if (titularesVidas.Count > 0) + { + titularesVidas.ForEach((TitularesVida t) => t.set_IdItem(this.itemManter.get_Id())); + await this._servico.SaveTitulares(titularesVidas); + } + } + this.ItensFiltrados.Remove(item3); + this.Itens.Remove(item3); + item3 = null; + goto Label6; + Label2: + item1 = item2; + Vida vida = await this._servico.BuscaVida(item3.get_Id()); + item1.set_Vida(vida); + item1 = null; + item2.get_Vida().set_Item(item2); + item2.get_Vida().set_Id((long)0); + flag = true; + goto Label3; + goto Label4; + } + + public async void Reativar(Item item) + { + if (item != null) + { + base.Loading(true); + await this._servico.Reativar(item, string.Concat("ITEM REATIVADO PELO USUARIO ", Recursos.Usuario.get_Nome())); + base.ToggleSnackBar("ITEM REATIVADO COM SUCESSO", true); + base.Loading(false); + this.RecarregarItens(item); + } + } + + public async void RecarregarItens(Item item) + { + // + // Current member / type: System.Void Gestor.Application.ViewModels.MenuItemViewModel::RecarregarItens(Gestor.Model.Domain.Seguros.Item) + // File path: C:\AggerSeguros\Gestor.Application.exe + // + // Product version: 0.0.0.0 + // Exception in: System.Void RecarregarItens(Gestor.Model.Domain.Seguros.Item) + // + // Object reference not set to an instance of an object. + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.FindLowestCommonAncestor(ICollection`1 typeNodes) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 515 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.MergeWithLowestCommonAncestor() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 459 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.ProcessSingleConstraints() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 378 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.InferTypes() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 331 + // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.Process(DecompilationContext theContext, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\ExpressionDecompilerStep.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileStateMachine(MethodBody body, DecompilationContext enclosingContext, BaseStateMachineRemoverStep removeStateMachineStep, Func`2 stateMachineDataSelector, DecompilationContext& decompilationContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileAsyncStateMachine(MethodBody body, DecompilationContext enclosingContext, AsyncData& asyncData) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 150 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.GetMoveNextStatements() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 155 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Match() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 76 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Process(DecompilationContext context, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 36 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61 + // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 133 + // + // mailto: JustDecompilePublicFeedback@telerik.com + + } + + private void RecheckAllSelected() + { + if (this._allSelectedChanging) + { + return; + } + try + { + this._allSelectedChanging = true; + if (this.Itens.All((Item e) => e.get_Selecionado())) + { + this.AllSelected = new bool?(true); + this.ManterTodosText = string.Concat(this._acaoItens, " ITENS SELECIONADOS"); + } + else if (!this.Itens.All((Item e) => !e.get_Selecionado())) + { + this.AllSelected = null; + this.ManterTodosText = string.Concat(this._acaoItens, " ITENS SELECIONADOS"); + } + else + { + this.AllSelected = new bool?(false); + this.ManterTodosText = string.Concat(this._acaoItens, " TODOS OS ITENS"); + } + } + finally + { + this._allSelectedChanging = false; + } + } + + public async void Seleciona(bool item = true) + { + if (!item || ConsultaViewModel.ItemSelecionado != null) + { + await this.SelecionaItens(ConsultaViewModel.FiltrarItens, ConsultaViewModel.ItemSelecionado); + } + else + { + this.Load(false, null); + } + } + + public void SelecionaItem(Item item) + { + if (this.Carregando) + { + return; + } + this.AlterandoSelectedItem = true; + this.SelectedItem = item; + ConsultaViewModel.ItemSelecionado = this.SelectedItem; + this.AlterandoSelectedItem = false; + } + + public async Task SelecionaItens(int type, Item item = null) + { + bool count; + Item item1; + base.Loading(true); + this.Carregando = true; + switch (type) + { + case 1: + case 2: + { + this.Itens = await this._servico.BuscarItens(this._documentoSelecionado.get_Id(), 2); + break; + } + case 3: + { + this.Itens = await this._servico.BuscarItens(this._documentoSelecionado.get_Controle().get_Id(), 1); + break; + } + case 4: + { + this.Itens = await this._servico.BuscarItens(this._documentoSelecionado.get_Controle().get_Id(), 3); + break; + } + default: + { + this.Itens = await this._servico.BuscarItens(this._documentoSelecionado.get_Controle().get_Id(), 0); + break; + } + } + this.ItensFiltrados = this.Itens; + if (item != null && item.get_Id() > (long)0) + { + this.AlterandoSelectedItem = true; + MenuItemViewModel menuItemViewModel = this; + if (this.ItensFiltrados == null || this.ItensFiltrados.Count <= 0) + { + item1 = null; + } + else + { + item1 = this.ItensFiltrados.FirstOrDefault((Item x) => x.get_Id() == item.get_Id()); + } + menuItemViewModel.SelectedItem = item1; + Action scrollToItem = Gestor.Application.Actions.Actions.ScrollToItem; + if (scrollToItem != null) + { + scrollToItem(); + } + else + { + } + this.AlterandoSelectedItem = false; + } + MenuItemViewModel menuItemViewModel1 = this; + if (this.MostrarLista) + { + count = true; + } + else + { + ObservableCollection itens = this.Itens; + if (itens != null) + { + count = itens.Count > 1; + } + else + { + count = false; + } + } + menuItemViewModel1.MostrarLista = count; + this.Carregando = false; + base.Loading(false); + } + + public void Substituir(Item item) + { + Action enableMenu = Gestor.Application.Actions.Actions.EnableMenu; + if (enableMenu != null) + { + enableMenu(false); + } + else + { + } + ConsultaViewModel.ItemSelecionado = item; + this.Load(true, null); + } + + private void WorkOnSelectedItem(Item value) + { + ConsultaViewModel.ItemSelecionado = value; + this.Load(false, null); + } + } +} \ No newline at end of file -- cgit v1.2.3