From 225aa1499e37faf9d38257caabbadc68d78b427e Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 12:29:41 -0300 Subject: decompiler.com --- .../DialogPesquisaAvancadaViewModel.cs | 503 +++++++++++++++++++++ 1 file changed, 503 insertions(+) create mode 100644 Decompiler/Gestor.Application.ViewModels.Generic/DialogPesquisaAvancadaViewModel.cs (limited to 'Decompiler/Gestor.Application.ViewModels.Generic/DialogPesquisaAvancadaViewModel.cs') diff --git a/Decompiler/Gestor.Application.ViewModels.Generic/DialogPesquisaAvancadaViewModel.cs b/Decompiler/Gestor.Application.ViewModels.Generic/DialogPesquisaAvancadaViewModel.cs new file mode 100644 index 0000000..b4985fd --- /dev/null +++ b/Decompiler/Gestor.Application.ViewModels.Generic/DialogPesquisaAvancadaViewModel.cs @@ -0,0 +1,503 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.ViewModels.Generic; + +public class DialogPesquisaAvancadaViewModel : BaseSegurosViewModel +{ + private ObservableCollection _pesquisas = new ObservableCollection(); + + private PesquisaAvancada _resultado = new PesquisaAvancada(); + + private string _pesquisa; + + private FiltroStatusDocumento _status; + + private TipoTela _tela; + + private TipoFiltroBusca _tipoFiltro; + + private bool _habilitarFiltroBuscar; + + private FiltroStatusDocumento _oldStatus; + + private bool _enableStatus = true; + + public bool TipoBusca; + + public ObservableCollection Pesquisas + { + get + { + return _pesquisas; + } + set + { + _pesquisas = value; + OnPropertyChanged("Pesquisas"); + } + } + + public PesquisaAvancada Resultado + { + get + { + return _resultado; + } + set + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + if (value != null) + { + value.Status = Status; + } + _resultado = value; + OnPropertyChanged("Resultado"); + } + } + + public string Pesquisa + { + get + { + return _pesquisa; + } + set + { + _pesquisa = value; + OnPropertyChanged("Pesquisa"); + } + } + + public FiltroStatusDocumento Status + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _status; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + _status = value; + _oldStatus = value; + if (Resultado != null) + { + Resultado.Status = Status; + } + OnPropertyChanged("Status"); + } + } + + public TipoTela Tela + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _tela; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _tela = value; + OnPropertyChanged("Tela"); + } + } + + public TipoFiltroBusca TipoFiltro + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _tipoFiltro; + } + set + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + _tipoFiltro = value; + OnPropertyChanged("TipoFiltro"); + } + } + + public bool HabilitarFiltroBuscar + { + get + { + return _habilitarFiltroBuscar; + } + set + { + _habilitarFiltroBuscar = value; + OnPropertyChanged("HabilitarFiltroBuscar"); + } + } + + private TipoPesquisa _tipo { get; set; } = (TipoPesquisa)14; + + + public TipoPesquisa Tipo + { + get + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + return _tipo; + } + set + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Invalid comparison between Unknown and I4 + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0004: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Invalid comparison between Unknown and I4 + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Invalid comparison between Unknown and I4 + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Invalid comparison between Unknown and I4 + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Invalid comparison between Unknown and I4 + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Invalid comparison between Unknown and I4 + if ((int)value == 1 || (int)value == 2 || (int)value == 17 || (int)value == 9) + { + EnableStatus = false; + FiltroStatusDocumento oldStatus = _oldStatus; + Status = (FiltroStatusDocumento)4; + _oldStatus = oldStatus; + } + else if ((int)_tipo == 1 || (int)_tipo == 2) + { + EnableStatus = true; + Status = _oldStatus; + } + _tipo = value; + GetTipoTela(); + HabilitarBusca(); + OnPropertyChanged("Tipo"); + } + } + + public bool EnableStatus + { + get + { + return _enableStatus; + } + set + { + _enableStatus = value; + OnPropertyChanged("EnableStatus"); + } + } + + public string Informacao => "O LIMITE DA PESQUISA É EM MIL ITENS,\r\nPARA OBTER UMA EXATIDÃO NA PESQUISA É NECESSÁRIO ESPECIFICAR O ITEM PROCURADO."; + + public void GetTipoTela() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Expected I4, but got Unknown + TipoPesquisa tipo = Tipo; + switch ((int)tipo) + { + case 1: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 10: + case 11: + case 12: + case 13: + case 15: + case 16: + case 17: + Tela = (TipoTela)21; + break; + case 0: + case 14: + Tela = (TipoTela)3; + break; + case 2: + case 9: + Tela = (TipoTela)7; + break; + } + } + + public void HabilitarBusca() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Expected I4, but got Unknown + TipoPesquisa tipo = Tipo; + switch ((int)tipo) + { + case 0: + case 4: + case 6: + case 8: + case 10: + case 13: + case 14: + HabilitarFiltroBuscar = true; + break; + case 1: + case 2: + TipoFiltro = (TipoFiltroBusca)1; + HabilitarFiltroBuscar = false; + break; + default: + TipoFiltro = (TipoFiltroBusca)0; + HabilitarFiltroBuscar = false; + break; + } + } + + public void GetTipoPesquisa() + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_000c: Invalid comparison between Unknown and I4 + TipoFiltroBusca tipoFiltro = _tipoFiltro; + if ((int)tipoFiltro != 0) + { + if ((int)tipoFiltro == 1) + { + TipoBusca = true; + } + } + else + { + TipoBusca = false; + } + } + + public async Task Pesquisar() + { + List list = ((Recursos.Usuario != null) ? (await VerificaVinculoVendedor(Recursos.Usuario)) : new List()); + List vendedorVinculado = list; + GetTipoPesquisa(); + TipoPesquisa tipo = Tipo; + switch ((int)tipo) + { + case 5: + Pesquisas = new ObservableCollection(await new PatrimonialServico().BuscarImobiliaria(Pesquisa, Status, vendedorVinculado)); + break; + case 7: + Pesquisas = new ObservableCollection(await new PatrimonialServico().BuscarLocatario(Pesquisa, Status, vendedorVinculado)); + break; + case 10: + Pesquisas = new ObservableCollection((await new ApoliceServico().BuscarApolice(Pesquisa, Status, vendedorVinculado, "Proposta", TipoBusca)).Select(delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + PesquisaAvancada val7 = new PesquisaAvancada(); + val7.IdCliente = ((DomainBase)x.Controle.Cliente).Id; + val7.IdDocumento = ((DomainBase)x).Id; + val7.Nome = x.Controle.Cliente.Nome; + val7.Pesquisa = "NÚMERO DA PROPOSTA: " + x.Proposta + " - NÚMERO DA APÓLICE: " + x.Apolice + " - NÚMERO DO ENDOSSO: " + x.Endosso; + return val7; + }).ToList()); + break; + case 11: + Pesquisas = new ObservableCollection(((IEnumerable)(await new ApoliceServico().BuscarApolice(Pesquisa, Status, vendedorVinculado, "NumeroEndosso", TipoBusca))).Select((Func)((Documento x) => new PesquisaAvancada + { + IdCliente = ((DomainBase)x.Controle.Cliente).Id, + IdDocumento = ((DomainBase)x).Id, + Nome = x.Controle.Cliente.Nome, + Pesquisa = "NÚMERO DA APÓLICE: " + x.Apolice + " - NÚMERO DO ENDOSSO: " + x.Endosso + })).ToList()); + break; + case 15: + Pesquisas = new ObservableCollection((await new ApoliceServico().BuscarApolice(Pesquisa, Status, vendedorVinculado, "PedidoEndosso", TipoBusca)).Select(delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + PesquisaAvancada val6 = new PesquisaAvancada(); + val6.IdCliente = ((DomainBase)x.Controle.Cliente).Id; + val6.IdDocumento = ((DomainBase)x).Id; + val6.Nome = x.Controle.Cliente.Nome; + val6.Pesquisa = "PROPOSTA ENDOSSO: " + x.PropostaEndosso + " - NÚMERO DA APÓLICE: " + x.Apolice + " - NÚMERO DO ENDOSSO: " + x.Endosso; + return val6; + }).ToList()); + break; + case 8: + Pesquisas = new ObservableCollection((await new ApoliceServico().BuscarApolice(Pesquisa, Status, vendedorVinculado, "", TipoBusca)).Select(delegate(Documento x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + PesquisaAvancada val5 = new PesquisaAvancada(); + val5.IdCliente = ((DomainBase)x.Controle.Cliente).Id; + val5.IdDocumento = ((DomainBase)x).Id; + val5.Nome = x.Controle.Cliente.Nome; + val5.Pesquisa = ((!x.Vigencia2.HasValue) ? $"NÚMERO DA APÓLICE: {x.Apolice} - VIGÊNCIA INICIAL: {x.Vigencia1:d} - NÚMERO DO ENDOSSO: {x.Endosso}" : $"NÚMERO DA APÓLICE: {x.Apolice} - VIGÊNCIA INICIAL: {x.Vigencia1:d} - VIGÊNCIA FINAL: {x.Vigencia2.Value:d} - NÚMERO DO ENDOSSO: {x.Endosso}"); + return val5; + }).ToList()); + break; + case 1: + { + if (long.TryParse(Pesquisa, out var _)) + { + Documento val3 = await new ApoliceServico().BuscarCodDocumento(long.Parse(Pesquisa), vendedorVinculado); + DialogPesquisaAvancadaViewModel dialogPesquisaAvancadaViewModel2 = this; + ObservableCollection pesquisas; + if (val3 != null && !val3.Excluido) + { + ObservableCollection observableCollection = new ObservableCollection(); + ObservableCollection observableCollection3 = observableCollection; + PesquisaAvancada val2 = new PesquisaAvancada(); + val2.Nome = val3.Controle.Cliente.Nome; + val2.IdDocumento = ((DomainBase)val3).Id; + val2.Pesquisa = "CÓDIGO DO COCUMENTO: " + ((DomainBase)val3).Id + " - NÚMERO DA PROPOSTA: " + val3.Proposta + " - NÚMERO DA APÓLICE: " + val3.Apolice + " - NÚMERO DO ENDOSSO: " + val3.Endosso; + val2.IdCliente = ((DomainBase)val3.Controle.Cliente).Id; + observableCollection3.Add(val2); + pesquisas = observableCollection; + } + else + { + pesquisas = new ObservableCollection(); + } + dialogPesquisaAvancadaViewModel2.Pesquisas = pesquisas; + } + break; + } + case 0: + Pesquisas = new ObservableCollection(await new AutoServico().BuscarChassi(Pesquisa, Status, vendedorVinculado, TipoBusca)); + break; + case 14: + Pesquisas = new ObservableCollection(await new AutoServico().BuscarPlaca(Pesquisa, Status, vendedorVinculado, TipoBusca)); + break; + case 6: + Pesquisas = new ObservableCollection(await new AutoServico().BuscarItem(Pesquisa, Status, vendedorVinculado, TipoBusca)); + break; + case 16: + { + ClienteServico clienteServico = new ClienteServico(); + string telefone = (Pesquisa = ValidationHelper.FormatarTelefone(Pesquisa)); + Pesquisas = new ObservableCollection(((IEnumerable)(await clienteServico.BuscarTelefonesClientes(telefone))).Select((Func)((ClienteTelefone x) => new PesquisaAvancada + { + Nome = x.Cliente.Nome, + Pesquisa = "TELEFONE: " + ((TelefoneBase)x).Prefixo + "-" + ((TelefoneBase)x).Numero, + IdCliente = ((DomainBase)x.Cliente).Id + })).ToList()); + break; + } + case 3: + Pesquisas = new ObservableCollection(((IEnumerable)(await new EmailServico().BuscarEmail(Pesquisa))).Select((Func)((ClienteEmail x) => new PesquisaAvancada + { + Nome = x.Cliente.Nome, + Pesquisa = "E-MAIL: " + ((EmailBase)x).Email, + IdCliente = ((DomainBase)x.Cliente).Id + })).ToList()); + break; + case 2: + { + SinistroServico sinistroServico = new SinistroServico(); + if (int.TryParse(Pesquisa, out var _)) + { + Sinistro val = await sinistroServico.BuscarSinistro(long.Parse(Pesquisa)); + if (val == null) + { + Pesquisas = new ObservableCollection(); + break; + } + DialogPesquisaAvancadaViewModel dialogPesquisaAvancadaViewModel = this; + ObservableCollection observableCollection = new ObservableCollection(); + ObservableCollection observableCollection2 = observableCollection; + PesquisaAvancada val2 = new PesquisaAvancada(); + val2.IdCliente = ((DomainBase)val.ControleSinistro.Item.Documento.Controle.Cliente).Id; + val2.IdDocumento = ((DomainBase)val.ControleSinistro.Item.Documento).Id; + val2.IdItem = ((DomainBase)val.ControleSinistro.Item).Id; + val2.IdSinistro = ((DomainBase)val).Id; + val2.Nome = val.ControleSinistro.Item.Documento.NomeProponente; + val2.Pesquisa = "CÓDIGO DO SINISTRO: " + ((DomainBase)val.ControleSinistro).Id + " - NÚMERO DA APÓLICE: " + val.ControleSinistro.Item.Documento.Apolice + " - ITEM " + val.ItemSinistrado; + observableCollection2.Add(val2); + dialogPesquisaAvancadaViewModel.Pesquisas = observableCollection; + } + break; + } + case 9: + Pesquisas = new ObservableCollection((await new SinistroServico().BuscarSinistros(Pesquisa)).Select(delegate(Sinistro x) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Expected O, but got Unknown + PesquisaAvancada val4 = new PesquisaAvancada(); + val4.Nome = x.ControleSinistro.Item.Documento.Controle.Cliente.Nome; + val4.Pesquisa = "NÚMERO DO SINISTRO: " + x.Numero + " - NÚMERO DA APÓLICE: " + x.ControleSinistro.Item.Documento.Apolice + " - ITEM: " + x.ItemSinistrado; + val4.IdCliente = ((DomainBase)x.ControleSinistro.Item.Documento.Controle.Cliente).Id; + val4.IdDocumento = ((DomainBase)x.ControleSinistro.Item.Documento).Id; + val4.IdItem = ((DomainBase)x.ControleSinistro.Item).Id; + val4.IdSinistro = ((DomainBase)x).Id; + return val4; + }).ToList()); + break; + case 4: + Pesquisas = new ObservableCollection(((IEnumerable)(await new ApoliceServico().BuscarApolice(Pesquisa, Status, vendedorVinculado, "Estipulante", TipoBusca))).Select((Func)((Documento x) => new PesquisaAvancada + { + IdCliente = ((DomainBase)x.Controle.Cliente).Id, + IdDocumento = ((DomainBase)x).Id, + Nome = x.Controle.Cliente.Nome, + Pesquisa = " NÚMERO DA APÓLICE: " + x.Apolice + })).ToList()); + break; + case 12: + Pesquisas = new ObservableCollection(((IEnumerable)(await new ClienteServico().BuscarObsCliente(Pesquisa))).Select((Func)((Cliente x) => new PesquisaAvancada + { + Nome = x.Nome, + Pesquisa = "OBSERVAÇÃO: " + x.Observacao, + IdCliente = ((DomainBase)x).Id + })).ToList()); + break; + case 18: + Pesquisas = new ObservableCollection(await new ItemServico().BuscaItensPorObs(Pesquisa, Status, vendedorVinculado, TipoBusca)); + break; + case 13: + Pesquisas = new ObservableCollection(((IEnumerable)(await new ClienteServico().BuscarPastaCliente(Pesquisa, TipoBusca))).Select((Func)((Cliente x) => new PesquisaAvancada + { + Nome = x.Nome, + Pesquisa = "PASTA: " + x.Pasta, + IdCliente = ((DomainBase)x).Id + })).ToList()); + break; + case 17: + Pesquisas = new ObservableCollection(((IEnumerable)(await new ParcelaServico().BuscarFatura(Pesquisa))).Select((Func)((Documento x) => new PesquisaAvancada + { + IdDocumento = ((DomainBase)x).Id, + Nome = x.Controle.Cliente.Nome, + Pesquisa = "CÓDIGO DA FATURA: " + x.Endosso, + IdCliente = ((DomainBase)x.Controle.Cliente).Id + })).ToList()); + break; + } + } +} -- cgit v1.2.3