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 --- .../Generic/DialogPesquisaAvancadaViewModel.cs | 604 --------------------- 1 file changed, 604 deletions(-) delete mode 100644 Gestor.Application/ViewModels/Generic/DialogPesquisaAvancadaViewModel.cs (limited to 'Gestor.Application/ViewModels/Generic/DialogPesquisaAvancadaViewModel.cs') diff --git a/Gestor.Application/ViewModels/Generic/DialogPesquisaAvancadaViewModel.cs b/Gestor.Application/ViewModels/Generic/DialogPesquisaAvancadaViewModel.cs deleted file mode 100644 index 284d821..0000000 --- a/Gestor.Application/ViewModels/Generic/DialogPesquisaAvancadaViewModel.cs +++ /dev/null @@ -1,604 +0,0 @@ -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; -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.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; - - private TipoPesquisa _tipo { get; set; } = 14; - - public bool EnableStatus - { - get - { - return this._enableStatus; - } - set - { - this._enableStatus = value; - base.OnPropertyChanged("EnableStatus"); - } - } - - public bool HabilitarFiltroBuscar - { - get - { - return this._habilitarFiltroBuscar; - } - set - { - this._habilitarFiltroBuscar = value; - base.OnPropertyChanged("HabilitarFiltroBuscar"); - } - } - - public string Informacao - { - get - { - return "O LIMITE DA PESQUISA É EM MIL ITENS,\r\nPARA OBTER UMA EXATIDÃO NA PESQUISA É NECESSÁRIO ESPECIFICAR O ITEM PROCURADO."; - } - } - - public string Pesquisa - { - get - { - return this._pesquisa; - } - set - { - this._pesquisa = value; - base.OnPropertyChanged("Pesquisa"); - } - } - - public ObservableCollection Pesquisas - { - get - { - return this._pesquisas; - } - set - { - this._pesquisas = value; - base.OnPropertyChanged("Pesquisas"); - } - } - - public PesquisaAvancada Resultado - { - get - { - return this._resultado; - } - set - { - if (value != null) - { - value.set_Status(this.Status); - } - this._resultado = value; - base.OnPropertyChanged("Resultado"); - } - } - - public FiltroStatusDocumento Status - { - get - { - return this._status; - } - set - { - this._status = value; - this._oldStatus = value; - if (this.Resultado != null) - { - this.Resultado.set_Status(this.Status); - } - base.OnPropertyChanged("Status"); - } - } - - public TipoTela Tela - { - get - { - return this._tela; - } - set - { - this._tela = value; - base.OnPropertyChanged("Tela"); - } - } - - public TipoPesquisa Tipo - { - get - { - return this._tipo; - } - set - { - if (value == 1 || value == 2 || value == 17 || value == 9) - { - this.EnableStatus = false; - FiltroStatusDocumento filtroStatusDocumento = this._oldStatus; - this.Status = 4; - this._oldStatus = filtroStatusDocumento; - } - else if (this._tipo == 1 || this._tipo == 2) - { - this.EnableStatus = true; - this.Status = this._oldStatus; - } - this._tipo = value; - this.GetTipoTela(); - this.HabilitarBusca(); - base.OnPropertyChanged("Tipo"); - } - } - - public TipoFiltroBusca TipoFiltro - { - get - { - return this._tipoFiltro; - } - set - { - this._tipoFiltro = value; - base.OnPropertyChanged("TipoFiltro"); - } - } - - public DialogPesquisaAvancadaViewModel() - { - } - - public void GetTipoPesquisa() - { - TipoFiltroBusca tipoFiltroBusca = this._tipoFiltro; - if (tipoFiltroBusca == null) - { - this.TipoBusca = false; - return; - } - if (tipoFiltroBusca != 1) - { - return; - } - this.TipoBusca = true; - } - - public void GetTipoTela() - { - switch (this.Tipo) - { - case 0: - case 14: - { - this.Tela = 3; - return; - } - 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: - { - this.Tela = 21; - return; - } - case 2: - case 9: - { - this.Tela = 7; - return; - } - default: - { - return; - } - } - } - - public void HabilitarBusca() - { - switch (this.Tipo) - { - case 0: - case 4: - case 6: - case 8: - case 10: - case 13: - case 14: - { - this.HabilitarFiltroBuscar = true; - return; - } - case 1: - case 2: - { - this.TipoFiltro = 1; - this.HabilitarFiltroBuscar = false; - return; - } - case 3: - case 5: - case 7: - case 9: - case 11: - case 12: - { - this.TipoFiltro = 0; - this.HabilitarFiltroBuscar = false; - return; - } - default: - { - this.TipoFiltro = 0; - this.HabilitarFiltroBuscar = false; - return; - } - } - } - - public async Task Pesquisar() - { - List vendedorUsuarios; - long id; - ObservableCollection observableCollection; - PesquisaAvancada pesquisaAvancada2; - int num; - ObservableCollection observableCollection1; - if (Recursos.Usuario != null) - { - vendedorUsuarios = await base.VerificaVinculoVendedor(Recursos.Usuario); - } - else - { - vendedorUsuarios = new List(); - } - List vendedorUsuarios1 = vendedorUsuarios; - this.GetTipoPesquisa(); - switch (this.Tipo) - { - case 0: - { - this.Pesquisas = new ObservableCollection(await (new AutoServico()).BuscarChassi(this.Pesquisa, this.Status, vendedorUsuarios1, this.TipoBusca)); - break; - } - case 1: - { - if (long.TryParse(this.Pesquisa, out id)) - { - Documento documento = await (new ApoliceServico()).BuscarCodDocumento(long.Parse(this.Pesquisa), vendedorUsuarios1); - DialogPesquisaAvancadaViewModel dialogPesquisaAvancadaViewModel = this; - if (documento == null || documento.get_Excluido()) - { - observableCollection1 = new ObservableCollection(); - } - else - { - observableCollection = new ObservableCollection(); - pesquisaAvancada2 = new PesquisaAvancada(); - pesquisaAvancada2.set_Nome(documento.get_Controle().get_Cliente().get_Nome()); - pesquisaAvancada2.set_IdDocumento(documento.get_Id()); - string[] proposta = new string[] { "CÓDIGO DO COCUMENTO: ", null, null, null, null, null, null, null }; - id = documento.get_Id(); - proposta[1] = id.ToString(); - proposta[2] = " - NÚMERO DA PROPOSTA: "; - proposta[3] = documento.get_Proposta(); - proposta[4] = " - NÚMERO DA APÓLICE: "; - proposta[5] = documento.get_Apolice(); - proposta[6] = " - NÚMERO DO ENDOSSO: "; - proposta[7] = documento.get_Endosso(); - pesquisaAvancada2.set_Pesquisa(string.Concat(proposta)); - pesquisaAvancada2.set_IdCliente(documento.get_Controle().get_Cliente().get_Id()); - observableCollection.Add(pesquisaAvancada2); - observableCollection1 = observableCollection; - } - dialogPesquisaAvancadaViewModel.Pesquisas = observableCollection1; - break; - } - else - { - return; - } - } - case 2: - { - SinistroServico sinistroServico = new SinistroServico(); - if (int.TryParse(this.Pesquisa, out num)) - { - Sinistro sinistro = await sinistroServico.BuscarSinistro(long.Parse(this.Pesquisa)); - if (sinistro != null) - { - observableCollection = new ObservableCollection(); - pesquisaAvancada2 = new PesquisaAvancada(); - pesquisaAvancada2.set_IdCliente(sinistro.get_ControleSinistro().get_Item().get_Documento().get_Controle().get_Cliente().get_Id()); - pesquisaAvancada2.set_IdDocumento(sinistro.get_ControleSinistro().get_Item().get_Documento().get_Id()); - pesquisaAvancada2.set_IdItem(sinistro.get_ControleSinistro().get_Item().get_Id()); - pesquisaAvancada2.set_IdSinistro(sinistro.get_Id()); - pesquisaAvancada2.set_Nome(sinistro.get_ControleSinistro().get_Item().get_Documento().get_NomeProponente()); - string[] itemSinistrado = new string[] { "CÓDIGO DO SINISTRO: ", null, null, null, null, null }; - id = sinistro.get_ControleSinistro().get_Id(); - itemSinistrado[1] = id.ToString(); - itemSinistrado[2] = " - NÚMERO DA APÓLICE: "; - itemSinistrado[3] = sinistro.get_ControleSinistro().get_Item().get_Documento().get_Apolice(); - itemSinistrado[4] = " - ITEM "; - itemSinistrado[5] = sinistro.get_ItemSinistrado(); - pesquisaAvancada2.set_Pesquisa(string.Concat(itemSinistrado)); - observableCollection.Add(pesquisaAvancada2); - this.Pesquisas = observableCollection; - break; - } - else - { - this.Pesquisas = new ObservableCollection(); - break; - } - } - else - { - return; - } - } - case 3: - { - List clienteEmails = await (new EmailServico()).BuscarEmail(this.Pesquisa); - DialogPesquisaAvancadaViewModel dialogPesquisaAvancadaViewModel1 = this; - List clienteEmails1 = clienteEmails; - dialogPesquisaAvancadaViewModel1.Pesquisas = new ObservableCollection(clienteEmails1.Select((ClienteEmail x) => { - PesquisaAvancada pesquisaAvancada = new PesquisaAvancada(); - pesquisaAvancada.set_Nome(x.get_Cliente().get_Nome()); - pesquisaAvancada.set_Pesquisa(string.Concat("E-MAIL: ", x.get_Email())); - pesquisaAvancada.set_IdCliente(x.get_Cliente().get_Id()); - return pesquisaAvancada; - }).ToList()); - break; - } - case 4: - { - List documentos = await (new ApoliceServico()).BuscarApolice(this.Pesquisa, this.Status, vendedorUsuarios1, "Estipulante", this.TipoBusca); - DialogPesquisaAvancadaViewModel observableCollection2 = this; - List documentos1 = documentos; - observableCollection2.Pesquisas = new ObservableCollection(documentos1.Select((Documento x) => { - PesquisaAvancada pesquisaAvancada = new PesquisaAvancada(); - pesquisaAvancada.set_IdCliente(x.get_Controle().get_Cliente().get_Id()); - pesquisaAvancada.set_IdDocumento(x.get_Id()); - pesquisaAvancada.set_Nome(x.get_Controle().get_Cliente().get_Nome()); - pesquisaAvancada.set_Pesquisa(string.Concat(" NÚMERO DA APÓLICE: ", x.get_Apolice())); - return pesquisaAvancada; - }).ToList()); - break; - } - case 5: - { - this.Pesquisas = new ObservableCollection(await (new PatrimonialServico()).BuscarImobiliaria(this.Pesquisa, this.Status, vendedorUsuarios1)); - break; - } - case 6: - { - this.Pesquisas = new ObservableCollection(await (new AutoServico()).BuscarItem(this.Pesquisa, this.Status, vendedorUsuarios1, this.TipoBusca)); - break; - } - case 7: - { - this.Pesquisas = new ObservableCollection(await (new PatrimonialServico()).BuscarLocatario(this.Pesquisa, this.Status, vendedorUsuarios1)); - break; - } - case 8: - { - List documentos2 = await (new ApoliceServico()).BuscarApolice(this.Pesquisa, this.Status, vendedorUsuarios1, "", this.TipoBusca); - DialogPesquisaAvancadaViewModel dialogPesquisaAvancadaViewModel2 = this; - List documentos3 = documentos2; - dialogPesquisaAvancadaViewModel2.Pesquisas = new ObservableCollection(documentos3.Select((Documento x) => { - string str; - PesquisaAvancada pesquisaAvancada = new PesquisaAvancada(); - pesquisaAvancada.set_IdCliente(x.get_Controle().get_Cliente().get_Id()); - pesquisaAvancada.set_IdDocumento(x.get_Id()); - pesquisaAvancada.set_Nome(x.get_Controle().get_Cliente().get_Nome()); - PesquisaAvancada pesquisaAvancada1 = pesquisaAvancada; - if (!x.get_Vigencia2().HasValue) - { - str = string.Format("NÚMERO DA APÓLICE: {0} - VIGÊNCIA INICIAL: {1:d} - NÚMERO DO ENDOSSO: {2}", x.get_Apolice(), x.get_Vigencia1(), x.get_Endosso()); - } - else - { - object[] apolice = new object[] { x.get_Apolice(), x.get_Vigencia1(), null, null }; - apolice[2] = x.get_Vigencia2().Value; - apolice[3] = x.get_Endosso(); - str = string.Format("NÚMERO DA APÓLICE: {0} - VIGÊNCIA INICIAL: {1:d} - VIGÊNCIA FINAL: {2:d} - NÚMERO DO ENDOSSO: {3}", apolice); - } - pesquisaAvancada1.set_Pesquisa(str); - return pesquisaAvancada; - }).ToList()); - break; - } - case 9: - { - List sinistros = await (new SinistroServico()).BuscarSinistros(this.Pesquisa); - DialogPesquisaAvancadaViewModel observableCollection3 = this; - List sinistros1 = sinistros; - observableCollection3.Pesquisas = new ObservableCollection(sinistros1.Select((Sinistro x) => { - PesquisaAvancada pesquisaAvancada = new PesquisaAvancada(); - pesquisaAvancada.set_Nome(x.get_ControleSinistro().get_Item().get_Documento().get_Controle().get_Cliente().get_Nome()); - pesquisaAvancada.set_Pesquisa(string.Concat(new string[] { "NÚMERO DO SINISTRO: ", x.get_Numero(), " - NÚMERO DA APÓLICE: ", x.get_ControleSinistro().get_Item().get_Documento().get_Apolice(), " - ITEM: ", x.get_ItemSinistrado() })); - pesquisaAvancada.set_IdCliente(x.get_ControleSinistro().get_Item().get_Documento().get_Controle().get_Cliente().get_Id()); - pesquisaAvancada.set_IdDocumento(x.get_ControleSinistro().get_Item().get_Documento().get_Id()); - pesquisaAvancada.set_IdItem(x.get_ControleSinistro().get_Item().get_Id()); - pesquisaAvancada.set_IdSinistro(x.get_Id()); - return pesquisaAvancada; - }).ToList()); - break; - } - case 10: - { - List documentos4 = await (new ApoliceServico()).BuscarApolice(this.Pesquisa, this.Status, vendedorUsuarios1, "Proposta", this.TipoBusca); - DialogPesquisaAvancadaViewModel dialogPesquisaAvancadaViewModel3 = this; - List documentos5 = documentos4; - dialogPesquisaAvancadaViewModel3.Pesquisas = new ObservableCollection(documentos5.Select((Documento x) => { - PesquisaAvancada pesquisaAvancada = new PesquisaAvancada(); - pesquisaAvancada.set_IdCliente(x.get_Controle().get_Cliente().get_Id()); - pesquisaAvancada.set_IdDocumento(x.get_Id()); - pesquisaAvancada.set_Nome(x.get_Controle().get_Cliente().get_Nome()); - pesquisaAvancada.set_Pesquisa(string.Concat(new string[] { "NÚMERO DA PROPOSTA: ", x.get_Proposta(), " - NÚMERO DA APÓLICE: ", x.get_Apolice(), " - NÚMERO DO ENDOSSO: ", x.get_Endosso() })); - return pesquisaAvancada; - }).ToList()); - break; - } - case 11: - { - List documentos6 = await (new ApoliceServico()).BuscarApolice(this.Pesquisa, this.Status, vendedorUsuarios1, "NumeroEndosso", this.TipoBusca); - DialogPesquisaAvancadaViewModel observableCollection4 = this; - List documentos7 = documentos6; - observableCollection4.Pesquisas = new ObservableCollection(documentos7.Select((Documento x) => { - PesquisaAvancada pesquisaAvancada = new PesquisaAvancada(); - pesquisaAvancada.set_IdCliente(x.get_Controle().get_Cliente().get_Id()); - pesquisaAvancada.set_IdDocumento(x.get_Id()); - pesquisaAvancada.set_Nome(x.get_Controle().get_Cliente().get_Nome()); - pesquisaAvancada.set_Pesquisa(string.Concat("NÚMERO DA APÓLICE: ", x.get_Apolice(), " - NÚMERO DO ENDOSSO: ", x.get_Endosso())); - return pesquisaAvancada; - }).ToList()); - break; - } - case 12: - { - List clientes = await (new ClienteServico()).BuscarObsCliente(this.Pesquisa); - DialogPesquisaAvancadaViewModel dialogPesquisaAvancadaViewModel4 = this; - List clientes1 = clientes; - dialogPesquisaAvancadaViewModel4.Pesquisas = new ObservableCollection(clientes1.Select((Cliente x) => { - PesquisaAvancada pesquisaAvancada = new PesquisaAvancada(); - pesquisaAvancada.set_Nome(x.get_Nome()); - pesquisaAvancada.set_Pesquisa(string.Concat("OBSERVAÇÃO: ", x.get_Observacao())); - pesquisaAvancada.set_IdCliente(x.get_Id()); - return pesquisaAvancada; - }).ToList()); - break; - } - case 13: - { - List clientes2 = await (new ClienteServico()).BuscarPastaCliente(this.Pesquisa, this.TipoBusca); - DialogPesquisaAvancadaViewModel observableCollection5 = this; - List clientes3 = clientes2; - observableCollection5.Pesquisas = new ObservableCollection(clientes3.Select((Cliente x) => { - PesquisaAvancada pesquisaAvancada = new PesquisaAvancada(); - pesquisaAvancada.set_Nome(x.get_Nome()); - pesquisaAvancada.set_Pesquisa(string.Concat("PASTA: ", x.get_Pasta())); - pesquisaAvancada.set_IdCliente(x.get_Id()); - return pesquisaAvancada; - }).ToList()); - break; - } - case 14: - { - this.Pesquisas = new ObservableCollection(await (new AutoServico()).BuscarPlaca(this.Pesquisa, this.Status, vendedorUsuarios1, this.TipoBusca)); - break; - } - case 15: - { - List documentos8 = await (new ApoliceServico()).BuscarApolice(this.Pesquisa, this.Status, vendedorUsuarios1, "PedidoEndosso", this.TipoBusca); - DialogPesquisaAvancadaViewModel dialogPesquisaAvancadaViewModel5 = this; - List documentos9 = documentos8; - dialogPesquisaAvancadaViewModel5.Pesquisas = new ObservableCollection(documentos9.Select((Documento x) => { - PesquisaAvancada pesquisaAvancada = new PesquisaAvancada(); - pesquisaAvancada.set_IdCliente(x.get_Controle().get_Cliente().get_Id()); - pesquisaAvancada.set_IdDocumento(x.get_Id()); - pesquisaAvancada.set_Nome(x.get_Controle().get_Cliente().get_Nome()); - pesquisaAvancada.set_Pesquisa(string.Concat(new string[] { "PROPOSTA ENDOSSO: ", x.get_PropostaEndosso(), " - NÚMERO DA APÓLICE: ", x.get_Apolice(), " - NÚMERO DO ENDOSSO: ", x.get_Endosso() })); - return pesquisaAvancada; - }).ToList()); - break; - } - case 16: - { - ClienteServico clienteServico = new ClienteServico(); - string str1 = ValidationHelper.FormatarTelefone(this.Pesquisa); - string str2 = str1; - this.Pesquisa = str1; - List clienteTelefones = await clienteServico.BuscarTelefonesClientes(str2); - DialogPesquisaAvancadaViewModel observableCollection6 = this; - List clienteTelefones1 = clienteTelefones; - observableCollection6.Pesquisas = new ObservableCollection(clienteTelefones1.Select((ClienteTelefone x) => { - PesquisaAvancada pesquisaAvancada = new PesquisaAvancada(); - pesquisaAvancada.set_Nome(x.get_Cliente().get_Nome()); - pesquisaAvancada.set_Pesquisa(string.Concat("TELEFONE: ", x.get_Prefixo(), "-", x.get_Numero())); - pesquisaAvancada.set_IdCliente(x.get_Cliente().get_Id()); - return pesquisaAvancada; - }).ToList()); - break; - } - case 17: - { - List documentos10 = await (new ParcelaServico()).BuscarFatura(this.Pesquisa); - DialogPesquisaAvancadaViewModel dialogPesquisaAvancadaViewModel6 = this; - List documentos11 = documentos10; - dialogPesquisaAvancadaViewModel6.Pesquisas = new ObservableCollection(documentos11.Select((Documento x) => { - PesquisaAvancada pesquisaAvancada = new PesquisaAvancada(); - pesquisaAvancada.set_IdDocumento(x.get_Id()); - pesquisaAvancada.set_Nome(x.get_Controle().get_Cliente().get_Nome()); - pesquisaAvancada.set_Pesquisa(string.Concat("CÓDIGO DA FATURA: ", x.get_Endosso())); - pesquisaAvancada.set_IdCliente(x.get_Controle().get_Cliente().get_Id()); - return pesquisaAvancada; - }).ToList()); - break; - } - case 18: - { - this.Pesquisas = new ObservableCollection(await (new ItemServico()).BuscaItensPorObs(this.Pesquisa, this.Status, vendedorUsuarios1, this.TipoBusca)); - break; - } - } - } - } -} \ No newline at end of file -- cgit v1.2.3