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 --- .../Ferramentas/ProtocoloDocumentosViewModel.cs | 399 --------------------- 1 file changed, 399 deletions(-) delete mode 100644 Gestor.Application/ViewModels/Ferramentas/ProtocoloDocumentosViewModel.cs (limited to 'Gestor.Application/ViewModels/Ferramentas/ProtocoloDocumentosViewModel.cs') diff --git a/Gestor.Application/ViewModels/Ferramentas/ProtocoloDocumentosViewModel.cs b/Gestor.Application/ViewModels/Ferramentas/ProtocoloDocumentosViewModel.cs deleted file mode 100644 index 027f344..0000000 --- a/Gestor.Application/ViewModels/Ferramentas/ProtocoloDocumentosViewModel.cs +++ /dev/null @@ -1,399 +0,0 @@ -using Assinador.Infrastructure.Helpers; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos.Seguros; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.Views.Ferramentas; -using Gestor.Application.Views.Generic; -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; -using System.Windows; - -namespace Gestor.Application.ViewModels.Ferramentas -{ - public class ProtocoloDocumentosViewModel : BaseSegurosViewModel - { - private Cliente _selectedCliente = new Cliente(); - - private ObservableCollection _apolicesFiltradas = new ObservableCollection(); - - private ObservableCollection _apolicesAdicionadas = new ObservableCollection(); - - private FiltroStatusDocumento _selectedStatus; - - public ObservableCollection ApolicesAdicionadas - { - get - { - return this._apolicesAdicionadas; - } - set - { - this._apolicesAdicionadas = value; - base.OnPropertyChanged("ApolicesAdicionadas"); - } - } - - public ObservableCollection ApolicesFiltradas - { - get - { - return this._apolicesFiltradas; - } - set - { - this._apolicesFiltradas = value; - base.OnPropertyChanged("ApolicesFiltradas"); - } - } - - public Cliente SelectedCliente - { - get - { - return this._selectedCliente; - } - set - { - this._selectedCliente = value; - if (this.SelectedCliente != null && this.SelectedCliente.get_Id() != 0 && (this.LastAccessId != this.SelectedCliente.get_Id() || this.LastAccessTela != 59)) - { - this.SelecionarDocumentos(); - this.LastAccessId = this.SelectedCliente.get_Id(); - this.LastAccessTela = 59; - } - base.OnPropertyChanged("SelectedCliente"); - } - } - - public FiltroStatusDocumento SelectedStatus - { - get - { - return this._selectedStatus; - } - set - { - this._selectedStatus = value; - this.SelectedCliente = this.SelectedCliente; - this.SelecionarDocumentos(); - base.OnPropertyChanged("SelectedStatus"); - } - } - - public ProtocoloDocumentosViewModel() - { - } - - public async void AdicionarEtiqueta(Documento documento) - { - ObservableCollection apolicesAdicionadas = this.ApolicesAdicionadas; - ProtocoloEtiqueta protocoloEtiquetum = new ProtocoloEtiqueta(); - ProtocoloEtiqueta protocoloEtiquetum1 = protocoloEtiquetum; - Documento documento1 = await (new ApoliceServico()).BuscarApoliceAsync(documento.get_Id(), false, false); - protocoloEtiquetum1.Documento = documento1; - protocoloEtiquetum.Tipo = 1; - apolicesAdicionadas.Add(protocoloEtiquetum); - apolicesAdicionadas = null; - protocoloEtiquetum1 = null; - protocoloEtiquetum = null; - ProtocoloDocumentosViewModel observableCollection = this; - ObservableCollection apolicesAdicionadas1 = this.ApolicesAdicionadas; - observableCollection.ApolicesAdicionadas = new ObservableCollection( - from x in apolicesAdicionadas1 - orderby x.Documento.get_Id() - select x); - } - - public async void AdicionarEtiquetaCliente() - { - if (this.SelectedCliente != null && this.SelectedCliente.get_Id() != 0) - { - bool flag = this.ApolicesAdicionadas.Any((ProtocoloEtiqueta x) => { - if (x.Documento.get_Controle().get_Cliente().get_Id() != this.SelectedCliente.get_Id()) - { - return false; - } - return x.Tipo == 1; - }); - if (flag) - { - flag = !await base.ShowMessage("JÁ EXISTE UMA ETIQUETA ADICIONADA PARA O CLIENTE SELECIONADO, DESEJA ADICIONAR NOVAMENTE?", "SIM", "NÃO", false); - } - if (!flag) - { - ObservableCollection apolicesAdicionadas = this.ApolicesAdicionadas; - ProtocoloEtiqueta protocoloEtiquetum = new ProtocoloEtiqueta(); - Documento documento = new Documento(); - Controle controle = new Controle(); - controle.set_Cliente(this.SelectedCliente); - documento.set_Controle(controle); - protocoloEtiquetum.Documento = documento; - protocoloEtiquetum.Tipo = 1; - apolicesAdicionadas.Add(protocoloEtiquetum); - ProtocoloDocumentosViewModel observableCollection = this; - ObservableCollection apolicesAdicionadas1 = this.ApolicesAdicionadas; - IOrderedEnumerable tipo = - from x in apolicesAdicionadas1 - orderby x.Tipo - select x; - observableCollection.ApolicesAdicionadas = new ObservableCollection(tipo.ThenBy((ProtocoloEtiqueta x) => x.Documento.get_Controle().get_Cliente().get_Id())); - } - } - } - - public async void AdicionarEtiquetaCorretora() - { - ProtocoloDocumentosViewModel protocoloDocumentosViewModel = this; - ClienteEndereco clienteEndereco = new ClienteEndereco(); - clienteEndereco.set_Endereco(Recursos.Empresa.get_Endereco()); - clienteEndereco.set_Bairro(Recursos.Empresa.get_Bairro()); - clienteEndereco.set_Numero(Recursos.Empresa.get_Numero()); - clienteEndereco.set_Complemento(Recursos.Empresa.get_Complemento()); - clienteEndereco.set_Cidade(Recursos.Empresa.get_Cidade()); - clienteEndereco.set_Estado(Recursos.Empresa.get_Estado()); - clienteEndereco.set_Cep(Recursos.Empresa.get_Cep()); - ObservableCollection observableCollection = new ObservableCollection() - { - clienteEndereco - }; - ObservableCollection apolicesAdicionadas = protocoloDocumentosViewModel.ApolicesAdicionadas; - ProtocoloEtiqueta protocoloEtiquetum = new ProtocoloEtiqueta(); - Documento documento = new Documento(); - Controle controle = new Controle(); - Cliente cliente = new Cliente(); - cliente.set_Nome(Recursos.Empresa.get_Nome()); - cliente.set_Id((long)-1); - cliente.set_Enderecos(observableCollection); - controle.set_Cliente(cliente); - documento.set_Controle(controle); - protocoloEtiquetum.Documento = documento; - protocoloEtiquetum.Tipo = 1; - apolicesAdicionadas.Add(protocoloEtiquetum); - ProtocoloDocumentosViewModel observableCollection1 = protocoloDocumentosViewModel; - ObservableCollection apolicesAdicionadas1 = protocoloDocumentosViewModel.ApolicesAdicionadas; - IOrderedEnumerable tipo = - from x in apolicesAdicionadas1 - orderby x.Tipo - select x; - observableCollection1.ApolicesAdicionadas = new ObservableCollection(tipo.ThenBy((ProtocoloEtiqueta x) => x.Documento.get_Controle().get_Cliente().get_Id())); - } - - public async void AdicionarProtocolo(Documento documento) - { - bool flag = this.ApolicesAdicionadas.Any((ProtocoloEtiqueta x) => { - if (x.Documento.get_Id() != documento.get_Id()) - { - return false; - } - return x.Tipo == 0; - }); - if (flag) - { - flag = !await base.ShowMessage("JÁ EXISTE UM PROTOCOLO ADICIONADO PARA O DOCUMENTO SELECIONADO, DESEJA ADICIONAR NOVAMENTE?", "SIM", "NÃO", false); - } - if (!flag) - { - ObservableCollection apolicesAdicionadas = this.ApolicesAdicionadas; - ProtocoloEtiqueta protocoloEtiquetum = new ProtocoloEtiqueta(); - ProtocoloEtiqueta protocoloEtiquetum1 = protocoloEtiquetum; - Documento documento1 = await (new ApoliceServico()).BuscarApoliceAsync(documento.get_Id(), false, false); - protocoloEtiquetum1.Documento = documento1; - protocoloEtiquetum.Tipo = 0; - apolicesAdicionadas.Add(protocoloEtiquetum); - apolicesAdicionadas = null; - protocoloEtiquetum1 = null; - protocoloEtiquetum = null; - ProtocoloDocumentosViewModel observableCollection = this; - ObservableCollection apolicesAdicionadas1 = this.ApolicesAdicionadas; - observableCollection.ApolicesAdicionadas = new ObservableCollection( - from x in apolicesAdicionadas1 - orderby x.Documento.get_Id() - select x); - } - } - - public async void Imprimir(TipoProtocoloEtiqueta tipo) - { - if (this.ApolicesAdicionadas.Count != 0) - { - TipoProtocoloEtiqueta tipoProtocoloEtiquetum = tipo; - if (tipoProtocoloEtiquetum == null) - { - ObservableCollection apolicesAdicionadas = this.ApolicesAdicionadas; - if (!apolicesAdicionadas.All((ProtocoloEtiqueta x) => x.Tipo != 0)) - { - ObservableCollection observableCollection = this.ApolicesAdicionadas; - if (observableCollection.Any((ProtocoloEtiqueta x) => x.Tipo == 0)) - { - ProtocoloDocumentosViewModel protocoloDocumentosViewModel = this; - ObservableCollection apolicesAdicionadas1 = this.ApolicesAdicionadas; - IEnumerable protocoloEtiquetas = - from x in apolicesAdicionadas1 - where x.Tipo == 0 - select x; - List documentos = await protocoloDocumentosViewModel.ShowProtocoloDialog(( - from x in protocoloEtiquetas - select x.Documento).ToList()); - if (documentos != null) - { - bool flag = await base.ShowMessage(string.Concat("DESEJA EMITIR DOIS PROTOCOLOS POR PÁGINA?", Environment.NewLine, "A QUANTIDADE DE INFORMÃÇÕES PODE IMPEDIR QUE ESSA FUNÇÃO FUNCIONE CORRETAMENTE"), "SIM", "NÃO", false); - this.PrepararProtocolo(documentos, flag); - documentos = null; - } - else - { - return; - } - } - } - else - { - await base.ShowMessage(string.Concat("NECESSÁRIO ADICIONAR DOCUMENTOS PARA EMISSÃO DE ", Functions.GetDescription(tipo)), "OK", "", false); - return; - } - } - else if (tipoProtocoloEtiquetum == 1) - { - ObservableCollection observableCollection1 = this.ApolicesAdicionadas; - if (!observableCollection1.All((ProtocoloEtiqueta x) => x.Tipo != 1)) - { - ObservableCollection apolicesAdicionadas2 = this.ApolicesAdicionadas; - if (apolicesAdicionadas2.Any((ProtocoloEtiqueta x) => { - if (x.Tipo != 1) - { - return false; - } - return x.Documento.get_Id() == (long)0; - })) - { - ObservableCollection observableCollection2 = this.ApolicesAdicionadas; - if (observableCollection2.Any((ProtocoloEtiqueta x) => { - if (x.Tipo != 1) - { - return false; - } - return x.Documento.get_Id() != (long)0; - })) - { - await base.ShowMessage("COMO EXISTEM ETIQUETAS DE CLIENTES E DOCUMENTOS,\nPRIMEIRO CONFIGURE AS DE SOMENTE CLIENTE.\nDEPOIS DE GERAR AS ETIQUETAS DE CLIENTE, CONFIGURAR AS DE DOCUMENTOS", "OK", "", false); - } - ObservableCollection apolicesAdicionadas3 = this.ApolicesAdicionadas; - IEnumerable protocoloEtiquetas1 = apolicesAdicionadas3.Where((ProtocoloEtiqueta x) => { - if (x.Tipo != 1) - { - return false; - } - return x.Documento.get_Id() == (long)0; - }); - (new HosterWindow(new EtiquetaView(( - from x in protocoloEtiquetas1 - select x.Documento).ToList(), true), "ETIQUETAS", new double?((double)900), new double?((double)600), false)).Show(); - } - ObservableCollection observableCollection3 = this.ApolicesAdicionadas; - if (observableCollection3.Any((ProtocoloEtiqueta x) => { - if (x.Tipo != 1) - { - return false; - } - return x.Documento.get_Id() != (long)0; - })) - { - ObservableCollection apolicesAdicionadas4 = this.ApolicesAdicionadas; - IEnumerable protocoloEtiquetas2 = apolicesAdicionadas4.Where((ProtocoloEtiqueta x) => { - if (x.Tipo != 1) - { - return false; - } - return x.Documento.get_Id() != (long)0; - }); - (new HosterWindow(new EtiquetaView(( - from x in protocoloEtiquetas2 - select x.Documento).ToList(), false), "ETIQUETAS", new double?((double)900), new double?((double)600), false)).Show(); - } - } - else - { - await base.ShowMessage(string.Concat("NECESSÁRIO ADICIONAR DOCUMENTOS PARA EMISSÃO DE ", Functions.GetDescription(tipo)), "OK", "", false); - return; - } - } - } - else - { - await base.ShowMessage(string.Concat("NECESSÁRIO ADICIONAR DOCUMENTOS PARA EMISSÃO DE ", Functions.GetDescription(tipo)), "OK", "", false); - } - } - - public async void PrepararProtocolo(List documentos, bool doisPorPagina) - { - if (await base.ShowMessage("DESEJA EMITIR O CHECKLIST?", "SIM", "NÃO", false)) - { - await base.EmitirCheckList(documentos); - } - if (documentos != null) - { - List documentos1 = documentos; - List> list = ( - from x in documentos1 - select new Tuple(x.get_Id(), x.get_ObsProtocolo())).ToList>(); - await base.EmitirProtocolos(list, doisPorPagina, documentos); - } - } - - public void Remover(ProtocoloEtiqueta documento) - { - this.ApolicesAdicionadas.Remove(documento); - this.SelecionarDocumentos(); - } - - public async void SelecionarDocumentos() - { - long? nullable; - object obj; - object nome; - long num; - base.Loading(true); - if (this.SelectedCliente != null) - { - this.ApolicesFiltradas = await (new ApoliceServico()).BuscarApolicesComissao(this.SelectedCliente.get_Id(), this.SelectedStatus); - ProtocoloDocumentosViewModel protocoloDocumentosViewModel = this; - obj = (this.SelectedStatus == 4 ? "TODOS OS DOCUMENTOS" : string.Concat("OS ", Functions.GetDescription(this.SelectedStatus))); - Cliente selectedCliente = this.SelectedCliente; - if (selectedCliente != null) - { - nome = selectedCliente.get_Nome(); - } - else - { - nome = null; - } - Cliente cliente = this.SelectedCliente; - if (cliente != null) - { - nullable = new long?(cliente.get_Id()); - } - else - { - nullable = null; - } - string str = string.Format("CONSULTOU {0} DO CLIENTE {1} ({2})", obj, nome, nullable); - num = (this.SelectedCliente == null ? (long)0 : this.SelectedCliente.get_Id()); - protocoloDocumentosViewModel.RegistrarAcao(str, num, new TipoTela?(59), null); - base.Loading(false); - } - else - { - base.Loading(false); - } - } - } -} \ No newline at end of file -- cgit v1.2.3