From 674ca83ba9243a9e95a7568c797668dab6aee26a Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:35:25 -0300 Subject: feat: upload files --- Gestor.Application/Componentes/CalculoControl.cs | 680 ++++++++++++++++++++ Gestor.Application/Componentes/CoberturaView.cs | 139 ++++ Gestor.Application/Componentes/ContasDialog.cs | 73 +++ .../Componentes/CustomIsReadOnlyControl.cs | 76 +++ .../Componentes/CustomItemControl.cs | 54 ++ .../Componentes/CustomItemValidation.cs | 11 + .../Componentes/CustomLegendChart.cs | 140 ++++ .../Componentes/CustomPasswordBox.cs | 203 ++++++ .../Componentes/CustomSenhaLoginBox.cs | 338 ++++++++++ .../Componentes/CustomSeriesViewModel.cs | 72 +++ Gestor.Application/Componentes/DefaultDialog.cs | 40 ++ .../Componentes/DialogAdvertising.cs | 101 +++ .../Componentes/DialogAnaliticoBi.cs | 387 +++++++++++ Gestor.Application/Componentes/DialogAnexar.cs | 98 +++ Gestor.Application/Componentes/DialogCopia.cs | 160 +++++ .../Componentes/DialogCopiarCliente.cs | 92 +++ .../Componentes/DialogCopiarPermissao.cs | 73 +++ .../Componentes/DialogDetalheExtrato.cs | 119 ++++ .../Componentes/DialogEditarParcelas.cs | 170 +++++ .../Componentes/DialogEnviarEmails.cs | 62 ++ .../Componentes/DialogExportarPermissao.cs | 103 +++ .../Componentes/DialogExtratoComissao.cs | 207 ++++++ Gestor.Application/Componentes/DialogGrafico.cs | 47 ++ Gestor.Application/Componentes/DialogHoster.cs | 73 +++ .../Componentes/DialogInstalacoes.cs | 125 ++++ Gestor.Application/Componentes/DialogLogAcesso.cs | 71 +++ Gestor.Application/Componentes/DialogMedalha.cs | 49 ++ Gestor.Application/Componentes/DialogObservacao.cs | 85 +++ .../Componentes/DialogPesquisaAvancada.cs | 129 ++++ Gestor.Application/Componentes/DialogPrint.cs | 176 ++++++ Gestor.Application/Componentes/DialogProtocolo.cs | 51 ++ .../Componentes/DialogReordenarItens.cs | 67 ++ .../Componentes/DialogSelecionarItens.cs | 49 ++ Gestor.Application/Componentes/DialogSenhaAdm.cs | 125 ++++ Gestor.Application/Componentes/DialogTarefa.cs | 391 ++++++++++++ .../Componentes/DialogTransferencia.cs | 110 ++++ Gestor.Application/Componentes/DialogTrilha.cs | 134 ++++ Gestor.Application/Componentes/DialogVinculo.cs | 89 +++ Gestor.Application/Componentes/ErrorDialog.cs | 40 ++ Gestor.Application/Componentes/GridRelatorio.cs | 695 ++++++++++++++++++++ Gestor.Application/Componentes/Loading.cs | 40 ++ .../Componentes/NRecoHtmlToPdfConverter.cs | 13 + Gestor.Application/Componentes/PassBox.cs | 213 +++++++ Gestor.Application/Componentes/ProgressDialog.cs | 40 ++ Gestor.Application/Componentes/ProspeccaoDialog.cs | 398 ++++++++++++ .../Componentes/VincularLancamentoDialog.cs | 82 +++ Gestor.Application/Componentes/WebBrowser.cs | 197 ++++++ Gestor.Application/Componentes/WebEditor.cs | 704 +++++++++++++++++++++ 48 files changed, 7591 insertions(+) create mode 100644 Gestor.Application/Componentes/CalculoControl.cs create mode 100644 Gestor.Application/Componentes/CoberturaView.cs create mode 100644 Gestor.Application/Componentes/ContasDialog.cs create mode 100644 Gestor.Application/Componentes/CustomIsReadOnlyControl.cs create mode 100644 Gestor.Application/Componentes/CustomItemControl.cs create mode 100644 Gestor.Application/Componentes/CustomItemValidation.cs create mode 100644 Gestor.Application/Componentes/CustomLegendChart.cs create mode 100644 Gestor.Application/Componentes/CustomPasswordBox.cs create mode 100644 Gestor.Application/Componentes/CustomSenhaLoginBox.cs create mode 100644 Gestor.Application/Componentes/CustomSeriesViewModel.cs create mode 100644 Gestor.Application/Componentes/DefaultDialog.cs create mode 100644 Gestor.Application/Componentes/DialogAdvertising.cs create mode 100644 Gestor.Application/Componentes/DialogAnaliticoBi.cs create mode 100644 Gestor.Application/Componentes/DialogAnexar.cs create mode 100644 Gestor.Application/Componentes/DialogCopia.cs create mode 100644 Gestor.Application/Componentes/DialogCopiarCliente.cs create mode 100644 Gestor.Application/Componentes/DialogCopiarPermissao.cs create mode 100644 Gestor.Application/Componentes/DialogDetalheExtrato.cs create mode 100644 Gestor.Application/Componentes/DialogEditarParcelas.cs create mode 100644 Gestor.Application/Componentes/DialogEnviarEmails.cs create mode 100644 Gestor.Application/Componentes/DialogExportarPermissao.cs create mode 100644 Gestor.Application/Componentes/DialogExtratoComissao.cs create mode 100644 Gestor.Application/Componentes/DialogGrafico.cs create mode 100644 Gestor.Application/Componentes/DialogHoster.cs create mode 100644 Gestor.Application/Componentes/DialogInstalacoes.cs create mode 100644 Gestor.Application/Componentes/DialogLogAcesso.cs create mode 100644 Gestor.Application/Componentes/DialogMedalha.cs create mode 100644 Gestor.Application/Componentes/DialogObservacao.cs create mode 100644 Gestor.Application/Componentes/DialogPesquisaAvancada.cs create mode 100644 Gestor.Application/Componentes/DialogPrint.cs create mode 100644 Gestor.Application/Componentes/DialogProtocolo.cs create mode 100644 Gestor.Application/Componentes/DialogReordenarItens.cs create mode 100644 Gestor.Application/Componentes/DialogSelecionarItens.cs create mode 100644 Gestor.Application/Componentes/DialogSenhaAdm.cs create mode 100644 Gestor.Application/Componentes/DialogTarefa.cs create mode 100644 Gestor.Application/Componentes/DialogTransferencia.cs create mode 100644 Gestor.Application/Componentes/DialogTrilha.cs create mode 100644 Gestor.Application/Componentes/DialogVinculo.cs create mode 100644 Gestor.Application/Componentes/ErrorDialog.cs create mode 100644 Gestor.Application/Componentes/GridRelatorio.cs create mode 100644 Gestor.Application/Componentes/Loading.cs create mode 100644 Gestor.Application/Componentes/NRecoHtmlToPdfConverter.cs create mode 100644 Gestor.Application/Componentes/PassBox.cs create mode 100644 Gestor.Application/Componentes/ProgressDialog.cs create mode 100644 Gestor.Application/Componentes/ProspeccaoDialog.cs create mode 100644 Gestor.Application/Componentes/VincularLancamentoDialog.cs create mode 100644 Gestor.Application/Componentes/WebBrowser.cs create mode 100644 Gestor.Application/Componentes/WebEditor.cs (limited to 'Gestor.Application/Componentes') diff --git a/Gestor.Application/Componentes/CalculoControl.cs b/Gestor.Application/Componentes/CalculoControl.cs new file mode 100644 index 0000000..5f2776d --- /dev/null +++ b/Gestor.Application/Componentes/CalculoControl.cs @@ -0,0 +1,680 @@ +using Agger.Registro; +using CsQuery.ExtensionMethods.Internal; +using Gestor.Application.Actions; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.CalculoWeb; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.License; +using Microsoft.CSharp.RuntimeBinder; +using Newtonsoft.Json.Linq; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Linq.Expressions; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class CalculoControl : UserControl, IComponentConnector + { + public readonly static DependencyProperty DocumentoIdProperty; + + public readonly static DependencyProperty ClienteIdProperty; + + public readonly static DependencyProperty RamoIdProperty; + + public readonly static DependencyProperty DocumentoProperty; + + private string _messageAggilizadorWeb = string.Concat("CRIADO COM SUCESSO!", Environment.NewLine, "DESEJA ACESSAR A PAGINA DO AGGILIZADOR AGORA?"); + + private string MessageAggilizador = string.Concat("NÃO FOI POSSÍVEL INICIAR A FUNÇÃO NO AGGILIZADOR DE CÁLCULOS.", Environment.NewLine, "CERTIFIQUE-SE QUE O AGGILIZADOR ESTÁ DEVIDAMENTE ATUALIZADO ANTES DE TENTAR NOVAMENTE."); + + internal Grid LayoutRoot; + + internal Button CalculoButton; + + private bool _contentLoaded; + + public object ClienteId + { + get + { + return base.GetValue(CalculoControl.ClienteIdProperty); + } + set + { + base.SetValue(CalculoControl.ClienteIdProperty, value); + } + } + + public string Documento + { + get + { + return (string)base.GetValue(CalculoControl.DocumentoProperty); + } + set + { + base.SetValue(CalculoControl.DocumentoProperty, value); + } + } + + public object DocumentoId + { + get + { + return base.GetValue(CalculoControl.DocumentoIdProperty); + } + set + { + base.SetValue(CalculoControl.DocumentoIdProperty, value); + } + } + + public object RamoId + { + get + { + return base.GetValue(CalculoControl.RamoIdProperty); + } + set + { + base.SetValue(CalculoControl.RamoIdProperty, value); + } + } + + static CalculoControl() + { + CalculoControl.DocumentoIdProperty = DependencyProperty.Register("DocumentoId", typeof(object), typeof(CalculoControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + CalculoControl.ClienteIdProperty = DependencyProperty.Register("ClienteId", typeof(object), typeof(CalculoControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + CalculoControl.RamoIdProperty = DependencyProperty.Register("RamoId", typeof(object), typeof(CalculoControl), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + CalculoControl.DocumentoProperty = DependencyProperty.Register("Documento", typeof(object), typeof(CalculoControl), new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + } + + public CalculoControl() + { + this.InitializeComponent(); + this.LayoutRoot.DataContext = this; + } + + private async Task AutoCalculo(Gestor.Model.Domain.Seguros.Documento doc) + { + // + // Current member / type: System.Threading.Tasks.Task`1 Gestor.Application.Componentes.CalculoControl::AutoCalculo(Gestor.Model.Domain.Seguros.Documento) + // File path: C:\AggerSeguros\Gestor.Application.exe + // + // Product version: 0.0.0.0 + // Exception in: System.Threading.Tasks.Task AutoCalculo(Gestor.Model.Domain.Seguros.Documento) + // + // Object reference not set to an instance of an object. + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.FindLowestCommonAncestor(ICollection`1 typeNodes) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 515 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.MergeWithLowestCommonAncestor() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 459 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.ProcessSingleConstraints() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 378 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.InferTypes() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 331 + // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.Process(DecompilationContext theContext, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\ExpressionDecompilerStep.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileStateMachine(MethodBody body, DecompilationContext enclosingContext, BaseStateMachineRemoverStep removeStateMachineStep, Func`2 stateMachineDataSelector, DecompilationContext& decompilationContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileAsyncStateMachine(MethodBody body, DecompilationContext enclosingContext, AsyncData& asyncData) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 150 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.GetMoveNextStatements() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 155 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Match() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 60 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Process(DecompilationContext context, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 31 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.RunPipeline(DecompilationPipeline pipeline, ILanguage language, MethodBody body, DecompilationContext& context) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 95 + // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61 + // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 118 + // + // mailto: JustDecompilePublicFeedback@telerik.com + + } + + public static async Task BuscaClienteCompleto(long idCliente) + { + Cliente cliente = await (new ClienteServico()).BuscarCliente(idCliente); + ObservableCollection observableCollection = await (new ClienteServico()).BuscarTelefonesAsync(idCliente); + ObservableCollection observableCollection1 = await (new ClienteServico()).BuscarEmailsAsync(idCliente); + ObservableCollection observableCollection2 = await (new ClienteServico()).BuscarEnderecosAsync(idCliente); + cliente.set_Telefones(new ObservableCollection(observableCollection)); + cliente.set_Emails(new ObservableCollection(observableCollection1)); + cliente.set_Enderecos(new ObservableCollection(observableCollection2)); + Cliente cliente1 = cliente; + cliente = null; + observableCollection = null; + observableCollection1 = null; + return cliente1; + } + + private async void Calcular_OnClick(object sender, RoutedEventArgs e) + { + long? nullable; + long? nullable1; + if (await this.VerificarPermissao()) + { + if (this.DocumentoId != null) + { + List produtos = LicenseHelper.Produtos; + if (!produtos.Any((Licenca produto) => produto.get_Produto() == 91)) + { + await this.Iniciar(true); + Gestor.Model.Domain.Seguros.Documento documento = await (new ApoliceServico()).BuscarApoliceAsync(long.Parse(this.DocumentoId.ToString()), true, false); + long id = documento.get_Controle().get_Cliente().get_Id(); + long num = documento.get_Id(); + long id1 = documento.get_Controle().get_Id(); + List itensAtivo = documento.get_ItensAtivo(); + if (itensAtivo != null) + { + Item item = itensAtivo.FirstOrDefault(); + if (item != null) + { + nullable1 = new long?(item.get_Id()); + } + else + { + nullable = null; + nullable1 = nullable; + } + } + else + { + nullable = null; + nullable1 = nullable; + } + dynamic variable = new { ClientId = id, DocumentId = num, ControlId = id1, ItemId = nullable1, Branch = documento.get_Controle().get_Ramo().get_Id() }; + this.IniciarPipe(variable); + } + else if (!string.IsNullOrEmpty(Recursos.Usuario.get_Email())) + { + string str = await this.CalculoWeb(this.DocumentoId.ToString()); + if (!ExtensionMethods.IsNullOrEmpty(str)) + { + if (await (new DashboardViewModel()).ShowMessage(this._messageAggilizadorWeb, "SIM", "NÃO", false)) + { + int num1 = 0; + try + { + ProcessStartInfo processStartInfo = new ProcessStartInfo(str) + { + UseShellExecute = true + }; + Process.Start(processStartInfo); + } + catch + { + num1 = 1; + } + if (num1 == 1) + { + await (new DashboardViewModel()).ShowMessage("ERRO AO ABRIR CALCULO", "OK", "", false); + } + } + } + } + else + { + await (new DashboardViewModel()).ShowMessage("USUÁRIO SEM E-MAIL CADASTRADO! O E-MAIL CADASTRADO DEVE SER O MESMO DO AGGILIZADOR.", "OK", "", false); + } + } + else + { + this.Prospectar(); + } + } + } + + private async Task CalculoWeb(string idDocumento) + { + // + // Current member / type: System.Threading.Tasks.Task`1 Gestor.Application.Componentes.CalculoControl::CalculoWeb(System.String) + // File path: C:\AggerSeguros\Gestor.Application.exe + // + // Product version: 0.0.0.0 + // Exception in: System.Threading.Tasks.Task CalculoWeb(System.String) + // + // Object reference not set to an instance of an object. + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.FindLowestCommonAncestor(ICollection`1 typeNodes) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 515 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.MergeWithLowestCommonAncestor() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 459 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.ProcessSingleConstraints() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 378 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.InferTypes() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 331 + // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.Process(DecompilationContext theContext, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\ExpressionDecompilerStep.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileStateMachine(MethodBody body, DecompilationContext enclosingContext, BaseStateMachineRemoverStep removeStateMachineStep, Func`2 stateMachineDataSelector, DecompilationContext& decompilationContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileAsyncStateMachine(MethodBody body, DecompilationContext enclosingContext, AsyncData& asyncData) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 150 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.GetMoveNextStatements() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 155 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Match() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 60 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Process(DecompilationContext context, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 31 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.RunPipeline(DecompilationPipeline pipeline, ILanguage language, MethodBody body, DecompilationContext& context) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 95 + // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61 + // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 118 + // + // mailto: JustDecompilePublicFeedback@telerik.com + + } + + private async Task CallPipe(dynamic message) + { + dynamic obj; + int num = 7; + PipeClient pipeClient = new PipeClient("AggilizadorPIPE"); + dynamic obj1 = pipeClient.Send(message); + while (true) + { + dynamic obj2 = !obj1; + obj = (!obj2 ? obj2 : obj2 & num > 0); + if (!obj) + { + break; + } + await Task.Delay(2000); + obj1 = pipeClient.Send(message); + num--; + } + bool flag = (bool)obj1; + pipeClient = null; + return flag; + } + + private async Task CondominioCalculo(Gestor.Model.Domain.Seguros.Documento doc) + { + // + // Current member / type: System.Threading.Tasks.Task`1 Gestor.Application.Componentes.CalculoControl::CondominioCalculo(Gestor.Model.Domain.Seguros.Documento) + // File path: C:\AggerSeguros\Gestor.Application.exe + // + // Product version: 0.0.0.0 + // Exception in: System.Threading.Tasks.Task CondominioCalculo(Gestor.Model.Domain.Seguros.Documento) + // + // Object reference not set to an instance of an object. + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.FindLowestCommonAncestor(ICollection`1 typeNodes) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 515 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.MergeWithLowestCommonAncestor() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 459 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.ProcessSingleConstraints() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 378 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.InferTypes() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 331 + // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.Process(DecompilationContext theContext, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\ExpressionDecompilerStep.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileStateMachine(MethodBody body, DecompilationContext enclosingContext, BaseStateMachineRemoverStep removeStateMachineStep, Func`2 stateMachineDataSelector, DecompilationContext& decompilationContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileAsyncStateMachine(MethodBody body, DecompilationContext enclosingContext, AsyncData& asyncData) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 150 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.GetMoveNextStatements() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 155 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Match() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 60 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Process(DecompilationContext context, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 31 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.RunPipeline(DecompilationPipeline pipeline, ILanguage language, MethodBody body, DecompilationContext& context) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 95 + // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61 + // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 118 + // + // mailto: JustDecompilePublicFeedback@telerik.com + + } + + private void DropContextMenu_OnClick(object sender, RoutedEventArgs e) + { + if (string.IsNullOrEmpty(this.Documento)) + { + this.Calcular_OnClick(sender, e); + return; + } + Button button = sender as Button; + System.Windows.Controls.ContextMenu contextMenu = button.ContextMenu; + contextMenu.PlacementTarget = button; + contextMenu.Placement = PlacementMode.Top; + contextMenu.IsOpen = true; + } + + private async Task EmpresaCalculo(Gestor.Model.Domain.Seguros.Documento doc) + { + // + // Current member / type: System.Threading.Tasks.Task`1 Gestor.Application.Componentes.CalculoControl::EmpresaCalculo(Gestor.Model.Domain.Seguros.Documento) + // File path: C:\AggerSeguros\Gestor.Application.exe + // + // Product version: 0.0.0.0 + // Exception in: System.Threading.Tasks.Task EmpresaCalculo(Gestor.Model.Domain.Seguros.Documento) + // + // Object reference not set to an instance of an object. + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.FindLowestCommonAncestor(ICollection`1 typeNodes) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 515 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.MergeWithLowestCommonAncestor() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 459 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.ProcessSingleConstraints() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 378 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.InferTypes() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 331 + // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.Process(DecompilationContext theContext, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\ExpressionDecompilerStep.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileStateMachine(MethodBody body, DecompilationContext enclosingContext, BaseStateMachineRemoverStep removeStateMachineStep, Func`2 stateMachineDataSelector, DecompilationContext& decompilationContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileAsyncStateMachine(MethodBody body, DecompilationContext enclosingContext, AsyncData& asyncData) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 150 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.GetMoveNextStatements() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 155 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Match() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 60 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Process(DecompilationContext context, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 31 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.RunPipeline(DecompilationPipeline pipeline, ILanguage language, MethodBody body, DecompilationContext& context) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 95 + // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61 + // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 118 + // + // mailto: JustDecompilePublicFeedback@telerik.com + + } + + public static async Task EnviaCalculoWeb(string body) + { + string empty; + string str; + try + { + using (HttpClient httpClient = new HttpClient()) + { + string str1 = "qN7vHy58kLTm4PXEbUgfzMAKrZye2GVn3sdJx9oRWcl71tbvQMF3cU6A8xn5"; + Uri apiCalculoWeb = Address.ApiCalculoWeb; + string[] strArrays = new string[] { "calculo" }; + Uri uri = apiCalculoWeb.Append(strArrays); + string[] strArrays1 = new string[] { "negocio" }; + Uri uri1 = uri.Append(strArrays1); + string[] strArrays2 = new string[] { "integracao" }; + Uri uri2 = uri1.Append(strArrays2); + httpClient.get_DefaultRequestHeaders().Clear(); + httpClient.get_DefaultRequestHeaders().Add("Authorization", str1); + StringContent stringContent = new StringContent(body, null, "application/json"); + HttpResponseMessage httpResponseMessage = await httpClient.PostAsync(uri2, stringContent); + if (httpResponseMessage.get_StatusCode() != HttpStatusCode.Unauthorized) + { + string str2 = await httpResponseMessage.get_Content().ReadAsStringAsync(); + JObject jObject = JObject.Parse(str2); + if (!str2.Contains("erro")) + { + JToken item = jObject.get_Item("url"); + if (item != null) + { + str = item.ToString(); + } + else + { + str = null; + } + empty = str; + } + else + { + empty = ""; + } + } + else + { + await (new DashboardViewModel()).ShowMessage("O E-MAIL CADASTRADO NO GESTOR É DIFERENTE DO E-MAIL CADASTRADO NO AGGILIZADOR!", "OK", "", false); + empty = string.Empty; + } + } + } + catch + { + empty = ""; + } + return empty; + } + + private async Task Iniciar(bool trazerParaFrente = false) + { + if (!"Aggilizador.Application".ProgramaEmExecucao()) + { + Action iniciarAggilizador = Gestor.Application.Actions.Actions.IniciarAggilizador; + if (iniciarAggilizador != null) + { + iniciarAggilizador(); + } + else + { + } + await Task.Delay(8000); + } + if (trazerParaFrente) + { + "Aggilizador.Application".BringToFront(); + } + } + + private async void IniciarPipe(dynamic message) + { + CalculoControl.u003cIniciarPipeu003ed__29 variable = new CalculoControl.u003cIniciarPipeu003ed__29(); + variable.u003cu003et__builder = AsyncVoidMethodBuilder.Create(); + variable.u003cu003e4__this = this; + variable.message = message; + variable.u003cu003e1__state = -1; + variable.u003cu003et__builder.Start(ref variable); + } + + [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/calculocontrol.xaml", UriKind.Relative)); + } + + private async void Prospectar() + { + if (this.ClienteId != null && this.RamoId != null) + { + await this.Iniciar(true); + dynamic variable = new { ClientId = long.Parse(this.ClienteId.ToString()), DocumentId = 0, ControlId = 0, ItemId = 0, Branch = long.Parse(this.RamoId.ToString()) }; + this.IniciarPipe(variable); + } + } + + private async Task ResidenciaCalculo(Gestor.Model.Domain.Seguros.Documento doc) + { + // + // Current member / type: System.Threading.Tasks.Task`1 Gestor.Application.Componentes.CalculoControl::ResidenciaCalculo(Gestor.Model.Domain.Seguros.Documento) + // File path: C:\AggerSeguros\Gestor.Application.exe + // + // Product version: 0.0.0.0 + // Exception in: System.Threading.Tasks.Task ResidenciaCalculo(Gestor.Model.Domain.Seguros.Documento) + // + // Object reference not set to an instance of an object. + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.FindLowestCommonAncestor(ICollection`1 typeNodes) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 515 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.MergeWithLowestCommonAncestor() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 459 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.ProcessSingleConstraints() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 378 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.InferTypes() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 331 + // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.Process(DecompilationContext theContext, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\ExpressionDecompilerStep.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileStateMachine(MethodBody body, DecompilationContext enclosingContext, BaseStateMachineRemoverStep removeStateMachineStep, Func`2 stateMachineDataSelector, DecompilationContext& decompilationContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileAsyncStateMachine(MethodBody body, DecompilationContext enclosingContext, AsyncData& asyncData) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 150 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.GetMoveNextStatements() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 155 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Match() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 60 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Process(DecompilationContext context, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 31 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.RunPipeline(DecompilationPipeline pipeline, ILanguage language, MethodBody body, DecompilationContext& context) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 95 + // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61 + // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 118 + // + // mailto: JustDecompilePublicFeedback@telerik.com + + } + + [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.CalculoButton = (Button)target; + this.CalculoButton.Click += new RoutedEventHandler(this.DropContextMenu_OnClick); + return; + } + case 3: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.Calcular_OnClick); + return; + } + case 4: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.VisualizarCalculos_OnClick); + return; + } + } + this._contentLoaded = true; + } + + private async Task VerificarPermissao() + { + bool flag; + if (Recursos.Usuario.get_PermissaoAggilizador().HasValue) + { + List produtos = LicenseHelper.Produtos; + if (!produtos.All((Licenca x) => { + if (x.get_Produto() == 79 || x.get_Produto() == 81) + { + return false; + } + return x.get_Produto() != 91; + })) + { + flag = true; + } + else + { + await (new DashboardViewModel()).ShowMessage("VOCÊ AINDA NÃO POSSUI AGGILIZADOR DE CÁLCULOS, ENTRE EM CONTATO COM comercial@agger.com.br PARA SABER MAIS", "OK", "", false); + flag = false; + } + } + else + { + await (new DashboardViewModel()).ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O AGGILIZADOR", "OK", "", false); + flag = false; + } + return flag; + } + + private async Task VidaGlobalCalculo(Gestor.Model.Domain.Seguros.Documento doc) + { + // + // Current member / type: System.Threading.Tasks.Task`1 Gestor.Application.Componentes.CalculoControl::VidaGlobalCalculo(Gestor.Model.Domain.Seguros.Documento) + // File path: C:\AggerSeguros\Gestor.Application.exe + // + // Product version: 0.0.0.0 + // Exception in: System.Threading.Tasks.Task VidaGlobalCalculo(Gestor.Model.Domain.Seguros.Documento) + // + // Object reference not set to an instance of an object. + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.FindLowestCommonAncestor(ICollection`1 typeNodes) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 515 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.MergeWithLowestCommonAncestor() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 459 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.ProcessSingleConstraints() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 378 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.InferTypes() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 331 + // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.Process(DecompilationContext theContext, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\ExpressionDecompilerStep.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileStateMachine(MethodBody body, DecompilationContext enclosingContext, BaseStateMachineRemoverStep removeStateMachineStep, Func`2 stateMachineDataSelector, DecompilationContext& decompilationContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileAsyncStateMachine(MethodBody body, DecompilationContext enclosingContext, AsyncData& asyncData) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 150 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.GetMoveNextStatements() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 155 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Match() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 60 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Process(DecompilationContext context, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 31 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.RunPipeline(DecompilationPipeline pipeline, ILanguage language, MethodBody body, DecompilationContext& context) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 95 + // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61 + // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 118 + // + // mailto: JustDecompilePublicFeedback@telerik.com + + } + + private async Task VidaIndividualCalculo(Gestor.Model.Domain.Seguros.Documento doc) + { + // + // Current member / type: System.Threading.Tasks.Task`1 Gestor.Application.Componentes.CalculoControl::VidaIndividualCalculo(Gestor.Model.Domain.Seguros.Documento) + // File path: C:\AggerSeguros\Gestor.Application.exe + // + // Product version: 0.0.0.0 + // Exception in: System.Threading.Tasks.Task VidaIndividualCalculo(Gestor.Model.Domain.Seguros.Documento) + // + // Object reference not set to an instance of an object. + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.FindLowestCommonAncestor(ICollection`1 typeNodes) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 515 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.MergeWithLowestCommonAncestor() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 459 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.ProcessSingleConstraints() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 378 + // at Telerik.JustDecompiler.Decompiler.TypeInference.TypeInferer.InferTypes() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\TypeInference\TypeInferer.cs:line 331 + // at Telerik.JustDecompiler.Decompiler.ExpressionDecompilerStep.Process(DecompilationContext theContext, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\ExpressionDecompilerStep.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileStateMachine(MethodBody body, DecompilationContext enclosingContext, BaseStateMachineRemoverStep removeStateMachineStep, Func`2 stateMachineDataSelector, DecompilationContext& decompilationContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 104 + // at Telerik.JustDecompiler.Decompiler.Extensions.DecompileAsyncStateMachine(MethodBody body, DecompilationContext enclosingContext, AsyncData& asyncData) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 150 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.GetMoveNextStatements() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 155 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Match() in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 60 + // at Telerik.JustDecompiler.Steps.RebuildAsyncStatementsStep.Process(DecompilationContext context, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAsyncStatementsStep.cs:line 31 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.RunPipeline(DecompilationPipeline pipeline, ILanguage language, MethodBody body, DecompilationContext& context) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 95 + // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61 + // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 118 + // + // mailto: JustDecompilePublicFeedback@telerik.com + + } + + private async void VisualizarCalculos_OnClick(object sender, RoutedEventArgs e) + { + string str; + string str1; + if (await this.VerificarPermissao()) + { + if (!string.IsNullOrEmpty(this.Documento)) + { + Gestor.Model.Domain.Seguros.Documento documento = await (new ApoliceServico()).BuscarApoliceAsync(long.Parse(this.DocumentoId.ToString()), true, false); + str1 = null; + if (this.RamoId != null && long.Parse(this.RamoId.ToString()) == (long)5) + { + if (documento.get_ItensAtivo() == null || documento.get_ItensAtivo().Count <= 0) + { + str = null; + } + else + { + str = await (new AutoServico()).BuscarChassi(documento.get_ItensAtivo().First().get_Id()); + } + str1 = str; + } + await this.Iniciar(false); + dynamic variable = new { CpfCnpj = this.Documento.Clear() }; + if (this.RamoId != null) + { + variable = new { CpfCnpj = this.Documento.Clear(), Branch = long.Parse(this.RamoId.ToString()) }; + } + if (str1 != null && this.RamoId != null) + { + variable = new { CpfCnpj = this.Documento.Clear(), Branch = long.Parse(this.RamoId.ToString()), Chassi = str1 }; + } + this.IniciarPipe(variable); + } + } + str1 = null; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/CoberturaView.cs b/Gestor.Application/Componentes/CoberturaView.cs new file mode 100644 index 0000000..1aca48f --- /dev/null +++ b/Gestor.Application/Componentes/CoberturaView.cs @@ -0,0 +1,139 @@ +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class CoberturaView : BaseUserControl, IComponentConnector, IStyleConnector + { + internal DataGrid CoberturaGrid; + + private bool _contentLoaded; + + public CoberturaViewModel ViewModel + { + get; + set; + } + + public CoberturaView(CoberturaViewModel viewModel) + { + this.ViewModel = viewModel ?? new CoberturaViewModel(null, null); + this.InitializeComponent(); + this.CoberturaGrid.DataContext = this.ViewModel; + } + + private void AdicionaCobertura_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.AdicionaCobertura(); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (!this.ViewModel.IsEnabled || e.get_Parameter().Trim().Length < 3) + { + return; + } + e.set_Cancel(true); + this.ViewModel.BuscarCobertura(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => { + if (searchResult.Result == null) + { + return; + } + AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; + autoCompleteBox.set_ItemsSource(searchResult.Result); + autoCompleteBox.PopulateComplete(); + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void ExcluirCobertura_OnClick(object sender, RoutedEventArgs e) + { + bool selectedIndex; + object item; + DataGrid coberturaGrid = this.CoberturaGrid; + if (coberturaGrid != null) + { + selectedIndex = coberturaGrid.SelectedIndex < 0; + } + else + { + selectedIndex = false; + } + if (selectedIndex) + { + return; + } + CoberturaViewModel viewModel = this.ViewModel; + DataGrid dataGrid = this.CoberturaGrid; + if (dataGrid != null) + { + item = dataGrid.Items[this.CoberturaGrid.SelectedIndex]; + } + else + { + item = null; + } + viewModel.ExcluirCobertura((Cobertura)item); + } + + [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/coberturaview.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId == 1) + { + ((MenuItem)target).Click += new RoutedEventHandler(this.AdicionaCobertura_OnClick); + return; + } + if (connectionId != 2) + { + this._contentLoaded = true; + return; + } + this.CoberturaGrid = (DataGrid)target; + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) + { + if (connectionId == 3) + { + ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, CoberturaView.AutoCompleteBox_Populating)); + return; + } + if (connectionId != 4) + { + return; + } + ((Button)target).Click += new RoutedEventHandler(this.ExcluirCobertura_OnClick); + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/ContasDialog.cs b/Gestor.Application/Componentes/ContasDialog.cs new file mode 100644 index 0000000..8d09b79 --- /dev/null +++ b/Gestor.Application/Componentes/ContasDialog.cs @@ -0,0 +1,73 @@ +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Model.Domain.Financeiro; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class ContasDialog : UserControl, IComponentConnector + { + internal Button ImportarButton; + + internal Button CancelarButton; + + private bool _contentLoaded; + + private ContasDialogModel ViewModel + { + get; + set; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + public ContasDialog(List contas) + { + this.ViewModel = new ContasDialogModel(contas); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + [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/contasdialog.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId == 1) + { + this.ImportarButton = (Button)target; + return; + } + if (connectionId != 2) + { + this._contentLoaded = true; + return; + } + this.CancelarButton = (Button)target; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/CustomIsReadOnlyControl.cs b/Gestor.Application/Componentes/CustomIsReadOnlyControl.cs new file mode 100644 index 0000000..988f8fc --- /dev/null +++ b/Gestor.Application/Componentes/CustomIsReadOnlyControl.cs @@ -0,0 +1,76 @@ +using System; +using System.Windows; + +namespace Gestor.Application.Componentes +{ + public class CustomIsReadOnlyControl : CustomItemControl + { + public readonly static DependencyProperty IsReadOnlyProperty; + + public readonly static DependencyProperty HasValidationProperty; + + public readonly static DependencyProperty TextProperty; + + public readonly static DependencyProperty TextAlignmentProperty; + + public bool HasValidation + { + get + { + return (bool)base.GetValue(CustomIsReadOnlyControl.HasValidationProperty); + } + set + { + base.SetValue(CustomIsReadOnlyControl.HasValidationProperty, value); + } + } + + public bool IsReadOnly + { + get + { + return (bool)base.GetValue(CustomIsReadOnlyControl.IsReadOnlyProperty); + } + set + { + base.SetValue(CustomIsReadOnlyControl.IsReadOnlyProperty, value); + } + } + + public string Text + { + get + { + return (string)base.GetValue(CustomIsReadOnlyControl.TextProperty); + } + set + { + base.SetValue(CustomIsReadOnlyControl.TextProperty, value); + } + } + + public System.Windows.TextAlignment TextAlignment + { + get + { + return (System.Windows.TextAlignment)base.GetValue(CustomIsReadOnlyControl.TextAlignmentProperty); + } + set + { + base.SetValue(CustomIsReadOnlyControl.TextAlignmentProperty, value); + } + } + + static CustomIsReadOnlyControl() + { + CustomIsReadOnlyControl.IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(CustomIsReadOnlyControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + CustomIsReadOnlyControl.HasValidationProperty = DependencyProperty.Register("HasValidation", typeof(bool), typeof(CustomIsReadOnlyControl), new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + CustomIsReadOnlyControl.TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(CustomIsReadOnlyControl), new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + CustomIsReadOnlyControl.TextAlignmentProperty = DependencyProperty.Register("TextAlignment", typeof(System.Windows.TextAlignment), typeof(CustomIsReadOnlyControl), new FrameworkPropertyMetadata((object)System.Windows.TextAlignment.Left, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + } + + public CustomIsReadOnlyControl() + { + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/CustomItemControl.cs b/Gestor.Application/Componentes/CustomItemControl.cs new file mode 100644 index 0000000..7f5cbeb --- /dev/null +++ b/Gestor.Application/Componentes/CustomItemControl.cs @@ -0,0 +1,54 @@ +using System; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; + +namespace Gestor.Application.Componentes +{ + public class CustomItemControl : ItemsControl + { + public readonly static DependencyProperty LabelProperty; + + public readonly static DependencyProperty LabelVisibilityProperty; + + public bool Entered + { + get; + set; + } + + public string Label + { + get + { + return (string)base.GetValue(CustomItemControl.LabelProperty); + } + set + { + base.SetValue(CustomItemControl.LabelProperty, value); + } + } + + public System.Windows.Visibility LabelVisibility + { + get + { + return (System.Windows.Visibility)base.GetValue(CustomItemControl.LabelVisibilityProperty); + } + set + { + base.SetValue(CustomItemControl.LabelVisibilityProperty, value); + } + } + + static CustomItemControl() + { + CustomItemControl.LabelProperty = DependencyProperty.Register("Label", typeof(string), typeof(CustomItemControl), new FrameworkPropertyMetadata(string.Empty, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + CustomItemControl.LabelVisibilityProperty = DependencyProperty.Register("LabelVisibility", typeof(System.Windows.Visibility), typeof(CustomItemControl), new FrameworkPropertyMetadata((object)System.Windows.Visibility.Visible, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + } + + public CustomItemControl() + { + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/CustomItemValidation.cs b/Gestor.Application/Componentes/CustomItemValidation.cs new file mode 100644 index 0000000..760f804 --- /dev/null +++ b/Gestor.Application/Componentes/CustomItemValidation.cs @@ -0,0 +1,11 @@ +using System; + +namespace Gestor.Application.Componentes +{ + public class CustomItemValidation : CustomItemControl + { + public CustomItemValidation() + { + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/CustomLegendChart.cs b/Gestor.Application/Componentes/CustomLegendChart.cs new file mode 100644 index 0000000..ddbff3c --- /dev/null +++ b/Gestor.Application/Componentes/CustomLegendChart.cs @@ -0,0 +1,140 @@ +using LiveCharts.Definitions.Series; +using LiveCharts.Wpf; +using LiveCharts.Wpf.Charts.Base; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using System.Windows.Media; + +namespace Gestor.Application.Componentes +{ + public class CustomLegendChart : UserControl, IChartLegend, INotifyPropertyChanged, IComponentConnector + { + public readonly static DependencyProperty OrientationProperty; + + internal ItemsControl itemsControl; + + private bool _contentLoaded; + + public ObservableCollection LegendEntries { get; } = new ObservableCollection(); + + public System.Windows.Controls.Orientation Orientation + { + get + { + return (System.Windows.Controls.Orientation)base.GetValue(CustomLegendChart.OrientationProperty); + } + set + { + base.SetValue(CustomLegendChart.OrientationProperty, value); + } + } + + public List Series + { + get + { + return ( + from x in this.LegendEntries + select x.SeriesViewModel).ToList(); + } + set + { + Chart ownerChart = this.GetOwnerChart(); + foreach (CustomSeriesViewModel list in ( + from x in this.LegendEntries + where !ownerChart.get_Series().Any((ISeriesView s) => (object)s == (object)x.View) + select x).ToList()) + { + this.LegendEntries.Remove(list); + } + foreach (SeriesViewModel seriesViewModel in value) + { + if (!this.LegendEntries.All((CustomSeriesViewModel x) => x.Title != seriesViewModel.get_Title())) + { + continue; + } + ISeriesView seriesView = ownerChart.get_Series().FirstOrDefault((ISeriesView x) => x.get_Title() == seriesViewModel.get_Title()); + this.LegendEntries.Add(new CustomSeriesViewModel(seriesViewModel, seriesView)); + } + this.OnPropertyChanged("Series"); + } + } + + static CustomLegendChart() + { + CustomLegendChart.OrientationProperty = DependencyProperty.Register("Orientation", typeof(System.Windows.Controls.Orientation), typeof(CustomLegendChart), new PropertyMetadata((object)System.Windows.Controls.Orientation.Horizontal)); + } + + public CustomLegendChart() + { + this.InitializeComponent(); + this.itemsControl.DataContext = this; + } + + public static T FindParent(DependencyObject child) + where T : DependencyObject + { + DependencyObject parent = VisualTreeHelper.GetParent(child); + if (parent == null) + { + return default(T); + } + T t = (T)(parent as T); + if (t != null) + { + return t; + } + return CustomLegendChart.FindParent(parent); + } + + private Chart GetOwnerChart() + { + return CustomLegendChart.FindParent(this); + } + + [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/customlegendchart.xaml", UriKind.Relative)); + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = "") + { + if (this.PropertyChanged != null) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId != 1) + { + this._contentLoaded = true; + return; + } + this.itemsControl = (ItemsControl)target; + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/CustomPasswordBox.cs b/Gestor.Application/Componentes/CustomPasswordBox.cs new file mode 100644 index 0000000..9b1c76d --- /dev/null +++ b/Gestor.Application/Componentes/CustomPasswordBox.cs @@ -0,0 +1,203 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class CustomPasswordBox : UserControl, IComponentConnector + { + public readonly static DependencyProperty IsReadOnlyProperty; + + public readonly static DependencyProperty TextProperty; + + public readonly static DependencyProperty PasswordViewProperty; + + private bool _typing; + + internal Grid LayoutRoot; + + internal TextBox TextRead; + + internal TextBox TextMask; + + internal System.Windows.Controls.PasswordBox PasswordBox; + + private bool _contentLoaded; + + public bool IsReadOnly + { + get + { + return (bool)base.GetValue(CustomPasswordBox.IsReadOnlyProperty); + } + set + { + base.SetValue(CustomPasswordBox.IsReadOnlyProperty, value); + } + } + + public bool PasswordView + { + get + { + return (bool)base.GetValue(CustomPasswordBox.PasswordViewProperty); + } + set + { + base.SetValue(CustomPasswordBox.PasswordViewProperty, value); + } + } + + public string Text + { + get + { + return (string)base.GetValue(CustomPasswordBox.TextProperty); + } + set + { + base.SetValue(CustomPasswordBox.TextProperty, value); + } + } + + static CustomPasswordBox() + { + CustomPasswordBox.IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(CustomPasswordBox), new PropertyMetadata(false, new PropertyChangedCallback(CustomPasswordBox.OnBoundIsReadOnlyChanged))); + CustomPasswordBox.TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(CustomPasswordBox), new PropertyMetadata(string.Empty, new PropertyChangedCallback(CustomPasswordBox.OnBoundPasswordChanged))); + CustomPasswordBox.PasswordViewProperty = DependencyProperty.Register("PasswordViewProperty", typeof(bool), typeof(CustomPasswordBox), new PropertyMetadata(false, new PropertyChangedCallback(CustomPasswordBox.OnBoundPasswordViewChanged))); + } + + public CustomPasswordBox() + { + this.InitializeComponent(); + this.LayoutRoot.DataContext = this; + this.PasswordView = false; + } + + private void Eye_Click(object sender, RoutedEventArgs e) + { + if (this.IsReadOnly) + { + return; + } + this.PasswordView = !this.PasswordView; + } + + [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/custompasswordbox.xaml", UriKind.Relative)); + } + + private static void OnBoundIsReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomPasswordBox customPasswordBox = d as CustomPasswordBox; + if (d == null || customPasswordBox == null) + { + return; + } + bool newValue = (bool)e.NewValue; + customPasswordBox.PasswordBox.Visibility = (newValue ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible); + customPasswordBox.TextRead.Visibility = (newValue ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); + customPasswordBox.TextMask.Visibility = (newValue ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); + } + + private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomPasswordBox customPasswordBox = d as CustomPasswordBox; + if (d == null || customPasswordBox == null) + { + return; + } + string newValue = (string)e.NewValue ?? ""; + if (customPasswordBox._typing) + { + return; + } + customPasswordBox.TextMask.Text = "".PadLeft(newValue.Length, '•'); + customPasswordBox.PasswordBox.Password = newValue; + } + + private static void OnBoundPasswordViewChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomPasswordBox text = d as CustomPasswordBox; + if (d == null || text == null) + { + return; + } + bool newValue = (bool)e.NewValue; + if (!newValue) + { + text.PasswordBox.Password = text.TextRead.Text; + } + else + { + text.TextRead.Text = text.PasswordBox.Password; + } + text.PasswordBox.Visibility = (newValue ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible); + text.TextRead.Visibility = (newValue ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); + text.TextMask.Visibility = text.PasswordBox.Visibility; + } + + private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e) + { + this._typing = true; + this.Text = this.PasswordBox.Password; + this._typing = false; + this.TextMask.Text = "".PadLeft(this.PasswordBox.Password.Length, '•'); + } + + [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.TextRead = (TextBox)target; + this.TextRead.TextChanged += new TextChangedEventHandler(this.TextRead_PasswordChanged); + return; + } + case 3: + { + this.TextMask = (TextBox)target; + return; + } + case 4: + { + this.PasswordBox = (System.Windows.Controls.PasswordBox)target; + this.PasswordBox.PasswordChanged += new RoutedEventHandler(this.PasswordBox_PasswordChanged); + return; + } + case 5: + { + ((Button)target).Click += new RoutedEventHandler(this.Eye_Click); + return; + } + } + this._contentLoaded = true; + } + + private void TextRead_PasswordChanged(object sender, TextChangedEventArgs e) + { + this.Text = this.TextRead.Text; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/CustomSenhaLoginBox.cs b/Gestor.Application/Componentes/CustomSenhaLoginBox.cs new file mode 100644 index 0000000..ce1a278 --- /dev/null +++ b/Gestor.Application/Componentes/CustomSenhaLoginBox.cs @@ -0,0 +1,338 @@ +using ControlzEx; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using System.Windows.Media; + +namespace Gestor.Application.Componentes +{ + public class CustomSenhaLoginBox : UserControl, IComponentConnector + { + public readonly static DependencyProperty TextProperty; + + public readonly static DependencyProperty IsReadOnlyProperty; + + public readonly static DependencyProperty PlaceHolderProperty; + + public readonly static DependencyProperty BackgroundProperty; + + public readonly static DependencyProperty ForegroundProperty; + + public readonly static DependencyProperty CaretBrushProperty; + + public readonly static DependencyProperty FontFamilyProperty; + + public readonly static DependencyProperty FontSizeProperty; + + public readonly static DependencyProperty BorderThicknessProperty; + + internal Grid LayoutRoot; + + internal TextBox TextRead; + + internal System.Windows.Controls.PasswordBox PasswordBox; + + internal Button ButtonEye; + + private bool _contentLoaded; + + private static bool _typing + { + get; + set; + } + + public new Brush Background + { + get + { + return (Brush)base.GetValue(CustomSenhaLoginBox.BackgroundProperty); + } + set + { + base.SetValue(CustomSenhaLoginBox.BackgroundProperty, value); + } + } + + public new Thickness BorderThickness + { + get + { + return (Thickness)base.GetValue(CustomSenhaLoginBox.BorderThicknessProperty); + } + set + { + base.SetValue(CustomSenhaLoginBox.BorderThicknessProperty, value); + } + } + + public Brush CaretBrush + { + get + { + return (Brush)base.GetValue(CustomSenhaLoginBox.CaretBrushProperty); + } + set + { + base.SetValue(CustomSenhaLoginBox.CaretBrushProperty, value); + } + } + + public new System.Windows.Media.FontFamily FontFamily + { + get + { + return (System.Windows.Media.FontFamily)base.GetValue(CustomSenhaLoginBox.FontFamilyProperty); + } + set + { + base.SetValue(CustomSenhaLoginBox.FontFamilyProperty, value); + } + } + + public new int FontSize + { + get + { + return (int)base.GetValue(CustomSenhaLoginBox.FontSizeProperty); + } + set + { + base.SetValue(CustomSenhaLoginBox.FontSizeProperty, value); + } + } + + public new Brush Foreground + { + get + { + return (Brush)base.GetValue(CustomSenhaLoginBox.ForegroundProperty); + } + set + { + base.SetValue(CustomSenhaLoginBox.ForegroundProperty, value); + } + } + + public bool IsReadOnly + { + get + { + return (bool)base.GetValue(CustomSenhaLoginBox.IsReadOnlyProperty); + } + set + { + base.SetValue(CustomSenhaLoginBox.IsReadOnlyProperty, value); + } + } + + public string PlaceHolder + { + get + { + return (string)base.GetValue(CustomSenhaLoginBox.PlaceHolderProperty); + } + set + { + base.SetValue(CustomSenhaLoginBox.PlaceHolderProperty, value); + } + } + + public string Text + { + get + { + return (string)base.GetValue(CustomSenhaLoginBox.TextProperty); + } + set + { + base.SetValue(CustomSenhaLoginBox.TextProperty, value); + } + } + + static CustomSenhaLoginBox() + { + CustomSenhaLoginBox.TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(CustomSenhaLoginBox), new PropertyMetadata(string.Empty, new PropertyChangedCallback(CustomSenhaLoginBox.OnBoundPasswordChanged))); + CustomSenhaLoginBox.IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(CustomSenhaLoginBox), new PropertyMetadata(false, new PropertyChangedCallback(CustomSenhaLoginBox.OnBoundIsReadOnlyChanged))); + CustomSenhaLoginBox.PlaceHolderProperty = DependencyProperty.Register("PlaceHolder", typeof(string), typeof(CustomSenhaLoginBox), new FrameworkPropertyMetadata("SENHA", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + CustomSenhaLoginBox.BackgroundProperty = DependencyProperty.Register("Background", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata(null, new PropertyChangedCallback(CustomSenhaLoginBox.OnBackgroundChanged))); + CustomSenhaLoginBox.ForegroundProperty = DependencyProperty.Register("Foreground", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata(null, new PropertyChangedCallback(CustomSenhaLoginBox.OnForegroundChanged))); + CustomSenhaLoginBox.CaretBrushProperty = DependencyProperty.Register("CaretBrush", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata(null, new PropertyChangedCallback(CustomSenhaLoginBox.OnCaretBrushChanged))); + CustomSenhaLoginBox.FontFamilyProperty = DependencyProperty.Register("FontFamily", typeof(System.Windows.Media.FontFamily), typeof(CustomSenhaLoginBox), new PropertyMetadata(null, new PropertyChangedCallback(CustomSenhaLoginBox.OnFontFamilyChanged))); + CustomSenhaLoginBox.FontSizeProperty = DependencyProperty.Register("FontSize", typeof(int), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)10, new PropertyChangedCallback(CustomSenhaLoginBox.OnFontSizeChanged))); + CustomSenhaLoginBox.BorderThicknessProperty = DependencyProperty.Register("BorderThickness", typeof(Thickness), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)(new Thickness(1)), new PropertyChangedCallback(CustomSenhaLoginBox.OnBorderThicknessChanged))); + } + + public CustomSenhaLoginBox() + { + this.InitializeComponent(); + this.LayoutRoot.DataContext = this; + } + + private void Eye_Click(object sender, RoutedEventArgs e) + { + if (this.IsReadOnly) + { + return; + } + Button button = sender as Button; + this.TextRead.Visibility = (this.TextRead.Visibility == System.Windows.Visibility.Collapsed ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); + this.PasswordBox.Visibility = (this.TextRead.Visibility == System.Windows.Visibility.Collapsed ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); + if (button != null && button.Content != null) + { + ((PackIcon)button.Content).set_Kind((this.TextRead.Visibility == System.Windows.Visibility.Collapsed ? 1492 : 1497)); + } + if (this.PasswordBox.Visibility != System.Windows.Visibility.Visible) + { + return; + } + this.PasswordBox.Focus(); + this.PasswordBox.SelectAll(); + } + + [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/customsenhaloginbox.xaml", UriKind.Relative)); + } + + private static void OnBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomSenhaLoginBox newValue = d as CustomSenhaLoginBox; + if (d == null || newValue == null) + { + return; + } + newValue.Background = (Brush)e.NewValue; + } + + private static void OnBorderThicknessChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomSenhaLoginBox newValue = d as CustomSenhaLoginBox; + if (d == null || newValue == null) + { + return; + } + newValue.BorderThickness = (Thickness)e.NewValue; + } + + private static void OnBoundIsReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomPasswordBox customPasswordBox = d as CustomPasswordBox; + if (d == null || customPasswordBox == null) + { + return; + } + bool newValue = (bool)e.NewValue; + customPasswordBox.PasswordBox.Visibility = (newValue ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible); + customPasswordBox.TextRead.Visibility = (newValue ? System.Windows.Visibility.Visible : System.Windows.Visibility.Collapsed); + } + + private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d == null || customSenhaLoginBox == null) + { + return; + } + string newValue = (string)e.NewValue ?? ""; + if (CustomSenhaLoginBox._typing) + { + return; + } + customSenhaLoginBox.PasswordBox.Password = newValue; + } + + private static void OnCaretBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomSenhaLoginBox newValue = d as CustomSenhaLoginBox; + if (d == null || newValue == null) + { + return; + } + newValue.CaretBrush = (Brush)e.NewValue; + } + + private static void OnFontFamilyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomSenhaLoginBox newValue = d as CustomSenhaLoginBox; + if (d == null || newValue == null) + { + return; + } + newValue.FontFamily = (System.Windows.Media.FontFamily)e.NewValue; + } + + private static void OnFontSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomSenhaLoginBox newValue = d as CustomSenhaLoginBox; + if (d == null || newValue == null) + { + return; + } + newValue.FontSize = (int)e.NewValue; + } + + private static void OnForegroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomSenhaLoginBox newValue = d as CustomSenhaLoginBox; + if (d == null || newValue == null) + { + return; + } + newValue.Foreground = (Brush)e.NewValue; + } + + private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e) + { + CustomSenhaLoginBox._typing = true; + this.Text = this.PasswordBox.Password; + CustomSenhaLoginBox._typing = false; + } + + [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.TextRead = (TextBox)target; + return; + } + case 3: + { + this.PasswordBox = (System.Windows.Controls.PasswordBox)target; + this.PasswordBox.PasswordChanged += new RoutedEventHandler(this.PasswordBox_PasswordChanged); + return; + } + case 4: + { + this.ButtonEye = (Button)target; + this.ButtonEye.Click += new RoutedEventHandler(this.Eye_Click); + return; + } + } + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/CustomSeriesViewModel.cs b/Gestor.Application/Componentes/CustomSeriesViewModel.cs new file mode 100644 index 0000000..7c4a6cf --- /dev/null +++ b/Gestor.Application/Componentes/CustomSeriesViewModel.cs @@ -0,0 +1,72 @@ +using LiveCharts.Definitions.Series; +using LiveCharts.Wpf; +using System; +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Windows; +using System.Windows.Media; + +namespace Gestor.Application.Componentes +{ + public class CustomSeriesViewModel : INotifyPropertyChanged + { + public Brush Fill + { + get + { + return this.SeriesViewModel.get_Fill() ?? this.SeriesViewModel.get_Stroke(); + } + } + + public bool IsVisible + { + get + { + return ((UIElement)this.View).Visibility == Visibility.Visible; + } + set + { + if (this.IsVisible != value) + { + ((UIElement)this.View).Visibility = (value ? Visibility.Visible : Visibility.Hidden); + this.OnPropertyChanged("IsVisible"); + } + } + } + + public LiveCharts.Wpf.SeriesViewModel SeriesViewModel + { + get; + } + + public string Title + { + get + { + return this.SeriesViewModel.get_Title(); + } + } + + public ISeriesView View + { + get; + } + + public CustomSeriesViewModel(LiveCharts.Wpf.SeriesViewModel svm, ISeriesView view) + { + this.SeriesViewModel = svm; + this.View = view; + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = "") + { + if (this.PropertyChanged != null) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + public event PropertyChangedEventHandler PropertyChanged; + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DefaultDialog.cs b/Gestor.Application/Componentes/DefaultDialog.cs new file mode 100644 index 0000000..5ff7c1e --- /dev/null +++ b/Gestor.Application/Componentes/DefaultDialog.cs @@ -0,0 +1,40 @@ +using Gestor.Application.Views.Generic; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DefaultDialog : BaseUserControl, IComponentConnector + { + private bool _contentLoaded; + + public DefaultDialog() + { + this.InitializeComponent(); + } + + [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/defaultdialog.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogAdvertising.cs b/Gestor.Application/Componentes/DialogAdvertising.cs new file mode 100644 index 0000000..dfff6b4 --- /dev/null +++ b/Gestor.Application/Componentes/DialogAdvertising.cs @@ -0,0 +1,101 @@ +using Gestor.Application.ViewModels.Generic; +using MaterialDesignThemes.Wpf; +using Newtonsoft.Json.Linq; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogAdvertising : UserControl, IComponentConnector + { + private DialogAdvertisingViewModel ViewModel; + + private readonly bool _isPromocao; + + internal Label Titulo; + + private bool _contentLoaded; + + public DialogAdvertising(JObject jsonAd, bool isPromo = true) + { + this.ViewModel = new DialogAdvertisingViewModel(jsonAd, isPromo); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + private void CloseOnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute(null, null); + } + + [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/dialogadvertising.xaml", UriKind.Relative)); + } + + private void Lido_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.SalvaEditarArquivoConfig(true); + DialogHost.CloseDialogCommand.Execute(null, null); + } + + private void LinkImage_MouseDown(object sender, MouseButtonEventArgs e) + { + try + { + if (!this._isPromocao) + { + this.ViewModel.EnviarPesquisa(); + } + Process.Start(this.ViewModel.Url); + } + catch + { + } + } + + [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.Titulo = (Label)target; + return; + } + case 2: + { + ((Button)target).Click += new RoutedEventHandler(this.CloseOnClick); + return; + } + case 3: + { + ((Image)target).MouseDown += new MouseButtonEventHandler(this.LinkImage_MouseDown); + return; + } + case 4: + { + ((Button)target).Click += new RoutedEventHandler(this.Lido_OnClick); + return; + } + } + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogAnaliticoBi.cs b/Gestor.Application/Componentes/DialogAnaliticoBi.cs new file mode 100644 index 0000000..61adc39 --- /dev/null +++ b/Gestor.Application/Componentes/DialogAnaliticoBi.cs @@ -0,0 +1,387 @@ +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Model.Attributes; +using Gestor.Model.Domain.BI; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Relatorios.ClientesAtivosInativos; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogAnaliticoBi : BaseUserControl, IComponentConnector, IStyleConnector + { + internal AnaliticoViewModel ViewModel; + + internal System.Windows.Controls.Grid MainGrid; + + internal DataGrid Grid; + + internal DataGridTemplateColumn InfoButton; + + internal TextBlock Totalizacao; + + private bool _contentLoaded; + + public List Campos + { + get; + set; + } + + public List Lista + { + get; + set; + } + + public DialogAnaliticoBi(string titulo, List analitico, string tipo, List campos) + { + this.ViewModel = new AnaliticoViewModel(tipo); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + this.ViewModel.Head = titulo; + this.Lista = analitico; + this.Campos = campos; + this.ConstruirLista(); + } + + private async Task AbrirTarefa(Tarefa data) + { + // + // Current member / type: System.Threading.Tasks.Task Gestor.Application.Componentes.DialogAnaliticoBi::AbrirTarefa(Gestor.Model.Domain.Ferramentas.Tarefa) + // File path: C:\AggerSeguros\Gestor.Application.exe + // + // Product version: 0.0.0.0 + // Exception in: System.Threading.Tasks.Task AbrirTarefa(Gestor.Model.Domain.Ferramentas.Tarefa) + // + // Collection was modified; enumeration operation may not execute. + // at System.Collections.Generic.List`1.Enumerator.MoveNextRare() + // at Telerik.JustDecompiler.Ast.BaseCodeVisitor.Visit(IEnumerable collection) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Ast\BaseCodeVisitor.cs:line 384 + // at Telerik.JustDecompiler.Steps.RebuildAnonymousDelegatesStep.VisitBlockStatement(BlockStatement node) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAnonymousDelegatesStep.cs:line 33 + // at Telerik.JustDecompiler.Steps.RebuildAnonymousDelegatesStep.Process(DecompilationContext context, BlockStatement body) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Steps\RebuildAnonymousDelegatesStep.cs:line 21 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.RunInternal(MethodBody body, BlockStatement block, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 100 + // at Telerik.JustDecompiler.Decompiler.DecompilationPipeline.Run(MethodBody body, ILanguage language) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\DecompilationPipeline.cs:line 72 + // at Telerik.JustDecompiler.Decompiler.Extensions.RunPipeline(DecompilationPipeline pipeline, ILanguage language, MethodBody body, DecompilationContext& context) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 95 + // at Telerik.JustDecompiler.Decompiler.Extensions.Decompile(MethodBody body, ILanguage language, DecompilationContext& context, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\Extensions.cs:line 61 + // at Telerik.JustDecompiler.Decompiler.WriterContextServices.BaseWriterContextService.DecompileMethod(ILanguage language, MethodDefinition method, TypeSpecificContext typeContext) in D:\a\CodemerxDecompile\CodemerxDecompile\src\JustDecompileEngine\src\JustDecompiler.Shared\Decompiler\WriterContextServices\BaseWriterContextService.cs:line 118 + // + // mailto: JustDecompilePublicFeedback@telerik.com + + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + this.Lista.ForEach((Analitico x) => x.set_Selecionado(!x.get_Selecionado())); + this.Grid.ItemsSource = null; + this.Grid.ItemsSource = this.Lista; + } + + private void ConstruirLista() + { + this.ViewModel.Loading(true); + PropertyInfo[] properties = this.Lista.First().GetType().GetProperties(); + this.Campos.ForEach((string x) => { + PropertyInfo propertyInfo = properties.FirstOrDefault((PropertyInfo p) => p.Name == x); + if (propertyInfo == null) + { + return; + } + object obj = propertyInfo.GetCustomAttributes(typeof(DescriptionAttribute), true).FirstOrDefault(); + string upper = propertyInfo.Name.ToUpper(); + if (obj != null) + { + upper = ((DescriptionAttribute)obj).Description; + } + object obj1 = propertyInfo.GetCustomAttributes(typeof(TipoAttribute), true).FirstOrDefault(); + string description = ""; + if (obj1 != null) + { + description = ((TipoAttribute)obj1).get_Description(); + } + string str = ""; + System.Windows.Style item = (System.Windows.Style)System.Windows.Application.Current.Resources["VerticalCenterStyle3"]; + System.Windows.Style style = (System.Windows.Style)System.Windows.Application.Current.Resources["MaterialDesignDataGridColumnHeader"]; + if (description == "DATA" || description == "DATA?") + { + str = "d"; + item = (System.Windows.Style)System.Windows.Application.Current.Resources["HorizontalCenterStyle2"]; + style = (System.Windows.Style)System.Windows.Application.Current.Resources["HorizontalCenterHeaderStyle"]; + } + else if (description == "PERCENTUAL") + { + str = "{0:0.00}%"; + item = (System.Windows.Style)System.Windows.Application.Current.Resources["HorizontalRightStyle"]; + style = (System.Windows.Style)System.Windows.Application.Current.Resources["HorizontalRightHeaderStyle"]; + } + else if (description == "VALOR" || description == "VALOR?") + { + str = "c"; + item = (System.Windows.Style)System.Windows.Application.Current.Resources["HorizontalRightStyle"]; + style = (System.Windows.Style)System.Windows.Application.Current.Resources["HorizontalRightHeaderStyle"]; + } + else if (description == "QUANTIDADE") + { + item = (System.Windows.Style)System.Windows.Application.Current.Resources["HorizontalCenterStyle2"]; + style = (System.Windows.Style)System.Windows.Application.Current.Resources["HorizontalCenterHeaderStyle"]; + } + this.Grid.Columns.Add(new MaterialDataGridTextColumn() + { + IsReadOnly = true, + Header = upper, + Binding = new Binding() + { + Path = new PropertyPath(propertyInfo.Name, Array.Empty()), + StringFormat = str, + UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged + }, + ElementStyle = item, + HeaderStyle = style + }); + }); + this.Grid.ItemsSource = this.Lista; + this.Totalizar(); + this.ViewModel.Loading(false); + } + + private async void Email_OnClick(object sender, RoutedEventArgs e) + { + List lista = this.Lista; + if (lista.Any((Analitico x) => x.get_Selecionado())) + { + if (Funcoes.IsWindowOpen("ENVIO DE E-MAIL")) + { + Funcoes.Destroy("ENVIO DE E-MAIL"); + } + List analiticos = this.Lista; + (new HosterWindow(new MalaDiretaView(( + from x in analiticos + where x.get_Selecionado() + select x).Select((Analitico x) => { + MalaDireta malaDiretum = new MalaDireta(); + Cliente cliente = new Cliente(); + cliente.set_Id(x.get_Cliente().get_Id()); + cliente.set_Nome(x.get_Cliente().get_Nome()); + cliente.set_Nascimento(x.get_Cliente().get_Nascimento()); + cliente.set_VencimentoHabilitacao(x.get_Cliente().get_VencimentoCnh()); + malaDiretum.set_Cliente(cliente); + malaDiretum.set_Apolice(x.get_Documento()); + malaDiretum.set_Parcela(x.get_Parcela()); + malaDiretum.set_Tela(this.ViewModel.Tela); + return malaDiretum; + }).ToList(), null, null, null), "ENVIO DE E-MAIL", new double?((double)1200), new double?((double)600), true)).Show(); + } + else + { + await this.ViewModel.ShowMessage("NECESSÁRIO SELECIONAR AO MENOS UM CLIENTE PARA PROSSEGUIR", "OK", "", false); + } + } + + private async void Grid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + double? nullable; + if (this.Grid.SelectedItem != null && (!(this.ViewModel.Tipo == "PARCELAS") || !(this.ViewModel.Tipo == "APOLICES"))) + { + if (this.ViewModel.Tipo != "CLIENTES") + { + Analitico selectedItem = (Analitico)this.Grid.SelectedItem; + nullable = null; + double? nullable1 = nullable; + nullable = null; + (new HosterWindow(new ApoliceView(selectedItem.get_Documento(), true, false, 0, (long)0, false), string.Concat("CADASTRO DE APÓLICES - ", selectedItem.get_Cliente().get_Nome()), nullable1, nullable, false)).Show(); + } + else + { + Analitico analitico = (Analitico)this.Grid.SelectedItem; + Cliente cliente = await this.ViewModel.CarregaCliente(analitico.get_Cliente().get_Id()); + nullable = null; + double? nullable2 = nullable; + nullable = null; + (new HosterWindow(new ClienteView(cliente, true, null), string.Concat("CADASTRO DE CLIENTE - ", cliente.get_Nome()), nullable2, nullable, false)).Show(); + } + } + } + + [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/dialoganaliticobi.xaml", UriKind.Relative)); + } + + private async void Open_OnClick(object sender, RoutedEventArgs e) + { + double? nullable; + if (this.Grid.SelectedItem != null && (!(this.ViewModel.Tipo == "PARCELAS") || !(this.ViewModel.Tipo == "APOLICES"))) + { + if (this.ViewModel.Tipo != "CLIENTES") + { + Analitico selectedItem = (Analitico)this.Grid.SelectedItem; + nullable = null; + double? nullable1 = nullable; + nullable = null; + (new HosterWindow(new ApoliceView(selectedItem.get_Documento(), true, false, 0, (long)0, false), string.Concat("CADASTRO DE APÓLICES - ", selectedItem.get_Cliente().get_Nome()), nullable1, nullable, false)).Show(); + } + else + { + Analitico analitico = (Analitico)this.Grid.SelectedItem; + Cliente cliente = await this.ViewModel.CarregaCliente(analitico.get_Cliente().get_Id()); + nullable = null; + double? nullable2 = nullable; + nullable = null; + (new HosterWindow(new ClienteView(cliente, true, null), string.Concat("CADASTRO DE CLIENTE - ", cliente.get_Nome()), nullable2, nullable, false)).Show(); + } + } + } + + private async void Print_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.Loading(true); + await this.ViewModel.Print(this.Grid); + this.ViewModel.Loading(false); + } + + [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.MainGrid = (System.Windows.Controls.Grid)target; + return; + } + case 2: + { + this.Grid = (DataGrid)target; + this.Grid.MouseDoubleClick += new MouseButtonEventHandler(this.Grid_OnMouseDoubleClick); + return; + } + case 3: + case 5: + { + this._contentLoaded = true; + return; + } + case 4: + { + this.InfoButton = (DataGridTemplateColumn)target; + return; + } + case 6: + { + this.Totalizacao = (TextBlock)target; + return; + } + case 7: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.Tarefas_OnClick); + return; + } + case 8: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.Email_OnClick); + return; + } + case 9: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.Print_OnClick); + 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) + { + if (connectionId != 3) + { + if (connectionId != 5) + { + return; + } + ((Button)target).Click += new RoutedEventHandler(this.Open_OnClick); + return; + } + ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBox_Checked); + ((CheckBox)target).Unchecked += new RoutedEventHandler(this.CheckBox_Checked); + } + + private async void Tarefas_OnClick(object sender, RoutedEventArgs e) + { + Tarefa tarefa = new Tarefa(); + tarefa.set_Entidade(1); + tarefa.set_Titulo(this.ViewModel.Head); + tarefa.set_Usuario(Recursos.Usuario); + tarefa.set_Agendamento(Funcoes.GetNetworkTime()); + await this.AbrirTarefa(tarefa); + List lista = this.Lista; + List list = ( + from x in lista + where x.get_Selecionado() + select x).ToList(); + this.Lista = this.Lista.Except(list).ToList(); + this.Grid.ItemsSource = null; + this.Grid.ItemsSource = this.Lista; + this.Totalizar(); + } + + private void Totalizar() + { + string tipo = this.ViewModel.Tipo; + if (tipo == "CLIENTES") + { + this.Totalizacao.Text = string.Format("TOTAL DE {0} CLIENTES", this.Lista.Count); + return; + } + if (tipo == "PARCELAS") + { + this.Totalizacao.Text = string.Format("TOTAL DE {0} SEGUROS SOMANDO O VALOR DE {1:c}", this.Lista.Count, this.Lista.Sum((Analitico x) => x.get_Valor())); + return; + } + if (tipo == "COMISSÃO") + { + this.Totalizacao.Text = string.Format("TOTAL DE {0} SEGUROS SOMANDO O VALOR DE COMISSÃO RECEBIDA DE {1:c}", this.Lista.Count, this.Lista.Sum((Analitico x) => x.get_ValorComissao())); + return; + } + this.Totalizacao.Text = string.Format("TOTAL DE {0} SEGUROS SOMANDO O VALOR DE {1:c}", this.Lista.Count, this.Lista.Sum((Analitico x) => x.get_PremioLiquido())); + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogAnexar.cs b/Gestor.Application/Componentes/DialogAnexar.cs new file mode 100644 index 0000000..3b87c6d --- /dev/null +++ b/Gestor.Application/Componentes/DialogAnexar.cs @@ -0,0 +1,98 @@ +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Common; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogAnexar : UserControl, IComponentConnector, IStyleConnector + { + private DialogAnexarViewModel ViewModel; + + internal Button SalvarButton; + + internal Button CancelarButton; + + private bool _contentLoaded; + + public DialogAnexar(List arquivos) + { + this.ViewModel = new DialogAnexarViewModel(arquivos); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + private void CancelarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute(null, this.CancelarButton); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + Button button = (Button)sender; + if (button == null || button.DataContext == null) + { + return; + } + ArquivoDigital dataContext = (ArquivoDigital)button.DataContext; + this.ViewModel.Remover(dataContext); + } + + [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/dialoganexar.xaml", UriKind.Relative)); + } + + private void SalvarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute(this.ViewModel.Arquivos.ToList(), this.SalvarButton); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId == 2) + { + this.SalvarButton = (Button)target; + this.SalvarButton.Click += new RoutedEventHandler(this.SalvarButton_OnClick); + return; + } + if (connectionId != 3) + { + this._contentLoaded = true; + return; + } + this.CancelarButton = (Button)target; + this.CancelarButton.Click += new RoutedEventHandler(this.CancelarButton_OnClick); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) + { + if (connectionId == 1) + { + ((Button)target).Click += new RoutedEventHandler(this.Excluir_OnClick); + } + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogCopia.cs b/Gestor.Application/Componentes/DialogCopia.cs new file mode 100644 index 0000000..f72933f --- /dev/null +++ b/Gestor.Application/Componentes/DialogCopia.cs @@ -0,0 +1,160 @@ +using Gestor.Application; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.MalaDireta; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using System.Windows.Threading; + +namespace Gestor.Application.Componentes +{ + public class DialogCopia : UserControl, IComponentConnector, IStyleConnector + { + internal TextBox CopiaBox; + + internal MaterialDesignThemes.Wpf.Snackbar Snackbar; + + private bool _contentLoaded; + + public DialogCopiaViewModel ViewModel + { + get; + set; + } + + public DialogCopia(Copia copia) + { + this.ViewModel = new DialogCopiaViewModel(copia); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + private void AdicionarCopia(object sender, RoutedEventArgs e) + { + this.ViewModel.AdicionarCopia(); + this.ToggleSnackBar(this.ViewModel.Erro, true); + } + + private void CloseSlackBar() + { + Thread.Sleep(3000); + System.Windows.Threading.Dispatcher dispatcher = App.ProgressRing.Dispatcher; + if (dispatcher == null) + { + return; + } + dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.ToggleSnackBar("", false))); + } + + private void ExcluirComum_OnDeleteClick(object sender, RoutedEventArgs e) + { + Chip chip = (Chip)sender; + this.ViewModel.ExcluirCopia("CÓPIA COMUM", (string)chip.DataContext); + } + + private void ExcluirOculta_OnDeleteClick(object sender, RoutedEventArgs e) + { + Chip chip = (Chip)sender; + this.ViewModel.ExcluirCopia("CÓPIA OCULTA", (string)chip.DataContext); + } + + [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/dialogcopia.xaml", UriKind.Relative)); + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + this.Snackbar.set_IsActive(false); + } + + [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.CopiaBox = (TextBox)target; + return; + } + case 2: + { + ((Button)target).Click += new RoutedEventHandler(this.AdicionarCopia); + return; + } + case 3: + case 4: + { + this._contentLoaded = true; + return; + } + case 5: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.AdicionarCopia); + return; + } + case 6: + { + this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; + return; + } + case 7: + { + ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); + 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) + { + if (connectionId == 3) + { + ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.ExcluirComum_OnDeleteClick)); + return; + } + if (connectionId != 4) + { + return; + } + ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.ExcluirOculta_OnDeleteClick)); + } + + public void ToggleSnackBar(string message, bool active = true) + { + this.Snackbar.get_Message().Content = message; + this.Snackbar.set_IsActive(active); + if (!active) + { + return; + } + Task.Factory.StartNew(new Action(this.CloseSlackBar)); + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogCopiarCliente.cs b/Gestor.Application/Componentes/DialogCopiarCliente.cs new file mode 100644 index 0000000..bb3abfe --- /dev/null +++ b/Gestor.Application/Componentes/DialogCopiarCliente.cs @@ -0,0 +1,92 @@ +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Seguros; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogCopiarCliente : UserControl, IComponentConnector + { + internal CopiarClienteViewModel ViewModel; + + internal AutoCompleteBox PesquisaCliente; + + internal Loading LoadingAutoComplete; + + private bool _contentLoaded; + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + public DialogCopiarCliente() + { + this.InitializeComponent(); + this.ViewModel = new CopiarClienteViewModel(); + base.DataContext = this.ViewModel; + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.get_Parameter().Trim().Length < 3) + { + return; + } + e.set_Cancel(true); + this.LoadingAutoComplete.Visibility = System.Windows.Visibility.Visible; + this.ViewModel.BuscarCliente(e.get_Parameter().Trim(), null, 2).ContinueWith((Task> searchResult) => { + this.LoadingAutoComplete.Visibility = System.Windows.Visibility.Collapsed; + if (searchResult.Result == null) + { + return; + } + AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; + autoCompleteBox.set_ItemsSource(searchResult.Result); + autoCompleteBox.PopulateComplete(); + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + [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/dialogcopiarcliente.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId == 1) + { + this.PesquisaCliente = (AutoCompleteBox)target; + this.PesquisaCliente.add_Populating(new PopulatingEventHandler(this, DialogCopiarCliente.AutoCompleteBox_Populating)); + return; + } + if (connectionId != 2) + { + this._contentLoaded = true; + return; + } + this.LoadingAutoComplete = (Loading)target; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogCopiarPermissao.cs b/Gestor.Application/Componentes/DialogCopiarPermissao.cs new file mode 100644 index 0000000..9ac6592 --- /dev/null +++ b/Gestor.Application/Componentes/DialogCopiarPermissao.cs @@ -0,0 +1,73 @@ +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogCopiarPermissao : UserControl, IComponentConnector + { + public DialogCopiarPermissaoViewModel ViewModel; + + private bool _contentLoaded; + + public DialogCopiarPermissao(DialogCopiarPermissaoViewModel viewModel) + { + this.ViewModel = viewModel; + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.get_Parameter().Length < 3) + { + return; + } + e.set_Cancel(true); + this.ViewModel.BuscarUsuario(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => { + if (searchResult.Result == null) + { + return; + } + AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; + autoCompleteBox.set_ItemsSource(searchResult.Result); + autoCompleteBox.PopulateComplete(); + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + [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/dialogcopiarpermissao.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId != 1) + { + this._contentLoaded = true; + return; + } + ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, DialogCopiarPermissao.AutoCompleteBox_Populating)); + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogDetalheExtrato.cs b/Gestor.Application/Componentes/DialogDetalheExtrato.cs new file mode 100644 index 0000000..e6d2a01 --- /dev/null +++ b/Gestor.Application/Componentes/DialogDetalheExtrato.cs @@ -0,0 +1,119 @@ +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Comissao; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Model.Domain.Seguros; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogDetalheExtrato : UserControl, IComponentConnector, IStyleConnector + { + internal DataGrid DetalhesGrid; + + private bool _contentLoaded; + + public ComissaoViewModel ViewModel + { + get; + set; + } + + public DialogDetalheExtrato(List detalhes) + { + this.InitializeComponent(); + this.DetalhesGrid.ItemsSource = detalhes; + } + + private async void AcessarApolice_OnClick(object sender, RoutedEventArgs e) + { + long? parcela; + Documento documento; + bool flag; + bool flag1; + DetalheExtrato dataContext = (DetalheExtrato)((Button)sender).DataContext; + flag = (dataContext != null ? !dataContext.get_Documento().HasValue : true); + if (flag) + { + flag1 = (dataContext != null ? !dataContext.get_Parcela().HasValue : true); + if (flag1) + { + return; + } + } + if (dataContext.get_Parcela().HasValue) + { + if (!dataContext.get_Documento().HasValue) + { + ParcelaServico parcelaServico = new ParcelaServico(); + parcela = dataContext.get_Parcela(); + documento = await parcelaServico.BuscarApolice(parcela.Value); + } + else + { + ApoliceServico apoliceServico = new ApoliceServico(); + parcela = dataContext.get_Documento(); + documento = await apoliceServico.BuscarApoliceAsync(parcela.Value, false, false); + } + Documento documento1 = documento; + if (documento1 != null) + { + double? nullable = null; + double? nullable1 = nullable; + nullable = null; + (new HosterWindow(new ApoliceView(documento1, true, false, 0, (long)0, false), string.Concat("CADASTRO DE APÓLICE - ", documento1.get_Controle().get_Cliente().get_Nome(), " - ", documento1.get_Apolice()), nullable1, nullable, false)).Show(); + } + else + { + return; + } + } + } + + [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/dialogdetalheextrato.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId != 1) + { + this._contentLoaded = true; + return; + } + this.DetalhesGrid = (DataGrid)target; + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) + { + if (connectionId == 2) + { + ((Button)target).Click += new RoutedEventHandler(this.AcessarApolice_OnClick); + } + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogEditarParcelas.cs b/Gestor.Application/Componentes/DialogEditarParcelas.cs new file mode 100644 index 0000000..3a4a496 --- /dev/null +++ b/Gestor.Application/Componentes/DialogEditarParcelas.cs @@ -0,0 +1,170 @@ +using Gestor.Application.Actions; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +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.Input; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogEditarParcelas : UserControl, IComponentConnector + { + internal MaterialDesignThemes.Wpf.Snackbar Snackbar; + + internal DataGrid ParcelaGrid; + + internal DataGridTextColumn ParcelaColumn; + + internal Label LabelStatus; + + internal Button SalvarButton; + + internal Button FecharButton; + + private bool _contentLoaded; + + public DialogEditarParcelasViewModel ViewModel + { + get; + set; + } + + public DialogEditarParcelas(Documento documento) + { + this.ViewModel = new DialogEditarParcelasViewModel(documento); + base.DataContext = this.ViewModel; + Gestor.Application.Actions.Actions.AcionarSnackbar = (Action)Delegate.Remove(Gestor.Application.Actions.Actions.AcionarSnackbar, new Action(this.AcionarSnackBar)); + Gestor.Application.Actions.Actions.AcionarSnackbar = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.AcionarSnackbar, new Action(this.AcionarSnackBar)); + this.InitializeComponent(); + } + + private void AcionarSnackBar(string message) + { + this.Snackbar.set_IsActive(true); + this.Snackbar.get_Message().Content = message; + } + + private void FecharButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute(null, this.SalvarButton); + } + + [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/dialogeditarparcelas.xaml", UriKind.Relative)); + } + + private void ParcelaGrid_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) + { + DateTime dateTime; + if (!(e.EditingElement is TextBox)) + { + return; + } + Parcela dataContext = (Parcela)e.Row.DataContext; + TextBox editingElement = e.EditingElement as TextBox; + if (editingElement == null) + { + return; + } + if (e.Column.ClipboardContentBinding.StringFormat == "d") + { + editingElement.Text = ValidationHelper.FormatDate(editingElement.Text); + if (e.Column.Header.ToString() == "VENCIMENTO") + { + dataContext.set_Vencimento((string.IsNullOrWhiteSpace(editingElement.Text) || !DateTime.TryParse(editingElement.Text, out dateTime) ? DateTime.MinValue : DateTime.Parse(editingElement.Text))); + } + } + string str = e.Column.Header.ToString(); + if (str == "VALOR") + { + this.ViewModel.AlterandoValor(); + return; + } + if (str != "VENCIMENTO") + { + return; + } + this.ViewModel.AlterandoVencimento((Parcela)e.Row.DataContext); + } + + private async void SalvarButton_OnClick(object sender, RoutedEventArgs e) + { + if (await this.ViewModel.SalvarParcelas()) + { + DialogHost.CloseDialogCommand.Execute(null, this.SalvarButton); + } + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + this.Snackbar.set_IsActive(false); + } + + [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.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; + return; + } + case 2: + { + ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); + return; + } + case 3: + { + this.ParcelaGrid = (DataGrid)target; + this.ParcelaGrid.CellEditEnding += new EventHandler(this.ParcelaGrid_OnCellEditEnding); + return; + } + case 4: + { + this.ParcelaColumn = (DataGridTextColumn)target; + return; + } + case 5: + { + this.LabelStatus = (Label)target; + return; + } + case 6: + { + this.SalvarButton = (Button)target; + this.SalvarButton.Click += new RoutedEventHandler(this.SalvarButton_OnClick); + return; + } + case 7: + { + this.FecharButton = (Button)target; + this.FecharButton.Click += new RoutedEventHandler(this.FecharButton_OnClick); + return; + } + } + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogEnviarEmails.cs b/Gestor.Application/Componentes/DialogEnviarEmails.cs new file mode 100644 index 0000000..cc4a048 --- /dev/null +++ b/Gestor.Application/Componentes/DialogEnviarEmails.cs @@ -0,0 +1,62 @@ +using Gestor.Application.ViewModels.Generic; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogEnviarEmails : UserControl, IComponentConnector + { + public DialogEnviarEmailsViewModel ViewModel; + + internal System.Windows.Controls.ProgressBar ProgressBar; + + private bool _contentLoaded; + + public DialogEnviarEmails(DialogEnviarEmailsViewModel viewModel) + { + this.ViewModel = viewModel; + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + private void Enviar_Click(object sender, RoutedEventArgs e) + { + this.ViewModel.Enviar(); + } + + [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/dialogenviaremails.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId == 1) + { + this.ProgressBar = (System.Windows.Controls.ProgressBar)target; + return; + } + if (connectionId != 2) + { + this._contentLoaded = true; + return; + } + ((MenuItem)target).Click += new RoutedEventHandler(this.Enviar_Click); + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogExportarPermissao.cs b/Gestor.Application/Componentes/DialogExportarPermissao.cs new file mode 100644 index 0000000..aa934dd --- /dev/null +++ b/Gestor.Application/Componentes/DialogExportarPermissao.cs @@ -0,0 +1,103 @@ +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogExportarPermissao : UserControl, IComponentConnector, IStyleConnector + { + public DialogExportarPermissaoViewModel ViewModel; + + internal DataGrid UsuarioGrid; + + private bool _contentLoaded; + + public DialogExportarPermissao(DialogExportarPermissaoViewModel viewModel) + { + this.ViewModel = viewModel; + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + private void AutoCompleteBox_OnTextChanged(object sender, RoutedEventArgs e) + { + if (!string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).get_Text())) + { + return; + } + this.ViewModel.FiltrarUsuario(""); + } + + private void AutoCompleteBoxUsuario_Populating(object sender, PopulatingEventArgs e) + { + e.set_Cancel(true); + this.ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim())).ContinueWith((Task> searchResult) => { + if (searchResult.Result == null) + { + return; + } + AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; + autoCompleteBox.set_ItemsSource(searchResult.Result); + autoCompleteBox.PopulateComplete(); + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + this.ViewModel.Selecionar(); + } + + [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/dialogexportarpermissao.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId != 1) + { + if (connectionId != 2) + { + this._contentLoaded = true; + return; + } + this.UsuarioGrid = (DataGrid)target; + return; + } + ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, DialogExportarPermissao.AutoCompleteBoxUsuario_Populating)); + ((AutoCompleteBox)target).add_TextChanged(new RoutedEventHandler(this.AutoCompleteBox_OnTextChanged)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) + { + if (connectionId == 3) + { + ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBox_Checked); + ((CheckBox)target).Unchecked += new RoutedEventHandler(this.CheckBox_Checked); + } + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogExtratoComissao.cs b/Gestor.Application/Componentes/DialogExtratoComissao.cs new file mode 100644 index 0000000..f408d36 --- /dev/null +++ b/Gestor.Application/Componentes/DialogExtratoComissao.cs @@ -0,0 +1,207 @@ +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; + +namespace Gestor.Application.Componentes +{ + public class DialogExtratoComissao : BaseUserControl, IComponentConnector, IStyleConnector + { + public ExtratoComissaoViewModel ViewModel; + + internal ComboBox SeguradoraBox; + + internal ComboBox SeguradoraSocialBox; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal System.Windows.Controls.ProgressBar ProgressBar; + + internal DataGrid ExtratoGrid; + + internal Button ImportarButton; + + internal Button FecharButton; + + private bool _contentLoaded; + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + public DialogExtratoComissao(List seguradoras) + { + this.InitializeComponent(); + this.ViewModel = new ExtratoComissaoViewModel(seguradoras); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; + if (dispatcher == null) + { + return; + } + dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); + } + + private async void CarregarExtratos() + { + if (this.SeguradoraBox.SelectedItem != null && this.InicioBox.SelectedDate.HasValue && this.FimBox.SelectedDate.HasValue) + { + this.ViewModel.IsEnabled = false; + this.ProgressBar.Visibility = System.Windows.Visibility.Visible; + ExtratoComissaoViewModel viewModel = this.ViewModel; + Seguradora selectedItem = (Seguradora)this.SeguradoraBox.SelectedItem; + DateTime value = this.InicioBox.SelectedDate.Value; + DateTime? selectedDate = this.FimBox.SelectedDate; + await viewModel.CarregarExtratos(selectedItem, value, selectedDate.Value); + this.ProgressBar.Visibility = System.Windows.Visibility.Collapsed; + this.ViewModel.IsEnabled = true; + } + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + this.ViewModel.SelecionarTudo(); + } + + private void ContentLoad() + { + this.InicioBox.SelectedDateChanged += new EventHandler(this.DataBox_SelectedDateChanged); + this.FimBox.SelectedDateChanged += new EventHandler(this.DataBox_SelectedDateChanged); + this.SeguradoraBox.SelectionChanged += new SelectionChangedEventHandler(this.SeguradoraBox_SelectionChanged); + this.SeguradoraSocialBox.SelectionChanged += new SelectionChangedEventHandler(this.SeguradoraSicialBox_SelectionChanged); + } + + private void DataBox_SelectedDateChanged(object sender, SelectionChangedEventArgs e) + { + this.CarregarExtratos(); + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute(null, this.FecharButton); + } + + private void Importar_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute(this.ViewModel.Selecionar(), this.ImportarButton); + } + + [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/dialogextratocomissao.xaml", UriKind.Relative)); + } + + private void SeguradoraBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + this.CarregarExtratos(); + } + + private void SeguradoraSicialBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + this.SeguradoraBox.SelectedItem = this.SeguradoraSocialBox.SelectedItem; + this.CarregarExtratos(); + } + + [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.SeguradoraBox = (ComboBox)target; + return; + } + case 2: + { + this.SeguradoraSocialBox = (ComboBox)target; + return; + } + case 3: + { + this.InicioBox = (DatePicker)target; + this.InicioBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); + return; + } + case 4: + { + this.FimBox = (DatePicker)target; + this.FimBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); + return; + } + case 5: + { + this.ProgressBar = (System.Windows.Controls.ProgressBar)target; + return; + } + case 6: + { + this.ExtratoGrid = (DataGrid)target; + return; + } + case 7: + { + this._contentLoaded = true; + return; + } + case 8: + { + this.ImportarButton = (Button)target; + this.ImportarButton.Click += new RoutedEventHandler(this.Importar_OnClick); + return; + } + case 9: + { + this.FecharButton = (Button)target; + this.FecharButton.Click += new RoutedEventHandler(this.Fechar_OnClick); + 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) + { + if (connectionId == 7) + { + ((CheckBox)target).Checked += new RoutedEventHandler(this.CheckBox_Checked); + ((CheckBox)target).Unchecked += new RoutedEventHandler(this.CheckBox_Checked); + } + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogGrafico.cs b/Gestor.Application/Componentes/DialogGrafico.cs new file mode 100644 index 0000000..4b06c7a --- /dev/null +++ b/Gestor.Application/Componentes/DialogGrafico.cs @@ -0,0 +1,47 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogGrafico : UserControl, IComponentConnector + { + private bool _contentLoaded; + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + public DialogGrafico() + { + this.InitializeComponent(); + } + + [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/dialoggrafico.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogHoster.cs b/Gestor.Application/Componentes/DialogHoster.cs new file mode 100644 index 0000000..1fbd014 --- /dev/null +++ b/Gestor.Application/Componentes/DialogHoster.cs @@ -0,0 +1,73 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; + +namespace Gestor.Application.Componentes +{ + public class DialogHoster : UserControl, IComponentConnector + { + internal TextBlock Head; + + internal Button CloseButton; + + internal ContentControl Content; + + private bool _contentLoaded; + + public DialogHoster(object view, string head) + { + this.InitializeComponent(); + this.Content.Content = view; + this.Head.Text = head; + } + + [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/dialoghoster.xaml", UriKind.Relative)); + } + + [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.Head = (TextBlock)target; + return; + } + case 2: + { + this.CloseButton = (Button)target; + return; + } + case 3: + { + this.Content = (ContentControl)target; + return; + } + } + this._contentLoaded = true; + } + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + ((Button)sender).Background = (((Button)sender).Name == "CloseButton" ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.DimGray)); + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogInstalacoes.cs b/Gestor.Application/Componentes/DialogInstalacoes.cs new file mode 100644 index 0000000..48ecc7e --- /dev/null +++ b/Gestor.Application/Componentes/DialogInstalacoes.cs @@ -0,0 +1,125 @@ +using Gestor.Model.License; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogInstalacoes : UserControl, IComponentConnector + { + internal DataGrid InstalacoesView; + + internal Button ValidarButton; + + internal Button FecharButton; + + internal MaterialDesignThemes.Wpf.Snackbar Snackbar; + + private bool _contentLoaded; + + public DialogInstalacoes(List instalacoes) + { + IEnumerable list; + this.InitializeComponent(); + DataGrid instalacoesView = this.InstalacoesView; + IEnumerable instalacaos = + from i in instalacoes + where !string.IsNullOrEmpty(i.get_Gerenciador()) + select i; + if (instalacaos != null) + { + list = instalacaos.ToList(); + } + else + { + list = null; + } + instalacoesView.ItemsSource = list; + this.InstalacoesView.SelectedIndex = -1; + } + + private void FecharButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute(null, this.FecharButton); + } + + [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/dialoginstalacoes.xaml", UriKind.Relative)); + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + this.Snackbar.get_Message().Content = ""; + this.Snackbar.set_IsActive(false); + } + + [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.InstalacoesView = (DataGrid)target; + return; + } + case 2: + { + this.ValidarButton = (Button)target; + this.ValidarButton.Click += new RoutedEventHandler(this.ValidarButton_OnClick); + return; + } + case 3: + { + this.FecharButton = (Button)target; + this.FecharButton.Click += new RoutedEventHandler(this.FecharButton_OnClick); + return; + } + case 4: + { + this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; + return; + } + case 5: + { + ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); + return; + } + } + this._contentLoaded = true; + } + + private void ValidarButton_OnClick(object sender, RoutedEventArgs e) + { + object selectedItem = this.InstalacoesView.SelectedItem; + if (selectedItem != null) + { + DialogHost.CloseDialogCommand.Execute((Instalacao)selectedItem, this.ValidarButton); + return; + } + this.Snackbar.get_Message().Content = "SELECIONE A INSTALAÇÃO A SER SUBSTITUÍDA"; + this.Snackbar.set_IsActive(true); + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogLogAcesso.cs b/Gestor.Application/Componentes/DialogLogAcesso.cs new file mode 100644 index 0000000..0878937 --- /dev/null +++ b/Gestor.Application/Componentes/DialogLogAcesso.cs @@ -0,0 +1,71 @@ +using Gestor.Application.ViewModels.Drawer; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Validation; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogLogAcesso : UserControl, IComponentConnector + { + internal System.Windows.Controls.ProgressBar ProgressBar; + + internal TextBlock TitleText; + + private bool _contentLoaded; + + public LogViewModel ViewModel + { + get; + set; + } + + public DialogLogAcesso(TipoTela tela, Usuario usuario) + { + this.ViewModel = new LogViewModel(tela, usuario.get_Id(), null, 0); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + this.ViewModel.RegistrarAcao(string.Format("ACESSOU LOG DE ACESSO DO USUÁRIO {0}, ID \"{1}\"", usuario.get_Nome(), usuario.get_Id()), usuario.get_Id(), new TipoTela?(tela), string.Format("ID ENTIDADE: {0}\nTIPO: {1}", usuario.get_Id(), Funcoes.GetDescription(tela))); + this.TitleText.Text = string.Format("LOG DE ACESSO DO USUARIO: {0}, ID {1}", usuario.get_Nome(), usuario.get_Id()); + } + + [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/dialoglogacesso.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId == 1) + { + this.ProgressBar = (System.Windows.Controls.ProgressBar)target; + return; + } + if (connectionId != 2) + { + this._contentLoaded = true; + return; + } + this.TitleText = (TextBlock)target; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogMedalha.cs b/Gestor.Application/Componentes/DialogMedalha.cs new file mode 100644 index 0000000..a24570a --- /dev/null +++ b/Gestor.Application/Componentes/DialogMedalha.cs @@ -0,0 +1,49 @@ +using Gestor.Application.ViewModels.Generic; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogMedalha : UserControl, IComponentConnector + { + private bool _contentLoaded; + + private DialogMedalhaViewModel ViewModel + { + get; + } + + public DialogMedalha(int liquido, int comissao, int resultado, int media) + { + this.ViewModel = new DialogMedalhaViewModel(liquido, comissao, resultado, media); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + [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/dialogmedalha.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogObservacao.cs b/Gestor.Application/Componentes/DialogObservacao.cs new file mode 100644 index 0000000..acca62f --- /dev/null +++ b/Gestor.Application/Componentes/DialogObservacao.cs @@ -0,0 +1,85 @@ +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogObservacao : UserControl, IComponentConnector + { + internal System.Windows.Controls.TextBox TextBox; + + internal Button SalvarButton; + + internal Button CancelarButton; + + private bool _contentLoaded; + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + public DialogObservacao() + { + this.InitializeComponent(); + } + + private void CancelarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute(null, this.CancelarButton); + } + + [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/dialogobservacao.xaml", UriKind.Relative)); + } + + private void SalvarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute(this.TextBox.Text, this.SalvarButton); + } + + [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.TextBox = (System.Windows.Controls.TextBox)target; + return; + } + case 2: + { + this.SalvarButton = (Button)target; + this.SalvarButton.Click += new RoutedEventHandler(this.SalvarButton_OnClick); + return; + } + case 3: + { + this.CancelarButton = (Button)target; + this.CancelarButton.Click += new RoutedEventHandler(this.CancelarButton_OnClick); + return; + } + } + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogPesquisaAvancada.cs b/Gestor.Application/Componentes/DialogPesquisaAvancada.cs new file mode 100644 index 0000000..e57893e --- /dev/null +++ b/Gestor.Application/Componentes/DialogPesquisaAvancada.cs @@ -0,0 +1,129 @@ +using Gestor.Application; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using System.Windows.Threading; + +namespace Gestor.Application.Componentes +{ + public class DialogPesquisaAvancada : UserControl, IComponentConnector + { + internal DataGrid Grid; + + internal MaterialDesignThemes.Wpf.Snackbar Snackbar; + + private bool _contentLoaded; + + public DialogPesquisaAvancadaViewModel ViewModel + { + get; + set; + } + + public DialogPesquisaAvancada(DialogPesquisaAvancadaViewModel viewModel) + { + this.ViewModel = viewModel; + base.DataContext = this.ViewModel; + this.InitializeComponent(); + this.ViewModel.GetTipoTela(); + this.ViewModel.HabilitarBusca(); + } + + private void CloseSlackBar() + { + Thread.Sleep(3000); + System.Windows.Threading.Dispatcher dispatcher = App.ProgressRing.Dispatcher; + if (dispatcher == null) + { + return; + } + dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.ToggleSnackBar("", false))); + } + + [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/dialogpesquisaavancada.xaml", UriKind.Relative)); + } + + private async void Pesquisar_OnClick(object sender, RoutedEventArgs e) + { + if (this.ViewModel.Pesquisa != null) + { + await this.ViewModel.Pesquisar(); + if (this.ViewModel.Pesquisas.Count == 0) + { + this.ToggleSnackBar("NÃO HÁ DOCUMENTOS ENCONTRADOS.", true); + } + } + else + { + this.ToggleSnackBar(string.Concat("INFORME QUAL ", ValidationHelper.GetDescription(this.ViewModel.Tipo), " DESEJA PROCURAR"), true); + } + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + this.Snackbar.set_IsActive(false); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + switch (connectionId) + { + case 1: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.Pesquisar_OnClick); + return; + } + case 2: + { + this.Grid = (DataGrid)target; + return; + } + case 3: + { + this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; + return; + } + case 4: + { + ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); + return; + } + } + this._contentLoaded = true; + } + + public void ToggleSnackBar(string message, bool active = true) + { + this.Snackbar.get_Message().Content = message; + this.Snackbar.set_IsActive(active); + if (!active) + { + return; + } + Task.Factory.StartNew(new Action(this.CloseSlackBar)); + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogPrint.cs b/Gestor.Application/Componentes/DialogPrint.cs new file mode 100644 index 0000000..a084b74 --- /dev/null +++ b/Gestor.Application/Componentes/DialogPrint.cs @@ -0,0 +1,176 @@ +using Gestor.Application.ViewModels.Relatorios; +using Gestor.Model.Common; +using Gestor.Model.Domain.Relatorios; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; + +namespace Gestor.Application.Componentes +{ + public class DialogPrint : UserControl, IComponentConnector, IStyleConnector + { + internal System.Windows.Controls.ProgressBar ProgressBar; + + internal CheckBox Landscape; + + internal CheckBox Portrait; + + internal Button ValidarButton; + + internal Button FecharButton; + + private bool _contentLoaded; + + public DialogPrintViewModel ViewModel + { + get; + set; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + public DialogPrint(Relatorio relatorio, Type tipo) + { + this.ViewModel = new DialogPrintViewModel(relatorio, tipo); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; + if (dispatcher == null) + { + return; + } + dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); + } + + private void CancelarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute(null, this.FecharButton); + } + + private async void ContentLoad() + { + this.ViewModel.Carregando = true; + await this.ViewModel.Carregar(); + this.Landscape.IsChecked = new bool?(true); + this.ViewModel.Carregando = false; + } + + private void ImprimirButton_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.Configuracoes.set_Campos(( + from x in this.ViewModel.Configuracoes.get_Campos() + where x.get_Selecionado() + select x).ToList()); + DialogHost.CloseDialogCommand.Execute(this.ViewModel.Configuracoes, this.ValidarButton); + this.ViewModel.Configuracoes.set_OrientacaoImpressao(new bool?(this.ViewModel.OrientacaoImpressao)); + } + + [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/dialogprint.xaml", UriKind.Relative)); + } + + [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.ProgressBar = (System.Windows.Controls.ProgressBar)target; + return; + } + case 2: + { + this._contentLoaded = true; + return; + } + case 3: + { + this.Landscape = (CheckBox)target; + this.Landscape.Checked += new RoutedEventHandler(this.ToggleButtonLandscape_OnChecked); + return; + } + case 4: + { + this.Portrait = (CheckBox)target; + this.Portrait.Checked += new RoutedEventHandler(this.ToggleButtonPortrait_OnChecked); + return; + } + case 5: + { + this.ValidarButton = (Button)target; + this.ValidarButton.Click += new RoutedEventHandler(this.ImprimirButton_OnClick); + return; + } + case 6: + { + this.FecharButton = (Button)target; + this.FecharButton.Click += new RoutedEventHandler(this.CancelarButton_OnClick); + 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) + { + if (connectionId == 2) + { + ((CheckBox)target).Checked += new RoutedEventHandler(this.ToggleButton_OnChecked); + ((CheckBox)target).Unchecked += new RoutedEventHandler(this.ToggleButton_OnChecked); + } + } + + private void ToggleButton_OnChecked(object sender, RoutedEventArgs e) + { + this.ViewModel.Selecionar(); + } + + private void ToggleButtonLandscape_OnChecked(object sender, RoutedEventArgs e) + { + this.ViewModel.OrientacaoImpressao = false; + this.ViewModel.OrientacaoImpressaoPortrait = false; + this.Portrait.IsChecked = new bool?(false); + } + + private void ToggleButtonPortrait_OnChecked(object sender, RoutedEventArgs e) + { + this.ViewModel.OrientacaoImpressao = true; + this.ViewModel.OrientacaoImpressaoLandscape = false; + this.Landscape.IsChecked = new bool?(false); + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogProtocolo.cs b/Gestor.Application/Componentes/DialogProtocolo.cs new file mode 100644 index 0000000..0ecaaac --- /dev/null +++ b/Gestor.Application/Componentes/DialogProtocolo.cs @@ -0,0 +1,51 @@ +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Seguros; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogProtocolo : UserControl, IComponentConnector + { + private bool _contentLoaded; + + private ProtocoloViewModel ViewModel + { + get; + } + + public DialogProtocolo(List itens) + { + this.ViewModel = new ProtocoloViewModel(itens); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + [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/dialogprotocolo.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogReordenarItens.cs b/Gestor.Application/Componentes/DialogReordenarItens.cs new file mode 100644 index 0000000..e378a0f --- /dev/null +++ b/Gestor.Application/Componentes/DialogReordenarItens.cs @@ -0,0 +1,67 @@ +using Gestor.Application.ViewModels.Generic; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogReordenarItens : UserControl, IComponentConnector + { + internal ProgressBar ProgressRing; + + private bool _contentLoaded; + + private ReordenarItensViewModel ViewModel + { + get; + } + + public DialogReordenarItens(List ids) + { + this.ViewModel = new ReordenarItensViewModel(ids); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + [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/dialogreordenaritens.xaml", UriKind.Relative)); + } + + private void ReordenarAutomaticamente_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.ReordenarAutomaticamente(); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId == 1) + { + ((Button)target).Click += new RoutedEventHandler(this.ReordenarAutomaticamente_OnClick); + return; + } + if (connectionId != 2) + { + this._contentLoaded = true; + return; + } + this.ProgressRing = (ProgressBar)target; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogSelecionarItens.cs b/Gestor.Application/Componentes/DialogSelecionarItens.cs new file mode 100644 index 0000000..6955962 --- /dev/null +++ b/Gestor.Application/Componentes/DialogSelecionarItens.cs @@ -0,0 +1,49 @@ +using Gestor.Application.ViewModels.Generic; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogSelecionarItens : UserControl, IComponentConnector + { + private bool _contentLoaded; + + private SelecionarItensViewModel ViewModel + { + get; + } + + public DialogSelecionarItens(long id) + { + this.ViewModel = new SelecionarItensViewModel(id); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + [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/dialogselecionaritens.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogSenhaAdm.cs b/Gestor.Application/Componentes/DialogSenhaAdm.cs new file mode 100644 index 0000000..897c5ea --- /dev/null +++ b/Gestor.Application/Componentes/DialogSenhaAdm.cs @@ -0,0 +1,125 @@ +using Gestor.Application.Servicos.Ferramentas; +using Gestor.Common.Helpers; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogSenhaAdm : UserControl, IComponentConnector + { + internal TextBlock MensagemBlock; + + internal CustomPasswordBox SenhaBox; + + internal TextBlock MensagemErro; + + internal Button ValidarButton; + + internal Button FecharButton; + + private bool _contentLoaded; + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + public DialogSenhaAdm(string mensagem) + { + this.InitializeComponent(); + this.MensagemBlock.Text = mensagem; + } + + private void FecharButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute(null, this.FecharButton); + } + + [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/dialogsenhaadm.xaml", UriKind.Relative)); + } + + private void PasswordBox_LostFocus(object sender, RoutedEventArgs e) + { + } + + private void PasswordBox_OnKeyDown(object sender, KeyEventArgs e) + { + if (e.Key != Key.Return) + { + return; + } + DialogHost.CloseDialogCommand.Execute(this.Validar(), this.ValidarButton); + } + + [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.MensagemBlock = (TextBlock)target; + return; + } + case 2: + { + this.SenhaBox = (CustomPasswordBox)target; + return; + } + case 3: + { + this.MensagemErro = (TextBlock)target; + return; + } + case 4: + { + this.ValidarButton = (Button)target; + this.ValidarButton.Click += new RoutedEventHandler(this.ValidarButton_OnClick); + return; + } + case 5: + { + this.FecharButton = (Button)target; + this.FecharButton.Click += new RoutedEventHandler(this.FecharButton_OnClick); + return; + } + } + this._contentLoaded = true; + } + + private bool Validar() + { + return this.SenhaBox.Text == EncryptionHelper.Decrypt((new EmpresaServico()).BuscarSenhaAdm()); + } + + private void ValidarButton_OnClick(object sender, RoutedEventArgs e) + { + if (!this.Validar()) + { + this.MensagemErro.Visibility = System.Windows.Visibility.Visible; + return; + } + DialogHost.CloseDialogCommand.Execute(this.Validar(), this.ValidarButton); + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogTarefa.cs b/Gestor.Application/Componentes/DialogTarefa.cs new file mode 100644 index 0000000..a9dc309 --- /dev/null +++ b/Gestor.Application/Componentes/DialogTarefa.cs @@ -0,0 +1,391 @@ +using Gestor.Application; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Componentes +{ + public class DialogTarefa : UserControl, IComponentConnector, IStyleConnector + { + internal Button ClienteButton; + + internal Button ApoliceButton; + + internal Button SinistroButton; + + internal TextBox TituloBox; + + internal DatePicker AgendamentoBox; + + internal RadioButton AnotacoesButton; + + internal TextBox AnotacoesBox; + + internal ComboBox ResponsavelBox; + + internal DatePicker ConclusaoBox; + + internal MenuItem SalvarButton; + + internal MaterialDesignThemes.Wpf.Snackbar Snackbar; + + private bool _contentLoaded; + + private DialogTarefaViewModel ViewModel + { + get; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + public DialogTarefa(Tarefa tarefa, List telefones, bool nota = false, bool agendamento = false) + { + this.ViewModel = new DialogTarefaViewModel(tarefa, telefones, nota, agendamento); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; + if (dispatcher == null) + { + return; + } + dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); + } + + private async void AcessarApolice_OnClick(object sender, RoutedEventArgs e) + { + Documento documento; + documento = (this.ViewModel.Tarefa.get_Entidade() != 3 ? await this.ViewModel.CarregaApolice(this.ViewModel.Tarefa.get_IdEntidade()) : await this.ViewModel.CarregaApoliceParcela(this.ViewModel.Tarefa.get_IdEntidade())); + double? nullable = null; + double? nullable1 = nullable; + nullable = null; + (new HosterWindow(new ApoliceView(documento, true, false, 0, (long)0, false), string.Concat("CADASTRO DE APÓLICES - ", this.ViewModel.Tarefa.get_Cliente()), nullable1, nullable, false)).Show(); + } + + private async void AcessarCliente_OnClick(object sender, RoutedEventArgs e) + { + double? nullable = null; + double? nullable1 = nullable; + nullable = null; + (new HosterWindow(new ClienteView(await this.ViewModel.CarregaCliente(this.ViewModel.Tarefa.get_IdCliente()), true, null), string.Concat("CADASTRO DE CLIENTE - ", this.ViewModel.Tarefa.get_Cliente()), nullable1, nullable, false)).Show(); + } + + private async void AcessarSinistro_OnClick(object sender, RoutedEventArgs e) + { + Sinistro sinistro = await this.ViewModel.CarregaSinistroApolice(this.ViewModel.Tarefa.get_IdEntidade()); + double? nullable = null; + double? nullable1 = nullable; + nullable = null; + (new HosterWindow(new SinistroView(sinistro.get_ControleSinistro().get_Item(), false), string.Concat("CADASTRO DE SINISTRO - ", sinistro.get_ControleSinistro().get_Item().get_Descricao()), nullable1, nullable, false)).Show(); + } + + private void AdicionarResponsavel_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.AdcionarResponsavel(); + } + + private void Anotacoes_OnChecked(object sender, RoutedEventArgs e) + { + this.ViewModel.IsAnotacoes = true; + } + + private void AnotacoesInternas_OnChecked(object sender, RoutedEventArgs e) + { + this.ViewModel.IsAnotacoes = false; + } + + private void CloseSlackBar() + { + Thread.Sleep(3000); + System.Windows.Threading.Dispatcher dispatcher = App.ProgressRing.Dispatcher; + if (dispatcher == null) + { + return; + } + dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() => this.ToggleSnackBar("", false))); + } + + private void ContentLoad() + { + this.AgendamentoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); + this.AgendamentoBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); + this.ViewModel.PermissaoWhatsapp = this.ViewModel.Restricao(32); + switch (this.ViewModel.Tarefa.get_Entidade()) + { + case 0: + { + this.ClienteButton.Visibility = System.Windows.Visibility.Visible; + this.ApoliceButton.Visibility = System.Windows.Visibility.Visible; + break; + } + case 2: + { + this.ClienteButton.Visibility = System.Windows.Visibility.Visible; + break; + } + case 3: + { + this.ClienteButton.Visibility = System.Windows.Visibility.Visible; + this.ApoliceButton.Visibility = System.Windows.Visibility.Visible; + break; + } + case 4: + { + this.ClienteButton.Visibility = System.Windows.Visibility.Visible; + this.SinistroButton.Visibility = System.Windows.Visibility.Visible; + break; + } + default: + { + this.ClienteButton.Visibility = System.Windows.Visibility.Collapsed; + this.ApoliceButton.Visibility = System.Windows.Visibility.Collapsed; + break; + } + } + this.AnotacoesButton.IsChecked = new bool?(this.ViewModel.IsAnotacoes); + this.AnotacoesButton.Checked += new RoutedEventHandler(this.Anotacoes_OnChecked); + } + + private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) + { + TelefoneBase dataContext = (TelefoneBase)((Button)sender).DataContext; + string.Concat(dataContext.get_Prefixo(), dataContext.get_Numero()).CopyToClipboard(); + this.ToggleSnackBar("NÚMERO COPIADO COM SUCESSO", true); + } + + private void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e) + { + ((DatePicker)sender).SelectedDate = new DateTime?(Funcoes.GetNetworkTime().Date); + } + + private void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + DatePicker datePicker = (DatePicker)sender; + datePicker.Text = ValidationHelper.FormatDate(datePicker.Text); + } + + private void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e) + { + if (e.Key != Key.Return) + { + return; + } + DatePicker str = (DatePicker)sender; + DateTime date = Funcoes.GetNetworkTime().Date; + str.Text = date.ToString("dd/MM/yyyy"); + } + + private void ExcluirResponsavel_OnClick(object sender, RoutedEventArgs e) + { + Chip chip = sender as Chip; + if (chip == null) + { + return; + } + ListBox listBox = Extentions.FindVisualAncestor(chip); + Usuario item = (Usuario)listBox.Items[listBox.Items.IndexOf(chip.DataContext)]; + if (item == null) + { + return; + } + this.ViewModel.RemoverResponsavel(item); + } + + [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/dialogtarefa.xaml", UriKind.Relative)); + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + if (this.ViewModel.Tarefa.get_UsuariosVinculados() == null) + { + this.ViewModel.Tarefa.set_UsuariosVinculados(new List()); + } + DialogHost.CloseDialogCommand.Execute(this.ViewModel.Tarefa, this.SalvarButton); + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + this.Snackbar.set_IsActive(false); + } + + [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.ClienteButton = (Button)target; + this.ClienteButton.Click += new RoutedEventHandler(this.AcessarCliente_OnClick); + return; + } + case 2: + { + this.ApoliceButton = (Button)target; + this.ApoliceButton.Click += new RoutedEventHandler(this.AcessarApolice_OnClick); + return; + } + case 3: + { + this.SinistroButton = (Button)target; + this.SinistroButton.Click += new RoutedEventHandler(this.AcessarSinistro_OnClick); + return; + } + case 4: + case 5: + case 12: + { + this._contentLoaded = true; + return; + } + case 6: + { + this.TituloBox = (TextBox)target; + return; + } + case 7: + { + this.AgendamentoBox = (DatePicker)target; + this.AgendamentoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); + this.AgendamentoBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); + return; + } + case 8: + { + this.AnotacoesButton = (RadioButton)target; + return; + } + case 9: + { + this.AnotacoesBox = (TextBox)target; + return; + } + case 10: + { + this.ResponsavelBox = (ComboBox)target; + return; + } + case 11: + { + ((Button)target).Click += new RoutedEventHandler(this.AdicionarResponsavel_OnClick); + return; + } + case 13: + { + this.ConclusaoBox = (DatePicker)target; + this.ConclusaoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); + this.ConclusaoBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); + return; + } + case 14: + { + this.SalvarButton = (MenuItem)target; + this.SalvarButton.Click += new RoutedEventHandler(this.MenuItem_OnClick); + return; + } + case 15: + { + this.Snackbar = (MaterialDesignThemes.Wpf.Snackbar)target; + return; + } + case 16: + { + ((SnackbarMessage)target).add_ActionClick(new RoutedEventHandler(this.SnackbarMessage_ActionClick)); + 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) + { + if (connectionId == 4) + { + ((Button)target).Click += new RoutedEventHandler(this.CopyTelefoneToClipBoard_Click); + return; + } + if (connectionId == 5) + { + ((Button)target).Click += new RoutedEventHandler(this.WhatsAppMessage_Click); + return; + } + if (connectionId != 12) + { + return; + } + ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.ExcluirResponsavel_OnClick)); + } + + private void TimePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + TimePicker timePicker = (TimePicker)sender; + timePicker.TextBox.Text = ValidationHelper.FormatTime(timePicker.TextBox.Text); + } + + public void ToggleSnackBar(string message, bool active = true) + { + this.Snackbar.get_Message().Content = message; + this.Snackbar.set_IsActive(active); + if (!active) + { + return; + } + Task.Factory.StartNew(new Action(this.CloseSlackBar)); + } + + private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) + { + string str; + TelefoneBase dataContext = (TelefoneBase)((Button)sender).DataContext; + str = (!dataContext.get_Tipo().HasValue || dataContext.get_Tipo().GetValueOrDefault() != 8 ? string.Concat("55", dataContext.get_Prefixo(), dataContext.get_Numero().Clear()) : string.Concat(dataContext.get_Prefixo(), dataContext.get_Numero()).Clear()); + if (!str.EnviarWhatsapp(null)) + { + await this.ViewModel.ShowMessage("HOUVE UM PROBLEMA AO ABRIR LINK DO WHATSAPP, O LINK FOI COPIADO EM SUA MAQUINA, BASTA ABRIR O NAVEGADOR DE INTERNET E COLAR NA BARRA DE ENDEREÇOS", "OK", "", false); + } + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogTransferencia.cs b/Gestor.Application/Componentes/DialogTransferencia.cs new file mode 100644 index 0000000..30f31c5 --- /dev/null +++ b/Gestor.Application/Componentes/DialogTransferencia.cs @@ -0,0 +1,110 @@ +using Assinador.Infrastructure.Helpers; +using CurrencyTextBoxControl; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Financeiro; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogTransferencia : UserControl, IComponentConnector + { + internal ComboBox ContaOrigemBox; + + internal CurrencyTextBox ValorBox; + + internal DatePicker VencimentoBox; + + internal ComboBox ContaDestinoBox; + + private bool _contentLoaded; + + private TranferenciaViewModel ViewModel + { + get; + } + + public DialogTransferencia(Transferencia transferencia) + { + this.ViewModel = new TranferenciaViewModel(transferencia); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + private void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e) + { + ((DatePicker)sender).SelectedDate = new DateTime?(Functions.GetNetworkTime().Date); + } + + public void DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + DatePicker datePicker = (DatePicker)sender; + datePicker.Text = ValidationHelper.FormatDate(datePicker.Text); + } + + public void DatePicker_PreviewKeyDown(object sender, KeyEventArgs e) + { + if (e.Key != Key.Return) + { + return; + } + DatePicker str = (DatePicker)sender; + DateTime date = Functions.GetNetworkTime().Date; + str.Text = date.ToString("dd/MM/yyyy"); + } + + [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/dialogtransferencia.xaml", UriKind.Relative)); + } + + [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.ContaOrigemBox = (ComboBox)target; + return; + } + case 2: + { + this.ValorBox = (CurrencyTextBox)target; + return; + } + case 3: + { + this.VencimentoBox = (DatePicker)target; + this.VencimentoBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); + this.VencimentoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); + this.VencimentoBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); + return; + } + case 4: + { + this.ContaDestinoBox = (ComboBox)target; + return; + } + } + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogTrilha.cs b/Gestor.Application/Componentes/DialogTrilha.cs new file mode 100644 index 0000000..e4f3011 --- /dev/null +++ b/Gestor.Application/Componentes/DialogTrilha.cs @@ -0,0 +1,134 @@ +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Ferramentas; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using System.Windows.Media; + +namespace Gestor.Application.Componentes +{ + public class DialogTrilha : UserControl, IComponentConnector, IStyleConnector + { + private bool _contentLoaded; + + public DialogTrilhaViewModel ViewModel + { + get; + set; + } + + public DialogTrilha(DialogTrilhaViewModel viewModel) + { + this.ViewModel = viewModel; + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + private void AdicionarFase_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.AdicionarFase(); + } + + private void ExcluirFase_OnClick(object sender, RoutedEventArgs e) + { + Fase dataContext = ((Button)sender).DataContext as Fase; + if (dataContext == null) + { + return; + } + this.ViewModel.ExcluirFase(dataContext); + } + + [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/dialogtrilha.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId != 1) + { + this._contentLoaded = true; + return; + } + ((MenuItem)target).Click += new RoutedEventHandler(this.AdicionarFase_OnClick); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) + { + switch (connectionId) + { + case 2: + { + ((TextBox)target).GotFocus += new RoutedEventHandler(this.UIElement_OnGotFocus); + ((TextBox)target).LostFocus += new RoutedEventHandler(this.UIElement_OnLostFocus); + return; + } + case 3: + { + ((TextBox)target).GotFocus += new RoutedEventHandler(this.UIElement_OnGotFocus); + ((TextBox)target).LostFocus += new RoutedEventHandler(this.UIElement_OnLostFocus); + return; + } + case 4: + { + ((Button)target).Click += new RoutedEventHandler(this.ExcluirFase_OnClick); + return; + } + default: + { + return; + } + } + } + + private void UIElement_OnGotFocus(object sender, RoutedEventArgs e) + { + DependencyObject parent = VisualTreeHelper.GetParent((UIElement)sender); + while (!(parent is ListBoxItem)) + { + if (parent == null) + { + continue; + } + parent = VisualTreeHelper.GetParent(parent); + } + ListBoxItem listBoxItem = (ListBoxItem)parent; + if (!listBoxItem.IsSelected) + { + listBoxItem.IsSelected = true; + } + } + + private void UIElement_OnLostFocus(object sender, RoutedEventArgs e) + { + ListBox listBox = ViewHelper.FindAncestor((TextBox)sender).FirstOrDefault(); + if (listBox == null) + { + return; + } + this.ViewModel.UpdateFase(listBox.SelectedIndex); + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/DialogVinculo.cs b/Gestor.Application/Componentes/DialogVinculo.cs new file mode 100644 index 0000000..b64f05e --- /dev/null +++ b/Gestor.Application/Componentes/DialogVinculo.cs @@ -0,0 +1,89 @@ +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Seguros; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class DialogVinculo : UserControl, IComponentConnector + { + internal TextBlock TitleBox; + + internal ComboBox TipoVendedorBox; + + internal ComboBox VendedorBox; + + internal ComboBox TipoVendedorVinculoBox; + + internal ComboBox RepasseVinculoBox; + + private bool _contentLoaded; + + private DialogVinculoViewModel ViewModel + { + get; + } + + public DialogVinculo(VinculoRepasse vinculo, List repasses, Repasse repasse) + { + this.ViewModel = new DialogVinculoViewModel(vinculo, repasses, repasse); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + [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/dialogvinculo.xaml", UriKind.Relative)); + } + + [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.TitleBox = (TextBlock)target; + return; + } + case 2: + { + this.TipoVendedorBox = (ComboBox)target; + return; + } + case 3: + { + this.VendedorBox = (ComboBox)target; + return; + } + case 4: + { + this.TipoVendedorVinculoBox = (ComboBox)target; + return; + } + case 5: + { + this.RepasseVinculoBox = (ComboBox)target; + return; + } + } + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/ErrorDialog.cs b/Gestor.Application/Componentes/ErrorDialog.cs new file mode 100644 index 0000000..90e3f63 --- /dev/null +++ b/Gestor.Application/Componentes/ErrorDialog.cs @@ -0,0 +1,40 @@ +using Gestor.Application.Views.Generic; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class ErrorDialog : BaseUserControl, IComponentConnector + { + private bool _contentLoaded; + + public ErrorDialog() + { + this.InitializeComponent(); + } + + [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/errordialog.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/GridRelatorio.cs b/Gestor.Application/Componentes/GridRelatorio.cs new file mode 100644 index 0000000..7673cf8 --- /dev/null +++ b/Gestor.Application/Componentes/GridRelatorio.cs @@ -0,0 +1,695 @@ +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 diff --git a/Gestor.Application/Componentes/Loading.cs b/Gestor.Application/Componentes/Loading.cs new file mode 100644 index 0000000..0c53d3b --- /dev/null +++ b/Gestor.Application/Componentes/Loading.cs @@ -0,0 +1,40 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class Loading : UserControl, IComponentConnector + { + private bool _contentLoaded; + + public Loading() + { + this.InitializeComponent(); + } + + [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/loading.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/NRecoHtmlToPdfConverter.cs b/Gestor.Application/Componentes/NRecoHtmlToPdfConverter.cs new file mode 100644 index 0000000..ca6a2c4 --- /dev/null +++ b/Gestor.Application/Componentes/NRecoHtmlToPdfConverter.cs @@ -0,0 +1,13 @@ +using NReco.PdfGenerator; +using System; + +namespace Gestor.Application.Componentes +{ + public class NRecoHtmlToPdfConverter : HtmlToPdfConverter + { + public NRecoHtmlToPdfConverter() + { + base.get_License().SetLicenseKey("PDF_Generator_Src_Examples_Pack_255474111334", "UN0G/w7zqQQlt19OtYHW14aK3o8N3sZ5gRq2SELQQjGKYV3luQETgIdsDxPl8e9ZYkRKlglzhNvxi7abVpvWeNYrTp45eL2lRgSIhMhV9Atpy1C12yBt/zG7141kzYD7hT9dmayX5d98MB0DPPlFL3A8b15f6w1qZ9ZVqBFE0w0="); + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/PassBox.cs b/Gestor.Application/Componentes/PassBox.cs new file mode 100644 index 0000000..9ca18aa --- /dev/null +++ b/Gestor.Application/Componentes/PassBox.cs @@ -0,0 +1,213 @@ +using Gestor.Common.Validation; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class PassBox : UserControl, IComponentConnector + { + public readonly static DependencyProperty ValueProperty; + + public readonly static DependencyProperty HintProperty; + + public readonly static DependencyProperty PasswordWidthProperty; + + private bool _hidePasswordView; + + internal Grid LayoutRoot; + + internal Button ShowHidePassword; + + internal PasswordBox TextPassword; + + internal TextBox TextPasswordVisible; + + private bool _contentLoaded; + + public bool HidePasswordView + { + get + { + return this._hidePasswordView; + } + set + { + if (value) + { + this.HidePassword(); + } + } + } + + public string Hint + { + get + { + return (string)base.GetValue(PassBox.HintProperty); + } + set + { + base.SetValue(PassBox.HintProperty, value); + } + } + + public string PasswordWidth + { + get + { + return (string)base.GetValue(PassBox.PasswordWidthProperty); + } + set + { + base.SetValue(PassBox.PasswordWidthProperty, value); + } + } + + public string Value + { + get + { + return (string)base.GetValue(PassBox.ValueProperty); + } + set + { + base.SetValue(PassBox.ValueProperty, value); + } + } + + public bool Visible + { + get; + set; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + static PassBox() + { + PassBox.ValueProperty = DependencyProperty.Register("Value", typeof(string), typeof(PassBox), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + PassBox.HintProperty = DependencyProperty.Register("Hint", typeof(string), typeof(PassBox), new FrameworkPropertyMetadata("SENHA", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + PassBox.PasswordWidthProperty = DependencyProperty.Register("PasswordWidth", typeof(string), typeof(PassBox), new PropertyMetadata(null, new PropertyChangedCallback(PassBox.OnBoundWidthChanged))); + } + + public PassBox() + { + this.InitializeComponent(); + this.LayoutRoot.DataContext = this; + } + + public void HidePassword() + { + this.TextPasswordVisible.Visibility = System.Windows.Visibility.Hidden; + this.TextPassword.Visibility = System.Windows.Visibility.Visible; + this.TextPassword.Focus(); + this.Visible = false; + } + + [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/passbox.xaml", UriKind.Relative)); + } + + private static void OnBoundWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + PassBox passBox = d as PassBox; + if (d == null || passBox == null) + { + return; + } + string newValue = (string)e.NewValue; + if (!ValidationHelper.ValidateDouble(newValue)) + { + return; + } + passBox.TextPassword.MinWidth = double.Parse(newValue); + passBox.TextPasswordVisible.MinWidth = double.Parse(newValue); + } + + private void ShowHidePassword_OnClick(object sender, RoutedEventArgs e) + { + if (this.Visible) + { + this.HidePassword(); + return; + } + this.ShowPassword(); + } + + private void ShowHidePassword_OnMouseDown(object sender, MouseButtonEventArgs e) + { + this.ShowPassword(); + } + + private void ShowHidePassword_OnMouseUp(object sender, MouseButtonEventArgs e) + { + this.HidePassword(); + } + + public void ShowPassword() + { + this.TextPasswordVisible.Visibility = System.Windows.Visibility.Visible; + this.TextPassword.Visibility = System.Windows.Visibility.Hidden; + this.TextPasswordVisible.Focus(); + this.Visible = true; + } + + [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.ShowHidePassword = (Button)target; + this.ShowHidePassword.PreviewMouseDown += new MouseButtonEventHandler(this.ShowHidePassword_OnMouseDown); + this.ShowHidePassword.PreviewMouseUp += new MouseButtonEventHandler(this.ShowHidePassword_OnMouseUp); + return; + } + case 3: + { + this.TextPassword = (PasswordBox)target; + this.TextPassword.PasswordChanged += new RoutedEventHandler(this.TextPassword_PasswordChanged); + return; + } + case 4: + { + this.TextPasswordVisible = (TextBox)target; + return; + } + } + this._contentLoaded = true; + } + + private void TextPassword_PasswordChanged(object sender, RoutedEventArgs e) + { + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/ProgressDialog.cs b/Gestor.Application/Componentes/ProgressDialog.cs new file mode 100644 index 0000000..847fe51 --- /dev/null +++ b/Gestor.Application/Componentes/ProgressDialog.cs @@ -0,0 +1,40 @@ +using Gestor.Application.Views.Generic; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class ProgressDialog : BaseUserControl, IComponentConnector + { + private bool _contentLoaded; + + public ProgressDialog() + { + this.InitializeComponent(); + } + + [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/progressdialog.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + this._contentLoaded = true; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/ProspeccaoDialog.cs b/Gestor.Application/Componentes/ProspeccaoDialog.cs new file mode 100644 index 0000000..151bc2a --- /dev/null +++ b/Gestor.Application/Componentes/ProspeccaoDialog.cs @@ -0,0 +1,398 @@ +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Componentes +{ + public class ProspeccaoDialog : BaseUserControl, IComponentConnector, IStyleConnector + { + public DialogProspeccaoViewModel ViewModel; + + internal TextBox DocumentoBox; + + internal DatePicker NascimentoBox; + + internal TextBox Prefixo1Box; + + internal TextBox Telefone1Box; + + internal TextBox Prefixo2Box; + + internal TextBox Telefone2Box; + + internal TextBox EmailBox; + + internal MenuItem SalvarButton; + + private bool _contentLoaded; + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + public ProspeccaoDialog(Prospeccao prospeccao) + { + this.ViewModel = new DialogProspeccaoViewModel(prospeccao); + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + private void AnexarArquivos_OnClick(object sender, RoutedEventArgs e) + { + this.ViewModel.Anexar(); + } + + private async void AutoCompleteBox_LostFocus(object sender, RoutedEventArgs e) + { + bool count; + ClienteTelefone item; + bool flag; + ClienteTelefone clienteTelefone; + bool email; + string str; + string numero; + string prefixo; + string numero1; + string prefixo1; + AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; + if (autoCompleteBox.get_SelectedItem() != null) + { + Cliente cliente = await this.ViewModel.BuscarInfoCliente((Cliente)autoCompleteBox.get_SelectedItem()); + this.DocumentoBox.Text = cliente.get_Documento(); + this.NascimentoBox.SelectedDate = cliente.get_Nascimento(); + ObservableCollection telefones = cliente.get_Telefones(); + if (telefones != null) + { + count = telefones.Count > 0; + } + else + { + count = false; + } + if (count) + { + item = cliente.get_Telefones()[0]; + } + else + { + item = null; + } + ClienteTelefone clienteTelefone1 = item; + if (clienteTelefone1 != null && clienteTelefone1.get_Prefixo() != null) + { + TextBox prefixo1Box = this.Prefixo1Box; + if (clienteTelefone1 != null) + { + prefixo1 = clienteTelefone1.get_Prefixo(); + } + else + { + prefixo1 = null; + } + prefixo1Box.Text = prefixo1; + } + if (clienteTelefone1 != null && clienteTelefone1.get_Numero() != null) + { + TextBox telefone1Box = this.Telefone1Box; + if (clienteTelefone1 != null) + { + numero1 = clienteTelefone1.get_Numero(); + } + else + { + numero1 = null; + } + telefone1Box.Text = numero1; + } + ObservableCollection observableCollection = cliente.get_Telefones(); + if (observableCollection != null) + { + flag = observableCollection.Count > 1; + } + else + { + flag = false; + } + if (flag) + { + clienteTelefone = cliente.get_Telefones()[1]; + } + else + { + clienteTelefone = null; + } + ClienteTelefone clienteTelefone2 = clienteTelefone; + if (clienteTelefone2 != null && clienteTelefone2.get_Prefixo() != null) + { + TextBox prefixo2Box = this.Prefixo2Box; + if (clienteTelefone2 != null) + { + prefixo = clienteTelefone2.get_Prefixo(); + } + else + { + prefixo = null; + } + prefixo2Box.Text = prefixo; + } + if (clienteTelefone2 != null && clienteTelefone2.get_Numero() != null) + { + TextBox telefone2Box = this.Telefone2Box; + if (clienteTelefone2 != null) + { + numero = clienteTelefone2.get_Numero(); + } + else + { + numero = null; + } + telefone2Box.Text = numero; + } + ObservableCollection emails = cliente.get_Emails(); + if (emails != null) + { + ClienteEmail clienteEmail = emails.FirstOrDefault(); + if (clienteEmail != null) + { + email = clienteEmail.get_Email(); + } + else + { + email = false; + } + } + else + { + email = false; + } + if (email) + { + TextBox emailBox = this.EmailBox; + ObservableCollection emails1 = cliente.get_Emails(); + if (emails1 != null) + { + ClienteEmail clienteEmail1 = emails1.FirstOrDefault(); + if (clienteEmail1 != null) + { + str = clienteEmail1.get_Email(); + } + else + { + str = null; + } + } + else + { + str = null; + } + emailBox.Text = str; + } + } + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.get_Parameter().Trim().Length < 3) + { + return; + } + e.set_Cancel(true); + this.ViewModel.BuscarCliente(ValidationHelper.RemoveDiacritics(e.get_Parameter().Trim()), null, 2).ContinueWith((Task> searchResult) => { + if (searchResult.Result == null) + { + return; + } + AutoCompleteBox autoCompleteBox = (AutoCompleteBox)sender; + autoCompleteBox.set_ItemsSource(searchResult.Result); + autoCompleteBox.PopulateComplete(); + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void DeleteArquivo_OnDeleteClick(object sender, RoutedEventArgs e) + { + Chip chip = sender as Chip; + if (chip == null) + { + return; + } + ListBox listBox = Extentions.FindVisualAncestor(chip); + ArquivoDigital item = (ArquivoDigital)listBox.Items[listBox.Items.IndexOf(chip.DataContext)]; + if (item == null) + { + return; + } + this.ViewModel.Delete(item); + } + + private void DocumentoBox_OnLostFocus(object sender, RoutedEventArgs e) + { + TextBox textBox = (TextBox)sender; + textBox.Text = ValidationHelper.FormatDocument(textBox.Text); + } + + [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/prospeccaodialog.xaml", UriKind.Relative)); + } + + private void SalvarButton_OnClick(object sender, RoutedEventArgs e) + { + List list; + Prospeccao selectedProspeccao = this.ViewModel.SelectedProspeccao; + ObservableCollection arquivosAnexados = this.ViewModel.ArquivosAnexados; + if (arquivosAnexados != null) + { + list = arquivosAnexados.ToList(); + } + else + { + list = null; + } + selectedProspeccao.set_Anexos(list); + DialogHost.CloseDialogCommand.Execute(this.ViewModel.SelectedProspeccao, this.SalvarButton); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + switch (connectionId) + { + case 1: + { + ((AutoCompleteBox)target).add_Populating(new PopulatingEventHandler(this, ProspeccaoDialog.AutoCompleteBox_Populating)); + ((AutoCompleteBox)target).LostFocus += new RoutedEventHandler(this.AutoCompleteBox_LostFocus); + return; + } + case 2: + { + this.DocumentoBox = (TextBox)target; + ProspeccaoDialog prospeccaoDialog = this; + this.DocumentoBox.PreviewTextInput += new TextCompositionEventHandler(prospeccaoDialog.SomenteNumeros); + this.DocumentoBox.LostFocus += new RoutedEventHandler(this.DocumentoBox_OnLostFocus); + return; + } + case 3: + { + this.NascimentoBox = (DatePicker)target; + this.NascimentoBox.LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); + this.NascimentoBox.MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); + this.NascimentoBox.PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); + return; + } + case 4: + { + this.Prefixo1Box = (TextBox)target; + ProspeccaoDialog prospeccaoDialog1 = this; + this.Prefixo1Box.PreviewTextInput += new TextCompositionEventHandler(prospeccaoDialog1.SomenteNumeros); + return; + } + case 5: + { + this.Telefone1Box = (TextBox)target; + ProspeccaoDialog prospeccaoDialog2 = this; + this.Telefone1Box.LostFocus += new RoutedEventHandler(prospeccaoDialog2.FormatarTelefone); + ProspeccaoDialog prospeccaoDialog3 = this; + this.Telefone1Box.PreviewTextInput += new TextCompositionEventHandler(prospeccaoDialog3.SomenteNumeros); + return; + } + case 6: + { + this.Prefixo2Box = (TextBox)target; + ProspeccaoDialog prospeccaoDialog4 = this; + this.Prefixo2Box.PreviewTextInput += new TextCompositionEventHandler(prospeccaoDialog4.SomenteNumeros); + return; + } + case 7: + { + this.Telefone2Box = (TextBox)target; + ProspeccaoDialog prospeccaoDialog5 = this; + this.Telefone2Box.LostFocus += new RoutedEventHandler(prospeccaoDialog5.FormatarTelefone); + ProspeccaoDialog prospeccaoDialog6 = this; + this.Telefone2Box.PreviewTextInput += new TextCompositionEventHandler(prospeccaoDialog6.SomenteNumeros); + return; + } + case 8: + { + this.EmailBox = (TextBox)target; + return; + } + case 9: + { + ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); + ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); + ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); + return; + } + case 10: + { + ((DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(this.DatePicker_OnLostKeyboardFocus); + ((DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(this.DataAtual_OnDoubleClick); + ((DatePicker)target).PreviewKeyDown += new KeyEventHandler(this.DatePicker_PreviewKeyDown); + return; + } + case 11: + { + this._contentLoaded = true; + return; + } + case 12: + { + ((MenuItem)target).Click += new RoutedEventHandler(this.AnexarArquivos_OnClick); + return; + } + case 13: + { + this.SalvarButton = (MenuItem)target; + this.SalvarButton.Click += new RoutedEventHandler(this.SalvarButton_OnClick); + 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) + { + if (connectionId == 11) + { + ((Chip)target).add_DeleteClick(new RoutedEventHandler(this.DeleteArquivo_OnDeleteClick)); + } + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/VincularLancamentoDialog.cs b/Gestor.Application/Componentes/VincularLancamentoDialog.cs new file mode 100644 index 0000000..98db83a --- /dev/null +++ b/Gestor.Application/Componentes/VincularLancamentoDialog.cs @@ -0,0 +1,82 @@ +using Gestor.Application.ViewModels.Financeiro; +using MaterialDesignThemes.Wpf; +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes +{ + public class VincularLancamentoDialog : UserControl, IComponentConnector, IStyleConnector + { + internal DataGrid LancamentoGrid; + + internal Button CancelarButton; + + private bool _contentLoaded; + + public FinanceiroViewModel ViewModel + { + get; + set; + } + + public VincularLancamentoDialog(FinanceiroViewModel viewModel) + { + this.ViewModel = viewModel; + base.DataContext = this.ViewModel; + this.InitializeComponent(); + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute(this.ViewModel.LancamentoVinculo, this.CancelarButton); + } + + [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/vincularlancamentodialog.xaml", UriKind.Relative)); + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId == 1) + { + this.LancamentoGrid = (DataGrid)target; + return; + } + if (connectionId != 3) + { + this._contentLoaded = true; + return; + } + this.CancelarButton = (Button)target; + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IStyleConnector.Connect(int connectionId, object target) + { + if (connectionId == 2) + { + ((Button)target).Click += new RoutedEventHandler(this.Button_Click); + } + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/WebBrowser.cs b/Gestor.Application/Componentes/WebBrowser.cs new file mode 100644 index 0000000..35327bc --- /dev/null +++ b/Gestor.Application/Componentes/WebBrowser.cs @@ -0,0 +1,197 @@ +using Gestor.Application.Properties; +using HtmlAgilityPack; +using mshtml; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Net; +using System.Reflection; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Interop; +using System.Windows.Markup; +using System.Windows.Navigation; +using System.Windows.Threading; + +namespace Gestor.Application.Componentes +{ + public class WebBrowser : UserControl, IComponentConnector + { + public HTMLDocument HtmlDocument; + + public System.Windows.Controls.WebBrowser Browser; + + public readonly static DependencyProperty IsReadOnlyProperty; + + internal Grid GridWebBrowser; + + private bool _contentLoaded; + + public bool IsReadOnly + { + get + { + return (bool)base.GetValue(Gestor.Application.Componentes.WebBrowser.IsReadOnlyProperty); + } + set + { + base.SetValue(Gestor.Application.Componentes.WebBrowser.IsReadOnlyProperty, value); + } + } + + static WebBrowser() + { + Gestor.Application.Componentes.WebBrowser.IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(Gestor.Application.Componentes.WebBrowser), new PropertyMetadata(false)); + } + + public WebBrowser() + { + this.InitializeComponent(); + System.Windows.Threading.Dispatcher dispatcher = base.Dispatcher; + if (dispatcher == null) + { + return; + } + dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(this.ContentLoad)); + } + + private void Browser_PreviewKeyDown(object sender, KeyEventArgs e) + { + if (this.IsReadOnly) + { + e.Handled = true; + } + } + + private void Completed(object sender, NavigationEventArgs e) + { + this.HtmlDocument = this.Browser.Document as HTMLDocument; + if (this.HtmlDocument == null) + { + return; + } + this.HtmlDocument.designMode = "On"; + } + + private void ContentLoad() + { + base.PreviewKeyDown += new KeyEventHandler(this.Browser_PreviewKeyDown); + } + + private static void EncodeNode(HtmlNode node) + { + if (node.get_HasChildNodes()) + { + foreach (HtmlNode childNode in node.get_ChildNodes()) + { + if (childNode.get_NodeType() != 3) + { + Gestor.Application.Componentes.WebBrowser.EncodeNode(childNode); + } + else + { + childNode.set_InnerHtml(WebUtility.HtmlEncode(childNode.get_InnerHtml())); + } + } + } + else if (node.get_NodeType() == 3) + { + node.set_InnerHtml(WebUtility.HtmlEncode(node.get_InnerHtml())); + } + } + + private void HideScriptErrors() + { + FieldInfo field = typeof(Gestor.Application.Componentes.WebBrowser).GetField("_axIWebBrowser2", BindingFlags.Instance | BindingFlags.NonPublic); + if (field == null) + { + return; + } + object value = field.GetValue(this.Browser); + if (value != null) + { + value.GetType().InvokeMember("Silent", BindingFlags.SetProperty, null, value, new object[] { true }); + } + } + + public static string HtmlEncode(string html) + { + if (html == null) + { + return null; + } + HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument(); + htmlDocument.LoadHtml(html); + htmlDocument.OptionWriteEmptyNodes = true; + Gestor.Application.Componentes.WebBrowser.EncodeNode(htmlDocument.get_DocumentNode()); + return htmlDocument.get_DocumentNode().get_InnerHtml(); + } + + [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/webbrowser.xaml", UriKind.Relative)); + } + + public void InstanciateNew(string htmlData = null) + { + if (this.Browser != null) + { + this.Browser.LoadCompleted -= new LoadCompletedEventHandler(this.Completed); + this.Browser.Dispose(); + this.GridWebBrowser.Children.Remove(this.Browser); + } + HTMLDocument htmlDocument = this.HtmlDocument; + if (htmlDocument != null) + { + htmlDocument.clear(); + } + else + { + } + this.Browser = new System.Windows.Controls.WebBrowser() + { + IsEnabled = true + }; + this.Browser.LoadCompleted += new LoadCompletedEventHandler(this.Completed); + this.GridWebBrowser.Children.Add(this.Browser); + this.HideScriptErrors(); + htmlData = Gestor.Application.Componentes.WebBrowser.HtmlEncode(htmlData); + this.Browser.NavigateToString((string.IsNullOrEmpty(htmlData) ? Gestor.Application.Properties.Resources.New : htmlData)); + this.HtmlDocument = this.Browser.Document as HTMLDocument; + if (this.HtmlDocument == null) + { + return; + } + this.HtmlDocument.charset = "ISO-8859-1"; + this.HtmlDocument.designMode = "On"; + } + + public void ReadOnly(bool isReadOnly) + { + this.IsReadOnly = isReadOnly; + } + + [DebuggerNonUserCode] + [EditorBrowsable(EditorBrowsableState.Never)] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) + { + if (connectionId != 1) + { + this._contentLoaded = true; + return; + } + this.GridWebBrowser = (Grid)target; + } + } +} \ No newline at end of file diff --git a/Gestor.Application/Componentes/WebEditor.cs b/Gestor.Application/Componentes/WebEditor.cs new file mode 100644 index 0000000..9e0cd81 --- /dev/null +++ b/Gestor.Application/Componentes/WebEditor.cs @@ -0,0 +1,704 @@ +using HtmlAgilityPack; +using Microsoft.Win32; +using mshtml; +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Net; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Forms; +using System.Windows.Markup; +using System.Windows.Media; + +namespace Gestor.Application.Componentes +{ + public class WebEditor : System.Windows.Controls.UserControl, IComponentConnector + { + private System.Windows.Forms.ColorDialog ColorDialog; + + public readonly static DependencyProperty ImageVisibilityProperty; + + public readonly static DependencyProperty BarVisibilityProperty; + + public readonly static DependencyProperty BodyProperty; + + public readonly static DependencyProperty IsReadOnlyProperty; + + internal WrapPanel PanelControls; + + internal System.Windows.Controls.ComboBox ComboTextFormat; + + internal System.Windows.Controls.ComboBox ComboFontFamily; + + internal System.Windows.Controls.ComboBox ComboFontSize; + + internal System.Windows.Controls.Button SettingsBold; + + internal System.Windows.Controls.Button SettingsItalic; + + internal System.Windows.Controls.Button SettingsUnderLine; + + internal System.Windows.Controls.Button SettingsFontColor; + + internal System.Windows.Controls.Button SettingsBullets; + + internal System.Windows.Controls.Button SettingsNumbered; + + internal System.Windows.Controls.Button SettingsLeftAlign; + + internal System.Windows.Controls.Button SettingsCenter; + + internal System.Windows.Controls.Button SettingsRightAlign; + + internal System.Windows.Controls.Button SettingsJustifyFull; + + internal System.Windows.Controls.Button SettingsLink; + + internal System.Windows.Controls.TextBox ImagemLink; + + internal Gestor.Application.Componentes.WebBrowser WebBrowserEditor; + + internal ItemsControl LinkPanel; + + internal System.Windows.Controls.TextBox HrefLink; + + internal CustomItemControl DescricaoBox; + + internal System.Windows.Controls.TextBox DescricaoLink; + + private bool _contentLoaded; + + public System.Windows.Visibility BarVisibility + { + get + { + return (System.Windows.Visibility)base.GetValue(WebEditor.BarVisibilityProperty); + } + set + { + base.SetValue(WebEditor.BarVisibilityProperty, value); + } + } + + public string Body + { + get + { + return (string)base.GetValue(WebEditor.BodyProperty); + } + set + { + base.SetValue(WebEditor.BodyProperty, value); + } + } + + public System.Windows.Visibility ImageVisibility + { + get + { + return (System.Windows.Visibility)base.GetValue(WebEditor.ImageVisibilityProperty); + } + set + { + base.SetValue(WebEditor.ImageVisibilityProperty, value); + } + } + + public bool IsReadOnly + { + get + { + return (bool)base.GetValue(WebEditor.IsReadOnlyProperty); + } + set + { + base.SetValue(WebEditor.IsReadOnlyProperty, value); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + static WebEditor() + { + WebEditor.ImageVisibilityProperty = DependencyProperty.Register("ImageVisibility", typeof(System.Windows.Visibility), typeof(WebEditor), new FrameworkPropertyMetadata((object)System.Windows.Visibility.Collapsed, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + WebEditor.BarVisibilityProperty = DependencyProperty.Register("BarVisibility", typeof(System.Windows.Visibility), typeof(WebEditor), new FrameworkPropertyMetadata((object)System.Windows.Visibility.Visible, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault)); + WebEditor.BodyProperty = DependencyProperty.Register("Body", typeof(string), typeof(WebEditor), new FrameworkPropertyMetadata(string.Empty, new PropertyChangedCallback(WebEditor.OnBoundBodyChanged))); + WebEditor.IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(WebEditor), new FrameworkPropertyMetadata(false, new PropertyChangedCallback(WebEditor.OnBoundReadOnlyChanged))); + } + + public WebEditor() + { + this.InitializeComponent(); + this.ColorDialog = new System.Windows.Forms.ColorDialog(); + } + + private void CancelLink_OnClick(object sender, RoutedEventArgs e) + { + this.LinkPanel.Visibility = System.Windows.Visibility.Collapsed; + this.WebBrowserEditor.Visibility = System.Windows.Visibility.Visible; + } + + private void ComboFontFamily_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + this.WebBrowserEditor.HtmlDocument = this.WebBrowserEditor.Browser.Document as HTMLDocument; + string str = this.ComboFontFamily.SelectedItem.ToString(); + HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument; + if (htmlDocument == null) + { + return; + } + htmlDocument.execCommand("FontName", false, str); + } + + private void ComboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + this.WebBrowserEditor.HtmlDocument = this.WebBrowserEditor.Browser.Document as HTMLDocument; + HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument; + if (htmlDocument == null) + { + return; + } + htmlDocument.execCommand("FontSize", false, this.ComboFontSize.SelectedItem); + } + + private void ComboTextFormat_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + string str = this.ComboTextFormat.SelectedValue.ToString(); + this.WebBrowserEditor.HtmlDocument = this.WebBrowserEditor.Browser.Document as HTMLDocument; + HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument; + if (htmlDocument == null) + { + return; + } + htmlDocument.execCommand("FormatBlock", false, str); + } + + private void DecodeNode(HtmlNode node) + { + if (node.get_HasChildNodes()) + { + foreach (HtmlNode childNode in node.get_ChildNodes()) + { + if (childNode.get_NodeType() != 3) + { + this.DecodeNode(childNode); + } + else + { + childNode.set_InnerHtml(WebUtility.HtmlDecode(childNode.get_InnerHtml())); + } + } + } + else if (node.get_NodeType() == 3) + { + node.set_InnerHtml(WebUtility.HtmlDecode(node.get_InnerHtml())); + } + } + + private void FontFamilyInitialize() + { + this.ComboFontFamily.ItemsSource = Fonts.SystemFontFamilies; + this.ComboFontFamily.Text = "Times New Roman"; + } + + private void FontFormatInitialize() + { + this.ComboTextFormat.ItemsSource = new List>() + { + new KeyValuePair("

", "Parágrafo"), + new KeyValuePair("

", "Título 1"), + new KeyValuePair("

", "Título 2"), + new KeyValuePair("

", "Título 3"), + new KeyValuePair("

", "Título 4"), + new KeyValuePair("
", "Título 5"), + new KeyValuePair("
", "Título 6"), + new KeyValuePair("
", "Endereço"), + new KeyValuePair("
", "Pré-formatação")
+			};
+			this.ComboTextFormat.SelectedValuePath = "Key";
+			this.ComboTextFormat.DisplayMemberPath = "Value";
+			this.ComboTextFormat.SelectedIndex = 0;
+		}
+
+		private void FontSizeInitialize()
+		{
+			List strs = new List();
+			for (int i = 1; i <= 7; i++)
+			{
+				strs.Add(i.ToString());
+			}
+			this.ComboFontSize.ItemsSource = strs;
+			this.ComboFontSize.Text = "3";
+		}
+
+		public string GetHtml()
+		{
+			string htmlDocument = this.WebBrowserEditor.HtmlDocument.documentElement.innerHTML;
+			return this.HtmlDecode(htmlDocument.Replace("about:", string.Empty));
+		}
+
+		public string GetText()
+		{
+			if (this.WebBrowserEditor.HtmlDocument.documentElement.innerText.Trim() == "new")
+			{
+				return "";
+			}
+			return this.WebBrowserEditor.HtmlDocument.documentElement.innerText;
+		}
+
+		public string HtmlDecode(string html)
+		{
+			if (html == null)
+			{
+				return null;
+			}
+			HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument();
+			htmlDocument.LoadHtml(html);
+			htmlDocument.OptionWriteEmptyNodes = true;
+			this.DecodeNode(htmlDocument.get_DocumentNode());
+			return htmlDocument.get_DocumentNode().get_InnerHtml();
+		}
+
+		public void Initialize(string htmlData = null)
+		{
+			this.WebBrowserEditor.InstanciateNew(htmlData);
+		}
+
+		[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/webeditor.xaml", UriKind.Relative));
+		}
+
+		private void InsertLink_OnClick(object sender, RoutedEventArgs e)
+		{
+			if (string.IsNullOrWhiteSpace(this.HrefLink.Text))
+			{
+				return;
+			}
+			IHTMLSelectionObject htmlDocument = this.WebBrowserEditor.HtmlDocument.selection;
+			if (htmlDocument != null)
+			{
+				IHTMLTxtRange variable = htmlDocument.createRange() as IHTMLTxtRange;
+				if (variable != null)
+				{
+					if (string.IsNullOrEmpty(variable.htmlText))
+					{
+						variable.pasteHTML(string.Concat(new string[] { "", this.DescricaoLink.Text, "" }));
+					}
+					else
+					{
+						variable.pasteHTML(string.Concat(new string[] { "", variable.htmlText, "" }));
+					}
+				}
+			}
+			this.LinkPanel.Visibility = System.Windows.Visibility.Collapsed;
+			this.WebBrowserEditor.Visibility = System.Windows.Visibility.Visible;
+		}
+
+		public void InsertText(string textToInsert)
+		{
+			object obj;
+			HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument;
+			if (htmlDocument != null)
+			{
+				IHTMLSelectionObject variable = htmlDocument.selection;
+				obj = (variable != null ? variable.createRange() : null);
+			}
+			else
+			{
+				obj = null;
+			}
+			dynamic obj1 = obj;
+			if (obj1 != null)
+			{
+				obj1.pasteHTML(textToInsert);
+			}
+		}
+
+		private static void OnBoundBodyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+		{
+			string newValue = (string)e.NewValue;
+			if (d != null)
+			{
+				WebEditor webEditor = d as WebEditor;
+				if (webEditor != null)
+				{
+					webEditor.WebBrowserEditor.InstanciateNew(newValue);
+					return;
+				}
+			}
+		}
+
+		private static void OnBoundReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+		{
+			bool newValue = (bool)e.NewValue;
+			if (d != null)
+			{
+				WebEditor webEditor = d as WebEditor;
+				if (webEditor != null)
+				{
+					webEditor.WebBrowserEditor.ReadOnly(newValue);
+					webEditor.PanelControls.IsEnabled = !newValue;
+					return;
+				}
+			}
+		}
+
+		public System.Windows.Media.Color Pick()
+		{
+			System.Windows.Media.Color a = new System.Windows.Media.Color();
+			this.ColorDialog.AllowFullOpen = true;
+			this.ColorDialog.FullOpen = true;
+			if (this.ColorDialog.ShowDialog() != DialogResult.OK)
+			{
+				return a;
+			}
+			System.Drawing.Color color = this.ColorDialog.Color;
+			a.A = color.A;
+			color = this.ColorDialog.Color;
+			a.B = color.B;
+			color = this.ColorDialog.Color;
+			a.G = color.G;
+			color = this.ColorDialog.Color;
+			a.R = color.R;
+			return a;
+		}
+
+		private void SettingsBold_Click(object sender, RoutedEventArgs e)
+		{
+			HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument;
+			if (htmlDocument == null)
+			{
+				return;
+			}
+			htmlDocument.execCommand("Bold", false, Type.Missing);
+		}
+
+		private void SettingsBullets_Click(object sender, RoutedEventArgs e)
+		{
+			HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument;
+			if (htmlDocument == null)
+			{
+				return;
+			}
+			htmlDocument.execCommand("InsertUnorderedList", false, Type.Missing);
+		}
+
+		private void SettingsCenter_Click(object sender, RoutedEventArgs e)
+		{
+			HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument;
+			if (htmlDocument == null)
+			{
+				return;
+			}
+			htmlDocument.execCommand("JustifyCenter", false, Type.Missing);
+		}
+
+		private void SettingsFontColor_Click(object sender, RoutedEventArgs e)
+		{
+			this.WebBrowserEditor.HtmlDocument = this.WebBrowserEditor.Browser.Document as HTMLDocument;
+			if (this.WebBrowserEditor.HtmlDocument == null)
+			{
+				return;
+			}
+			System.Windows.Media.Color color = this.Pick();
+			string str = string.Format("#{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B);
+			this.WebBrowserEditor.HtmlDocument.execCommand("ForeColor", false, str);
+		}
+
+		private void SettingsImage_Click(object sender, RoutedEventArgs e)
+		{
+			object obj;
+			Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog()
+			{
+				Title = "Selecione a imagem",
+				Filter = "Todos os formatos|*.jpg;*.jpeg;*.png|JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|Portable Network Graphic (*.png)|*.png"
+			};
+			if (!openFileDialog.ShowDialog().GetValueOrDefault())
+			{
+				return;
+			}
+			string str = Path.GetExtension(openFileDialog.FileName).ToLower().Substring(1);
+			string base64String = Convert.ToBase64String(File.ReadAllBytes(openFileDialog.FileName));
+			string str1 = string.Concat("data:image/", str, ";base64,", base64String);
+			HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument;
+			if (htmlDocument != null)
+			{
+				IHTMLSelectionObject variable = htmlDocument.selection;
+				obj = (variable != null ? variable.createRange() : null);
+			}
+			else
+			{
+				obj = null;
+			}
+			object obj1 = obj;
+			string str2 = string.Concat("\"Imagem\"");
+			if (!string.IsNullOrEmpty(this.ImagemLink.Text.Trim()))
+			{
+				str2 = string.Concat(new string[] { "", str2, "" });
+			}
+			dynamic obj2 = obj1;
+			if (obj2 != null)
+			{
+				obj2.pasteHTML(str2);
+			}
+		}
+
+		private void SettingsInsertOrderedList_Click(object sender, RoutedEventArgs e)
+		{
+			HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument;
+			if (htmlDocument == null)
+			{
+				return;
+			}
+			htmlDocument.execCommand("InsertOrderedList", false, Type.Missing);
+		}
+
+		private void SettingsItalic_Click(object sender, RoutedEventArgs e)
+		{
+			HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument;
+			if (htmlDocument == null)
+			{
+				return;
+			}
+			htmlDocument.execCommand("Italic", false, Type.Missing);
+		}
+
+		private void SettingsJustifyFull_Click(object sender, RoutedEventArgs e)
+		{
+			HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument;
+			if (htmlDocument == null)
+			{
+				return;
+			}
+			htmlDocument.execCommand("JustifyFull", false, Type.Missing);
+		}
+
+		private void SettingsLeftAlign_Click(object sender, RoutedEventArgs e)
+		{
+			HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument;
+			if (htmlDocument == null)
+			{
+				return;
+			}
+			htmlDocument.execCommand("JustifyLeft", false, Type.Missing);
+		}
+
+		private void SettingsLink_OnClick(object sender, RoutedEventArgs e)
+		{
+			HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument;
+			this.DescricaoBox.Visibility = System.Windows.Visibility.Visible;
+			IHTMLSelectionObject variable = htmlDocument.selection;
+			if (variable != null)
+			{
+				IHTMLTxtRange variable1 = variable.createRange() as IHTMLTxtRange;
+				if (variable1 != null)
+				{
+					this.DescricaoBox.Visibility = (!string.IsNullOrEmpty(variable1.htmlText) ? System.Windows.Visibility.Collapsed : System.Windows.Visibility.Visible);
+				}
+			}
+			this.LinkPanel.Visibility = System.Windows.Visibility.Visible;
+			this.WebBrowserEditor.Visibility = System.Windows.Visibility.Hidden;
+		}
+
+		private void SettingsRightAlign_Click(object sender, RoutedEventArgs e)
+		{
+			HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument;
+			if (htmlDocument == null)
+			{
+				return;
+			}
+			htmlDocument.execCommand("JustifyRight", false, Type.Missing);
+		}
+
+		private void SettingsUnderLine_Click(object sender, RoutedEventArgs e)
+		{
+			HTMLDocument htmlDocument = this.WebBrowserEditor.HtmlDocument;
+			if (htmlDocument == null)
+			{
+				return;
+			}
+			htmlDocument.execCommand("Underline", false, Type.Missing);
+		}
+
+		[DebuggerNonUserCode]
+		[EditorBrowsable(EditorBrowsableState.Never)]
+		[GeneratedCode("PresentationBuildTasks", "4.0.0.0")]
+		void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
+		{
+			switch (connectionId)
+			{
+				case 1:
+				{
+					((WebEditor)target).Loaded += new RoutedEventHandler(this.Window_Loaded);
+					return;
+				}
+				case 2:
+				{
+					this.PanelControls = (WrapPanel)target;
+					return;
+				}
+				case 3:
+				{
+					this.ComboTextFormat = (System.Windows.Controls.ComboBox)target;
+					this.ComboTextFormat.SelectionChanged += new SelectionChangedEventHandler(this.ComboTextFormat_SelectionChanged);
+					return;
+				}
+				case 4:
+				{
+					this.ComboFontFamily = (System.Windows.Controls.ComboBox)target;
+					this.ComboFontFamily.SelectionChanged += new SelectionChangedEventHandler(this.ComboFontFamily_SelectionChanged);
+					return;
+				}
+				case 5:
+				{
+					this.ComboFontSize = (System.Windows.Controls.ComboBox)target;
+					this.ComboFontSize.SelectionChanged += new SelectionChangedEventHandler(this.ComboFontSize_SelectionChanged);
+					return;
+				}
+				case 6:
+				{
+					this.SettingsBold = (System.Windows.Controls.Button)target;
+					this.SettingsBold.Click += new RoutedEventHandler(this.SettingsBold_Click);
+					return;
+				}
+				case 7:
+				{
+					this.SettingsItalic = (System.Windows.Controls.Button)target;
+					this.SettingsItalic.Click += new RoutedEventHandler(this.SettingsItalic_Click);
+					return;
+				}
+				case 8:
+				{
+					this.SettingsUnderLine = (System.Windows.Controls.Button)target;
+					this.SettingsUnderLine.Click += new RoutedEventHandler(this.SettingsUnderLine_Click);
+					return;
+				}
+				case 9:
+				{
+					this.SettingsFontColor = (System.Windows.Controls.Button)target;
+					this.SettingsFontColor.Click += new RoutedEventHandler(this.SettingsFontColor_Click);
+					return;
+				}
+				case 10:
+				{
+					this.SettingsBullets = (System.Windows.Controls.Button)target;
+					this.SettingsBullets.Click += new RoutedEventHandler(this.SettingsBullets_Click);
+					return;
+				}
+				case 11:
+				{
+					this.SettingsNumbered = (System.Windows.Controls.Button)target;
+					this.SettingsNumbered.Click += new RoutedEventHandler(this.SettingsInsertOrderedList_Click);
+					return;
+				}
+				case 12:
+				{
+					this.SettingsLeftAlign = (System.Windows.Controls.Button)target;
+					this.SettingsLeftAlign.Click += new RoutedEventHandler(this.SettingsLeftAlign_Click);
+					return;
+				}
+				case 13:
+				{
+					this.SettingsCenter = (System.Windows.Controls.Button)target;
+					this.SettingsCenter.Click += new RoutedEventHandler(this.SettingsCenter_Click);
+					return;
+				}
+				case 14:
+				{
+					this.SettingsRightAlign = (System.Windows.Controls.Button)target;
+					this.SettingsRightAlign.Click += new RoutedEventHandler(this.SettingsRightAlign_Click);
+					return;
+				}
+				case 15:
+				{
+					this.SettingsJustifyFull = (System.Windows.Controls.Button)target;
+					this.SettingsJustifyFull.Click += new RoutedEventHandler(this.SettingsJustifyFull_Click);
+					return;
+				}
+				case 16:
+				{
+					this.SettingsLink = (System.Windows.Controls.Button)target;
+					this.SettingsLink.Click += new RoutedEventHandler(this.SettingsLink_OnClick);
+					return;
+				}
+				case 17:
+				{
+					this.ImagemLink = (System.Windows.Controls.TextBox)target;
+					return;
+				}
+				case 18:
+				{
+					((System.Windows.Controls.MenuItem)target).Click += new RoutedEventHandler(this.SettingsImage_Click);
+					return;
+				}
+				case 19:
+				{
+					this.WebBrowserEditor = (Gestor.Application.Componentes.WebBrowser)target;
+					return;
+				}
+				case 20:
+				{
+					this.LinkPanel = (ItemsControl)target;
+					return;
+				}
+				case 21:
+				{
+					((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.CancelLink_OnClick);
+					return;
+				}
+				case 22:
+				{
+					this.HrefLink = (System.Windows.Controls.TextBox)target;
+					return;
+				}
+				case 23:
+				{
+					this.DescricaoBox = (CustomItemControl)target;
+					return;
+				}
+				case 24:
+				{
+					this.DescricaoLink = (System.Windows.Controls.TextBox)target;
+					return;
+				}
+				case 25:
+				{
+					((System.Windows.Controls.Button)target).Click += new RoutedEventHandler(this.InsertLink_OnClick);
+					return;
+				}
+			}
+			this._contentLoaded = true;
+		}
+
+		private void Window_Loaded(object sender, RoutedEventArgs e)
+		{
+			if (this.WebBrowserEditor.Browser == null)
+			{
+				this.WebBrowserEditor.InstanciateNew(null);
+			}
+			this.FontFamilyInitialize();
+			this.FontSizeInitialize();
+			this.FontFormatInitialize();
+		}
+	}
+}
\ No newline at end of file
-- 
cgit v1.2.3