diff options
Diffstat (limited to 'Decompiler/Gestor.Application.Componentes/GridRelatorio.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Componentes/GridRelatorio.cs | 607 |
1 files changed, 607 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Componentes/GridRelatorio.cs b/Decompiler/Gestor.Application.Componentes/GridRelatorio.cs new file mode 100644 index 0000000..9a107ae --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/GridRelatorio.cs @@ -0,0 +1,607 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Markup; +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; + +namespace Gestor.Application.Componentes; + +public class GridRelatorio : UserControl, IComponentConnector, IStyleConnector +{ + internal Grid LayoutRoot; + + internal 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 RelatorioViewModel ViewModel { get; } + + private int _index { get; set; } = -1; + + + private ListSortDirection _sortDirection { get; set; } + + public GridRelatorio(RelatorioViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + ViewModel.Totalizacao = true; + InitializeComponent(); + ((FrameworkElement)LayoutRoot).DataContext = this; + TipoRelatorio(); + } + + private void TipoRelatorio() + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Invalid comparison between Unknown and I4 + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Invalid comparison between Unknown and I4 + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Invalid comparison between Unknown and I4 + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_010f: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_0115: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Invalid comparison between Unknown and I4 + //IL_0127: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Invalid comparison between Unknown and I4 + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Invalid comparison between Unknown and I4 + //IL_012e: Unknown result type (might be due to invalid IL or missing references) + //IL_0131: Invalid comparison between Unknown and I4 + //IL_011e: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Unknown result type (might be due to invalid IL or missing references) + //IL_0123: Invalid comparison between Unknown and I4 + ((DataGridColumn)AssinaturaButton).Visibility = (Visibility)(((int)ViewModel.Relatorio != 2) ? 2 : 0); + ((DataGridColumn)VinculoButton).Visibility = (Visibility)(((int)ViewModel.Relatorio != 3) ? 2 : 0); + ((DataGridColumn)CalculoButton).Visibility = (Visibility)(((int)ViewModel.Relatorio != 4) ? 2 : 0); + string tipo = ValidationHelper.GetTipo((Enum)(object)ViewModel.Relatorio); + switch (tipo) + { + case "FECHAMENTO": + case "NOTA FISCAL": + ((DataGridColumn)InfoButton).Visibility = (Visibility)2; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + break; + case "TAREFA": + ((DataGridColumn)InfoButton).Visibility = (Visibility)0; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + break; + case "EXTRATO": + ((DataGridColumn)InfoButton).Visibility = (Visibility)2; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)0; + break; + default: + ((DataGridColumn)InfoButton).Visibility = (Visibility)0; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)0; + break; + } + Relatorio relatorio = ViewModel.Relatorio; + if ((int)relatorio <= 15) + { + if ((int)relatorio != 8) + { + if (relatorio - 14 <= 1) + { + goto IL_014f; + } + } + else + { + ((DataGridColumn)InfoButton).Visibility = (Visibility)0; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)0; + } + } + else if (relatorio - 24 > 1) + { + if ((int)relatorio == 26) + { + goto IL_014f; + } + } + else + { + ((DataGridColumn)InfoButton).Visibility = (Visibility)0; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + } + goto IL_0181; + IL_0181: + ((UIElement)Totalizacao).Visibility = (Visibility)((!ViewModel.Totais) ? 2 : 0); + if (string.IsNullOrWhiteSpace(tipo)) + { + ((DataGridColumn)InfoButton).Visibility = (Visibility)2; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + } + return; + IL_014f: + ((DataGridColumn)InfoButton).Visibility = (Visibility)2; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + goto IL_0181; + } + + private async void ArquivoDigital_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + object dataContext = ((FrameworkElement)val).DataContext; + FiltroArquivoDigital val2 = null; + switch (ValidationHelper.GetTipo((Enum)(object)ViewModel.Relatorio)) + { + case "CLIENTE": + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)1).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)1) + "."); + return; + } + if ((int)ViewModel.Relatorio == 17) + { + Item item = dataContext.GetValueFromType<Item>(); + Documento valueFromType3 = ((FrameworkElement)val).DataContext.GetValueFromType<Documento>(); + if (item == null) + { + return; + } + item.Documento = await new ApoliceServico().BuscarApoliceAsync(((DomainBase)valueFromType3).Id); + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)item).Id, + Tipo = (TipoArquivoDigital)4, + Parente = item + }; + } + else + { + Cliente valueFromType4 = dataContext.GetValueFromType<Cliente>(); + if (valueFromType4 == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType4).Id, + Tipo = (TipoArquivoDigital)1, + Parente = valueFromType4 + }; + } + break; + case "FECHAMENTO": + case "DOCUMENTO": + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)2) + "."); + return; + } + Documento valueFromType5 = dataContext.GetValueFromType<Documento>(); + if (valueFromType5 == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType5).Id, + Tipo = (TipoArquivoDigital)2, + Parente = valueFromType5 + }; + break; + } + case "PARCELA": + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)3).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)3) + "."); + return; + } + Parcela valueFromType2 = dataContext.GetValueFromType<Parcela>(); + if (valueFromType2 == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType2).Id, + IdApolice = ((DomainBase)valueFromType2.Documento).Id, + Tipo = (TipoArquivoDigital)3, + Parente = valueFromType2 + }; + break; + } + case "SINISTRO": + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)5).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)5) + "."); + return; + } + Sinistro valueFromType6 = dataContext.GetValueFromType<Sinistro>(); + if (valueFromType6 == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType6).Id, + IdApolice = ((DomainBase)valueFromType6.ControleSinistro.Item.Documento).Id, + Tipo = (TipoArquivoDigital)5, + Parente = valueFromType6 + }; + break; + } + case "EXTRATO": + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)7).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)7) + "."); + return; + } + Extrato valueFromType = dataContext.GetValueFromType<Extrato>(); + if (valueFromType == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType).Id, + Tipo = (TipoArquivoDigital)7, + Parente = valueFromType + }; + break; + } + } + if (val2 == null) + { + await ViewModel.ShowMessage("ESSE TIPO DE RELATÓRIO NÃO POSSUI ARQUIVO DIGITAL"); + } + else + { + new BaseSegurosViewModel().ShowDrawer(new ArquivoDigitalDrawer(val2), 0, close: false); + } + } + + private async void CheckBox_Checked(object sender, RoutedEventArgs e) + { + ViewModel.Carregando = true; + ViewModel.IsEnabled = false; + await ViewModel.Selecionar(); + ViewModel.IsEnabled = true; + ViewModel.Carregando = false; + } + + private async void MaisInformacoes_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext == null) + { + return; + } + string tipo = ValidationHelper.GetTipo((Enum)(object)ViewModel.Relatorio); + if ((int)ViewModel.Relatorio == 17) + { + Item valueFromType = ((FrameworkElement)val).DataContext.GetValueFromType<Item>(); + Documento valueFromType2 = ((FrameworkElement)val).DataContext.GetValueFromType<Documento>(); + if (valueFromType != null) + { + valueFromType.Documento = valueFromType2; + ((Window)new HosterWindow((ContentControl)(object)new AutoView(null, lockInsert: true, substituir: false, null, valueFromType, valueFromType2.Controle.Ramo), "CADASTRO DE ITENS DO CLIENTE - " + valueFromType2.Controle.Cliente.Nome)).ShowDialog(); + } + } + else if ((int)ViewModel.Relatorio == 4 && ((FrameworkElement)val).DataContext.GetValueFromType<Prospeccao>() != null) + { + TipoDocumento valueFromType3 = ((FrameworkElement)val).DataContext.GetValueFromType<TipoDocumento>(); + if (((object)(TipoDocumento)(ref valueFromType3)).ToString() == "PROSPECÇÃO") + { + return; + } + Prospeccao val2 = await ViewModel.ShowProspeccaoDialog(((FrameworkElement)val).DataContext.GetValueFromType<Prospeccao>()); + if (val2 != null) + { + List<KeyValuePair<string, string>> list = await ViewModel.SalvarProspeccao(val2); + if (list != null && list.Count >= 1) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + } + else + { + if (tipo == null) + { + return; + } + Documento valueFromType4; + switch (tipo.Length) + { + case 7: + switch (tipo[0]) + { + case 'C': + if (tipo == "CLIENTE") + { + Cliente valueFromType7 = ((FrameworkElement)val).DataContext.GetValueFromType<Cliente>(); + if (valueFromType7 != null) + { + valueFromType7 = await new ClienteServico().BuscarClienteAsync(((DomainBase)valueFromType7).Id); + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(valueFromType7, lockInsert: true), "CADASTRO DE CLIENTES - " + valueFromType7.Nome)).ShowDialog(); + } + } + break; + case 'P': + { + if (!(tipo == "PARCELA")) + { + break; + } + Documento valueFromType5 = ((FrameworkElement)val).DataContext.GetValueFromType<Documento>(); + if (valueFromType5 != null) + { + Parcela valueFromType6 = ((FrameworkElement)val).DataContext.GetValueFromType<Parcela>(); + if (valueFromType6 != null) + { + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(valueFromType5, lockInsert: true, invoke: false, (AcessoApolice)1, ((DomainBase)valueFromType6).Id), "CADASTRO DE APÓLICES - " + valueFromType5.Controle.Cliente.Nome)).Show(); + } + } + break; + } + } + break; + case 10: + if (!(tipo == "FECHAMENTO")) + { + break; + } + goto IL_0453; + case 9: + if (!(tipo == "DOCUMENTO")) + { + break; + } + goto IL_0453; + case 8: + if (tipo == "SINISTRO") + { + Sinistro sinistroInfo = (Sinistro)((FrameworkElement)val).DataContext; + Sinistro valueFromType8 = ((FrameworkElement)val).DataContext.GetValueFromType<Sinistro>(); + if (valueFromType8 != null) + { + ((Window)new HosterWindow((ContentControl)(object)new SinistroView((await ViewModel.CarregaSinistroApolice(((DomainBase)valueFromType8).Id)).ControleSinistro.Item, attached: false), "CADASTRO DE SINISTROS - " + sinistroInfo.Nome + " - " + sinistroInfo.Apolice + " " + sinistroInfo.Endosso)).Show(); + } + } + break; + case 6: + if (tipo == "TAREFA") + { + Tarefa val4 = (Tarefa)((FrameworkElement)val).DataContext; + Tarefa tarefa = new Tarefa + { + Id = val4.Id, + IdCliente = val4.IdCliente, + Cliente = val4.Cliente, + IdEntidade = val4.IdEntidade, + Entidade = val4.Entidade, + Conclusao = val4.Conclusao + }; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa, enableMenu: false), 0, close: false); + } + break; + case 4: + { + if (tipo == "LOGS") + { + if (((FrameworkElement)val).DataContext is LogAcaoRelatorio) + { + ViewModel.ShowDrawer(new LogUtilizacaoDrawer(((LogAcaoRelatorio)((FrameworkElement)val).DataContext).RegistroEntity, ViewModel.Relatorio), 0, close: false); + break; + } + LogsEnvio val3 = (LogsEnvio)((FrameworkElement)val).DataContext; + ViewModel.ShowDrawer(new LogEmailDrawer((TipoTela)17, val3.Id, singleMode: true), 0, close: false); + } + break; + } + IL_0453: + valueFromType4 = ((FrameworkElement)val).DataContext.GetValueFromType<Documento>(); + if (valueFromType4 != null) + { + valueFromType4 = await new ApoliceServico().BuscarApoliceAsync(((DomainBase)valueFromType4).Id); + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(valueFromType4, lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + valueFromType4.Controle.Cliente.Nome)).Show(); + } + break; + } + } + } + + private void Totalizacao_OnCollapsedExpanded(object sender, RoutedEventArgs e) + { + ViewModel.Totalizacao = Totalizacao.IsExpanded; + } + + private async void Vinculo_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext != null) + { + ApolicePendente pendencia = (ApolicePendente)((FrameworkElement)val).DataContext; + await ViewModel.RemoverVinculo(pendencia); + } + } + + private void Grid_Sorting(object sender, DataGridSortingEventArgs e) + { + _index = ((DataGridColumnEventArgs)e).Column.DisplayIndex; + _sortDirection = ((((DataGridColumnEventArgs)e).Column.SortDirection == ListSortDirection.Ascending) ? ListSortDirection.Descending : ListSortDirection.Ascending); + } + + public void SortDataGrid() + { + //IL_0048: Unknown result type (might be due to invalid IL or missing references) + DataGridColumn val = DataGrid.Columns[_index]; + ((Collection<SortDescription>)(object)((CollectionView)((ItemsControl)DataGrid).Items).SortDescriptions).Clear(); + ((Collection<SortDescription>)(object)((CollectionView)((ItemsControl)DataGrid).Items).SortDescriptions).Add(new SortDescription(val.SortMemberPath, _sortDirection)); + foreach (DataGridColumn column in DataGrid.Columns) + { + column.SortDirection = null; + } + val.SortDirection = _sortDirection; + ((CollectionView)((ItemsControl)DataGrid).Items).Refresh(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/gridrelatorio.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Expected O, but got Unknown + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Expected O, but got Unknown + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a5: Expected O, but got Unknown + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Expected O, but got Unknown + //IL_00b5: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Expected O, but got Unknown + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Expected O, but got Unknown + //IL_00e3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ed: Expected O, but got Unknown + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fa: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LayoutRoot = (Grid)target; + break; + case 2: + DataGrid = (DataGrid)target; + DataGrid.Sorting += new DataGridSortingEventHandler(Grid_Sorting); + break; + case 4: + InfoButton = (DataGridTemplateColumn)target; + break; + case 6: + ArquivoButton = (DataGridTemplateColumn)target; + break; + case 8: + VinculoButton = (DataGridTemplateColumn)target; + break; + case 10: + CalculoButton = (DataGridTemplateColumn)target; + break; + case 11: + AssinaturaButton = (DataGridTemplateColumn)target; + break; + case 12: + Totalizacao = (Expander)target; + Totalizacao.Collapsed += new RoutedEventHandler(Totalizacao_OnCollapsedExpanded); + Totalizacao.Expanded += new RoutedEventHandler(Totalizacao_OnCollapsedExpanded); + break; + case 13: + SinteticoGrid = (ItemsControl)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Expected O, but got Unknown + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Expected O, but got Unknown + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Expected O, but got Unknown + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Expected O, but got Unknown + switch (connectionId) + { + case 3: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(MaisInformacoes_OnClick); + break; + case 7: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick); + break; + case 9: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Vinculo_OnClick); + break; + case 4: + case 6: + case 8: + break; + } + } +} |