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 --- Gestor.Application/Componentes/GridRelatorio.cs | 695 ------------------------ 1 file changed, 695 deletions(-) delete mode 100644 Gestor.Application/Componentes/GridRelatorio.cs (limited to 'Gestor.Application/Componentes/GridRelatorio.cs') diff --git a/Gestor.Application/Componentes/GridRelatorio.cs b/Gestor.Application/Componentes/GridRelatorio.cs deleted file mode 100644 index 7673cf8..0000000 --- a/Gestor.Application/Componentes/GridRelatorio.cs +++ /dev/null @@ -1,695 +0,0 @@ -using Gestor.Application.Drawers; -using Gestor.Application.Helpers; -using Gestor.Application.Servicos; -using Gestor.Application.Servicos.Seguros; -using Gestor.Application.ViewModels.Generic; -using Gestor.Application.ViewModels.Relatorios; -using Gestor.Application.Views.Generic; -using Gestor.Application.Views.Seguros; -using Gestor.Application.Views.Seguros.Itens; -using Gestor.Common.Validation; -using Gestor.Model.Common; -using Gestor.Model.Domain.Ferramentas; -using Gestor.Model.Domain.Generic; -using Gestor.Model.Domain.Relatorios.ApolicePendente; -using Gestor.Model.Domain.Relatorios.Log; -using Gestor.Model.Domain.Relatorios.LogsEnvio; -using Gestor.Model.Domain.Relatorios.Sinistro; -using Gestor.Model.Domain.Relatorios.Tarefa; -using Gestor.Model.Domain.Seguros; -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.ComponentModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Markup; - -namespace Gestor.Application.Componentes -{ - public class GridRelatorio : UserControl, IComponentConnector, IStyleConnector - { - internal Grid LayoutRoot; - - internal System.Windows.Controls.DataGrid DataGrid; - - internal DataGridTemplateColumn InfoButton; - - internal DataGridTemplateColumn ArquivoButton; - - internal DataGridTemplateColumn VinculoButton; - - internal DataGridTemplateColumn CalculoButton; - - internal DataGridTemplateColumn AssinaturaButton; - - internal Expander Totalizacao; - - internal ItemsControl SinteticoGrid; - - private bool _contentLoaded; - - private int _index { get; set; } = -1; - - private ListSortDirection _sortDirection - { - get; - set; - } - - private RelatorioViewModel ViewModel - { - get; - } - - public GridRelatorio(RelatorioViewModel viewModel) - { - this.ViewModel = viewModel; - base.DataContext = this.ViewModel; - this.ViewModel.Totalizacao = true; - this.InitializeComponent(); - this.LayoutRoot.DataContext = this; - this.TipoRelatorio(); - } - - private async void ArquivoDigital_OnClick(object sender, RoutedEventArgs e) - { - Button button = (Button)sender; - object dataContext = button.DataContext; - FiltroArquivoDigital filtroArquivoDigital = null; - string tipo = ValidationHelper.GetTipo(this.ViewModel.Relatorio); - if (tipo == "CLIENTE") - { - if (!(new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 1).get_Consultar()) - { - await this.ViewModel.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", ValidationHelper.GetDescription((TipoArquivoDigital)1), "."), "OK", "", false); - return; - } - else if (this.ViewModel.Relatorio != 17) - { - Cliente valueFromType = dataContext.GetValueFromType(); - if (valueFromType != null) - { - FiltroArquivoDigital filtroArquivoDigital1 = new FiltroArquivoDigital(); - filtroArquivoDigital1.set_Id(valueFromType.get_Id()); - filtroArquivoDigital1.set_Tipo(1); - filtroArquivoDigital1.set_Parente(valueFromType); - filtroArquivoDigital = filtroArquivoDigital1; - } - else - { - return; - } - } - else - { - Item item = dataContext.GetValueFromType(); - Documento documento = button.DataContext.GetValueFromType(); - if (item != null) - { - documento = await (new ApoliceServico()).BuscarApoliceAsync(documento.get_Id(), false, false); - item.set_Documento(documento); - FiltroArquivoDigital filtroArquivoDigital2 = new FiltroArquivoDigital(); - filtroArquivoDigital2.set_Id(item.get_Id()); - filtroArquivoDigital2.set_Tipo(4); - filtroArquivoDigital2.set_Parente(item); - filtroArquivoDigital = filtroArquivoDigital2; - item = null; - } - else - { - return; - } - } - } - else if (tipo == "FECHAMENTO" || tipo == "DOCUMENTO") - { - if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 2).get_Consultar()) - { - Documento valueFromType1 = dataContext.GetValueFromType(); - if (valueFromType1 != null) - { - FiltroArquivoDigital filtroArquivoDigital3 = new FiltroArquivoDigital(); - filtroArquivoDigital3.set_Id(valueFromType1.get_Id()); - filtroArquivoDigital3.set_Tipo(2); - filtroArquivoDigital3.set_Parente(valueFromType1); - filtroArquivoDigital = filtroArquivoDigital3; - } - else - { - return; - } - } - else - { - await this.ViewModel.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", ValidationHelper.GetDescription((TipoArquivoDigital)2), "."), "OK", "", false); - return; - } - } - else if (tipo == "PARCELA") - { - if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 3).get_Consultar()) - { - Parcela parcela = dataContext.GetValueFromType(); - if (parcela != null) - { - FiltroArquivoDigital filtroArquivoDigital4 = new FiltroArquivoDigital(); - filtroArquivoDigital4.set_Id(parcela.get_Id()); - filtroArquivoDigital4.set_IdApolice(parcela.get_Documento().get_Id()); - filtroArquivoDigital4.set_Tipo(3); - filtroArquivoDigital4.set_Parente(parcela); - filtroArquivoDigital = filtroArquivoDigital4; - } - else - { - return; - } - } - else - { - await this.ViewModel.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", ValidationHelper.GetDescription((TipoArquivoDigital)3), "."), "OK", "", false); - return; - } - } - else if (tipo != "SINISTRO") - { - if (tipo == "EXTRATO") - { - if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 7).get_Consultar()) - { - Extrato extrato = dataContext.GetValueFromType(); - if (extrato != null) - { - FiltroArquivoDigital filtroArquivoDigital5 = new FiltroArquivoDigital(); - filtroArquivoDigital5.set_Id(extrato.get_Id()); - filtroArquivoDigital5.set_Tipo(7); - filtroArquivoDigital5.set_Parente(extrato); - filtroArquivoDigital = filtroArquivoDigital5; - } - else - { - return; - } - } - else - { - await this.ViewModel.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", ValidationHelper.GetDescription((TipoArquivoDigital)7), "."), "OK", "", false); - return; - } - } - } - else if ((new PermissaoArquivoDigitalServico()).BuscarPermissao(Recursos.Usuario, 5).get_Consultar()) - { - Gestor.Model.Domain.Seguros.Sinistro sinistro = dataContext.GetValueFromType(); - if (sinistro != null) - { - FiltroArquivoDigital filtroArquivoDigital6 = new FiltroArquivoDigital(); - filtroArquivoDigital6.set_Id(sinistro.get_Id()); - filtroArquivoDigital6.set_IdApolice(sinistro.get_ControleSinistro().get_Item().get_Documento().get_Id()); - filtroArquivoDigital6.set_Tipo(5); - filtroArquivoDigital6.set_Parente(sinistro); - filtroArquivoDigital = filtroArquivoDigital6; - } - else - { - return; - } - } - else - { - await this.ViewModel.ShowMessage(string.Concat("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE ", ValidationHelper.GetDescription((TipoArquivoDigital)5), "."), "OK", "", false); - return; - } - if (filtroArquivoDigital != null) - { - (new BaseSegurosViewModel()).ShowDrawer(new ArquivoDigitalDrawer(filtroArquivoDigital), 0, false); - } - else - { - await this.ViewModel.ShowMessage("ESSE TIPO DE RELATÓRIO NÃO POSSUI ARQUIVO DIGITAL", "OK", "", false); - } - } - - private async void CheckBox_Checked(object sender, RoutedEventArgs e) - { - this.ViewModel.Carregando = true; - this.ViewModel.IsEnabled = false; - await this.ViewModel.Selecionar(); - this.ViewModel.IsEnabled = true; - this.ViewModel.Carregando = false; - } - - private void Grid_Sorting(object sender, DataGridSortingEventArgs e) - { - this._index = e.Column.DisplayIndex; - ListSortDirection? sortDirection = e.Column.SortDirection; - this._sortDirection = (!(sortDirection.GetValueOrDefault() == ListSortDirection.Ascending & sortDirection.HasValue) ? ListSortDirection.Ascending : ListSortDirection.Descending); - } - - [DebuggerNonUserCode] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - public void InitializeComponent() - { - if (this._contentLoaded) - { - return; - } - this._contentLoaded = true; - System.Windows.Application.LoadComponent(this, new Uri("/Gestor.Application;component/componentes/gridrelatorio.xaml", UriKind.Relative)); - } - - private async void MaisInformacoes_OnClick(object sender, RoutedEventArgs e) - { - double? nullable; - Gestor.Model.Domain.Relatorios.Sinistro.Sinistro dataContext; - Button button = (Button)sender; - if (button.DataContext != null) - { - string tipo = ValidationHelper.GetTipo(this.ViewModel.Relatorio); - if (this.ViewModel.Relatorio == 17) - { - Item valueFromType = button.DataContext.GetValueFromType(); - Documento documento = button.DataContext.GetValueFromType(); - if (valueFromType != null) - { - valueFromType.set_Documento(documento); - nullable = null; - double? nullable1 = nullable; - nullable = null; - (new HosterWindow(new AutoView(null, true, false, null, valueFromType, documento.get_Controle().get_Ramo(), false), string.Concat("CADASTRO DE ITENS DO CLIENTE - ", documento.get_Controle().get_Cliente().get_Nome()), nullable1, nullable, false)).ShowDialog(); - } - } - else if (this.ViewModel.Relatorio != 4 || button.DataContext.GetValueFromType() == null) - { - if (tipo != null) - { - switch (tipo.Length) - { - case 4: - { - if (tipo != "LOGS") - { - goto Label1; - } - else if (!(button.DataContext is LogAcaoRelatorio)) - { - LogsEnvio logsEnvio = (LogsEnvio)button.DataContext; - this.ViewModel.ShowDrawer(new LogEmailDrawer(17, logsEnvio.get_Id(), true), 0, false); - goto Label1; - } - else - { - this.ViewModel.ShowDrawer(new LogUtilizacaoDrawer(((LogAcaoRelatorio)button.DataContext).get_RegistroEntity(), this.ViewModel.Relatorio), 0, false); - return; - } - } - case 6: - { - if (tipo == "TAREFA") - { - Gestor.Model.Domain.Relatorios.Tarefa.Tarefa tarefa = (Gestor.Model.Domain.Relatorios.Tarefa.Tarefa)button.DataContext; - Gestor.Model.Domain.Ferramentas.Tarefa tarefa1 = new Gestor.Model.Domain.Ferramentas.Tarefa(); - tarefa1.set_Id(tarefa.get_Id()); - tarefa1.set_IdCliente(tarefa.get_IdCliente()); - tarefa1.set_Cliente(tarefa.get_Cliente()); - tarefa1.set_IdEntidade(tarefa.get_IdEntidade()); - tarefa1.set_Entidade(tarefa.get_Entidade()); - tarefa1.set_Conclusao(tarefa.get_Conclusao()); - Gestor.Model.Domain.Ferramentas.Tarefa tarefa2 = tarefa1; - this.ViewModel.ShowDrawer(new TarefaDrawer(tarefa2, false), 0, false); - goto Label1; - } - else - { - goto Label1; - } - } - case 7: - { - char chr = tipo[0]; - if (chr == 'C') - { - if (tipo == "CLIENTE") - { - Cliente cliente = button.DataContext.GetValueFromType(); - if (cliente != null) - { - cliente = await (new ClienteServico()).BuscarClienteAsync(cliente.get_Id()); - nullable = null; - double? nullable2 = nullable; - nullable = null; - (new HosterWindow(new ClienteView(cliente, true, null), string.Concat("CADASTRO DE CLIENTES - ", cliente.get_Nome()), nullable2, nullable, false)).ShowDialog(); - goto Label1; - } - else - { - return; - } - } - else - { - goto Label1; - } - } - else if (chr != 'P') - { - goto Label1; - } - else if (tipo == "PARCELA") - { - Documento valueFromType1 = button.DataContext.GetValueFromType(); - if (valueFromType1 != null) - { - Parcela parcela = button.DataContext.GetValueFromType(); - if (parcela != null) - { - nullable = null; - double? nullable3 = nullable; - nullable = null; - (new HosterWindow(new ApoliceView(valueFromType1, true, false, 1, parcela.get_Id(), false), string.Concat("CADASTRO DE APÓLICES - ", valueFromType1.get_Controle().get_Cliente().get_Nome()), nullable3, nullable, false)).Show(); - goto Label1; - } - else - { - return; - } - } - else - { - return; - } - } - else - { - goto Label1; - } - } - case 8: - { - if (tipo == "SINISTRO") - { - dataContext = (Gestor.Model.Domain.Relatorios.Sinistro.Sinistro)button.DataContext; - Gestor.Model.Domain.Seguros.Sinistro sinistro = button.DataContext.GetValueFromType(); - if (sinistro != null) - { - sinistro = await this.ViewModel.CarregaSinistroApolice(sinistro.get_Id()); - SinistroView sinistroView = new SinistroView(sinistro.get_ControleSinistro().get_Item(), false); - string[] nome = new string[] { "CADASTRO DE SINISTROS - ", dataContext.get_Nome(), " - ", dataContext.get_Apolice(), " ", dataContext.get_Endosso() }; - nullable = null; - double? nullable4 = nullable; - nullable = null; - (new HosterWindow(sinistroView, string.Concat(nome), nullable4, nullable, false)).Show(); - goto Label1; - } - else - { - return; - } - } - else - { - goto Label1; - } - } - case 9: - { - if (tipo == "DOCUMENTO") - { - break; - } - goto Label1; - } - case 10: - { - if (tipo == "FECHAMENTO") - { - break; - } - goto Label1; - } - default: - { - goto Label1; - } - } - Documento documento1 = button.DataContext.GetValueFromType(); - if (documento1 != null) - { - documento1 = await (new ApoliceServico()).BuscarApoliceAsync(documento1.get_Id(), false, false); - nullable = null; - double? nullable5 = nullable; - nullable = null; - (new HosterWindow(new ApoliceView(documento1, true, false, 0, (long)0, false), string.Concat("CADASTRO DE APÓLICES - ", documento1.get_Controle().get_Cliente().get_Nome()), nullable5, nullable, false)).Show(); - } - else - { - return; - } - } - Label1: - dataContext = null; - } - else if (button.DataContext.GetValueFromType().ToString() != "PROSPECÇÃO") - { - Prospeccao prospeccao = await this.ViewModel.ShowProspeccaoDialog(button.DataContext.GetValueFromType()); - if (prospeccao != null) - { - List> keyValuePairs = await this.ViewModel.SalvarProspeccao(prospeccao); - if (keyValuePairs != null && keyValuePairs.Count >= 1) - { - await this.ViewModel.ShowMessage(keyValuePairs, this.ViewModel.ErroCamposInvalidos, "OK", ""); - } - } - } - } - } - - public void SortDataGrid() - { - DataGridColumn item = this.DataGrid.Columns[this._index]; - this.DataGrid.Items.SortDescriptions.Clear(); - this.DataGrid.Items.SortDescriptions.Add(new SortDescription(item.SortMemberPath, this._sortDirection)); - foreach (DataGridColumn column in this.DataGrid.Columns) - { - column.SortDirection = null; - } - item.SortDirection = new ListSortDirection?(this._sortDirection); - this.DataGrid.Items.Refresh(); - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 1: - { - this.LayoutRoot = (Grid)target; - return; - } - case 2: - { - this.DataGrid = (System.Windows.Controls.DataGrid)target; - this.DataGrid.Sorting += new DataGridSortingEventHandler(this.Grid_Sorting); - return; - } - case 3: - case 5: - case 7: - case 9: - { - this._contentLoaded = true; - return; - } - case 4: - { - this.InfoButton = (DataGridTemplateColumn)target; - return; - } - case 6: - { - this.ArquivoButton = (DataGridTemplateColumn)target; - return; - } - case 8: - { - this.VinculoButton = (DataGridTemplateColumn)target; - return; - } - case 10: - { - this.CalculoButton = (DataGridTemplateColumn)target; - return; - } - case 11: - { - this.AssinaturaButton = (DataGridTemplateColumn)target; - return; - } - case 12: - { - this.Totalizacao = (Expander)target; - this.Totalizacao.Collapsed += new RoutedEventHandler(this.Totalizacao_OnCollapsedExpanded); - this.Totalizacao.Expanded += new RoutedEventHandler(this.Totalizacao_OnCollapsedExpanded); - return; - } - case 13: - { - this.SinteticoGrid = (ItemsControl)target; - return; - } - default: - { - this._contentLoaded = true; - return; - } - } - } - - [DebuggerNonUserCode] - [EditorBrowsable(EditorBrowsableState.Never)] - [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] - void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) - { - switch (connectionId) - { - case 3: - { - ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBox_Checked); - ((CheckBox)target).Unchecked += new RoutedEventHandler(this.CheckBox_Checked); - return; - } - case 4: - case 6: - case 8: - { - return; - } - case 5: - { - ((Button)target).Click += new RoutedEventHandler(this.MaisInformacoes_OnClick); - return; - } - case 7: - { - ((Button)target).Click += new RoutedEventHandler(this.ArquivoDigital_OnClick); - return; - } - case 9: - { - ((Button)target).Click += new RoutedEventHandler(this.Vinculo_OnClick); - return; - } - default: - { - return; - } - } - } - - private void TipoRelatorio() - { - Expander totalizacao; - System.Windows.Visibility visibility; - this.AssinaturaButton.Visibility = (this.ViewModel.Relatorio == 2 ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - this.VinculoButton.Visibility = (this.ViewModel.Relatorio == 3 ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - this.CalculoButton.Visibility = (this.ViewModel.Relatorio == 4 ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - string tipo = ValidationHelper.GetTipo(this.ViewModel.Relatorio); - if (tipo == "FECHAMENTO" || tipo == "NOTA FISCAL") - { - this.InfoButton.Visibility = System.Windows.Visibility.Collapsed; - this.ArquivoButton.Visibility = System.Windows.Visibility.Collapsed; - } - else if (tipo == "TAREFA") - { - this.InfoButton.Visibility = System.Windows.Visibility.Visible; - this.ArquivoButton.Visibility = System.Windows.Visibility.Collapsed; - } - else if (tipo == "EXTRATO") - { - this.InfoButton.Visibility = System.Windows.Visibility.Collapsed; - this.ArquivoButton.Visibility = System.Windows.Visibility.Visible; - } - else - { - this.InfoButton.Visibility = System.Windows.Visibility.Visible; - this.ArquivoButton.Visibility = System.Windows.Visibility.Visible; - } - Relatorio relatorio = this.ViewModel.Relatorio; - if (relatorio <= 15) - { - if (relatorio == 8) - { - this.InfoButton.Visibility = System.Windows.Visibility.Visible; - this.ArquivoButton.Visibility = System.Windows.Visibility.Visible; - } - else if (relatorio - 14 <= 1) - { - this.InfoButton.Visibility = System.Windows.Visibility.Collapsed; - this.ArquivoButton.Visibility = System.Windows.Visibility.Collapsed; - totalizacao = this.Totalizacao; - visibility = (this.ViewModel.Totais ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - totalizacao.Visibility = visibility; - if (!string.IsNullOrWhiteSpace(tipo)) - { - return; - } - this.InfoButton.Visibility = System.Windows.Visibility.Collapsed; - this.ArquivoButton.Visibility = System.Windows.Visibility.Collapsed; - return; - } - } - else if (relatorio - 24 <= 1) - { - this.InfoButton.Visibility = System.Windows.Visibility.Visible; - this.ArquivoButton.Visibility = System.Windows.Visibility.Collapsed; - } - else if (relatorio == 26) - { - this.InfoButton.Visibility = System.Windows.Visibility.Collapsed; - this.ArquivoButton.Visibility = System.Windows.Visibility.Collapsed; - totalizacao = this.Totalizacao; - visibility = (this.ViewModel.Totais ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - totalizacao.Visibility = visibility; - if (!string.IsNullOrWhiteSpace(tipo)) - { - return; - } - this.InfoButton.Visibility = System.Windows.Visibility.Collapsed; - this.ArquivoButton.Visibility = System.Windows.Visibility.Collapsed; - return; - } - totalizacao = this.Totalizacao; - visibility = (this.ViewModel.Totais ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); - totalizacao.Visibility = visibility; - if (!string.IsNullOrWhiteSpace(tipo)) - { - return; - } - this.InfoButton.Visibility = System.Windows.Visibility.Collapsed; - this.ArquivoButton.Visibility = System.Windows.Visibility.Collapsed; - } - - private void Totalizacao_OnCollapsedExpanded(object sender, RoutedEventArgs e) - { - this.ViewModel.Totalizacao = this.Totalizacao.IsExpanded; - } - - private async void Vinculo_OnClick(object sender, RoutedEventArgs e) - { - Button button = (Button)sender; - if (button.DataContext != null) - { - ApolicePendente dataContext = (ApolicePendente)button.DataContext; - await this.ViewModel.RemoverVinculo(dataContext); - } - } - } -} \ No newline at end of file -- cgit v1.2.3