diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
| commit | 225aa1499e37faf9d38257caabbadc68d78b427e (patch) | |
| tree | 102bb7a40c58595348ae9d3c7076201759fe0720 /Decompiler/Gestor.Application.Views.Seguros | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.Views.Seguros')
9 files changed, 10165 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Views.Seguros/ApoliceView.cs b/Decompiler/Gestor.Application.Views.Seguros/ApoliceView.cs new file mode 100644 index 0000000..d1bb049 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/ApoliceView.cs @@ -0,0 +1,3255 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Text.RegularExpressions; +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 CurrencyTextBoxControl; +using Gestor.Application.Actions; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Seguros; + +public class ApoliceView : BaseUserControl, IComponentConnector, IStyleConnector +{ + private string _vencimentoCartaoOld = ""; + + private bool _calculando; + + internal DockPanel MenuApolice; + + internal MenuItem IncluirpoliceButton; + + internal MenuItem AlterarApoliceButton; + + internal MenuItem SalvarApoliceButton; + + internal MenuItem CancelarApoliceButton; + + internal MenuItem ExcluirpoliceButton; + + internal Button ButtonImportado; + + internal MenuItem ArquivoDigitalButton; + + internal MenuItem MaisOpcoesButton; + + internal MenuItem EditarParcelasButton; + + internal WrapPanel ApoliceControl1; + + internal ComboBox ProdutoBox; + + internal ComboBox SituacaoBox; + + internal ComboBox NegocioCorretoraBox; + + internal ComboBox TipoRecebimentoBox; + + internal ComboBox TipoEndossoBox; + + internal TextBox ApoliceBox; + + internal TextBox EndossoBox; + + internal DatePicker Vigencia2Box; + + internal DatePicker TransmissaoBox; + + internal DatePicker EmissaoBox; + + internal ComboBox FormaPagamentoBox; + + internal Grid PremiosBox; + + internal ToggleButton AdicionalBox; + + internal CustomIsReadOnlyControl Comissao; + + internal CurrencyTextBox ComissaoBox; + + internal CurrencyTextBox PremioLiquidoBox; + + internal CurrencyTextBox PremioAdicionalBox; + + internal CurrencyTextBox IofBox; + + internal CurrencyTextBox DiferencaBox; + + internal CurrencyTextBox PremioTotalBox; + + internal CurrencyTextBox ParcelasBox; + + internal CustomIsReadOnlyControl ComissaoOriginal; + + internal CustomIsReadOnlyControl Gerada; + + internal CustomIsReadOnlyControl Recebida; + + internal CustomIsReadOnlyControl Pendente; + + internal CustomIsReadOnlyControl Repasse; + + internal Menu BaixarParcelaButton; + + internal Menu SalvarParcelaButton; + + internal StackPanel EditarParcelasFields; + + internal CustomItemValidation TipoParcelaField; + + internal ComboBox TipoParcelaBox; + + internal CustomItemControl QuantidadeFaturaField; + + internal CurrencyTextBox QuantidadeFaturaBox; + + internal CustomItemValidation FaturaField; + + internal TextBox FaturaBox; + + internal CustomItemValidation VigenciaInicialField; + + internal CustomItemValidation VigenciaFinalField; + + internal DatePicker VigenciaFinalParcelaBox; + + internal CustomItemValidation VencimentoField; + + internal CustomItemControl EmissaoField; + + internal DatePicker EmissaoParcelaBox; + + internal CustomItemValidation PercentualComissaoField; + + internal CurrencyTextBox ComissaoParcelaBox; + + internal TextBlock ComissaoIcon; + + internal CustomItemControl ValorLiquidoField; + + internal CurrencyTextBox ValorLiquidoParcelaBox; + + internal CustomItemControl ValorField; + + internal CurrencyTextBox ValorParcelaBox; + + internal CustomItemValidation RecebimentoField; + + internal DatePicker RecebimentoParcelaBox; + + internal CustomItemControl QuitacaoField; + + internal CustomItemControl DataControleParcelaField; + + internal CustomItemValidation CreditoField; + + internal DatePicker CreditoParcelaBox; + + internal CustomItemValidation ValorRealizadoField; + + internal CurrencyTextBox ValorRealizadoParcelaBox; + + internal CustomItemValidation ValorComissaoField; + + internal CurrencyTextBox ValorComissaoParcelaBox; + + internal WrapPanel ImpostosField; + + internal CustomItemControl PorcentagemIrField; + + internal CurrencyTextBox PorcentagemIrBox; + + internal CustomItemControl ValorIrField; + + internal CurrencyTextBox ValorIrBox; + + internal CustomItemControl PorcentagemIssField; + + internal CurrencyTextBox PorcentagemIssBox; + + internal CustomItemControl ValorIssField; + + internal CurrencyTextBox ValorIssBox; + + internal CustomItemControl ValorOutrosField; + + internal CurrencyTextBox ValorOutrosBox; + + internal CustomItemControl ValorDescontoField; + + internal CurrencyTextBox ValorDescontoBox; + + internal CustomItemControl ValorComDescField; + + internal CurrencyTextBox ValorComDescBox; + + internal DataGrid ParcelaGrid; + + internal DataGridTextColumn ParcelaColumn; + + internal DataGridTextColumn FaturaColumn; + + internal DataGridTextColumn VigenciaInicialColumn; + + internal DataGridTextColumn VigenciaFinalColumn; + + internal DataGridTextColumn ParcelasComissaoColumn; + + internal DataGridTextColumn ParcelasValorComissaoColumn; + + internal DataGridTextColumn ParcelasValorComissaoDescColumn; + + internal DataGridTemplateColumn MaisInformacoesColumn; + + internal MenuItem EditarVendedorButton; + + internal MenuItem SalvarVendedorButton; + + internal MenuItem CancelarVendedorButton; + + internal WrapPanel EditarVendedorFields; + + internal ToggleButton CoCorretagemToogle; + + internal ComboBox TipoVendedorBox; + + internal ComboBox VendedorBox; + + internal CustomItemValidation ComissaoNovoBox; + + internal ComboBox ComissaoNovoComboBox; + + internal CustomItemValidation ComissaoRenovacaoBox; + + internal ComboBox ComissaoRenovacaoComboBox; + + internal CurrencyTextBox ValorRepasseBox; + + internal TextBox FormaRecebidaBox; + + internal TextBox FormaIncidenciaBox; + + internal DataGrid VendedorGrid; + + internal DataGridTextColumn VendedorGridColumn; + + internal DataGridTextColumn PagamentosPorcentagemRepasseColumn; + + internal DataGridTextColumn PagamentosValorRepasseColumn; + + internal TextBox ProponenteBox; + + internal AutoCompleteBox AutoCompleteBanco; + + internal TextBox AgenciaBox; + + internal TextBox ContaBox; + + internal TextBox CartaoBox; + + internal ComboBox BandeiraBox; + + internal TextBox VencimentoCartaoBox; + + internal DatePicker DataBox; + + internal TextBox PastaBox; + + private bool _contentLoaded; + + public ApoliceViewModel ViewModel { get; set; } + + private int EditarParcelaTipo { get; set; } + + private AcessoApolice AcessoApolice { get; } + + public ApoliceView(Documento documentoSelecionado, bool lockInsert = false, bool invoke = true, AcessoApolice acesso = 0, long idparcela = 0L, bool consultaTela = false) + { + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + ((FrameworkElement)this).Tag = "CADASTRO DE APÓLICE"; + AcessoApolice = acesso; + Gestor.Application.Actions.Actions.Redimencionar = (Action<bool>)Delegate.Combine(Gestor.Application.Actions.Actions.Redimencionar, new Action<bool>(Redimencionar)); + ViewModel = new ApoliceViewModel(acesso, documentoSelecionado, invoke, idparcela); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + ((FrameworkElement)ParcelaGrid).DataContext = ViewModel; + if (consultaTela) + { + ((UIElement)ExcluirpoliceButton).IsEnabled = false; + } + Restricao(); + if (lockInsert) + { + ((UIElement)IncluirpoliceButton).IsEnabled = false; + } + if (documentoSelecionado != null) + { + string text = ((documentoSelecionado.Tipo == 0 && string.IsNullOrEmpty(documentoSelecionado.Apolice)) ? ("PROPOSTA \"" + documentoSelecionado.Proposta + "\"") : ((documentoSelecionado.Tipo == 0 && !string.IsNullOrEmpty(documentoSelecionado.Apolice)) ? ("APÓLICE \"" + documentoSelecionado.Apolice + "\"") : (string.IsNullOrEmpty(documentoSelecionado.Endosso) ? ("PROPOSTA DE ENDOSSO \"" + documentoSelecionado.PropostaEndosso + "\"") : ("ENDOSSO \"" + documentoSelecionado.Endosso + "\"")))); + ViewModel.RegistrarAcao("ACESSOU " + text, ((DomainBase)documentoSelecionado).Id, (TipoTela)2, ViewModel.GerarObs(documentoSelecionado)); + } + } + + private void ValidarTela() + { + if (ViewModel.SelectedDocumento != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedDocumento.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void Redimencionar(bool invoke) + { + Window? obj = ((IEnumerable)Application.Current.Windows).OfType<Window>().SingleOrDefault((Func<Window, bool>)((Window x) => x.IsActive)); + double num = ((obj != null) ? ((FrameworkElement)obj).ActualWidth : 1366.0); + Redimencionar(num - (double)(invoke ? 40 : 0)); + Gestor.Application.Actions.Actions.Redimencionar = (Action<bool>)Delegate.Remove(Gestor.Application.Actions.Actions.Redimencionar, new Action<bool>(Redimencionar)); + } + + private async void ApoliceView_OnLoaded(object sender, RoutedEventArgs e) + { + while (!ViewModel.Loaded) + { + await Task.Delay(100); + } + AcessarApolice(AcessoApolice); + } + + private void AcessarApolice(AcessoApolice acesso) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0002: Invalid comparison between Unknown and I4 + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Expected O, but got Unknown + //IL_0004: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Invalid comparison between Unknown and I4 + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Expected O, but got Unknown + if ((int)acesso != 2) + { + if ((int)acesso == 3) + { + Renovar_OnClick(this, new RoutedEventArgs()); + Restricao(insert: true); + } + } + else + { + Endossar_OnClick(this, new RoutedEventArgs()); + Restricao(insert: true); + } + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0073: Expected O, but got Unknown + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Expected O, but got Unknown + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Expected O, but got Unknown + //IL_00dc: Unknown result type (might be due to invalid IL or missing references) + //IL_00e6: Expected O, but got Unknown + //IL_00f3: Unknown result type (might be due to invalid IL or missing references) + //IL_00fd: Expected O, but got Unknown + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Expected O, but got Unknown + //IL_0121: Unknown result type (might be due to invalid IL or missing references) + //IL_012b: Expected O, but got Unknown + //IL_0138: Unknown result type (might be due to invalid IL or missing references) + //IL_0142: Expected O, but got Unknown + //IL_014f: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + //IL_0166: Unknown result type (might be due to invalid IL or missing references) + //IL_0170: Expected O, but got Unknown + //IL_017d: Unknown result type (might be due to invalid IL or missing references) + //IL_0187: Expected O, but got Unknown + //IL_0194: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Expected O, but got Unknown + //IL_01ab: Unknown result type (might be due to invalid IL or missing references) + //IL_01b5: Expected O, but got Unknown + //IL_01c2: Unknown result type (might be due to invalid IL or missing references) + //IL_01cc: Expected O, but got Unknown + //IL_01d9: Unknown result type (might be due to invalid IL or missing references) + //IL_01e3: Expected O, but got Unknown + //IL_01f0: Unknown result type (might be due to invalid IL or missing references) + //IL_01fa: Expected O, but got Unknown + //IL_0207: Unknown result type (might be due to invalid IL or missing references) + //IL_0211: Expected O, but got Unknown + //IL_021e: Unknown result type (might be due to invalid IL or missing references) + //IL_0228: Expected O, but got Unknown + //IL_0235: Unknown result type (might be due to invalid IL or missing references) + //IL_023f: Expected O, but got Unknown + //IL_0283: Unknown result type (might be due to invalid IL or missing references) + //IL_028d: Expected O, but got Unknown + //IL_02dc: Unknown result type (might be due to invalid IL or missing references) + //IL_02e2: Invalid comparison between Unknown and I4 + ((Selector)ParcelaGrid).SelectionChanged += new SelectionChangedEventHandler(ParcelaGrid_OnSelectionChanged); + ((UIElement)ApoliceBox).LostFocus += new RoutedEventHandler(ValidacaoDocumento); + ((UIElement)EndossoBox).LostFocus += new RoutedEventHandler(ValidacaoDocumento); + ((Selector)TipoEndossoBox).SelectionChanged += new SelectionChangedEventHandler(TipoEndossoBox_OnSelectionChanged); + ((Selector)TipoRecebimentoBox).SelectionChanged += new SelectionChangedEventHandler(TipoRecebimentoBox_OnSelectionChanged); + ((Selector)SituacaoBox).SelectionChanged += new SelectionChangedEventHandler(SituacaoBox_OnSelectionChanged); + ((UIElement)PremioLiquidoBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)PremioAdicionalBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)IofBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)DiferencaBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + AdicionalBox.Unchecked += new RoutedEventHandler(AdicionalBox_OnChecked); + AdicionalBox.Checked += new RoutedEventHandler(AdicionalBox_OnChecked); + ((UIElement)ParcelasBox).LostFocus += new RoutedEventHandler(AlteracaoParcela_LostFocus); + ((Selector)NegocioCorretoraBox).SelectionChanged += new SelectionChangedEventHandler(NegocioCorretoraBox_OnSelectionChanged); + ((UIElement)ComissaoBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)DataBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)DataBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Selector)VendedorBox).SelectionChanged += new SelectionChangedEventHandler(VendedorBox_OnSelectionChanged); + ((Selector)TipoVendedorBox).SelectionChanged += new SelectionChangedEventHandler(TipoVendedorBox_OnSelectionChanged); + ((UIElement)ValorLiquidoParcelaBox).LostFocus += new RoutedEventHandler(ValorParcelaBox_OnLostFocus); + ((UIElement)ComissaoParcelaBox).LostFocus += new RoutedEventHandler(Recalcula); + ((UIElement)ValorLiquidoParcelaBox).LostFocus += new RoutedEventHandler(Recalcula); + ((UIElement)ValorComissaoParcelaBox).LostFocus += new RoutedEventHandler(Recalcula); + ((UIElement)ValorRealizadoParcelaBox).LostFocus += new RoutedEventHandler(Recalcula); + ((UIElement)ValorParcelaBox).LostFocus += new RoutedEventHandler(Recalcula); + bool flag = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5); + ((UIElement)ValorDescontoField).Visibility = (Visibility)((!flag) ? 2 : 0); + ((FrameworkElement)this).SizeChanged += new SizeChangedEventHandler(ApoliceControl_SizeChanged); + if (ViewModel.SelectedDocumento != null) + { + AutoCompleteBox autoCompleteBanco = AutoCompleteBanco; + Banco banco = ViewModel.SelectedDocumento.Banco; + autoCompleteBanco.Text = ((banco != null) ? banco.Nome : null); + ViewModel.IsFatura = (int)ViewModel.SelectedDocumento.TipoRecebimento.GetValueOrDefault((TipoRecebimento)1) == 2; + Parcelas(!ViewModel.IsFatura); + } + } + + private async void ExcluirVendedor_Click(object sender, RoutedEventArgs e) + { + ((ButtonBase)(Button)sender).Click -= new RoutedEventHandler(ExcluirVendedor_Click); + Button val = (Button)sender; + if (val == null || ((FrameworkElement)val).DataContext == null) + { + return; + } + VendedorParcela pagamento = (VendedorParcela)((FrameworkElement)val).DataContext; + int num; + if (pagamento == null) + { + num = 0; + } + else + { + Repasse repasse = pagamento.Repasse; + num = (((int)((repasse != null) ? repasse.Tipo : null).GetValueOrDefault() == 3) ? 1 : 0); + } + bool deleteCoCorretagem = (byte)num != 0; + if (!((UIElement)AlterarApoliceButton).IsEnabled && ((UIElement)SalvarApoliceButton).IsEnabled) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL EXCLUIR VENDEDOR DURANTE ALTERAÇÃO DE DOCUMENTO."); + return; + } + if (pagamento != null && !pagamento.DataPagamento.HasValue) + { + if (!ViewModel._excluirPermissEnabled) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA EXCLUIR VENDEDORES. ENTRE EM CONTATO COM O ADMINISTRADOR DO SISTEMA."); + return; + } + if (pagamento.CoCorretagem) + { + IEnumerable<VendedorParcela> enumerable = ViewModel.Pagamentos.Where(delegate(VendedorParcela pgt) + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Invalid comparison between Unknown and I4 + Repasse repasse2 = pgt.Repasse; + return (repasse2 == null || (int)repasse2.Tipo.GetValueOrDefault() != 3) && !pgt.Vendedor.Corretora; + }); + if (enumerable != null && enumerable.Count() >= 1) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL EXCLUIR O VENDEDOR CO-CORRETAGEM. HÁ VENDEDORES CADASTRADOS NO DOCUMENTO"); + return; + } + } + await ViewModel.ExcluirVendedor(pagamento); + } + else if ((await ViewModel.ShowSenha($"DESEJA REALMENTE EXCLUIR O PAGAMENTO DO VENDEDOR {pagamento.Vendedor.Nome} {pagamento.DataPagamento:d}?\nESSE PROCEDIMENTO É IRREVERSÍVEL.")).GetValueOrDefault()) + { + await ViewModel.ExcluirPagamento(pagamento); + } + ((TextBoxBase)ComissaoBox).IsReadOnly = ViewModel.VerificaCoCorretagem(); + ViewModel.ComissOriginalVisibility = (Visibility)((!((TextBoxBase)ComissaoBox).IsReadOnly) ? 2 : 0); + if (deleteCoCorretagem) + { + await ViewModel.AjusteComissãoCoCorretagem(removido: true); + } + ((ButtonBase)(Button)sender).Click += new RoutedEventHandler(ExcluirVendedor_Click); + } + + private async void BaixarParcelas_Click(object sender, RoutedEventArgs e) + { + ((UIElement)ParcelaGrid).IsEnabled = false; + ((MenuItem)sender).Click -= new RoutedEventHandler(BaixarParcelas_Click); + ViewModel.QuantidadeFaturas = 1; + if (await ViewModel.SelecionarParcelaBaixa()) + { + ToggleBotoesParcela(habilitar: true); + ViewModel.BaixarParcelas = true; + await ViewModel.CarregarImposto(); + EditarParcelaTipo = 2; + BaixarParcelas(); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarParcelas_Click); + ViewModel.AllowEditVendedor = false; + } + } + + private async Task SalvarParcela() + { + bool flag = EditarParcelaTipo == 3 && ViewModel.QuantidadeFaturas > 1; + if (flag) + { + flag = !(await ViewModel.ShowMessage($"O SISTEMA IRÁ INCLUIR/REPLICAR A FATURA {ViewModel.QuantidadeFaturas} VEZES. DESEJA PROSSEGUIR?", "SIM", "NÃO")); + } + if (flag) + { + return; + } + List<KeyValuePair<string, string>> list = await ViewModel.SalvarParcelas(EditarParcelaTipo); + ((DependencyObject)(object)this).ValidateFields(list); + if (list != null && list.Count != 0) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return; + } + EditarVendedor(editar: false); + ((UIElement)SalvarParcelaButton).Visibility = (Visibility)2; + ViewModel.EditandoParcela = false; + ((UIElement)BaixarParcelaButton).Visibility = (Visibility)0; + ViewModel.BaixarParcelas = false; + EditarParcelaTipo = 0; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ToggleBotoesParcela(habilitar: false); + if (ViewModel.UltimaFatura) + { + ViewModel.UltimaFatura = false; + ToggleBotoesParcela(habilitar: true); + EditarParcelaTipo = 3; + ReplicarFatura(); + ViewModel.QuantidadeFaturas = 0; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + EditandoParcela(!ViewModel.UltimaFatura); + } + } + + private async void SalvarParcela_Click(object sender, RoutedEventArgs e) + { + ((MenuItem)((ItemsControl)SalvarParcelaButton).Items[0]).Click -= new RoutedEventHandler(SalvarParcela_Click); + LostFocusValorRealizado(); + ViewModel.Loading(isLoading: true); + if (!ViewModel.CriandoParcelaEspecial) + { + await SalvarParcela(); + } + ViewModel.Loading(isLoading: false); + ((UIElement)SalvarParcelaButton).IsEnabled = true; + ((MenuItem)((ItemsControl)SalvarParcelaButton).Items[0]).Click += new RoutedEventHandler(SalvarParcela_Click); + } + + private void AlterarParcela_Click(object sender, RoutedEventArgs e) + { + ViewModel.QuantidadeFaturas = 1; + if (ViewModel.Parcelas.Count != 0) + { + ToggleBotoesParcela(habilitar: true); + EditarParcelaTipo = 1; + ViewModel.SelecionaPrimeiraParcela(); + AlterarParcela(); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.AllowEditVendedor = ViewModel.IsFatura; + } + } + + private void AlterarParcela() + { + ((UIElement)FaturaField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)QuantidadeFaturaField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)VigenciaInicialField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)VigenciaFinalField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)ValorLiquidoField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)PercentualComissaoField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)ComissaoIcon).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)EmissaoField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)RecebimentoField).Visibility = (Visibility)2; + ((UIElement)QuitacaoField).Visibility = (Visibility)0; + ((UIElement)DataControleParcelaField).Visibility = (Visibility)0; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)2; + ((UIElement)CreditoField).Visibility = (Visibility)2; + ((UIElement)ValorComissaoField).Visibility = (Visibility)2; + ((UIElement)VencimentoField).Visibility = (Visibility)0; + ((UIElement)ValorField).Visibility = (Visibility)0; + ((UIElement)TipoParcelaField).Visibility = (Visibility)2; + ((UIElement)VencimentoField).Visibility = (Visibility)0; + ((UIElement)ValorField).Visibility = (Visibility)0; + ((UIElement)EditarParcelasFields).Visibility = (Visibility)0; + ValidarParcela(); + } + + private void BaixarParcelas() + { + ((UIElement)FaturaField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)VigenciaInicialField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)VigenciaFinalField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)PercentualComissaoField).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)ComissaoIcon).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((UIElement)QuantidadeFaturaField).Visibility = (Visibility)2; + ((UIElement)QuitacaoField).Visibility = (Visibility)2; + ((UIElement)DataControleParcelaField).Visibility = (Visibility)2; + ((UIElement)EmissaoField).Visibility = (Visibility)2; + ((UIElement)ValorLiquidoField).Visibility = (Visibility)0; + ((UIElement)VencimentoField).Visibility = (Visibility)2; + ((UIElement)ValorField).Visibility = (Visibility)2; + ((UIElement)TipoParcelaField).Visibility = (Visibility)2; + ((UIElement)RecebimentoField).Visibility = (Visibility)0; + ((UIElement)CreditoField).Visibility = (Visibility)0; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)0; + ((UIElement)ValorComissaoField).Visibility = (Visibility)0; + ((UIElement)EditarParcelasFields).Visibility = (Visibility)0; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5)) + { + ((UIElement)ImpostosField).Visibility = (Visibility)0; + } + ((UIElement)ParcelaGrid).IsEnabled = false; + ValidarParcela(); + ((UIElement)RecebimentoParcelaBox).Focus(); + } + + private async void ExcluirParcela_Click(object sender, RoutedEventArgs e) + { + if (await ViewModel.PagamentoVendedor(ViewModel.SelectedParcela)) + { + bool? flag = await ViewModel.ShowSenha("HÁ PAGAMENTOS DE VENDEDORES REALIZADOS PARA ESSA PARCELA. DESEJA PROSSEGUIR COM A EXCLUSÃO?"); + if (!flag.HasValue) + { + return; + } + if (!flag.GetValueOrDefault()) + { + await ViewModel.ShowMessage("SENHA INVÁLIDA"); + return; + } + } + if (!ViewModel.SelectedParcela.DataRecebimento.HasValue) + { + await ViewModel.ExcluirParcela(); + } + else + { + await ViewModel.ExcluirBaixa(); + } + EditandoParcela(enable: true); + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Expected O, but got Unknown + Tarefa tarefa = new Tarefa + { + IdCliente = ((DomainBase)ViewModel.SelectedDocumento.Controle.Cliente).Id, + Cliente = ViewModel.SelectedDocumento.Controle.Cliente.Nome, + Entidade = (TipoTarefa)0, + IdEntidade = ((DomainBase)ViewModel.SelectedDocumento).Id, + Titulo = ViewModel.SelectedDocumento.Controle.Cliente.Nome + " APÓLICE " + ViewModel.SelectedDocumento.Apolice + }; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa), 0, close: false); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + FiltroArquivoDigital filtro = null; + string text = ""; + Button val = (Button)((sender is Button) ? sender : null); + if (val == null) + { + MenuItem val2 = (MenuItem)((sender is MenuItem) ? sender : null); + if (val2 != null) + { + text = ((FrameworkElement)val2).Name; + } + } + else + { + text = ((FrameworkElement)val).Name; + } + if (!(text == "ArquivoDigitalButton")) + { + if (text == "Parcela") + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)3).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)3) + "."); + return; + } + filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedParcela).Id, + IdApolice = ((DomainBase)ViewModel.SelectedParcela.Documento).Id, + Tipo = (TipoArquivoDigital)3, + Parente = ViewModel.SelectedParcela + }; + } + } + else + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)2) + "."); + return; + } + filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedDocumento).Id, + Tipo = (TipoArquivoDigital)2, + Parente = ViewModel.SelectedDocumento + }; + } + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private async void ExcluirDocumento_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.ExcluirApolice(); + } + + private async void RecusarDocumento_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)18)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA RECUSAR. PROCURE O ADMINSTRADOR DO SISTEMA."); + } + else + { + await ViewModel.RecusarApolice(); + } + } + + private async void Renovar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)17)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA RENOVAR. PROCURE O ADMINSTRADOR DO SISTEMA."); + return; + } + if (!ViewModel.EnableRenovar) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL RENOVAR UM DOCUMENTO SEM EMISSÃO OU SEM FINAL DE VIGÊNCIA."); + } + if (await ViewModel.IncluirApolice(renovar: true)) + { + ViewModel.BotoesParcelaEnabled = false; + ViewModel.AllowEditEmissao = true; + Restricao(insert: true); + } + } + + private async void Endossar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)33)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ENDOSSAR. PROCURE O ADMINSTRADOR DO SISTEMA."); + } + else if (!ViewModel.EnableEndossar) + { + List<KeyValuePair<string, string>> pairs = ViewModel.SelectedDocumento.ValidateEndossar(); + await ViewModel.ShowMessage(pairs, ViewModel.ErroCamposInvalidos, "OK"); + } + else if (await ViewModel.IncluirEndosso()) + { + ViewModel.BotoesParcelaEnabled = false; + Endossar(); + Restricao(insert: true); + } + } + + private async void CancelarApolice_OnClick(object sender, RoutedEventArgs e) + { + CancelarAlteracao(); + await ViewModel.CancelarAlteracao(); + AlterandoDocumento(alterando: false); + EditandoVendedor(enable: false); + Restricao(); + } + + private void CancelarAlteracao() + { + SetValid(AutoCompleteBanco, valid: true); + AutoCompleteBanco.Text = string.Empty; + ViewModel.BotoesParcelaEnabled = true; + ViewModel.AlteracaoEnabled = true; + EditarVendedor(editar: false); + ValidarDocumento(); + } + + private static void SetValid(AutoCompleteBox autocomplete, bool valid) + { + ViewHelper.SetInvalid((Control)(object)autocomplete, "BANCO INVÁLIDO", valid); + } + + private async void SalvarApolice_OnClick(object sender, RoutedEventArgs e) + { + SalvarApoliceButton.Click -= new RoutedEventHandler(SalvarApolice_OnClick); + if (ViewModel.CompararValores()) + { + PremioTotalBox.Number = PremioLiquidoBox.Number + PremioAdicionalBox.Number + IofBox.Number + DiferencaBox.Number; + } + ExecutarValidacaoDataApolice(); + if (!(await SalvarDocumento())) + { + SalvarApoliceButton.Click += new RoutedEventHandler(SalvarApolice_OnClick); + return; + } + try + { + await ViewModel.CreateLinkAssistencia(ViewModel.SelectedDocumento, null, retorno: false); + } + catch (Exception) + { + } + AlterandoDocumento(alterando: false); + EditandoVendedor(enable: false); + ViewModel.BotoesParcelaEnabled = true; + Restricao(); + SalvarApoliceButton.Click += new RoutedEventHandler(SalvarApolice_OnClick); + } + + public void AlterandoDocumento(bool alterando) + { + PermissaoUsuario val = ViewModel.ServicoPermissUsuario.BuscarPermissao(Recursos.Usuario, (TipoTela)2); + ((UIElement)EditarVendedorButton).IsEnabled = (val == null || val.Incluir) && !alterando; + } + + private void ExecutarValidacaoDataApolice() + { + ViewModel.SelectedDocumento.Vigencia2 = (DateTime.TryParse(ValidationHelper.FormatDate(Vigencia2Box.Text), out var result) ? new DateTime?(result) : null); + ViewModel.SelectedDocumento.Remessa = (DateTime.TryParse(ValidationHelper.FormatDate(TransmissaoBox.Text), out result) ? new DateTime?(result) : null); + ViewModel.SelectedDocumento.Emissao = (DateTime.TryParse(ValidationHelper.FormatDate(EmissaoBox.Text), out result) ? new DateTime?(result) : null); + ViewModel.SelectedDocumento.DataControle = (DateTime.TryParse(ValidationHelper.FormatDate(DataBox.Text), out result) ? new DateTime?(result) : null); + } + + private async Task<bool> SalvarDocumento() + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + EditarVendedor(editar: false); + SetValid(AutoCompleteBanco, valid: true); + return true; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return false; + } + + private async void IncluirApolice_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.IncluirApolice(); + ViewModel.BotoesParcelaEnabled = false; + ViewModel.AllowEditEmissao = true; + ValidarDocumento(); + Restricao(insert: true); + ValidarTela(); + ((UIElement)IncluirpoliceButton).IsEnabled = false; + ((UIElement)AlterarApoliceButton).IsEnabled = false; + ((UIElement)ExcluirpoliceButton).IsEnabled = false; + AlterandoDocumento(alterando: true); + } + + private async void SalvarVendedor_Click(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + bool num = ViewModel.SelectedParcela == null || ((int)ViewModel.SelectedParcela.SubTipo == 1 && (int)ViewModel.SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1); + if (Recursos.Configuracoes.Any((ConfiguracaoSistema config) => (int)config.Configuracao == 56)) + { + ToggleButton coCorretagemToogle = CoCorretagemToogle; + if (coCorretagemToogle != null && coCorretagemToogle.IsChecked.GetValueOrDefault()) + { + VendedorParcela selectedPagamento = ViewModel.SelectedPagamento; + ToggleButton coCorretagemToogle2 = CoCorretagemToogle; + selectedPagamento.CoCorretagem = ((coCorretagemToogle2 != null) ? coCorretagemToogle2.IsChecked : null).GetValueOrDefault(true); + } + } + List<KeyValuePair<string, string>> list = ((!num) ? (await ViewModel.AdicionarVendedorParcelaEspecial()) : (await ViewModel.AdicionarVendedor())); + List<KeyValuePair<string, string>> list2 = list; + bool flag = list2 == null || list2.Count == 0; + ViewModel.Loading(isLoading: false); + if (flag) + { + EditarVendedor(editar: false); + EditandoVendedor(enable: false); + if (ViewModel.VerificaCoCorretagem()) + { + ((TextBoxBase)ComissaoBox).IsReadOnly = true; + ViewModel.ComissOriginalVisibility = (Visibility)0; + } + ViewModel.AllowEditParcela = flag; + } + else + { + ViewModel.AllowEditParcela = flag; + await ViewModel.ShowMessage(list2, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void CancelarVendedor_Click(object sender, RoutedEventArgs e) + { + EditarVendedor(editar: false); + ViewModel.SelectedPagamento = null; + ViewModel.AllowEditParcela = true; + EditandoVendedor(enable: false); + } + + private void EditarVendedor(bool editar) + { + //IL_015f: Unknown result type (might be due to invalid IL or missing references) + //IL_0165: Invalid comparison between Unknown and I4 + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Invalid comparison between Unknown and I4 + //IL_013f: Unknown result type (might be due to invalid IL or missing references) + //IL_0145: Invalid comparison between Unknown and I4 + ((UIElement)SalvarVendedorButton).Visibility = (Visibility)((!editar) ? 2 : 0); + ((UIElement)CancelarVendedorButton).Visibility = (Visibility)((!editar) ? 2 : 0); + ((UIElement)EditarVendedorButton).Visibility = (Visibility)(editar ? 2 : 0); + ((UIElement)EditarVendedorFields).Visibility = (Visibility)((!editar) ? 2 : 0); + ((UIElement)VendedorGrid).IsEnabled = !editar; + if (editar && Recursos.Configuracoes.Any((ConfiguracaoSistema config) => (int)config.Configuracao == 56)) + { + bool isEnabled = ViewModel.Pagamentos.Count == 1 && ViewModel.Pagamentos.Any((VendedorParcela vendedor) => vendedor.Repasse == null) && !IsFatura(); + ((UIElement)CoCorretagemToogle).IsEnabled = isEnabled; + } + bool flag = (ViewModel.SelectedDocumento.NegocioCorretora.HasValue ? ((int)ViewModel.SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1) : ((int)ViewModel.SelectedDocumento.Situacao == 2 && ViewModel.SelectedDocumento.Negocio.HasValue && (int)ViewModel.SelectedDocumento.Negocio.GetValueOrDefault() == 1)); + ((UIElement)ComissaoNovoBox).Visibility = (Visibility)((!editar || flag) ? 2 : 0); + ((UIElement)ComissaoRenovacaoBox).Visibility = (Visibility)((!(editar && flag)) ? 2 : 0); + CoCorretagemToogle.IsChecked = false; + } + + private async void IncluirVendedor_Click(object sender, RoutedEventArgs e) + { + ViewModel.AllowEditParcela = false; + List<KeyValuePair<string, string>> list = ViewModel.HabilitarVendedor(EditarParcelaTipo); + if (list != null && list.Count != 0) + { + ((DependencyObject)(object)this).ValidateFields(list); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return; + } + ViewModel.IncluirVendedor(); + EditarVendedor(editar: true); + ValidarVendedor(); + EditandoVendedor(enable: true); + ViewModel.VendedorCoCorretagem(); + } + + public void EditandoVendedor(bool enable) + { + PermissaoUsuario val = ViewModel.ServicoPermissUsuario.BuscarPermissao(Recursos.Usuario, (TipoTela)2); + ((UIElement)IncluirpoliceButton).IsEnabled = (val == null || val.Incluir) && !enable; + ((UIElement)AlterarApoliceButton).IsEnabled = (val == null || val.Alterar) && !enable; + ((UIElement)ExcluirpoliceButton).IsEnabled = (val == null || val.Excluir) && !enable; + } + + public void EditandoParcela(bool enable) + { + PermissaoUsuario val = ViewModel.ServicoPermissUsuario.BuscarPermissao(Recursos.Usuario, (TipoTela)2); + ViewModel.AllowEditVendedor = (val == null || val.Incluir) && !enable; + } + + private void TipoVendedorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + if (ViewModel.SelectedPagamento == null) + { + ViewModel.SelectedPagamento = new VendedorParcela(); + } + ViewModel.SelectedPagamento.TipoVendedor = (TipoVendedor)((Selector)val).SelectedItem; + } + } + + private void TipoRecebimentoBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + ViewModel.IsFatura = (int)(TipoRecebimento)((Selector)val).SelectedItem == 2; + Parcelas(!ViewModel.IsFatura); + if (ViewModel.EnableFields) + { + ((Selector)FormaPagamentoBox).SelectedItem = (ViewModel.IsFatura ? new FormaPagamento?((FormaPagamento)5) : ViewModel.SelectedDocumento.FormaPagamento); + } + } + } + + private void Parcelas(bool premios) + { + ViewModel.AllowEditVendedor = ((DomainBase)ViewModel.SelectedDocumento).Id == 0; + ((UIElement)PremiosBox).Visibility = (Visibility)((!premios) ? 2 : 0); + ((DataGridColumn)FaturaColumn).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((DataGridColumn)VigenciaInicialColumn).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ((DataGridColumn)VigenciaFinalColumn).Visibility = (Visibility)((!ViewModel.IsFatura) ? 2 : 0); + ValidarDocumento(); + if (!premios) + { + ParcelasBox.Number = 0m; + ComissaoBox.Number = 0m; + PremioLiquidoBox.Number = 0m; + PremioTotalBox.Number = 0m; + IofBox.Number = 0m; + DiferencaBox.Number = 0m; + PremioAdicionalBox.Number = 0m; + ((Selector)FormaPagamentoBox).SelectedItem = (object)(FormaPagamento)4; + Vigencia2Box.SelectedDate = ((((DomainBase)ViewModel.SelectedDocumento).Id == 0L && ViewModel.SelectedDocumento.Tipo == 0) ? null : Vigencia2Box.SelectedDate); + ViewModel.AllowEditVendedor = ((DomainBase)ViewModel.SelectedDocumento).Id != 0; + } + } + + private async void ParcelaGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + await ViewModel.SelecionaParcela((Parcela)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void SituacaoBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + TipoSeguro situacao = (TipoSeguro)((Selector)val).SelectedItem; + ViewModel.ToggleSeguradoraAnterior(situacao); + } + } + + private void Recalcula(object sender, RoutedEventArgs e) + { + ViewModel.RecalculaRepasse(); + } + + private void AlteracaoParcela_LostFocus(object sender, RoutedEventArgs e) + { + ValidarDocumento(); + } + + private void AlteracaoDePremio_LostFocus(object sender, RoutedEventArgs e) + { + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + if (!ViewModel.AllowEditApolice || ViewModel.SelectedDocumento == null) + { + return; + } + CurrencyTextBox val = (CurrencyTextBox)sender; + if (val == null) + { + return; + } + string name = ((FrameworkElement)val).Name; + if ((name == "PremioLiquidoBox" || name == "PremioAdicionalBox") && IofBox.Number == 0m) + { + decimal num = PremioLiquidoBox.Number + PremioAdicionalBox.Number; + Ramo ramo = ViewModel.SelectedDocumento.Controle.Ramo; + decimal num2 = num * ((ramo != null) ? ramo.Iof : 0m); + IofBox.Number = num2; + CurrencyTextBox premioTotalBox = PremioTotalBox; + premioTotalBox.Number += num2; + } + PremioTotalBox.Number = PremioLiquidoBox.Number + PremioAdicionalBox.Number + IofBox.Number + DiferencaBox.Number; + switch (((FrameworkElement)val).Name) + { + case "PremioLiquidoBox": + case "PremioAdicionalBox": + case "ComissaoBox": + if (ViewModel.HabilitarVendedor().Count == 0) + { + ViewModel.RecalculaRepasses(); + } + break; + } + ValidarDocumento(); + } + + private void CancelarParcela_Click(object sender, RoutedEventArgs e) + { + ToggleBotoesParcela(habilitar: false); + ViewModel.BaixarParcelas = false; + ViewModel.CancelPagamento(); + ValidarDocumento(); + EditarVendedor(editar: false); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + EditandoParcela(enable: false); + } + + private bool IsFatura() + { + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Invalid comparison between Unknown and I4 + return (int)ViewModel.SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 2; + } + + private void Vigencia_DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Expected O, but got Unknown + DatePicker_OnLostKeyboardFocus(sender, e); + DatePicker val = (DatePicker)sender; + if (!string.IsNullOrEmpty(val.Text) && DateTime.TryParse(ValidationHelper.FormatDate(val.Text), out var result)) + { + VigenciaFinalParcelaBox.SelectedDate = result.AddMonths(1); + EmissaoParcelaBox.SelectedDate = result; + } + } + + private void Vencimento_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Expected O, but got Unknown + DatePicker_OnLostKeyboardFocus(sender, e); + DatePicker val = (DatePicker)sender; + if (!string.IsNullOrEmpty(val.Text) && DateTime.TryParse(ValidationHelper.FormatDate(val.Text), out var result)) + { + CreditoParcelaBox.SelectedDate = result; + } + } + + private void ToggleBotoesParcela(bool habilitar) + { + ((UIElement)SalvarParcelaButton).Visibility = (Visibility)((!habilitar) ? 2 : 0); + ViewModel.EditandoParcela = habilitar; + ((UIElement)BaixarParcelaButton).Visibility = (Visibility)(habilitar ? 2 : 0); + ((UIElement)MenuApolice).IsEnabled = !habilitar; + ViewModel.IsEnabled = !habilitar; + ((UIElement)PremiosBox).IsEnabled = !habilitar; + ((UIElement)DataControleParcelaField).Visibility = (Visibility)2; + if (!habilitar) + { + ((UIElement)QuantidadeFaturaField).Visibility = (Visibility)2; + ((UIElement)TipoParcelaField).Visibility = (Visibility)2; + ((UIElement)VencimentoField).Visibility = (Visibility)2; + ((UIElement)ValorField).Visibility = (Visibility)2; + ((UIElement)RecebimentoField).Visibility = (Visibility)2; + ((UIElement)QuitacaoField).Visibility = (Visibility)2; + ((UIElement)CreditoField).Visibility = (Visibility)2; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)2; + ((UIElement)ValorComissaoField).Visibility = (Visibility)2; + ((UIElement)PercentualComissaoField).Visibility = (Visibility)2; + ((UIElement)ComissaoIcon).Visibility = (Visibility)2; + ((UIElement)EmissaoField).Visibility = (Visibility)2; + ((UIElement)ValorLiquidoField).Visibility = (Visibility)2; + ((UIElement)FaturaField).Visibility = (Visibility)2; + ((UIElement)VigenciaInicialField).Visibility = (Visibility)2; + ((UIElement)VigenciaFinalField).Visibility = (Visibility)2; + ((UIElement)EditarParcelasFields).Visibility = (Visibility)2; + ((UIElement)ImpostosField).Visibility = (Visibility)2; + ((UIElement)ParcelaGrid).IsEnabled = true; + } + } + + private async void IncluirNovaFatura_Click(object sender, RoutedEventArgs e) + { + ViewModel.QuantidadeFaturas = 1; + bool flag = IsFatura(); + if (flag && ViewModel.SelectedDocumento.Ordem > 0) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL ADICIONAR FATURAS AO ENDOSSO, TODAS AS FATURAS DEVEM SER ADICIONADAS SOBRE A APÓLICE."); + return; + } + ToggleBotoesParcela(habilitar: true); + EditarParcelaTipo = 3; + ViewModel.QuantidadeFaturas = 1; + NovaFatura(); + ViewModel.AllowEditVendedor = flag; + ViewModel.BaixarParcelas = true; + ViewModel.VisibilityAlterarVencimento = (Visibility)0; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + } + + private void IncluirParcelaEspecial_Click(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0087: Expected O, but got Unknown + ((MenuItem)sender).Click -= new RoutedEventHandler(IncluirParcelaEspecial_Click); + ViewModel.QuantidadeFaturas = 1; + ToggleBotoesParcela(habilitar: true); + EditarParcelaTipo = 4; + NovaParcelaEspecial(); + ViewModel.EditarParcelaEspecial(); + ViewModel.BaixarParcelas = true; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ((MenuItem)sender).Click += new RoutedEventHandler(IncluirParcelaEspecial_Click); + EditandoParcela(enable: true); + } + + private void NovaParcelaEspecial() + { + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Invalid comparison between Unknown and I4 + ((UIElement)FaturaField).Visibility = (Visibility)2; + ((UIElement)VigenciaInicialField).Visibility = (Visibility)2; + ((UIElement)VigenciaFinalField).Visibility = (Visibility)2; + ((UIElement)EmissaoField).Visibility = (Visibility)2; + ((UIElement)ValorLiquidoField).Visibility = (Visibility)2; + ((UIElement)QuantidadeFaturaField).Visibility = (Visibility)(((int)ViewModel.SelectedDocumento.TipoRecebimento.GetValueOrDefault() != 2) ? 2 : 0); + ((UIElement)TipoParcelaField).Visibility = (Visibility)0; + ((UIElement)VencimentoField).Visibility = (Visibility)0; + ((UIElement)ValorField).Visibility = (Visibility)0; + ((UIElement)RecebimentoField).Visibility = (Visibility)0; + ((UIElement)QuitacaoField).Visibility = (Visibility)0; + ((UIElement)CreditoField).Visibility = (Visibility)0; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)0; + ((UIElement)ValorComissaoField).Visibility = (Visibility)0; + ((UIElement)PercentualComissaoField).Visibility = (Visibility)0; + ((UIElement)ComissaoIcon).Visibility = (Visibility)0; + ((UIElement)EditarParcelasFields).Visibility = (Visibility)0; + ((UIElement)ParcelaGrid).IsEnabled = false; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5)) + { + ((UIElement)ImpostosField).Visibility = (Visibility)0; + } + ViewModel.IncluirParcelaEspecial(); + ValidarParcela(); + ((UIElement)ValorParcelaBox).Focus(); + } + + private void NovaFatura() + { + ((UIElement)VigenciaInicialField).Visibility = (Visibility)0; + ((UIElement)VigenciaFinalField).Visibility = (Visibility)0; + ((UIElement)EmissaoField).Visibility = (Visibility)0; + ((UIElement)ValorLiquidoField).Visibility = (Visibility)0; + ((UIElement)QuantidadeFaturaField).Visibility = (Visibility)0; + ((UIElement)RecebimentoField).Visibility = (Visibility)0; + ((UIElement)QuitacaoField).Visibility = (Visibility)0; + ((UIElement)DataControleParcelaField).Visibility = (Visibility)0; + ((UIElement)CreditoField).Visibility = (Visibility)0; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)0; + ((UIElement)ValorComissaoField).Visibility = (Visibility)0; + ((UIElement)VencimentoField).Visibility = (Visibility)0; + ((UIElement)ValorField).Visibility = (Visibility)0; + ((UIElement)TipoParcelaField).Visibility = (Visibility)2; + ((UIElement)PercentualComissaoField).Visibility = (Visibility)0; + ((UIElement)ComissaoIcon).Visibility = (Visibility)0; + ((UIElement)FaturaField).Visibility = (Visibility)0; + ((UIElement)EditarParcelasFields).Visibility = (Visibility)0; + ((UIElement)ParcelaGrid).IsEnabled = false; + if (ViewModel.Restricao((TipoRestricao)15)) + { + ((UIElement)RecebimentoField).Visibility = (Visibility)2; + ((UIElement)QuitacaoField).Visibility = (Visibility)2; + ((UIElement)CreditoField).Visibility = (Visibility)2; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)2; + ((UIElement)ValorComissaoField).Visibility = (Visibility)2; + } + ViewModel.IncluirFatura(); + ValidarParcela(); + ((UIElement)QuantidadeFaturaBox).Focus(); + EditandoParcela(enable: true); + } + + private void ReplicarFatura() + { + ((UIElement)VigenciaInicialField).Visibility = (Visibility)0; + ((UIElement)VigenciaFinalField).Visibility = (Visibility)0; + ((UIElement)EmissaoField).Visibility = (Visibility)0; + ((UIElement)ValorLiquidoField).Visibility = (Visibility)0; + ((UIElement)QuantidadeFaturaField).Visibility = (Visibility)0; + ((UIElement)RecebimentoField).Visibility = (Visibility)0; + ((UIElement)QuitacaoField).Visibility = (Visibility)0; + ((UIElement)DataControleParcelaField).Visibility = (Visibility)0; + ((UIElement)CreditoField).Visibility = (Visibility)0; + ((UIElement)ValorRealizadoField).Visibility = (Visibility)0; + ((UIElement)ValorComissaoField).Visibility = (Visibility)0; + ((UIElement)VencimentoField).Visibility = (Visibility)0; + ((UIElement)ValorField).Visibility = (Visibility)0; + ((UIElement)TipoParcelaField).Visibility = (Visibility)2; + ((UIElement)PercentualComissaoField).Visibility = (Visibility)0; + ((UIElement)ComissaoIcon).Visibility = (Visibility)0; + ((UIElement)FaturaField).Visibility = (Visibility)0; + if (!ViewModel.Restricao((TipoRestricao)15)) + { + ViewModel.BaixarParcelas = true; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5)) + { + ((UIElement)ImpostosField).Visibility = (Visibility)0; + } + } + if (((IEnumerable<Parcela>)ViewModel.Parcelas.OrderBy((Parcela x) => x.NumeroParcela)).LastOrDefault((Func<Parcela, bool>)((Parcela x) => (int)x.SubTipo == 1)).NumeroParcela != 999) + { + ((UIElement)EditarParcelasFields).Visibility = (Visibility)0; + ((UIElement)ParcelaGrid).IsEnabled = false; + } + ViewModel.ReplicarFatura(); + ValidarParcela(); + ((UIElement)QuantidadeFaturaBox).Focus(); + } + + private void AutoCompleteBancoBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarBanco(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Banco>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void Endossar() + { + ViewModel.AlteracaoEnabled = false; + ViewModel.Situacao.Add((TipoSeguro)3); + ValidarDocumento(); + } + + private void TipoEndossoBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Expected O, but got Unknown + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Invalid comparison between Unknown and I4 + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Invalid comparison between Unknown and I4 + if (ViewModel.SelectedDocumento != null && ViewModel.SelectedDocumento.Tipo == 0) + { + return; + } + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem == null) + { + return; + } + bool premios = !ViewModel.IsFatura && (int)(TipoEndosso)((Selector)val).SelectedItem != 1; + if (ViewModel.EnableFields) + { + if ((int)(TipoEndosso)((Selector)val).SelectedItem == 0 || (int)(TipoEndosso)((Selector)val).SelectedItem == 4) + { + if (ViewModel.SelectedDocumento != null) + { + Documento selectedDocumento = ViewModel.SelectedDocumento; + Documento cancelDocumento = ViewModel.CancelDocumento; + selectedDocumento.Comissao = ((cancelDocumento != null) ? cancelDocumento.Comissao : 0m); + } + } + else if (ViewModel.SelectedDocumento != null) + { + ViewModel.SelectedDocumento.Comissao = 0m; + } + ViewModel.OnPropertyChanged("SelectedDocumento"); + } + Parcelas(premios); + } + + private void VendedorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + ViewModel.FiltrarRepasse((Vendedor)((Selector)val).SelectedItem); + if (ViewModel.CoCorretagem) + { + ((UIElement)ComissaoNovoBox).Visibility = (Visibility)0; + ((UIElement)ComissaoRenovacaoBox).Visibility = (Visibility)2; + } + } + } + + private void ComissaoVendedorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Invalid comparison between Unknown and I4 + //IL_00f2: Unknown result type (might be due to invalid IL or missing references) + //IL_00f8: Invalid comparison between Unknown and I4 + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Invalid comparison between Unknown and I4 + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Invalid comparison between Unknown and I4 + //IL_0145: Unknown result type (might be due to invalid IL or missing references) + //IL_014a: Unknown result type (might be due to invalid IL or missing references) + //IL_0156: Expected O, but got Unknown + //IL_01a0: Unknown result type (might be due to invalid IL or missing references) + //IL_01a6: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem == null) + { + return; + } + Repasse val2 = (Repasse)((Selector)val).SelectedItem; + if (val2 != null && (int)val2.Tipo.GetValueOrDefault() == 3) + { + ViewModel.SelectedPagamento.ValorRepasse = 0.00m; + ValorRepasseBox.Number = ViewModel.SelectedPagamento.ValorRepasse.Value; + return; + } + bool flag = (ViewModel.SelectedDocumento.NegocioCorretora.HasValue ? ((int)ViewModel.SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1) : ((int)ViewModel.SelectedDocumento.Situacao == 2 && ViewModel.SelectedDocumento.Negocio.HasValue && (int)ViewModel.SelectedDocumento.Negocio.GetValueOrDefault() == 1)); + ViewModel.SelectedPagamento.Repasse = val2; + ViewModel.SelectedPagamento.PorcentagemRepasse = (flag ? val2.ValorRenovacao : val2.ValorNovo); + if (ViewModel.SelectedParcela == null) + { + ViewModel.SelectedParcela = new Parcela + { + SubTipo = (SubTipo)1 + }; + } + ViewModel.SelectedParcela.Documento = ViewModel.SelectedDocumento; + ViewModel.SelectedPagamento.ValorRepasse = Funcoes.CalculaRepasse(val2, ViewModel.SelectedParcela, ViewModel.SelectedParcela == null || (int)ViewModel.SelectedParcela.SubTipo == 1); + ViewModel.SelectedPagamento.ValorTotal = ViewModel.SelectedPagamento.ValorRepasse; + ValorRepasseBox.Number = ViewModel.SelectedPagamento.ValorRepasse.Value; + FormaRecebidaBox.Text = ValidationHelper.GetDescription((Enum)(object)val2.Forma); + FormaIncidenciaBox.Text = ValidationHelper.GetDescription((Enum)(object)val2.Incidencia); + } + + private void ValidacaoDocumento(object sender, RoutedEventArgs e) + { + ValidarDocumento(); + } + + private void ValidarDocumento() + { + if (ViewModel.SelectedDocumento != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedDocumento.Validate(ViewModel.IsEndosso, Recursos.Configuracoes.Any((ConfiguracaoSistema c) => (int)c.Configuracao == 11)); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void ValidacaoParcela(object sender, RoutedEventArgs e) + { + ValidarParcela(); + } + + private void ValidarParcela() + { + if (ViewModel.SelectedParcela != null) + { + if (ViewModel.SelectedParcela.Documento == null) + { + ViewModel.SelectedParcela.Documento = ViewModel.SelectedDocumento; + } + ViewModel.SelectedParcela.Documento.Parcelas = ViewModel.Parcelas; + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedParcela.Validate(Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 9), Recursos.Configuracoes.Any((ConfiguracaoSistema y) => (int)y.Configuracao == 11), ViewModel.EditandoParcela, Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 16)); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void ValidarVendedor() + { + if (ViewModel.SelectedPagamento != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedPagamento.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void ValorRealizadoParcelaBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + CurrencyTextBox val = (CurrencyTextBox)sender; + if (val != null && val.Number != 0m && ViewModel.SelectedParcela != null) + { + decimal number = val.Number; + decimal num = ViewModel.SelectedParcela.Comissao * 0.01m; + ValorComissaoParcelaBox.Number = number * num; + } + } + + private void LostFocusValorRealizado() + { + if (!(ValorRealizadoParcelaBox.Number == 0m) && ViewModel.SelectedParcela != null && ((UIElement)ValorRealizadoParcelaBox).IsFocused) + { + decimal number = ValorRealizadoParcelaBox.Number; + decimal num = ViewModel.SelectedParcela.Comissao * 0.01m; + ValorComissaoParcelaBox.Number = number * num; + } + } + + private void Restricao(bool insert = false) + { + //IL_00c8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e0: Unknown result type (might be due to invalid IL or missing references) + //IL_00f2: Unknown result type (might be due to invalid IL or missing references) + //IL_0104: Unknown result type (might be due to invalid IL or missing references) + //IL_0116: Unknown result type (might be due to invalid IL or missing references) + //IL_0128: Unknown result type (might be due to invalid IL or missing references) + //IL_013a: Unknown result type (might be due to invalid IL or missing references) + //IL_014e: Unknown result type (might be due to invalid IL or missing references) + //IL_0163: Unknown result type (might be due to invalid IL or missing references) + //IL_016f: Unknown result type (might be due to invalid IL or missing references) + //IL_017b: Unknown result type (might be due to invalid IL or missing references) + //IL_018a: Unknown result type (might be due to invalid IL or missing references) + bool flag = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5); + if (insert) + { + ((UIElement)Comissao).Visibility = (Visibility)0; + ((UIElement)Gerada).Visibility = (Visibility)0; + ((UIElement)Recebida).Visibility = (Visibility)0; + ((UIElement)Pendente).Visibility = (Visibility)0; + ((UIElement)Repasse).Visibility = (Visibility)0; + ((DataGridColumn)ParcelasComissaoColumn).Visibility = (Visibility)0; + ((DataGridColumn)ParcelasValorComissaoColumn).Visibility = (Visibility)(flag ? 2 : 0); + ((DataGridColumn)ParcelasValorComissaoDescColumn).Visibility = (Visibility)((!flag) ? 2 : 0); + ((DataGridColumn)PagamentosPorcentagemRepasseColumn).Visibility = (Visibility)0; + ((DataGridColumn)PagamentosValorRepasseColumn).Visibility = (Visibility)0; + } + else + { + Visibility val = (Visibility)(ViewModel.Restricao((TipoRestricao)14) ? 2 : 0); + bool flag2 = ViewModel.Restricao((TipoRestricao)95); + ((UIElement)Comissao).Visibility = (Visibility)((!flag2) ? ((int)val) : 0); + ((UIElement)Gerada).Visibility = (Visibility)(flag2 ? 2 : ((int)val)); + ((UIElement)Recebida).Visibility = (Visibility)(flag2 ? 2 : ((int)val)); + ((UIElement)Pendente).Visibility = (Visibility)(flag2 ? 2 : ((int)val)); + ((UIElement)Repasse).Visibility = (Visibility)(flag2 ? 2 : ((int)val)); + ((DataGridColumn)ParcelasComissaoColumn).Visibility = (Visibility)((!flag2) ? ((int)val) : 0); + ((DataGridColumn)ParcelasValorComissaoColumn).Visibility = (Visibility)((flag || flag2) ? 2 : ((int)val)); + ((DataGridColumn)ParcelasValorComissaoDescColumn).Visibility = (Visibility)((!flag) ? 2 : ((int)val)); + ((DataGridColumn)MaisInformacoesColumn).Visibility = val; + ((DataGridColumn)PagamentosPorcentagemRepasseColumn).Visibility = val; + ((DataGridColumn)PagamentosValorRepasseColumn).Visibility = (Visibility)(flag2 ? 2 : ((int)val)); + } + } + + private void AdicionalBox_OnChecked(object sender, RoutedEventArgs e) + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + if (ViewModel.SelectedDocumento != null) + { + AlteracaoDePremio_LostFocus(PremioAdicionalBox, new RoutedEventArgs()); + } + } + + private async void Button_Click(object sender, RoutedEventArgs e) + { + bool num = ViewModel.Restricao((TipoRestricao)97); + if (!num) + { + Documento documento = ViewModel.AbrirDetalhes(); + ViewModel.ShowDrawer(new ValoresApoliceDrawer(documento), 0); + } + if (num) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR MAIS INFORMAÇÕES."); + } + } + + private void ReplicarFatura_Click(object sender, RoutedEventArgs e) + { + ViewModel.QuantidadeFaturas = 1; + ToggleBotoesParcela(habilitar: true); + EditarParcelaTipo = 3; + ReplicarFatura(); + ViewModel.QuantidadeFaturas = 1; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + } + + private async void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.UpdatePremio = false; + Restricao(); + ViewModel.EnableControle = Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 34) || ViewModel.Repasses.All((VendedorParcela x) => !x.DataPagamento.HasValue); + ViewModel.CoCorretagem = ViewModel.Repasses.Any(delegate(VendedorParcela x) + { + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_001a: Invalid comparison between Unknown and I4 + Repasse repasse = x.Repasse; + return repasse != null && (int)repasse.Tipo.GetValueOrDefault() == 3; + }); + ViewModel.VerificaCoCorretagem(); + await ViewModel.Alteracao(alterar: true); + ViewModel.Alterar(alterar: true); + ValidarTela(); + AlterandoDocumento(alterando: true); + ((UIElement)ExcluirpoliceButton).IsEnabled = false; + ((UIElement)IncluirpoliceButton).IsEnabled = false; + ((UIElement)AlterarApoliceButton).IsEnabled = false; + ViewModel.Inclusao = false; + } + + private void ValorParcelaBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Expected O, but got Unknown + if (!ViewModel.IsFatura) + { + return; + } + CurrencyTextBox val = (CurrencyTextBox)sender; + if (!(ValorParcelaBox.Number > 0m)) + { + decimal obj; + if (!Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 46)) + { + obj = 0m; + } + else + { + Ramo ramo = ViewModel.SelectedDocumento.Controle.Ramo; + obj = ((ramo != null) ? ramo.Iof : 0m); + } + decimal num = obj + 1m; + ValorParcelaBox.Number = val.Number * num; + ((UIElement)ValorParcelaBox).Focus(); + } + } + + private void ValoresParcelaInfo_OnClick(object sender, RoutedEventArgs e) + { + Parcela parcela = ViewModel.AbrirDetalhesParcela(); + ViewModel.ShowDrawer(new ValoresParcelaDrawer(parcela, ViewModel.SelectedDocumento), 0); + } + + private void ManutecaoItens_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.ManutecaoItens(); + } + + private void VencimentoCartaoBox_OnTextChanged(object sender, TextChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Expected O, but got Unknown + int num = ((TextBox)sender).CaretIndex; + TextBox val = (TextBox)sender; + if (val.Text.Contains("/") && new Regex("/").Match(val.Text).Index < num) + { + num--; + } + string text = val.Text.Replace("/", ""); + string text2 = text.Substring(0, (text.Length > 4) ? 4 : text.Length); + if (new Regex("^0").IsMatch(text2)) + { + if (new Regex("^00").IsMatch(text2)) + { + val.Text = _vencimentoCartaoOld; + val.CaretIndex = num; + return; + } + } + else if (new Regex("^1").IsMatch(text2)) + { + if (new Regex("^1[^0-2]").IsMatch(text2)) + { + val.Text = _vencimentoCartaoOld; + val.CaretIndex = num; + return; + } + } + else if (new Regex("^[^01]").IsMatch(text2)) + { + val.Text = _vencimentoCartaoOld; + val.CaretIndex = num; + return; + } + if (text2.Length > 2) + { + val.Text = text2.Insert(2, "/"); + num++; + } + else if (val.Text.Contains("/")) + { + val.Text = text2; + } + val.CaretIndex = num; + _vencimentoCartaoOld = text2; + } + + private void VencimentoCartaoBox_OnGotFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + string text = ((TextBox)sender).Text.Replace("/", ""); + _vencimentoCartaoOld = text.Substring(0, (text.Length > 4) ? 4 : text.Length); + } + + private async void AbrirPerfil_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.VerificarPermissao((TipoTela)32)) + { + if (((DomainBase)ViewModel.SelectedDocumento.Controle.Ramo).Id == 5) + { + ((Window)new HosterWindow((ContentControl)(object)new PerfilView(ViewModel.SelectedDocumento.Controle), "PERFIL", 900.0, 500.0)).ShowDialog(); + } + else + { + ((Window)new HosterWindow((ContentControl)(object)new PerfilEmpresaView(ViewModel.SelectedDocumento.Controle), "QUESTIONÁRIO EMPRESA", 900.0, 500.0)).ShowDialog(); + } + ViewModel.Alterar(alterar: false); + } + } + + private void NegocioCorretoraBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + if (!ViewModel.EnableFields) + { + return; + } + ComboBox val = (ComboBox)sender; + if ((((int)val != 0) ? ((Selector)val).SelectedItem : null) != null) + { + AlteracaoDePremio_LostFocus(PremioLiquidoBox, new RoutedEventArgs()); + if ((int)((UIElement)SalvarVendedorButton).Visibility == 0) + { + EditarVendedor(editar: true); + ComissaoVendedorBox_OnSelectionChanged(((int)((UIElement)ComissaoNovoBox).Visibility == 0) ? ComissaoNovoComboBox : ComissaoRenovacaoComboBox, e); + } + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDocumento != null && ((DomainBase)ViewModel.SelectedDocumento).Id != 0L) + { + ViewModel.AbrirLog((TipoTela)2, ((DomainBase)ViewModel.SelectedDocumento).Id); + } + } + + private async void AbrirLogParcelas_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDocumento == null) + { + return; + } + ApoliceViewModel viewModel = ViewModel; + if (viewModel != null && viewModel.Parcelas.Count > 0) + { + List<long> listaParcelas = new List<long>(); + ViewModel.Parcelas.ToList().ForEach(delegate(Parcela x) + { + listaParcelas.Add(((DomainBase)x).Id); + }); + ViewModel.AbrirLogParcela(listaParcelas, ((DomainBase)ViewModel.SelectedDocumento).Id); + } + } + + private void AbrirLogParcelaSelecionada_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedParcela != null && ((DomainBase)ViewModel.SelectedParcela).Id != 0L) + { + List<long> parcelas = new List<long> { ((DomainBase)ViewModel.SelectedParcela).Id }; + if (ViewModel.SelectedDocumento != null && ((DomainBase)ViewModel.SelectedDocumento).Id != 0L) + { + ViewModel.AbrirLogParcela(parcelas, ((DomainBase)ViewModel.SelectedDocumento).Id, ViewModel.SelectedParcela.NumeroParcela); + } + } + } + + private void AbrirLogVendedor_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedParcela != null && ((DomainBase)ViewModel.SelectedParcela).Id != 0L) + { + ViewModel.AbrirLog((TipoTela)37, ((DomainBase)ViewModel.SelectedParcela).Id); + } + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDocumento != null && ((DomainBase)ViewModel.SelectedDocumento).Id != 0L) + { + ViewModel.AbrirLogEmail((TipoTela)2, ((DomainBase)ViewModel.SelectedDocumento).Id); + } + } + + private void AbrirLogEmailPF_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedParcela != null && ((DomainBase)ViewModel.SelectedParcela).Id != 0L) + { + ViewModel.AbrirLogEmail((TipoTela)5, ((DomainBase)ViewModel.SelectedParcela).Id); + } + } + + private void AbrirLogTrocaCliente_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDocumento != null && ((DomainBase)ViewModel.SelectedDocumento).Id != 0L) + { + ViewModel.AbrirLog((TipoTela)41, ((DomainBase)ViewModel.SelectedDocumento).Id); + } + } + + private void Importacao_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDocumento != null && ((DomainBase)ViewModel.SelectedDocumento).Id != 0L) + { + AbrirImportacao(); + } + } + + private async void AbrirImportacao() + { + await ViewModel.Importacao(); + ((ToolTip)((FrameworkElement)ButtonImportado).ToolTip).PlacementTarget = (UIElement)(object)ButtonImportado; + ((ToolTip)((FrameworkElement)ButtonImportado).ToolTip).Placement = (PlacementMode)3; + ((ToolTip)((FrameworkElement)ButtonImportado).ToolTip).IsOpen = true; + await Task.Run(async delegate + { + await Task.Delay(5000); + }); + ((ToolTip)((FrameworkElement)ButtonImportado).ToolTip).IsOpen = false; + } + + private void AbrirInfo_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirInfo(); + } + + private void Initial_DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + DatePicker_OnLostKeyboardFocus(sender, e); + if (string.IsNullOrEmpty(((DatePicker)sender).Text)) + { + ((DatePicker)sender).SelectedDate = DateTime.MinValue; + ViewModel.SelectedDocumento.Vigencia1 = DateTime.MinValue; + Documento selectedDocumento = ViewModel.SelectedDocumento; + if (selectedDocumento != null) + { + _ = selectedDocumento.Vigencia1; + if (true && ViewModel.SelectedDocumento.Vigencia1 == DateTime.MinValue) + { + ((DatePicker)sender).SelectedDate = DateTime.Now.Date; + ViewModel.SelectedDocumento.Vigencia1 = DateTime.Now.Date; + } + } + } + if (string.IsNullOrWhiteSpace(Vigencia2Box.Text)) + { + Vigencia2Box.DisplayDate = ValidationHelper.ToDateTime(((DatePicker)sender).Text).AddYears(1); + Vigencia2Box.Text = Vigencia2Box.DisplayDate.ToShortDateString(); + } + } + + private void Vencimento_DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + DatePicker_OnLostKeyboardFocus(sender, e); + if (ViewModel.SelectedDocumento != null) + { + if (string.IsNullOrEmpty(((DatePicker)sender).Text)) + { + ((DatePicker)sender).SelectedDate = ViewModel.SelectedDocumento.Vigencia1; + ((DatePicker)sender).Text = ViewModel.SelectedDocumento.Vigencia1.ToString("dd/MM/yyyy"); + } + DatePicker_OnLostKeyboardFocus(sender, e); + } + } + + private void CalculoComissao_OnNumberChanged(object sender, EventArgs e) + { + if (ViewModel.BaixarParcelas && !_calculando) + { + _calculando = true; + decimal number = ValorComissaoParcelaBox.Number; + PorcentagemIrBox.NumberChanged -= PorcentagemIrBox_OnNumberChanged; + PorcentagemIssBox.NumberChanged -= PorcentagemIssBox_OnNumberChanged; + Imposto imposto = ViewModel.Imposto; + if (imposto != null && ((DomainBase)imposto).Id > 0) + { + PorcentagemIrBox.Number = ViewModel.Imposto.Ir * 100m; + } + Imposto imposto2 = ViewModel.Imposto; + if (imposto2 != null && ((DomainBase)imposto2).Id > 0) + { + PorcentagemIssBox.Number = ViewModel.Imposto.Iss * 100m; + } + PorcentagemIrBox.NumberChanged += PorcentagemIrBox_OnNumberChanged; + PorcentagemIssBox.NumberChanged += PorcentagemIssBox_OnNumberChanged; + Imposto imposto3 = ViewModel.Imposto; + decimal num = ((imposto3 != null && ((DomainBase)imposto3).Id > 0) ? (number * ViewModel.Imposto.Ir) : ValorIrBox.Number); + if (ValorIrBox.Number != num) + { + ViewModel.SelectedParcela.Irr = num; + } + Imposto imposto4 = ViewModel.Imposto; + decimal num2 = ((imposto4 != null && ((DomainBase)imposto4).Id > 0) ? (number * ViewModel.Imposto.Iss) : ValorIssBox.Number); + if (ValorIssBox.Number != num2) + { + ViewModel.SelectedParcela.Iss = num2; + } + Imposto imposto5 = ViewModel.Imposto; + decimal num3 = ((imposto5 != null && ((DomainBase)imposto5).Id > 0) ? (number * ViewModel.Imposto.Outros) : ValorOutrosBox.Number); + if (ValorOutrosBox.Number != num3) + { + ViewModel.SelectedParcela.Outros = num3; + } + Imposto imposto6 = ViewModel.Imposto; + decimal num4 = ((imposto6 != null && ((DomainBase)imposto6).Id > 0) ? (number * ViewModel.Imposto.Desconto) : ValorDescontoBox.Number); + if (ValorDescontoBox.Number != num4) + { + ViewModel.SelectedParcela.Desconto = num4; + } + ValorComDescBox.Number = number - num - num2 - num3 - num4; + ViewModel.OnPropertyChanged("SelectedParcela"); + _calculando = false; + } + } + + private void PorcentagemIrBox_OnNumberChanged(object sender, EventArgs e) + { + if (ViewModel.BaixarParcelas && !_calculando) + { + _calculando = true; + ValorIrBox.Number = ValorComissaoParcelaBox.Number * (PorcentagemIrBox.Number / 100m); + _calculando = false; + ValorImposto_OnNumberChanged(ValorIrBox, new EventArgs()); + } + } + + private void PorcentagemIssBox_OnNumberChanged(object sender, EventArgs e) + { + if (ViewModel.BaixarParcelas && !_calculando) + { + _calculando = true; + ValorIssBox.Number = ValorComissaoParcelaBox.Number * (PorcentagemIssBox.Number / 100m); + _calculando = false; + ValorImposto_OnNumberChanged(ValorIssBox, new EventArgs()); + } + } + + private void ValorImposto_OnNumberChanged(object sender, EventArgs e) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Expected O, but got Unknown + if (ViewModel.BaixarParcelas && !_calculando) + { + _calculando = true; + CurrencyTextBox val = (CurrencyTextBox)sender; + decimal num = ((ValorComissaoParcelaBox.Number == 0m) ? 1m : ValorComissaoParcelaBox.Number); + decimal number = ValorComissaoParcelaBox.Number; + switch (((FrameworkElement)val).Name) + { + case "ValorIrBox": + PorcentagemIrBox.Number = ValorIrBox.Number * 100m / num; + number = num - val.Number - ValorIssBox.Number - ValorOutrosBox.Number - ValorDescontoBox.Number; + break; + case "ValorIssBox": + PorcentagemIssBox.Number = ValorIssBox.Number * 100m / num; + number = num - val.Number - ValorIrBox.Number - ValorOutrosBox.Number - ValorDescontoBox.Number; + break; + case "ValorOutrosBox": + number = num - val.Number - ValorIrBox.Number - ValorIrBox.Number - ValorDescontoBox.Number; + break; + case "ValorDescontoBox": + number = num - val.Number - ValorIrBox.Number - ValorIrBox.Number - ValorOutrosBox.Number; + break; + } + ValorComDescBox.Number = number; + _calculando = false; + } + } + + private void AutoCompleteBanco_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + AutoCompleteBox val = (AutoCompleteBox)sender; + SetValid(val, string.IsNullOrWhiteSpace(val.Text) || ViewModel.SelectedDocumento.Banco != null); + } + + private void Redimencionar(double width) + { + ViewModel.TamanhoGrid = (width - 17.0) / 2.0; + int num = (ViewModel.IsFatura ? 620 : 450); + if (ViewModel.TamanhoGrid < (double)num) + { + ViewModel.TamanhoGrid = width; + } + } + + private void ApoliceControl_SizeChanged(object sender, SizeChangedEventArgs e) + { + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + if (e != null) + { + _ = e.NewSize; + if (0 == 0) + { + Size newSize = e.NewSize; + Redimencionar(((Size)(ref newSize)).Width); + } + } + } + + private async void Ramo_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (!Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 20) && ViewModel.SelectedDocumento != null) + { + EditarVendedor(editar: false); + ViewModel.SelectedPagamento = null; + await ViewModel.BuscarVendedores(); + await ViewModel.LimparRepasses(); + } + } + + private async void EditarParcelas_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.EditarParcelas(); + } + + private void MenuItem_Click(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogAntigo(); + } + + private async void Perdido_OnClick(object sender, RoutedEventArgs e) + { + if ((int)ViewModel.SelectedDocumento.Situacao == 7) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL ALTERAR O STATUS PARA PERDIDO DE UM DOCUMENTO RECUSADO."); + return; + } + if (!(await ViewModel.ShowMessage("DESEJA REALMENTE ALTERAR O STATUS DO SEGURO PARA PERDIDO?", "SIM", "NÃO"))) + { + return; + } + ViewModel.Loading(isLoading: true); + Cliente cliente = await new ClienteServico().BuscarCliente(((DomainBase)ViewModel.SelectedDocumento.Controle.Cliente).Id); + Cliente val = cliente; + val.Telefones = await new ClienteServico().BuscarTelefonesAsync(((DomainBase)ViewModel.SelectedDocumento.Controle.Cliente).Id); + val = cliente; + val.Emails = await new ClienteServico().BuscarEmailsAsync(((DomainBase)ViewModel.SelectedDocumento.Controle.Cliente).Id); + ObservableCollection<Item> itens = await new ItemServico().BuscarItems(((DomainBase)ViewModel.SelectedDocumento.Controle).Id, (StatusItem)0); + if (!(await new ApoliceServico().Perdido(((DomainBase)ViewModel.SelectedDocumento.Controle).Id))) + { + ViewModel.Loading(isLoading: false); + return; + } + Prospeccao val2 = new Prospeccao + { + Nome = cliente.Nome, + Documento = cliente.Documento, + Nascimento = cliente.Nascimento + }; + ObservableCollection<ClienteTelefone> telefones = cliente.Telefones; + object obj; + if (telefones == null) + { + obj = null; + } + else + { + ClienteTelefone? obj2 = telefones.FirstOrDefault(); + obj = ((obj2 != null) ? ((TelefoneBase)obj2).Prefixo : null); + } + if (obj == null) + { + obj = ""; + } + val2.Prefixo1 = (string)obj; + ObservableCollection<ClienteTelefone> telefones2 = cliente.Telefones; + object obj3; + if (telefones2 == null) + { + obj3 = null; + } + else + { + ClienteTelefone? obj4 = telefones2.FirstOrDefault(); + obj3 = ((obj4 != null) ? ((TelefoneBase)obj4).Numero : null); + } + if (obj3 == null) + { + obj3 = ""; + } + val2.Telefone1 = (string)obj3; + val2.Prefixo2 = ((cliente.Telefones != null && cliente.Telefones.Count > 1) ? ((TelefoneBase)cliente.Telefones[1]).Prefixo : ""); + object telefone; + if (cliente.Telefones != null) + { + ObservableCollection<ClienteTelefone> telefones3 = cliente.Telefones; + if (telefones3 != null && telefones3.Count > 1) + { + telefone = ((TelefoneBase)cliente.Telefones[1]).Numero; + goto IL_0536; + } + } + telefone = ""; + goto IL_0536; + IL_0536: + val2.Telefone2 = (string)telefone; + ObservableCollection<ClienteEmail> emails = cliente.Emails; + object obj5; + if (emails == null) + { + obj5 = null; + } + else + { + ClienteEmail? obj6 = emails.FirstOrDefault(); + obj5 = ((obj6 != null) ? ((EmailBase)obj6).Email : null); + } + if (obj5 == null) + { + obj5 = ""; + } + val2.Email = (string)obj5; + val2.VigenciaFinal = (ViewModel.SelectedDocumento.Vigencia2 ?? Funcoes.GetNetworkTime().Date).AddYears(1); + val2.Vendedor = ViewModel.SelectedDocumento.VendedorPrincipal; + Item? obj7 = itens.FirstOrDefault(); + val2.Item = ((obj7 != null) ? obj7.Descricao : null); + val2.Tipo = "SEGURO PERDIDO"; + val2.Observacao = "SEGURO PERDIDO: PROPOSTA: " + ViewModel.SelectedDocumento.Proposta + ", APÓLICE: " + ViewModel.SelectedDocumento.Apolice; + val2.Status = (StatusProspeccao)1; + val2.Renovacao = true; + Prospeccao data = val2; + await AbrirProspeccao(data); + await ViewModel.SelecionaDocumento(ViewModel.SelectedDocumento); + ViewModel.Loading(isLoading: false); + } + + private async Task AbrirProspeccao(Prospeccao data) + { + while (true) + { + if (await ViewModel.ShowProspeccaoDialog(data) == null) + { + if (await ViewModel.ShowMessage("DESEJA REALMENTE NÃO CADASTRAR UMA PROSPECÇÃO PARA ESSE DOCUMENTO?", "SIM", "NÃO")) + { + return; + } + continue; + } + List<KeyValuePair<string, string>> list = await ViewModel.SalvarProspeccao(data); + if (list == null || list.Count == 0) + { + break; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + ViewModel.ToggleSnackBar("PROSPECÇÃO SALVA COM SUCESSO."); + } + + private void FocusPremios(object sender, RoutedEventArgs e) + { + ViewModel.UpdatePremio = true; + } + + private void AbrirLogParcelaAntigo_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogAntigoParcela(); + } + + private void AdicionarCoCorretagem_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ToggleButton val = (ToggleButton)sender; + bool flag = (int)val != 0 && val.IsChecked.GetValueOrDefault(); + ComboBox comissaoNovoComboBox = ComissaoNovoComboBox; + if (((comissaoNovoComboBox != null) ? ((Selector)comissaoNovoComboBox).SelectedItem : null) != null) + { + ((Selector)ComissaoNovoComboBox).SelectedItem = null; + } + if (flag) + { + ((Selector)TipoVendedorBox).SelectedIndex = 0; + } + else if (((Selector)TipoVendedorBox).SelectedItem != null) + { + ((Selector)TipoVendedorBox).SelectedItem = null; + } + ComboBox vendedorBox = VendedorBox; + if (((vendedorBox != null) ? ((Selector)vendedorBox).SelectedItem : null) != null) + { + ((Selector)VendedorBox).SelectedItem = null; + } + if (ValidationHelper.IsNotNullOrEmpty(((TextBox)ValorRepasseBox).Text)) + { + ((TextBox)ValorRepasseBox).Text = ""; + } + ViewModel.VendedorCoCorretagem(flag); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/apoliceview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_027b: Unknown result type (might be due to invalid IL or missing references) + //IL_0285: Expected O, but got Unknown + //IL_0288: Unknown result type (might be due to invalid IL or missing references) + //IL_0292: Expected O, but got Unknown + //IL_029f: Unknown result type (might be due to invalid IL or missing references) + //IL_02a9: Expected O, but got Unknown + //IL_02ac: Unknown result type (might be due to invalid IL or missing references) + //IL_02b6: Expected O, but got Unknown + //IL_02c3: Unknown result type (might be due to invalid IL or missing references) + //IL_02cd: Expected O, but got Unknown + //IL_02d0: Unknown result type (might be due to invalid IL or missing references) + //IL_02da: Expected O, but got Unknown + //IL_02e7: Unknown result type (might be due to invalid IL or missing references) + //IL_02f1: Expected O, but got Unknown + //IL_02f4: Unknown result type (might be due to invalid IL or missing references) + //IL_02fe: Expected O, but got Unknown + //IL_030b: Unknown result type (might be due to invalid IL or missing references) + //IL_0315: Expected O, but got Unknown + //IL_0318: Unknown result type (might be due to invalid IL or missing references) + //IL_0322: Expected O, but got Unknown + //IL_032f: Unknown result type (might be due to invalid IL or missing references) + //IL_0339: Expected O, but got Unknown + //IL_033c: Unknown result type (might be due to invalid IL or missing references) + //IL_0346: Expected O, but got Unknown + //IL_0353: Unknown result type (might be due to invalid IL or missing references) + //IL_035d: Expected O, but got Unknown + //IL_035f: Unknown result type (might be due to invalid IL or missing references) + //IL_036b: Unknown result type (might be due to invalid IL or missing references) + //IL_0375: Expected O, but got Unknown + //IL_0378: Unknown result type (might be due to invalid IL or missing references) + //IL_0382: Expected O, but got Unknown + //IL_038f: Unknown result type (might be due to invalid IL or missing references) + //IL_0399: Expected O, but got Unknown + //IL_039c: Unknown result type (might be due to invalid IL or missing references) + //IL_03a6: Expected O, but got Unknown + //IL_03a9: Unknown result type (might be due to invalid IL or missing references) + //IL_03b3: Expected O, but got Unknown + //IL_03c0: Unknown result type (might be due to invalid IL or missing references) + //IL_03ca: Expected O, but got Unknown + //IL_03cc: Unknown result type (might be due to invalid IL or missing references) + //IL_03d8: Unknown result type (might be due to invalid IL or missing references) + //IL_03e2: Expected O, but got Unknown + //IL_03e4: Unknown result type (might be due to invalid IL or missing references) + //IL_03f0: Unknown result type (might be due to invalid IL or missing references) + //IL_03fa: Expected O, but got Unknown + //IL_03fc: Unknown result type (might be due to invalid IL or missing references) + //IL_0408: Unknown result type (might be due to invalid IL or missing references) + //IL_0412: Expected O, but got Unknown + //IL_0414: Unknown result type (might be due to invalid IL or missing references) + //IL_0420: Unknown result type (might be due to invalid IL or missing references) + //IL_042a: Expected O, but got Unknown + //IL_042c: Unknown result type (might be due to invalid IL or missing references) + //IL_0438: Unknown result type (might be due to invalid IL or missing references) + //IL_0442: Expected O, but got Unknown + //IL_0444: Unknown result type (might be due to invalid IL or missing references) + //IL_0450: Unknown result type (might be due to invalid IL or missing references) + //IL_045a: Expected O, but got Unknown + //IL_045c: Unknown result type (might be due to invalid IL or missing references) + //IL_0468: Unknown result type (might be due to invalid IL or missing references) + //IL_0472: Expected O, but got Unknown + //IL_0474: Unknown result type (might be due to invalid IL or missing references) + //IL_0480: Unknown result type (might be due to invalid IL or missing references) + //IL_048a: Expected O, but got Unknown + //IL_048c: Unknown result type (might be due to invalid IL or missing references) + //IL_0498: Unknown result type (might be due to invalid IL or missing references) + //IL_04a2: Expected O, but got Unknown + //IL_04a4: Unknown result type (might be due to invalid IL or missing references) + //IL_04b0: Unknown result type (might be due to invalid IL or missing references) + //IL_04ba: Expected O, but got Unknown + //IL_04bc: Unknown result type (might be due to invalid IL or missing references) + //IL_04c8: Unknown result type (might be due to invalid IL or missing references) + //IL_04d2: Expected O, but got Unknown + //IL_04d4: Unknown result type (might be due to invalid IL or missing references) + //IL_04e0: Unknown result type (might be due to invalid IL or missing references) + //IL_04ea: Expected O, but got Unknown + //IL_04ed: Unknown result type (might be due to invalid IL or missing references) + //IL_04f7: Expected O, but got Unknown + //IL_04f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0505: Unknown result type (might be due to invalid IL or missing references) + //IL_050f: Expected O, but got Unknown + //IL_0512: Unknown result type (might be due to invalid IL or missing references) + //IL_051c: Expected O, but got Unknown + //IL_051f: Unknown result type (might be due to invalid IL or missing references) + //IL_0529: Expected O, but got Unknown + //IL_052c: Unknown result type (might be due to invalid IL or missing references) + //IL_0536: Expected O, but got Unknown + //IL_0539: Unknown result type (might be due to invalid IL or missing references) + //IL_0543: Expected O, but got Unknown + //IL_0546: Unknown result type (might be due to invalid IL or missing references) + //IL_0550: Expected O, but got Unknown + //IL_0553: Unknown result type (might be due to invalid IL or missing references) + //IL_055d: Expected O, but got Unknown + //IL_0560: Unknown result type (might be due to invalid IL or missing references) + //IL_056a: Expected O, but got Unknown + //IL_056c: Unknown result type (might be due to invalid IL or missing references) + //IL_0578: Unknown result type (might be due to invalid IL or missing references) + //IL_0582: Expected O, but got Unknown + //IL_0583: Unknown result type (might be due to invalid IL or missing references) + //IL_058f: Unknown result type (might be due to invalid IL or missing references) + //IL_0599: Expected O, but got Unknown + //IL_059a: Unknown result type (might be due to invalid IL or missing references) + //IL_05a6: Unknown result type (might be due to invalid IL or missing references) + //IL_05b0: Expected O, but got Unknown + //IL_05b1: Unknown result type (might be due to invalid IL or missing references) + //IL_05ca: Unknown result type (might be due to invalid IL or missing references) + //IL_05d4: Expected O, but got Unknown + //IL_05e1: Unknown result type (might be due to invalid IL or missing references) + //IL_05eb: Expected O, but got Unknown + //IL_05f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0602: Expected O, but got Unknown + //IL_061c: Unknown result type (might be due to invalid IL or missing references) + //IL_0626: Expected O, but got Unknown + //IL_0633: Unknown result type (might be due to invalid IL or missing references) + //IL_063d: Expected O, but got Unknown + //IL_064a: Unknown result type (might be due to invalid IL or missing references) + //IL_0654: Expected O, but got Unknown + //IL_0661: Unknown result type (might be due to invalid IL or missing references) + //IL_066b: Expected O, but got Unknown + //IL_066e: Unknown result type (might be due to invalid IL or missing references) + //IL_0678: Expected O, but got Unknown + //IL_0685: Unknown result type (might be due to invalid IL or missing references) + //IL_068f: Expected O, but got Unknown + //IL_069c: Unknown result type (might be due to invalid IL or missing references) + //IL_06a6: Expected O, but got Unknown + //IL_06b3: Unknown result type (might be due to invalid IL or missing references) + //IL_06bd: Expected O, but got Unknown + //IL_06d7: Unknown result type (might be due to invalid IL or missing references) + //IL_06e1: Expected O, but got Unknown + //IL_06e4: Unknown result type (might be due to invalid IL or missing references) + //IL_06ee: Expected O, but got Unknown + //IL_06f1: Unknown result type (might be due to invalid IL or missing references) + //IL_06fb: Expected O, but got Unknown + //IL_070b: Unknown result type (might be due to invalid IL or missing references) + //IL_0715: Expected O, but got Unknown + //IL_0718: Unknown result type (might be due to invalid IL or missing references) + //IL_0722: Expected O, but got Unknown + //IL_0725: Unknown result type (might be due to invalid IL or missing references) + //IL_072f: Expected O, but got Unknown + //IL_073c: Unknown result type (might be due to invalid IL or missing references) + //IL_0746: Expected O, but got Unknown + //IL_0749: Unknown result type (might be due to invalid IL or missing references) + //IL_0753: Expected O, but got Unknown + //IL_0756: Unknown result type (might be due to invalid IL or missing references) + //IL_0760: Expected O, but got Unknown + //IL_0763: Unknown result type (might be due to invalid IL or missing references) + //IL_076d: Expected O, but got Unknown + //IL_0770: Unknown result type (might be due to invalid IL or missing references) + //IL_077a: Expected O, but got Unknown + //IL_07bd: Unknown result type (might be due to invalid IL or missing references) + //IL_07c9: Unknown result type (might be due to invalid IL or missing references) + //IL_07d3: Expected O, but got Unknown + //IL_07d6: Unknown result type (might be due to invalid IL or missing references) + //IL_07e0: Expected O, but got Unknown + //IL_07e2: Unknown result type (might be due to invalid IL or missing references) + //IL_07ee: Unknown result type (might be due to invalid IL or missing references) + //IL_07f8: Expected O, but got Unknown + //IL_07fa: Unknown result type (might be due to invalid IL or missing references) + //IL_0806: Unknown result type (might be due to invalid IL or missing references) + //IL_0810: Expected O, but got Unknown + //IL_0812: Unknown result type (might be due to invalid IL or missing references) + //IL_081e: Unknown result type (might be due to invalid IL or missing references) + //IL_0828: Expected O, but got Unknown + //IL_082a: Unknown result type (might be due to invalid IL or missing references) + //IL_0836: Unknown result type (might be due to invalid IL or missing references) + //IL_0840: Expected O, but got Unknown + //IL_0842: Unknown result type (might be due to invalid IL or missing references) + //IL_084e: Unknown result type (might be due to invalid IL or missing references) + //IL_0858: Expected O, but got Unknown + //IL_085a: Unknown result type (might be due to invalid IL or missing references) + //IL_0866: Unknown result type (might be due to invalid IL or missing references) + //IL_0870: Expected O, but got Unknown + //IL_0873: Unknown result type (might be due to invalid IL or missing references) + //IL_087d: Expected O, but got Unknown + //IL_087f: Unknown result type (might be due to invalid IL or missing references) + //IL_088b: Unknown result type (might be due to invalid IL or missing references) + //IL_0895: Expected O, but got Unknown + //IL_0897: Unknown result type (might be due to invalid IL or missing references) + //IL_08a3: Unknown result type (might be due to invalid IL or missing references) + //IL_08ad: Expected O, but got Unknown + //IL_08af: Unknown result type (might be due to invalid IL or missing references) + //IL_08bb: Unknown result type (might be due to invalid IL or missing references) + //IL_08c5: Expected O, but got Unknown + //IL_08c7: Unknown result type (might be due to invalid IL or missing references) + //IL_08d3: Unknown result type (might be due to invalid IL or missing references) + //IL_08dd: Expected O, but got Unknown + //IL_08df: Unknown result type (might be due to invalid IL or missing references) + //IL_08eb: Unknown result type (might be due to invalid IL or missing references) + //IL_08f5: Expected O, but got Unknown + //IL_08f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0902: Expected O, but got Unknown + //IL_0912: Unknown result type (might be due to invalid IL or missing references) + //IL_091c: Expected O, but got Unknown + //IL_092c: Unknown result type (might be due to invalid IL or missing references) + //IL_0936: Expected O, but got Unknown + //IL_0946: Unknown result type (might be due to invalid IL or missing references) + //IL_0950: Expected O, but got Unknown + //IL_095f: Unknown result type (might be due to invalid IL or missing references) + //IL_096b: Unknown result type (might be due to invalid IL or missing references) + //IL_0975: Expected O, but got Unknown + //IL_0976: Unknown result type (might be due to invalid IL or missing references) + //IL_0982: Unknown result type (might be due to invalid IL or missing references) + //IL_098c: Expected O, but got Unknown + //IL_098d: Unknown result type (might be due to invalid IL or missing references) + //IL_0999: Unknown result type (might be due to invalid IL or missing references) + //IL_09a3: Expected O, but got Unknown + //IL_09b3: Unknown result type (might be due to invalid IL or missing references) + //IL_09bd: Expected O, but got Unknown + //IL_09ca: Unknown result type (might be due to invalid IL or missing references) + //IL_09d4: Expected O, but got Unknown + //IL_09e1: Unknown result type (might be due to invalid IL or missing references) + //IL_09eb: Expected O, but got Unknown + //IL_09f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0a02: Expected O, but got Unknown + //IL_0a11: Unknown result type (might be due to invalid IL or missing references) + //IL_0a1d: Unknown result type (might be due to invalid IL or missing references) + //IL_0a27: Expected O, but got Unknown + //IL_0a28: Unknown result type (might be due to invalid IL or missing references) + //IL_0a34: Unknown result type (might be due to invalid IL or missing references) + //IL_0a3e: Expected O, but got Unknown + //IL_0a3f: Unknown result type (might be due to invalid IL or missing references) + //IL_0a4b: Unknown result type (might be due to invalid IL or missing references) + //IL_0a55: Expected O, but got Unknown + //IL_0a65: Unknown result type (might be due to invalid IL or missing references) + //IL_0a6f: Expected O, but got Unknown + //IL_0a7c: Unknown result type (might be due to invalid IL or missing references) + //IL_0a86: Expected O, but got Unknown + //IL_0a93: Unknown result type (might be due to invalid IL or missing references) + //IL_0a9d: Expected O, but got Unknown + //IL_0aaa: Unknown result type (might be due to invalid IL or missing references) + //IL_0ab4: Expected O, but got Unknown + //IL_0ac4: Unknown result type (might be due to invalid IL or missing references) + //IL_0ace: Expected O, but got Unknown + //IL_0ad1: Unknown result type (might be due to invalid IL or missing references) + //IL_0adb: Expected O, but got Unknown + //IL_0aeb: Unknown result type (might be due to invalid IL or missing references) + //IL_0af5: Expected O, but got Unknown + //IL_0b05: Unknown result type (might be due to invalid IL or missing references) + //IL_0b0f: Expected O, but got Unknown + //IL_0b1f: Unknown result type (might be due to invalid IL or missing references) + //IL_0b29: Expected O, but got Unknown + //IL_0b36: Unknown result type (might be due to invalid IL or missing references) + //IL_0b40: Expected O, but got Unknown + //IL_0b4d: Unknown result type (might be due to invalid IL or missing references) + //IL_0b57: Expected O, but got Unknown + //IL_0b64: Unknown result type (might be due to invalid IL or missing references) + //IL_0b6e: Expected O, but got Unknown + //IL_0b94: Unknown result type (might be due to invalid IL or missing references) + //IL_0ba0: Unknown result type (might be due to invalid IL or missing references) + //IL_0baa: Expected O, but got Unknown + //IL_0bab: Unknown result type (might be due to invalid IL or missing references) + //IL_0bb7: Unknown result type (might be due to invalid IL or missing references) + //IL_0bc1: Expected O, but got Unknown + //IL_0bc2: Unknown result type (might be due to invalid IL or missing references) + //IL_0bce: Unknown result type (might be due to invalid IL or missing references) + //IL_0bd8: Expected O, but got Unknown + //IL_0bd9: Unknown result type (might be due to invalid IL or missing references) + //IL_0bfe: Unknown result type (might be due to invalid IL or missing references) + //IL_0c0a: Unknown result type (might be due to invalid IL or missing references) + //IL_0c14: Expected O, but got Unknown + //IL_0c15: Unknown result type (might be due to invalid IL or missing references) + //IL_0c21: Unknown result type (might be due to invalid IL or missing references) + //IL_0c2b: Expected O, but got Unknown + //IL_0c2c: Unknown result type (might be due to invalid IL or missing references) + //IL_0c38: Unknown result type (might be due to invalid IL or missing references) + //IL_0c42: Expected O, but got Unknown + //IL_0c43: Unknown result type (might be due to invalid IL or missing references) + //IL_0c69: Unknown result type (might be due to invalid IL or missing references) + //IL_0c73: Expected O, but got Unknown + //IL_0c80: Unknown result type (might be due to invalid IL or missing references) + //IL_0c8a: Expected O, but got Unknown + //IL_0c97: Unknown result type (might be due to invalid IL or missing references) + //IL_0ca1: Expected O, but got Unknown + //IL_0cae: Unknown result type (might be due to invalid IL or missing references) + //IL_0cb8: Expected O, but got Unknown + //IL_0cdf: Unknown result type (might be due to invalid IL or missing references) + //IL_0ce9: Expected O, but got Unknown + //IL_0cf6: Unknown result type (might be due to invalid IL or missing references) + //IL_0d00: Expected O, but got Unknown + //IL_0d10: Unknown result type (might be due to invalid IL or missing references) + //IL_0d1a: Expected O, but got Unknown + //IL_0d34: Unknown result type (might be due to invalid IL or missing references) + //IL_0d3e: Expected O, but got Unknown + //IL_0d4e: Unknown result type (might be due to invalid IL or missing references) + //IL_0d58: Expected O, but got Unknown + //IL_0d7f: Unknown result type (might be due to invalid IL or missing references) + //IL_0d89: Expected O, but got Unknown + //IL_0db0: Unknown result type (might be due to invalid IL or missing references) + //IL_0dba: Expected O, but got Unknown + //IL_0de1: Unknown result type (might be due to invalid IL or missing references) + //IL_0deb: Expected O, but got Unknown + //IL_0e12: Unknown result type (might be due to invalid IL or missing references) + //IL_0e1c: Expected O, but got Unknown + //IL_0e43: Unknown result type (might be due to invalid IL or missing references) + //IL_0e4d: Expected O, but got Unknown + //IL_0e74: Unknown result type (might be due to invalid IL or missing references) + //IL_0e7e: Expected O, but got Unknown + //IL_0e98: Unknown result type (might be due to invalid IL or missing references) + //IL_0ea2: Expected O, but got Unknown + //IL_0ea5: Unknown result type (might be due to invalid IL or missing references) + //IL_0eaf: Expected O, but got Unknown + //IL_0eb2: Unknown result type (might be due to invalid IL or missing references) + //IL_0ebc: Expected O, but got Unknown + //IL_0ebf: Unknown result type (might be due to invalid IL or missing references) + //IL_0ec9: Expected O, but got Unknown + //IL_0ecc: Unknown result type (might be due to invalid IL or missing references) + //IL_0ed6: Expected O, but got Unknown + //IL_0ed9: Unknown result type (might be due to invalid IL or missing references) + //IL_0ee3: Expected O, but got Unknown + //IL_0ee6: Unknown result type (might be due to invalid IL or missing references) + //IL_0ef0: Expected O, but got Unknown + //IL_0ef3: Unknown result type (might be due to invalid IL or missing references) + //IL_0efd: Expected O, but got Unknown + //IL_0f00: Unknown result type (might be due to invalid IL or missing references) + //IL_0f0a: Expected O, but got Unknown + //IL_0f0d: Unknown result type (might be due to invalid IL or missing references) + //IL_0f17: Expected O, but got Unknown + //IL_0f24: Unknown result type (might be due to invalid IL or missing references) + //IL_0f2e: Expected O, but got Unknown + //IL_0f31: Unknown result type (might be due to invalid IL or missing references) + //IL_0f3b: Expected O, but got Unknown + //IL_0f48: Unknown result type (might be due to invalid IL or missing references) + //IL_0f52: Expected O, but got Unknown + //IL_0f55: Unknown result type (might be due to invalid IL or missing references) + //IL_0f5f: Expected O, but got Unknown + //IL_0f6c: Unknown result type (might be due to invalid IL or missing references) + //IL_0f76: Expected O, but got Unknown + //IL_0f78: Unknown result type (might be due to invalid IL or missing references) + //IL_0f84: Unknown result type (might be due to invalid IL or missing references) + //IL_0f8e: Expected O, but got Unknown + //IL_0f91: Unknown result type (might be due to invalid IL or missing references) + //IL_0f9b: Expected O, but got Unknown + //IL_0f9e: Unknown result type (might be due to invalid IL or missing references) + //IL_0fa8: Expected O, but got Unknown + //IL_0fb5: Unknown result type (might be due to invalid IL or missing references) + //IL_0fbf: Expected O, but got Unknown + //IL_0fc2: Unknown result type (might be due to invalid IL or missing references) + //IL_0fcc: Expected O, but got Unknown + //IL_0fcf: Unknown result type (might be due to invalid IL or missing references) + //IL_0fd9: Expected O, but got Unknown + //IL_0fe9: Unknown result type (might be due to invalid IL or missing references) + //IL_0ff3: Expected O, but got Unknown + //IL_1000: Unknown result type (might be due to invalid IL or missing references) + //IL_100a: Expected O, but got Unknown + //IL_101a: Unknown result type (might be due to invalid IL or missing references) + //IL_1024: Expected O, but got Unknown + //IL_1031: Unknown result type (might be due to invalid IL or missing references) + //IL_103b: Expected O, but got Unknown + //IL_103e: Unknown result type (might be due to invalid IL or missing references) + //IL_1048: Expected O, but got Unknown + //IL_1062: Unknown result type (might be due to invalid IL or missing references) + //IL_106c: Expected O, but got Unknown + //IL_106f: Unknown result type (might be due to invalid IL or missing references) + //IL_1079: Expected O, but got Unknown + //IL_107c: Unknown result type (might be due to invalid IL or missing references) + //IL_1086: Expected O, but got Unknown + //IL_1089: Unknown result type (might be due to invalid IL or missing references) + //IL_1093: Expected O, but got Unknown + //IL_1096: Unknown result type (might be due to invalid IL or missing references) + //IL_10a0: Expected O, but got Unknown + //IL_10a3: Unknown result type (might be due to invalid IL or missing references) + //IL_10ad: Expected O, but got Unknown + //IL_10b0: Unknown result type (might be due to invalid IL or missing references) + //IL_10ba: Expected O, but got Unknown + //IL_10bd: Unknown result type (might be due to invalid IL or missing references) + //IL_10c7: Expected O, but got Unknown + //IL_10d4: Unknown result type (might be due to invalid IL or missing references) + //IL_10de: Expected O, but got Unknown + //IL_10eb: Unknown result type (might be due to invalid IL or missing references) + //IL_10f5: Expected O, but got Unknown + //IL_10f8: Unknown result type (might be due to invalid IL or missing references) + //IL_1102: Expected O, but got Unknown + //IL_1105: Unknown result type (might be due to invalid IL or missing references) + //IL_110f: Expected O, but got Unknown + //IL_1112: Unknown result type (might be due to invalid IL or missing references) + //IL_111c: Expected O, but got Unknown + //IL_111f: Unknown result type (might be due to invalid IL or missing references) + //IL_1129: Expected O, but got Unknown + //IL_112c: Unknown result type (might be due to invalid IL or missing references) + //IL_1136: Expected O, but got Unknown + //IL_1144: Unknown result type (might be due to invalid IL or missing references) + //IL_114e: Expected O, but got Unknown + //IL_115b: Unknown result type (might be due to invalid IL or missing references) + //IL_1165: Expected O, but got Unknown + //IL_1172: Unknown result type (might be due to invalid IL or missing references) + //IL_117c: Expected O, but got Unknown + //IL_117f: Unknown result type (might be due to invalid IL or missing references) + //IL_1189: Expected O, but got Unknown + //IL_1196: Unknown result type (might be due to invalid IL or missing references) + //IL_11a0: Expected O, but got Unknown + //IL_11a3: Unknown result type (might be due to invalid IL or missing references) + //IL_11ad: Expected O, but got Unknown + switch (connectionId) + { + case 1: + MenuApolice = (DockPanel)target; + break; + case 2: + IncluirpoliceButton = (MenuItem)target; + IncluirpoliceButton.Click += new RoutedEventHandler(IncluirApolice_OnClick); + break; + case 3: + AlterarApoliceButton = (MenuItem)target; + AlterarApoliceButton.Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 4: + SalvarApoliceButton = (MenuItem)target; + SalvarApoliceButton.Click += new RoutedEventHandler(SalvarApolice_OnClick); + break; + case 5: + CancelarApoliceButton = (MenuItem)target; + CancelarApoliceButton.Click += new RoutedEventHandler(CancelarApolice_OnClick); + break; + case 6: + ExcluirpoliceButton = (MenuItem)target; + ExcluirpoliceButton.Click += new RoutedEventHandler(ExcluirDocumento_OnClick); + break; + case 7: + ButtonImportado = (Button)target; + ((ButtonBase)ButtonImportado).Click += new RoutedEventHandler(Importacao_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirPerfil_OnClick); + break; + case 9: + ArquivoDigitalButton = (MenuItem)target; + ArquivoDigitalButton.Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 10: + MaisOpcoesButton = (MenuItem)target; + break; + case 11: + EditarParcelasButton = (MenuItem)target; + EditarParcelasButton.Click += new RoutedEventHandler(EditarParcelas_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(Renovar_OnClick); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(Perdido_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(Endossar_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(RecusarDocumento_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(ManutecaoItens_OnClick); + break; + case 17: + ((MenuItem)target).Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 18: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 19: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 20: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmailPF_OnClick); + break; + case 21: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogTrocaCliente_OnClick); + break; + case 22: + ((MenuItem)target).Click += new RoutedEventHandler(MenuItem_Click); + break; + case 23: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirInfo_OnClick); + break; + case 24: + ApoliceControl1 = (WrapPanel)target; + break; + case 25: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(Ramo_OnSelectionChanged); + break; + case 26: + ProdutoBox = (ComboBox)target; + break; + case 27: + SituacaoBox = (ComboBox)target; + break; + case 28: + NegocioCorretoraBox = (ComboBox)target; + break; + case 29: + TipoRecebimentoBox = (ComboBox)target; + break; + case 30: + TipoEndossoBox = (ComboBox)target; + break; + case 31: + ApoliceBox = (TextBox)target; + break; + case 32: + EndossoBox = (TextBox)target; + break; + case 33: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Initial_DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((DatePicker)target).SelectedDateChanged += ValidacaoDocumento; + break; + case 34: + Vigencia2Box = (DatePicker)target; + ((UIElement)Vigencia2Box).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)Vigencia2Box).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + Vigencia2Box.SelectedDateChanged += ValidacaoDocumento; + break; + case 35: + TransmissaoBox = (DatePicker)target; + ((UIElement)TransmissaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)TransmissaoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)TransmissaoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 36: + EmissaoBox = (DatePicker)target; + ((UIElement)EmissaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)EmissaoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)EmissaoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + EmissaoBox.SelectedDateChanged += ValidacaoDocumento; + break; + case 37: + FormaPagamentoBox = (ComboBox)target; + break; + case 38: + PremiosBox = (Grid)target; + break; + case 39: + AdicionalBox = (ToggleButton)target; + break; + case 40: + Comissao = (CustomIsReadOnlyControl)target; + break; + case 41: + ComissaoBox = (CurrencyTextBox)target; + break; + case 42: + PremioLiquidoBox = (CurrencyTextBox)target; + break; + case 43: + PremioAdicionalBox = (CurrencyTextBox)target; + ((UIElement)PremioAdicionalBox).GotFocus += new RoutedEventHandler(FocusPremios); + break; + case 44: + IofBox = (CurrencyTextBox)target; + break; + case 45: + DiferencaBox = (CurrencyTextBox)target; + break; + case 46: + PremioTotalBox = (CurrencyTextBox)target; + break; + case 47: + ParcelasBox = (CurrencyTextBox)target; + break; + case 48: + ComissaoOriginal = (CustomIsReadOnlyControl)target; + break; + case 49: + Gerada = (CustomIsReadOnlyControl)target; + break; + case 50: + Recebida = (CustomIsReadOnlyControl)target; + break; + case 51: + Pendente = (CustomIsReadOnlyControl)target; + break; + case 52: + Repasse = (CustomIsReadOnlyControl)target; + break; + case 53: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Button_Click); + break; + case 54: + BaixarParcelaButton = (Menu)target; + break; + case 55: + ((MenuItem)target).Click += new RoutedEventHandler(BaixarParcelas_Click); + break; + case 56: + ((MenuItem)target).Click += new RoutedEventHandler(AlterarParcela_Click); + break; + case 57: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirNovaFatura_Click); + break; + case 58: + ((MenuItem)target).Click += new RoutedEventHandler(ReplicarFatura_Click); + break; + case 59: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirParcelaEspecial_Click); + break; + case 60: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirParcela_Click); + break; + case 61: + SalvarParcelaButton = (Menu)target; + break; + case 62: + ((MenuItem)target).Click += new RoutedEventHandler(SalvarParcela_Click); + break; + case 63: + ((MenuItem)target).Click += new RoutedEventHandler(CancelarParcela_Click); + break; + case 64: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogParcelas_OnClick); + break; + case 65: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogParcelaSelecionada_OnClick); + break; + case 66: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogParcelaAntigo_OnClick); + break; + case 67: + EditarParcelasFields = (StackPanel)target; + break; + case 68: + TipoParcelaField = (CustomItemValidation)target; + break; + case 69: + TipoParcelaBox = (ComboBox)target; + break; + case 70: + QuantidadeFaturaField = (CustomItemControl)target; + break; + case 71: + QuantidadeFaturaBox = (CurrencyTextBox)target; + break; + case 72: + FaturaField = (CustomItemValidation)target; + break; + case 73: + FaturaBox = (TextBox)target; + break; + case 74: + VigenciaInicialField = (CustomItemValidation)target; + break; + case 75: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Vigencia_DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 76: + VigenciaFinalField = (CustomItemValidation)target; + break; + case 77: + VigenciaFinalParcelaBox = (DatePicker)target; + ((UIElement)VigenciaFinalParcelaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)VigenciaFinalParcelaBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)VigenciaFinalParcelaBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 78: + VencimentoField = (CustomItemValidation)target; + break; + case 79: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Vencimento_DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 80: + EmissaoField = (CustomItemControl)target; + break; + case 81: + EmissaoParcelaBox = (DatePicker)target; + ((UIElement)EmissaoParcelaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)EmissaoParcelaBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)EmissaoParcelaBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 82: + PercentualComissaoField = (CustomItemValidation)target; + break; + case 83: + ComissaoParcelaBox = (CurrencyTextBox)target; + break; + case 84: + ComissaoIcon = (TextBlock)target; + break; + case 85: + ValorLiquidoField = (CustomItemControl)target; + break; + case 86: + ValorLiquidoParcelaBox = (CurrencyTextBox)target; + break; + case 87: + ValorField = (CustomItemControl)target; + break; + case 88: + ValorParcelaBox = (CurrencyTextBox)target; + break; + case 89: + RecebimentoField = (CustomItemValidation)target; + break; + case 90: + RecebimentoParcelaBox = (DatePicker)target; + ((UIElement)RecebimentoParcelaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Vencimento_OnLostKeyboardFocus); + ((UIElement)RecebimentoParcelaBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)RecebimentoParcelaBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + RecebimentoParcelaBox.SelectedDateChanged += ValidacaoParcela; + break; + case 91: + QuitacaoField = (CustomItemControl)target; + break; + case 92: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((DatePicker)target).SelectedDateChanged += ValidacaoParcela; + break; + case 93: + DataControleParcelaField = (CustomItemControl)target; + break; + case 94: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((DatePicker)target).SelectedDateChanged += ValidacaoParcela; + break; + case 95: + CreditoField = (CustomItemValidation)target; + break; + case 96: + CreditoParcelaBox = (DatePicker)target; + ((UIElement)CreditoParcelaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)CreditoParcelaBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)CreditoParcelaBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + CreditoParcelaBox.SelectedDateChanged += ValidacaoParcela; + break; + case 97: + ValorRealizadoField = (CustomItemValidation)target; + break; + case 98: + ValorRealizadoParcelaBox = (CurrencyTextBox)target; + ((UIElement)ValorRealizadoParcelaBox).LostFocus += new RoutedEventHandler(ValorRealizadoParcelaBox_OnLostFocus); + break; + case 99: + ValorComissaoField = (CustomItemValidation)target; + break; + case 100: + ValorComissaoParcelaBox = (CurrencyTextBox)target; + ValorComissaoParcelaBox.NumberChanged += CalculoComissao_OnNumberChanged; + break; + case 101: + ImpostosField = (WrapPanel)target; + break; + case 102: + PorcentagemIrField = (CustomItemControl)target; + break; + case 103: + PorcentagemIrBox = (CurrencyTextBox)target; + PorcentagemIrBox.NumberChanged += PorcentagemIrBox_OnNumberChanged; + break; + case 104: + ValorIrField = (CustomItemControl)target; + break; + case 105: + ValorIrBox = (CurrencyTextBox)target; + ValorIrBox.NumberChanged += ValorImposto_OnNumberChanged; + break; + case 106: + PorcentagemIssField = (CustomItemControl)target; + break; + case 107: + PorcentagemIssBox = (CurrencyTextBox)target; + PorcentagemIssBox.NumberChanged += PorcentagemIssBox_OnNumberChanged; + break; + case 108: + ValorIssField = (CustomItemControl)target; + break; + case 109: + ValorIssBox = (CurrencyTextBox)target; + ValorIssBox.NumberChanged += ValorImposto_OnNumberChanged; + break; + case 110: + ValorOutrosField = (CustomItemControl)target; + break; + case 111: + ValorOutrosBox = (CurrencyTextBox)target; + ValorOutrosBox.NumberChanged += ValorImposto_OnNumberChanged; + break; + case 112: + ValorDescontoField = (CustomItemControl)target; + break; + case 113: + ValorDescontoBox = (CurrencyTextBox)target; + ValorDescontoBox.NumberChanged += ValorImposto_OnNumberChanged; + break; + case 114: + ValorComDescField = (CustomItemControl)target; + break; + case 115: + ValorComDescBox = (CurrencyTextBox)target; + ValorComDescBox.NumberChanged += ValorImposto_OnNumberChanged; + break; + case 116: + ParcelaGrid = (DataGrid)target; + break; + case 117: + ParcelaColumn = (DataGridTextColumn)target; + break; + case 118: + FaturaColumn = (DataGridTextColumn)target; + break; + case 119: + VigenciaInicialColumn = (DataGridTextColumn)target; + break; + case 120: + VigenciaFinalColumn = (DataGridTextColumn)target; + break; + case 121: + ParcelasComissaoColumn = (DataGridTextColumn)target; + break; + case 122: + ParcelasValorComissaoColumn = (DataGridTextColumn)target; + break; + case 123: + ParcelasValorComissaoDescColumn = (DataGridTextColumn)target; + break; + case 124: + MaisInformacoesColumn = (DataGridTemplateColumn)target; + break; + case 127: + EditarVendedorButton = (MenuItem)target; + EditarVendedorButton.Click += new RoutedEventHandler(IncluirVendedor_Click); + break; + case 128: + SalvarVendedorButton = (MenuItem)target; + SalvarVendedorButton.Click += new RoutedEventHandler(SalvarVendedor_Click); + break; + case 129: + CancelarVendedorButton = (MenuItem)target; + CancelarVendedorButton.Click += new RoutedEventHandler(CancelarVendedor_Click); + break; + case 130: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogVendedor_OnClick); + break; + case 131: + EditarVendedorFields = (WrapPanel)target; + break; + case 132: + CoCorretagemToogle = (ToggleButton)target; + ((ButtonBase)CoCorretagemToogle).Click += new RoutedEventHandler(AdicionarCoCorretagem_OnClick); + break; + case 133: + TipoVendedorBox = (ComboBox)target; + break; + case 134: + VendedorBox = (ComboBox)target; + break; + case 135: + ComissaoNovoBox = (CustomItemValidation)target; + break; + case 136: + ComissaoNovoComboBox = (ComboBox)target; + ((Selector)ComissaoNovoComboBox).SelectionChanged += new SelectionChangedEventHandler(ComissaoVendedorBox_OnSelectionChanged); + break; + case 137: + ComissaoRenovacaoBox = (CustomItemValidation)target; + break; + case 138: + ComissaoRenovacaoComboBox = (ComboBox)target; + ((Selector)ComissaoRenovacaoComboBox).SelectionChanged += new SelectionChangedEventHandler(ComissaoVendedorBox_OnSelectionChanged); + break; + case 139: + ValorRepasseBox = (CurrencyTextBox)target; + ValorRepasseBox.NumberChanged += CalculoComissao_OnNumberChanged; + break; + case 140: + FormaRecebidaBox = (TextBox)target; + break; + case 141: + FormaIncidenciaBox = (TextBox)target; + break; + case 142: + VendedorGrid = (DataGrid)target; + break; + case 143: + VendedorGridColumn = (DataGridTextColumn)target; + break; + case 144: + PagamentosPorcentagemRepasseColumn = (DataGridTextColumn)target; + break; + case 145: + PagamentosValorRepasseColumn = (DataGridTextColumn)target; + break; + case 147: + ProponenteBox = (TextBox)target; + break; + case 148: + AutoCompleteBanco = (AutoCompleteBox)target; + AutoCompleteBanco.Populating += new PopulatingEventHandler(AutoCompleteBancoBox_Populating); + ((UIElement)AutoCompleteBanco).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(AutoCompleteBanco_OnLostKeyboardFocus); + break; + case 149: + AgenciaBox = (TextBox)target; + break; + case 150: + ContaBox = (TextBox)target; + break; + case 151: + CartaoBox = (TextBox)target; + break; + case 152: + BandeiraBox = (ComboBox)target; + break; + case 153: + VencimentoCartaoBox = (TextBox)target; + ((UIElement)VencimentoCartaoBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((TextBoxBase)VencimentoCartaoBox).TextChanged += new TextChangedEventHandler(VencimentoCartaoBox_OnTextChanged); + ((UIElement)VencimentoCartaoBox).GotFocus += new RoutedEventHandler(VencimentoCartaoBox_OnGotFocus); + break; + case 154: + DataBox = (DatePicker)target; + ((Control)DataBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 155: + PastaBox = (TextBox)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Expected O, but got Unknown + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Expected O, but got Unknown + switch (connectionId) + { + case 125: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ValoresParcelaInfo_OnClick); + break; + case 126: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 146: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirVendedor_Click); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/ClienteView.cs b/Decompiler/Gestor.Application.Views.Seguros/ClienteView.cs new file mode 100644 index 0000000..a05df26 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/ClienteView.cs @@ -0,0 +1,1261 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +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; +using System.Windows.Threading; +using CurrencyTextBoxControl; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Generic; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Seguros; + +public class ClienteView : BaseUserControl, IComponentConnector, IStyleConnector +{ + public ClienteViewModel ViewModel; + + internal Grid MainGrid; + + internal MenuItem IncluirClienteButton; + + internal ComboBox TipoDocumentoPrincipalBox; + + internal TextBox DocumentoPrincipalBox; + + internal TextBox NomeBox; + + internal TextBox NomeSocialBox; + + internal TextBox CaepfBox; + + internal TextBox RneBox; + + internal TextBox CeiBox; + + internal TextBox IdentidadeBox; + + internal TextBox EmissorBox; + + internal TextBox EstadoEmissorBox; + + internal TextBox HabilitacaoBox; + + internal TextBox CategoriaHabilitacaooBox; + + internal ComboBox SexoBox; + + internal ComboBox EstadoCivilBox; + + internal AutoCompleteBox AutoCompleteProfissao; + + internal AutoCompleteBox AutoCompleteAtividade; + + internal TextBox ResponsavelBox; + + internal TextBox DocumentoResponsavel; + + internal TextBox EmailBox; + + internal TextBox PastaBox; + + internal AutoCompleteBox AutoCompleteBanco; + + internal TextBox AgenciaBox; + + internal TextBox TipoContaBox; + + internal TextBox ContaBox; + + internal CurrencyTextBox RendaMensalBox; + + internal ListBox TelefoneListBox; + + internal ListBox EmailListBox; + + internal ListBox EnderecoListBox; + + internal AutoCompleteBox VinculoBox; + + internal TextBox NomeOrigemBox; + + internal ListBox ContatosListBox; + + private bool _contentLoaded; + + private static int Ordem { get; set; } + + public ClienteView(Cliente cliente = null, bool lockInsert = false, ClienteViewModel viewModel = null) + { + ((FrameworkElement)this).Tag = "CADASTRO DE CLIENTES"; + ViewModel = viewModel ?? new ClienteViewModel(cliente, !lockInsert); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + if (lockInsert) + { + ((UIElement)IncluirClienteButton).IsEnabled = false; + } + if (cliente != null) + { + ViewModel.RegistrarAcao("ACESSOU CLIENTE \"" + cliente.Nome + "\"", ((DomainBase)cliente).Id, (TipoTela)1, $"ID CLIENTE: {((DomainBase)cliente).Id}"); + } + } + + private void ContentLoad() + { + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Expected O, but got Unknown + ((FrameworkElement)TelefoneListBox).DataContext = ViewModel; + ((FrameworkElement)EmailListBox).DataContext = ViewModel; + ((FrameworkElement)EnderecoListBox).DataContext = ViewModel; + ((FrameworkElement)ContatosListBox).DataContext = ViewModel; + ((UIElement)DocumentoResponsavel).LostFocus += new RoutedEventHandler(Validar_LostFocus); + if (ViewModel.SelectedCliente != null) + { + AutoCompleteBox autoCompleteBanco = AutoCompleteBanco; + Banco banco = ViewModel.SelectedCliente.Banco; + autoCompleteBanco.Text = ((banco != null) ? banco.Nome : null); + AutoCompleteBox autoCompleteAtividade = AutoCompleteAtividade; + Atividade atividade = ViewModel.SelectedCliente.Atividade; + autoCompleteAtividade.Text = ((atividade != null) ? atividade.Nome : null); + AutoCompleteBox autoCompleteProfissao = AutoCompleteProfissao; + Profissao profissao = ViewModel.SelectedCliente.Profissao; + autoCompleteProfissao.Text = ((profissao != null) ? profissao.Nome : null); + } + } + + private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Expected O, but got Unknown + //IL_0098: Unknown result type (might be due to invalid IL or missing references) + if (((TextBoxBase)(TextBox)sender).IsReadOnly) + { + return; + } + TextBox val = (TextBox)sender; + string text = ValidationHelper.Clear(val.Text); + if (string.IsNullOrEmpty(text)) + { + return; + } + val.Text = ((text.Length == 11) ? ValidationHelper.FormatDocument(text.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(text.PadLeft(14, '0').Substring(0, 14))); + if (((FrameworkElement)val).Name == "DocumentoPrincipalBox") + { + ViewModel.JuridicaouFisica(DocumentoPrincipalBox.Text); + if ((int)ViewModel.VisibilityFisica == 0) + { + ResponsavelBox.Text = string.Empty; + DocumentoResponsavel.Text = string.Empty; + EmailBox.Text = string.Empty; + } + } + } + + private void IncluirEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirEmail(); + ValidarTela(); + } + + private void IncluirEndereco_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirEndereco(); + ValidarTela(); + } + + private void IncluirTelefone_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirTelefone(); + } + + private void ExcluirTelefone_OnClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + ClienteTelefone telefone = (ClienteTelefone)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + ViewModel.ExcluirTelefone(telefone); + } + } + + private void ExcluirEmail_OnClick(object sender, RoutedEventArgs e) + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + ClienteEmail email = (ClienteEmail)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + ViewModel.ExcluirEmail(email); + } + } + + private void ExcluirEndereco_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + Grid val = Extentions.FindVisualAncestor<Grid>((DependencyObject)(Button)sender); + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + ClienteEndereco endereco = (ClienteEndereco)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + ViewModel.ExcluirEndereco(endereco); + } + + private void IncluirMaisContatos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirContato(); + } + + private void IncluirVinculo_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.IncluirVinculo()) + { + VinculoBox.Text = ""; + } + } + + private void ExcluirMaisContatos_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + MaisContato contato = (MaisContato)((FrameworkElement)val).DataContext; + ViewModel.ExcluirContato(contato); + } + } + + private void ExcluirVinculo_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + Button val = (Button)sender; + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ClienteVinculo vinculo = (ClienteVinculo)((FrameworkElement)val).DataContext; + ViewModel.ExcluirVinculo(vinculo); + } + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.IncluirCliente(); + DocumentoPrincipalBox.Text = ""; + AutoCompleteBanco.Text = ""; + AutoCompleteProfissao.Text = ""; + AutoCompleteAtividade.Text = ""; + ((UIElement)DocumentoPrincipalBox).Focus(); + ValidarTela(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + ClearInputFields(); + ValidarTela(); + ((DomainBase)ViewModel.SelectedCliente).Initialize(); + InitializeResponsavelAssinatura(); + ViewModel.Salvando = false; + } + + private void InitializeResponsavelAssinatura() + { + TextBox responsavelBox = ResponsavelBox; + ResponsavelAssinatura responsavelAssinatura = ViewModel.SelectedCliente.ResponsavelAssinatura; + responsavelBox.Text = ((responsavelAssinatura != null) ? responsavelAssinatura.NomeResponsavel : null) ?? string.Empty; + TextBox documentoResponsavel = DocumentoResponsavel; + ResponsavelAssinatura responsavelAssinatura2 = ViewModel.SelectedCliente.ResponsavelAssinatura; + documentoResponsavel.Text = ((responsavelAssinatura2 != null) ? responsavelAssinatura2.DocumentoResponsavel : null) ?? string.Empty; + TextBox emailBox = EmailBox; + ResponsavelAssinatura responsavelAssinatura3 = ViewModel.SelectedCliente.ResponsavelAssinatura; + emailBox.Text = ((responsavelAssinatura3 != null) ? responsavelAssinatura3.EmailResponsavel : null) ?? string.Empty; + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ClearInputFields(); + SetValid(AutoCompleteBanco, valid: true); + ViewModel.CancelarAlteracao(); + } + + private void ClearInputFields() + { + AutoCompleteBox autoCompleteBanco = AutoCompleteBanco; + Banco banco = ViewModel.SelectedCliente.Banco; + autoCompleteBanco.Text = ((banco != null) ? banco.Nome : null) ?? string.Empty; + AutoCompleteBox autoCompleteProfissao = AutoCompleteProfissao; + Profissao profissao = ViewModel.SelectedCliente.Profissao; + autoCompleteProfissao.Text = ((profissao != null) ? profissao.Nome : null) ?? string.Empty; + AutoCompleteBox autoCompleteProfissao2 = AutoCompleteProfissao; + Profissao profissao2 = ViewModel.SelectedCliente.Profissao; + autoCompleteProfissao2.Text = ((profissao2 != null) ? profissao2.Nome : null) ?? string.Empty; + AutoCompleteBox autoCompleteAtividade = AutoCompleteAtividade; + Atividade atividade = ViewModel.SelectedCliente.Atividade; + autoCompleteAtividade.Text = ((atividade != null) ? atividade.Nome : null) ?? string.Empty; + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ViewModel.ProfissaoText = AutoCompleteProfissao.Text; + ViewModel.AtividadeText = AutoCompleteAtividade.Text; + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + SetValid(AutoCompleteBanco, valid: true); + } + else + { + await ViewModel.ShowMessage(list.Distinct().ToList(), ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)1).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + EnumHelper.GetDescription<TipoArquivoDigital>((TipoArquivoDigital)1) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedCliente).Id, + Tipo = (TipoArquivoDigital)1, + Parente = ViewModel.SelectedCliente + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private async void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) + { + TextBox val = (TextBox)sender; + if (((TextBoxBase)val).IsReadOnly || string.IsNullOrWhiteSpace(val.Text)) + { + return; + } + string text = ValidationHelper.FormatPostCode(val.Text); + WrapPanel val2 = Extentions.FindVisualAncestor<WrapPanel>((DependencyObject)(object)val); + ListBox val3 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val2); + ListBoxItem val4 = (ListBoxItem)((ItemsControl)val3).ItemContainerGenerator.ContainerFromIndex(((CollectionView)((ItemsControl)val3).Items).IndexOf(((FrameworkElement)val2).DataContext)); + ContentPresenter contentPresenter = FindVisualChild.Find<ContentPresenter>((DependencyObject)(object)val4); + DataTemplate dataTemplate = contentPresenter.ContentTemplate; + TextBox val5 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("CepBox", (FrameworkElement)(object)contentPresenter); + ProgressBar progress = (ProgressBar)((FrameworkTemplate)dataTemplate).FindName("ProgressCep", (FrameworkElement)(object)contentPresenter); + ((UIElement)progress).Visibility = (Visibility)0; + val5.Text = text; + if (!ValidationHelper.ValidatePostCode(text)) + { + ((UIElement)progress).Visibility = (Visibility)2; + return; + } + EnderecoBase val6 = await ViewModel.BuscaCep(text); + if (val6 == null) + { + ((UIElement)progress).Visibility = (Visibility)2; + return; + } + TextBox val7 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("EnderecoBox", (FrameworkElement)(object)contentPresenter); + TextBox val8 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("CidadeBox", (FrameworkElement)(object)contentPresenter); + TextBox val9 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("EstadoBox", (FrameworkElement)(object)contentPresenter); + TextBox val10 = (TextBox)((FrameworkTemplate)dataTemplate).FindName("BairroBox", (FrameworkElement)(object)contentPresenter); + val7.Text = val6.Endereco; + val8.Text = val6.Cidade; + val9.Text = val6.Estado; + val10.Text = val6.Bairro; + ((UIElement)progress).Visibility = (Visibility)2; + } + + public override void FormatarDocumento(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + TextBox val = (TextBox)sender; + val.Text = ValidationHelper.FormatDocument(val.Text); + ViewModel.JuridicaouFisica(val.Text); + } + + private void ValidarTela() + { + if (ViewModel.SelectedCliente != null) + { + List<KeyValuePair<string, string>> list = ViewModel.SelectedCliente.Validate(); + if (Recursos.Configuracoes.All((ConfiguracaoSistema x) => (int)x.Configuracao != 29)) + { + ClienteEmail? obj = ViewModel.Emails.FirstOrDefault(); + list.AddRange(((obj != null) ? obj.Validate() : null) ?? new List<KeyValuePair<string, string>>()); + } + ClienteTelefone? obj2 = ViewModel.Telefones.FirstOrDefault(); + list.AddRange(((obj2 != null) ? obj2.Validate() : null) ?? new List<KeyValuePair<string, string>>()); + ClienteEndereco? obj3 = ViewModel.Enderecos.FirstOrDefault(); + list.AddRange(((obj3 != null) ? obj3.Validate() : null) ?? new List<KeyValuePair<string, string>>()); + ((DependencyObject)(object)this).ValidateFields(list, focusField: false); + } + } + + private void AutoCompleteProfissaoBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 1) + { + return; + } + e.Cancel = true; + ViewModel.BuscarProfissao(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Profissao>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteAtividadeBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 1) + { + return; + } + e.Cancel = true; + ViewModel.BuscarAtividade(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Atividade>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBancoBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarBanco(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Banco>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteParentescoBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarClienteVinculo(ValidationHelper.RemoveDiacritics(e.Parameter.Trim()), ((DomainBase)ViewModel.SelectedCliente).Id).ContinueWith(delegate(Task<List<Cliente>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void OrdemBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + TextBox val = (TextBox)((sender is TextBox) ? sender : null); + if (val == null || ((TextBoxBase)val).IsReadOnly || !int.TryParse(val.Text, out var result)) + { + return; + } + WrapPanel val2 = Extentions.FindVisualAncestor<WrapPanel>((DependencyObject)(object)Extentions.FindVisualAncestor<CustomItemValidation>((DependencyObject)(object)val)); + ListBox val3 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val2); + if (val3 == null) + { + return; + } + for (int i = 0; i < ((CollectionView)((ItemsControl)val3).Items).Count; i++) + { + if (i != ((CollectionView)((ItemsControl)val3).Items).IndexOf(((FrameworkElement)val2).DataContext)) + { + ContentPresenter val4 = FindVisualChild.Find<ContentPresenter>((DependencyObject)(ListBoxItem)((ItemsControl)val3).ItemContainerGenerator.ContainerFromIndex(i)); + TextBox val5 = (TextBox)((FrameworkTemplate)val4.ContentTemplate).FindName("OrdemBox", (FrameworkElement)(object)val4); + if (int.TryParse(val5.Text, out var result2) && result2 == result) + { + val5.Text = Ordem.ToString(); + } + } + } + } + + private void OrdemBox_OnPreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + TextBox val = (TextBox)((sender is TextBox) ? sender : null); + if (val != null && int.TryParse(val.Text, out var result)) + { + Ordem = result; + } + } + + private void AbrirLog_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)1, ((DomainBase)ViewModel.SelectedCliente).Id); + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogEmail((TipoTela)1, ((DomainBase)ViewModel.SelectedCliente).Id); + } + + private void TipoComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Expected O, but got Unknown + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a3: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + CustomIsReadOnlyControl customIsReadOnlyControl = Extentions.FindVisualAncestor<CustomIsReadOnlyControl>((DependencyObject)(object)val); + if (customIsReadOnlyControl == null) + { + return; + } + WrapPanel val2 = Extentions.FindVisualAncestor<WrapPanel>((DependencyObject)(object)customIsReadOnlyControl); + ListBox val3 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val2); + ContentPresenter val4 = FindVisualChild.Find<ContentPresenter>((DependencyObject)(ListBoxItem)((ItemsControl)val3).ItemContainerGenerator.ContainerFromIndex(((CollectionView)((ItemsControl)val3).Items).IndexOf(((FrameworkElement)val2).DataContext))); + DataTemplate contentTemplate = val4.ContentTemplate; + CustomItemValidation customItemValidation = (CustomItemValidation)((FrameworkTemplate)contentTemplate).FindName("Prefixo", (FrameworkElement)(object)val4); + CustomItemValidation depObj = (CustomItemValidation)((FrameworkTemplate)contentTemplate).FindName("Telefone", (FrameworkElement)(object)val4); + TextBox? obj = ((DependencyObject)(object)customItemValidation).FindChildren<TextBox>().FirstOrDefault(); + TextBox val5 = ((DependencyObject)(object)depObj).FindChildren<TextBox>().FirstOrDefault(); + if (obj != null && val5 != null) + { + if ((int)(TipoTelefone)((Selector)val).SelectedValue != 8) + { + ((UIElement)customItemValidation).Visibility = (Visibility)0; + val5.MaxLength = 10; + int length = ((val5.Text.Length >= 10) ? 10 : val5.Text.Length); + val5.Text = val5.Text.Substring(0, length); + } + else + { + ((UIElement)customItemValidation).Visibility = (Visibility)2; + val5.MaxLength = 20; + } + } + } + + private void AutoCompleteBanco_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + AutoCompleteBox val = (AutoCompleteBox)sender; + SetValid(val, string.IsNullOrWhiteSpace(val.Text) || ViewModel.SelectedCliente.Banco != null); + } + + private static void SetValid(AutoCompleteBox autocomplete, bool valid) + { + ViewHelper.SetInvalid((Control)(object)autocomplete, "BANCO INVÁLIDO", valid); + } + + private void Tarefa_Click(object sender, RoutedEventArgs e) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Expected O, but got Unknown + Tarefa tarefa = new Tarefa + { + IdCliente = ((DomainBase)ViewModel.SelectedCliente).Id, + Cliente = ViewModel.SelectedCliente.Nome, + Entidade = (TipoTarefa)2, + IdEntidade = ((DomainBase)ViewModel.SelectedCliente).Id, + Titulo = ViewModel.SelectedCliente.Nome + }; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa), 0, close: false); + } + + private void Validar_LostFocus(object sender, RoutedEventArgs e) + { + ValidarTela(); + } + + private async void ExcluirOrigem_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext != null) + { + ViewModel.Loading(isLoading: true); + await ViewModel.ExcluirOrigem((OrigemCliente)((FrameworkElement)val).DataContext); + ViewModel.Loading(isLoading: false); + } + } + + private async void IncluirOrigem_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + await ViewModel.IncluirOrigem(NomeOrigemBox.Text.Trim()); + NomeOrigemBox.Text = string.Empty; + ViewModel.Loading(isLoading: false); + } + + private void MenuItem_Click(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLogAntigo(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/clienteview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0113: Unknown result type (might be due to invalid IL or missing references) + //IL_011d: Expected O, but got Unknown + //IL_0120: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Expected O, but got Unknown + //IL_0137: Unknown result type (might be due to invalid IL or missing references) + //IL_0141: Expected O, but got Unknown + //IL_0143: Unknown result type (might be due to invalid IL or missing references) + //IL_014f: Unknown result type (might be due to invalid IL or missing references) + //IL_0159: Expected O, but got Unknown + //IL_015b: Unknown result type (might be due to invalid IL or missing references) + //IL_0167: Unknown result type (might be due to invalid IL or missing references) + //IL_0171: Expected O, but got Unknown + //IL_0173: Unknown result type (might be due to invalid IL or missing references) + //IL_017f: Unknown result type (might be due to invalid IL or missing references) + //IL_0189: Expected O, but got Unknown + //IL_018b: Unknown result type (might be due to invalid IL or missing references) + //IL_0197: Unknown result type (might be due to invalid IL or missing references) + //IL_01a1: Expected O, but got Unknown + //IL_01a3: Unknown result type (might be due to invalid IL or missing references) + //IL_01af: Unknown result type (might be due to invalid IL or missing references) + //IL_01b9: Expected O, but got Unknown + //IL_01bb: Unknown result type (might be due to invalid IL or missing references) + //IL_01c7: Unknown result type (might be due to invalid IL or missing references) + //IL_01d1: Expected O, but got Unknown + //IL_01d3: Unknown result type (might be due to invalid IL or missing references) + //IL_01df: Unknown result type (might be due to invalid IL or missing references) + //IL_01e9: Expected O, but got Unknown + //IL_01eb: Unknown result type (might be due to invalid IL or missing references) + //IL_01f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0201: Expected O, but got Unknown + //IL_0203: Unknown result type (might be due to invalid IL or missing references) + //IL_020f: Unknown result type (might be due to invalid IL or missing references) + //IL_0219: Expected O, but got Unknown + //IL_021c: Unknown result type (might be due to invalid IL or missing references) + //IL_0226: Expected O, but got Unknown + //IL_0229: Unknown result type (might be due to invalid IL or missing references) + //IL_0233: Expected O, but got Unknown + //IL_0241: Unknown result type (might be due to invalid IL or missing references) + //IL_024b: Expected O, but got Unknown + //IL_0258: Unknown result type (might be due to invalid IL or missing references) + //IL_0262: Expected O, but got Unknown + //IL_0265: Unknown result type (might be due to invalid IL or missing references) + //IL_026f: Expected O, but got Unknown + //IL_0272: Unknown result type (might be due to invalid IL or missing references) + //IL_027c: Expected O, but got Unknown + //IL_027e: Unknown result type (might be due to invalid IL or missing references) + //IL_028a: Unknown result type (might be due to invalid IL or missing references) + //IL_0294: Expected O, but got Unknown + //IL_0295: Unknown result type (might be due to invalid IL or missing references) + //IL_02a1: Unknown result type (might be due to invalid IL or missing references) + //IL_02ab: Expected O, but got Unknown + //IL_02ac: Unknown result type (might be due to invalid IL or missing references) + //IL_02b8: Unknown result type (might be due to invalid IL or missing references) + //IL_02c2: Expected O, but got Unknown + //IL_02c3: Unknown result type (might be due to invalid IL or missing references) + //IL_02cf: Unknown result type (might be due to invalid IL or missing references) + //IL_02d9: Expected O, but got Unknown + //IL_02dc: Unknown result type (might be due to invalid IL or missing references) + //IL_02e6: Expected O, but got Unknown + //IL_02e9: Unknown result type (might be due to invalid IL or missing references) + //IL_02f3: Expected O, but got Unknown + //IL_02f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0300: Expected O, but got Unknown + //IL_0303: Unknown result type (might be due to invalid IL or missing references) + //IL_030d: Expected O, but got Unknown + //IL_0310: Unknown result type (might be due to invalid IL or missing references) + //IL_031a: Expected O, but got Unknown + //IL_0327: Unknown result type (might be due to invalid IL or missing references) + //IL_0331: Expected O, but got Unknown + //IL_0334: Unknown result type (might be due to invalid IL or missing references) + //IL_033e: Expected O, but got Unknown + //IL_034b: Unknown result type (might be due to invalid IL or missing references) + //IL_0355: Expected O, but got Unknown + //IL_0357: Unknown result type (might be due to invalid IL or missing references) + //IL_0363: Unknown result type (might be due to invalid IL or missing references) + //IL_036d: Expected O, but got Unknown + //IL_036e: Unknown result type (might be due to invalid IL or missing references) + //IL_037a: Unknown result type (might be due to invalid IL or missing references) + //IL_0384: Expected O, but got Unknown + //IL_0385: Unknown result type (might be due to invalid IL or missing references) + //IL_0391: Unknown result type (might be due to invalid IL or missing references) + //IL_039b: Expected O, but got Unknown + //IL_039c: Unknown result type (might be due to invalid IL or missing references) + //IL_03a8: Unknown result type (might be due to invalid IL or missing references) + //IL_03b2: Expected O, but got Unknown + //IL_03b5: Unknown result type (might be due to invalid IL or missing references) + //IL_03bf: Expected O, but got Unknown + //IL_03cd: Unknown result type (might be due to invalid IL or missing references) + //IL_03d7: Expected O, but got Unknown + //IL_03da: Unknown result type (might be due to invalid IL or missing references) + //IL_03e4: Expected O, but got Unknown + //IL_03f2: Unknown result type (might be due to invalid IL or missing references) + //IL_03fc: Expected O, but got Unknown + //IL_03fe: Unknown result type (might be due to invalid IL or missing references) + //IL_040a: Unknown result type (might be due to invalid IL or missing references) + //IL_0414: Expected O, but got Unknown + //IL_0415: Unknown result type (might be due to invalid IL or missing references) + //IL_0421: Unknown result type (might be due to invalid IL or missing references) + //IL_042b: Expected O, but got Unknown + //IL_042c: Unknown result type (might be due to invalid IL or missing references) + //IL_0438: Unknown result type (might be due to invalid IL or missing references) + //IL_0442: Expected O, but got Unknown + //IL_0444: Unknown result type (might be due to invalid IL or missing references) + //IL_0450: Unknown result type (might be due to invalid IL or missing references) + //IL_045a: Expected O, but got Unknown + //IL_045b: Unknown result type (might be due to invalid IL or missing references) + //IL_0467: Unknown result type (might be due to invalid IL or missing references) + //IL_0471: Expected O, but got Unknown + //IL_0472: Unknown result type (might be due to invalid IL or missing references) + //IL_047e: Unknown result type (might be due to invalid IL or missing references) + //IL_0488: Expected O, but got Unknown + //IL_048b: Unknown result type (might be due to invalid IL or missing references) + //IL_0495: Expected O, but got Unknown + //IL_0498: Unknown result type (might be due to invalid IL or missing references) + //IL_04a2: Expected O, but got Unknown + //IL_04a5: Unknown result type (might be due to invalid IL or missing references) + //IL_04af: Expected O, but got Unknown + //IL_04bc: Unknown result type (might be due to invalid IL or missing references) + //IL_04c6: Expected O, but got Unknown + //IL_04c9: Unknown result type (might be due to invalid IL or missing references) + //IL_04d3: Expected O, but got Unknown + //IL_04e0: Unknown result type (might be due to invalid IL or missing references) + //IL_04ea: Expected O, but got Unknown + //IL_04ed: Unknown result type (might be due to invalid IL or missing references) + //IL_04f7: Expected O, but got Unknown + //IL_0504: Unknown result type (might be due to invalid IL or missing references) + //IL_050e: Expected O, but got Unknown + //IL_0511: Unknown result type (might be due to invalid IL or missing references) + //IL_051b: Expected O, but got Unknown + //IL_0529: Unknown result type (might be due to invalid IL or missing references) + //IL_0533: Expected O, but got Unknown + //IL_0540: Unknown result type (might be due to invalid IL or missing references) + //IL_054a: Expected O, but got Unknown + //IL_054d: Unknown result type (might be due to invalid IL or missing references) + //IL_0557: Expected O, but got Unknown + //IL_0564: Unknown result type (might be due to invalid IL or missing references) + //IL_056e: Expected O, but got Unknown + //IL_0570: Unknown result type (might be due to invalid IL or missing references) + //IL_057c: Unknown result type (might be due to invalid IL or missing references) + //IL_0586: Expected O, but got Unknown + //IL_0587: Unknown result type (might be due to invalid IL or missing references) + //IL_0593: Unknown result type (might be due to invalid IL or missing references) + //IL_059d: Expected O, but got Unknown + //IL_059e: Unknown result type (might be due to invalid IL or missing references) + //IL_05aa: Unknown result type (might be due to invalid IL or missing references) + //IL_05b4: Expected O, but got Unknown + //IL_05b7: Unknown result type (might be due to invalid IL or missing references) + //IL_05c1: Expected O, but got Unknown + //IL_05c4: Unknown result type (might be due to invalid IL or missing references) + //IL_05ce: Expected O, but got Unknown + //IL_05db: Unknown result type (might be due to invalid IL or missing references) + //IL_05e5: Expected O, but got Unknown + //IL_05f2: Unknown result type (might be due to invalid IL or missing references) + //IL_05fc: Expected O, but got Unknown + //IL_05ff: Unknown result type (might be due to invalid IL or missing references) + //IL_0609: Expected O, but got Unknown + //IL_060c: Unknown result type (might be due to invalid IL or missing references) + //IL_0616: Expected O, but got Unknown + //IL_0619: Unknown result type (might be due to invalid IL or missing references) + //IL_0623: Expected O, but got Unknown + //IL_0626: Unknown result type (might be due to invalid IL or missing references) + //IL_0630: Expected O, but got Unknown + //IL_0632: Unknown result type (might be due to invalid IL or missing references) + //IL_063e: Unknown result type (might be due to invalid IL or missing references) + //IL_0648: Expected O, but got Unknown + //IL_064b: Unknown result type (might be due to invalid IL or missing references) + //IL_0655: Expected O, but got Unknown + //IL_0657: Unknown result type (might be due to invalid IL or missing references) + //IL_0663: Unknown result type (might be due to invalid IL or missing references) + //IL_066d: Expected O, but got Unknown + //IL_0670: Unknown result type (might be due to invalid IL or missing references) + //IL_067a: Expected O, but got Unknown + //IL_067c: Unknown result type (might be due to invalid IL or missing references) + //IL_0688: Unknown result type (might be due to invalid IL or missing references) + //IL_0692: Expected O, but got Unknown + //IL_0695: Unknown result type (might be due to invalid IL or missing references) + //IL_069f: Expected O, but got Unknown + //IL_06a2: Unknown result type (might be due to invalid IL or missing references) + //IL_06ac: Expected O, but got Unknown + //IL_06b9: Unknown result type (might be due to invalid IL or missing references) + //IL_06c3: Expected O, but got Unknown + //IL_06c5: Unknown result type (might be due to invalid IL or missing references) + //IL_06d1: Unknown result type (might be due to invalid IL or missing references) + //IL_06db: Expected O, but got Unknown + //IL_06de: Unknown result type (might be due to invalid IL or missing references) + //IL_06e8: Expected O, but got Unknown + //IL_06ea: Unknown result type (might be due to invalid IL or missing references) + //IL_06f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0700: Expected O, but got Unknown + //IL_0702: Unknown result type (might be due to invalid IL or missing references) + //IL_070e: Unknown result type (might be due to invalid IL or missing references) + //IL_0718: Expected O, but got Unknown + //IL_071b: Unknown result type (might be due to invalid IL or missing references) + //IL_0725: Expected O, but got Unknown + switch (connectionId) + { + case 1: + MainGrid = (Grid)target; + break; + case 2: + IncluirClienteButton = (MenuItem)target; + IncluirClienteButton.Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Tarefa_Click); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLog_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(MenuItem_Click); + break; + case 12: + TipoDocumentoPrincipalBox = (ComboBox)target; + break; + case 13: + DocumentoPrincipalBox = (TextBox)target; + ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus); + break; + case 14: + NomeBox = (TextBox)target; + break; + case 15: + NomeSocialBox = (TextBox)target; + break; + case 16: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewTextInput += new TextCompositionEventHandler(base.SomenteData); + break; + case 17: + CaepfBox = (TextBox)target; + break; + case 18: + RneBox = (TextBox)target; + break; + case 19: + CeiBox = (TextBox)target; + break; + case 20: + IdentidadeBox = (TextBox)target; + break; + case 21: + EmissorBox = (TextBox)target; + ((UIElement)EmissorBox).PreviewTextInput += new TextCompositionEventHandler(base.SomenteCaracteres); + break; + case 22: + EstadoEmissorBox = (TextBox)target; + ((UIElement)EstadoEmissorBox).PreviewTextInput += new TextCompositionEventHandler(base.SomenteCaracteres); + break; + case 23: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewTextInput += new TextCompositionEventHandler(base.SomenteData); + break; + case 24: + HabilitacaoBox = (TextBox)target; + ((UIElement)HabilitacaoBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 25: + CategoriaHabilitacaooBox = (TextBox)target; + ((UIElement)CategoriaHabilitacaooBox).PreviewTextInput += new TextCompositionEventHandler(LetrasHabilitacao); + break; + case 26: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 27: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 28: + SexoBox = (ComboBox)target; + break; + case 29: + EstadoCivilBox = (ComboBox)target; + break; + case 30: + AutoCompleteProfissao = (AutoCompleteBox)target; + AutoCompleteProfissao.Populating += new PopulatingEventHandler(AutoCompleteProfissaoBox_Populating); + break; + case 31: + AutoCompleteAtividade = (AutoCompleteBox)target; + AutoCompleteAtividade.Populating += new PopulatingEventHandler(AutoCompleteAtividadeBox_Populating); + break; + case 32: + ResponsavelBox = (TextBox)target; + ((UIElement)ResponsavelBox).LostFocus += new RoutedEventHandler(Validar_LostFocus); + break; + case 33: + DocumentoResponsavel = (TextBox)target; + ((UIElement)DocumentoResponsavel).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)DocumentoResponsavel).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus); + break; + case 34: + EmailBox = (TextBox)target; + ((UIElement)EmailBox).LostFocus += new RoutedEventHandler(Validar_LostFocus); + break; + case 35: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 36: + PastaBox = (TextBox)target; + break; + case 37: + AutoCompleteBanco = (AutoCompleteBox)target; + AutoCompleteBanco.Populating += new PopulatingEventHandler(AutoCompleteBancoBox_Populating); + ((UIElement)AutoCompleteBanco).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(AutoCompleteBanco_OnLostKeyboardFocus); + break; + case 38: + AgenciaBox = (TextBox)target; + break; + case 39: + TipoContaBox = (TextBox)target; + break; + case 40: + ContaBox = (TextBox)target; + break; + case 41: + RendaMensalBox = (CurrencyTextBox)target; + break; + case 42: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirTelefone_OnClick); + break; + case 43: + TelefoneListBox = (ListBox)target; + break; + case 49: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirEmail_OnClick); + break; + case 50: + EmailListBox = (ListBox)target; + break; + case 53: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirEndereco_OnClick); + break; + case 54: + EnderecoListBox = (ListBox)target; + break; + case 58: + VinculoBox = (AutoCompleteBox)target; + VinculoBox.Populating += new PopulatingEventHandler(AutoCompleteParentescoBox_Populating); + break; + case 59: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirVinculo_OnClick); + break; + case 61: + NomeOrigemBox = (TextBox)target; + break; + case 62: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirOrigem_OnClick); + break; + case 64: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirMaisContatos_OnClick); + break; + case 65: + ContatosListBox = (ListBox)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_007b: Unknown result type (might be due to invalid IL or missing references) + //IL_0087: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Expected O, but got Unknown + //IL_0093: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Expected O, but got Unknown + //IL_00ac: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Expected O, but got Unknown + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_00db: Expected O, but got Unknown + //IL_00dd: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Unknown result type (might be due to invalid IL or missing references) + //IL_00f3: Expected O, but got Unknown + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Unknown result type (might be due to invalid IL or missing references) + //IL_010a: Expected O, but got Unknown + //IL_010b: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_0122: Expected O, but got Unknown + //IL_0124: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_013a: Expected O, but got Unknown + //IL_013c: Unknown result type (might be due to invalid IL or missing references) + //IL_0148: Unknown result type (might be due to invalid IL or missing references) + //IL_0152: Expected O, but got Unknown + //IL_0153: Unknown result type (might be due to invalid IL or missing references) + //IL_015f: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Expected O, but got Unknown + //IL_016a: Unknown result type (might be due to invalid IL or missing references) + //IL_0177: Unknown result type (might be due to invalid IL or missing references) + //IL_0181: Expected O, but got Unknown + //IL_0183: Unknown result type (might be due to invalid IL or missing references) + //IL_018f: Unknown result type (might be due to invalid IL or missing references) + //IL_0199: Expected O, but got Unknown + //IL_019b: Unknown result type (might be due to invalid IL or missing references) + //IL_01a7: Unknown result type (might be due to invalid IL or missing references) + //IL_01b1: Expected O, but got Unknown + //IL_01b2: Unknown result type (might be due to invalid IL or missing references) + //IL_01bf: Unknown result type (might be due to invalid IL or missing references) + //IL_01c9: Expected O, but got Unknown + //IL_01cb: Unknown result type (might be due to invalid IL or missing references) + //IL_01d7: Unknown result type (might be due to invalid IL or missing references) + //IL_01e1: Expected O, but got Unknown + //IL_01e2: Unknown result type (might be due to invalid IL or missing references) + //IL_01ee: Unknown result type (might be due to invalid IL or missing references) + //IL_01f8: Expected O, but got Unknown + //IL_01f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0206: Unknown result type (might be due to invalid IL or missing references) + //IL_0210: Expected O, but got Unknown + //IL_0212: Unknown result type (might be due to invalid IL or missing references) + //IL_021e: Unknown result type (might be due to invalid IL or missing references) + //IL_0228: Expected O, but got Unknown + //IL_022a: Unknown result type (might be due to invalid IL or missing references) + //IL_0236: Unknown result type (might be due to invalid IL or missing references) + //IL_0240: Expected O, but got Unknown + //IL_0242: Unknown result type (might be due to invalid IL or missing references) + //IL_024e: Unknown result type (might be due to invalid IL or missing references) + //IL_0258: Expected O, but got Unknown + //IL_025a: Unknown result type (might be due to invalid IL or missing references) + //IL_0267: Unknown result type (might be due to invalid IL or missing references) + //IL_0271: Expected O, but got Unknown + //IL_0273: Unknown result type (might be due to invalid IL or missing references) + //IL_027f: Unknown result type (might be due to invalid IL or missing references) + //IL_0289: Expected O, but got Unknown + //IL_028a: Unknown result type (might be due to invalid IL or missing references) + //IL_0296: Unknown result type (might be due to invalid IL or missing references) + //IL_02a0: Expected O, but got Unknown + //IL_02a1: Unknown result type (might be due to invalid IL or missing references) + //IL_02ad: Unknown result type (might be due to invalid IL or missing references) + //IL_02b7: Expected O, but got Unknown + //IL_02b8: Unknown result type (might be due to invalid IL or missing references) + //IL_02c4: Unknown result type (might be due to invalid IL or missing references) + //IL_02ce: Expected O, but got Unknown + //IL_02d0: Unknown result type (might be due to invalid IL or missing references) + //IL_02dc: Unknown result type (might be due to invalid IL or missing references) + //IL_02e6: Expected O, but got Unknown + //IL_02e8: Unknown result type (might be due to invalid IL or missing references) + //IL_02f5: Unknown result type (might be due to invalid IL or missing references) + //IL_02ff: Expected O, but got Unknown + //IL_0301: Unknown result type (might be due to invalid IL or missing references) + //IL_030e: Unknown result type (might be due to invalid IL or missing references) + //IL_0318: Expected O, but got Unknown + //IL_0319: Unknown result type (might be due to invalid IL or missing references) + //IL_0326: Unknown result type (might be due to invalid IL or missing references) + //IL_0330: Expected O, but got Unknown + //IL_0332: Unknown result type (might be due to invalid IL or missing references) + //IL_033e: Unknown result type (might be due to invalid IL or missing references) + //IL_0348: Expected O, but got Unknown + switch (connectionId) + { + case 44: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TipoComboBox_OnSelectionChanged); + break; + case 45: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 46: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 47: + ((UIElement)(TextBox)target).PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(OrdemBox_OnPreviewGotKeyboardFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(OrdemBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 48: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTelefone_OnClick); + break; + case 51: + ((UIElement)(TextBox)target).PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(OrdemBox_OnPreviewGotKeyboardFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(OrdemBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 52: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirEmail_OnClick); + break; + case 55: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 56: + ((UIElement)(TextBox)target).PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(OrdemBox_OnPreviewGotKeyboardFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(OrdemBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 57: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirEndereco_OnClick); + break; + case 60: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirVinculo_OnClick); + break; + case 63: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirOrigem_OnClick); + break; + case 66: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarDocumento); + break; + case 67: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewTextInput += new TextCompositionEventHandler(base.SomenteData); + break; + case 68: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TipoComboBox_OnSelectionChanged); + break; + case 69: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 70: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 71: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirMaisContatos_OnClick); + break; + case 49: + case 50: + case 53: + case 54: + case 58: + case 59: + case 61: + case 62: + case 64: + case 65: + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/ComissaoView.cs b/Decompiler/Gestor.Application.Views.Seguros/ComissaoView.cs new file mode 100644 index 0000000..b5b4178 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/ComissaoView.cs @@ -0,0 +1,1028 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Text.RegularExpressions; +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; +using System.Windows.Threading; +using Gestor.Application.Actions; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Comissao; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Seguros; + +public class ComissaoView : BaseUserControl, IComponentConnector, IStyleConnector +{ + [Serializable] + [CompilerGenerated] + private sealed class _003C_003Ec + { + public static readonly _003C_003Ec _003C_003E9 = new _003C_003Ec(); + + public static MouseButtonEventHandler _003C_003E9__5_0; + + internal void _003CContentLoad_003Eb__5_0(object sender, MouseButtonEventArgs args) + { + } + } + + internal ComboBox UsuarioBox; + + internal ComboBox StatusBox; + + internal ComboBox SeguradoraBox; + + internal ComboBox Seguradora2Box; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal DataGrid ExtratoGrid; + + internal Card ProgressBar2; + + internal Card ProgressBar; + + internal MenuItem DesfazerExtratoButton; + + internal DatePicker DataBaixaBox; + + internal TextBox FiltroDetalhes; + + internal DataGrid DetalhesGrid; + + internal Grid PainelCritica; + + internal AutoCompleteBox AutoCompleteCliente; + + internal TextBox TipoDocumentoPrincipalBox; + + internal TextBox DocumentoPrincipalBox; + + internal TextBox FiltroApoliceBox; + + internal DataGrid ApoliceGrid; + + internal DataGrid ParcelaGrid; + + internal DataGridTextColumn ParcelaColumn; + + internal DataGrid FaturaGrid; + + private bool _contentLoaded; + + public ComissaoViewModel ViewModel { get; set; } + + public SubTipo _previousSubTipo { get; set; } = (SubTipo)2; + + + public ComissaoView() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + ((FrameworkElement)this).Tag = "COMISSÃO AUTOMÁTICA"; + ViewModel = new ComissaoViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + ((FrameworkElement)ExtratoGrid).DataContext = ((FrameworkElement)this).DataContext; + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Expected O, but got Unknown + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Expected O, but got Unknown + //IL_0106: Unknown result type (might be due to invalid IL or missing references) + //IL_0110: Expected O, but got Unknown + //IL_011d: Unknown result type (might be due to invalid IL or missing references) + //IL_0127: Expected O, but got Unknown + //IL_00e9: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + ((UIElement)DataBaixaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)DataBaixaBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)InicioBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + InicioBox.SelectedDateChanged += FiltroDataBox_OnSelectedDateChanged; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)FimBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + FimBox.SelectedDateChanged += FiltroDataBox_OnSelectedDateChanged; + ((Selector)ExtratoGrid).SelectionChanged += new SelectionChangedEventHandler(Grid_OnSelectionChanged); + DataGrid extratoGrid = ExtratoGrid; + object obj = _003C_003Ec._003C_003E9__5_0; + if (obj == null) + { + MouseButtonEventHandler val = delegate + { + }; + _003C_003Ec._003C_003E9__5_0 = val; + obj = (object)val; + } + ((Control)extratoGrid).MouseDoubleClick += (MouseButtonEventHandler)obj; + ((Control)DetalhesGrid).MouseDoubleClick += new MouseButtonEventHandler(DetalhesGrid_OnMouseDoubleClick); + ((Selector)ApoliceGrid).SelectionChanged += new SelectionChangedEventHandler(ApoliceGrid_OnSelectionChanged); + } + + private async void ApoliceGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + await ViewModel.SelecionaDocumento((Documento)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private async void Grid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val != null && ((Selector)val).SelectedIndex >= 0) + { + await ViewModel.SelecionaExtrato((Extrato)((ItemsControl)val).Items[((Selector)val).SelectedIndex]); + } + } + + private async void AutoCompleteBoxDetalhe_OnTextChanged(object sender, RoutedEventArgs e) + { + TextBox val = (TextBox)sender; + await ViewModel.FiltrarDetalhe(((val != null) ? val.Text : null) ?? ""); + } + + private async void AutoCompleteBoxDocumento_OnTextChanged(object sender, RoutedEventArgs e) + { + TextBox val = (TextBox)sender; + await ViewModel.FiltrarApolices(((val != null) ? val.Text : null) ?? ""); + } + + private async void DetalhesGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.Loading(isLoading: true); + ViewModel.IsVisibleDetalhes = (Visibility)2; + DetalheExtrato val2 = (DetalheExtrato)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null); + if (val2 != null) + { + await AbrirCritica(val2); + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.Loading(isLoading: false); + } + } + } + + private async Task AbrirCritica(DetalheExtrato detalhe) + { + List<StatusParcela> list = new List<StatusParcela> + { + (StatusParcela)1, + (StatusParcela)10, + (StatusParcela)12, + (StatusParcela)13 + }; + if (detalhe.Status.HasValue && list.Contains(detalhe.Status.Value)) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL CRITICAR UMA PARCELA JÁ BAIXADA"); + return; + } + ViewModel.FiltrarDetalheExtrato(((DomainBase)detalhe).Id); + await ViewModel.BuscarCriticado(detalhe); + if (!detalhe.Parcela.HasValue && !detalhe.Documento.HasValue) + { + AutoCompleteCliente.Text = detalhe.Cliente.Trim(); + } + ViewModel.Criticando = true; + ((UIElement)PainelCritica).Visibility = (Visibility)0; + ((UIElement)FiltroDetalhes).Visibility = (Visibility)2; + ((UIElement)DetalhesGrid).Visibility = (Visibility)2; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.FiltroApolice = string.Empty; + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarCliente(ValidationHelper.RemoveDiacritics(e.Parameter.Trim()), null, (TipoFiltroCliente)2).ContinueWith(delegate(Task<List<Cliente>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private async void AtualizarExtrato_OnClick(object sender, RoutedEventArgs e) + { + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.EnableButtons = false; + await ViewModel.AtualizarExtrato(); + await ViewModel.SelecionaExtrato(ViewModel.SelectedExtrato); + ViewModel.EnableButtons = true; + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + } + + private async void CriticarDocumento_OnClick(object sender, RoutedEventArgs e) + { + if (((Selector)DetalhesGrid).SelectedIndex < 0) + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR UMA PARCELA PARA CRITICAR."); + return; + } + SubTipo? subTipo = ViewModel.SelectedDetalhe.SubTipo; + if (subTipo.HasValue && (int)subTipo.GetValueOrDefault() == 1) + { + if (ViewModel.SelectedParcela == null || ((DomainBase)ViewModel.SelectedParcela).Id == 0L) + { + await ViewModel.ShowMessage("PARA CRITICAR ESSE DOCUMENTO É NECESSÁRIO SELECIONAR UMA PARCELA"); + return; + } + } + else if (ViewModel.SelectedDocumento == null || ((DomainBase)ViewModel.SelectedDocumento).Id == 0L) + { + await ViewModel.ShowMessage("PARA CRITICAR ESSE DOCUMENTO É NECESSÁRIO SELECIONAR UM DOCUMENTO"); + return; + } + object obj; + if (((Selector)DetalhesGrid).SelectedIndex < 0) + { + DataGrid detalhesGrid = DetalhesGrid; + if (((detalhesGrid != null) ? new int?(((CollectionView)((ItemsControl)detalhesGrid).Items).Count) : null) >= ((Selector)DetalhesGrid).SelectedIndex) + { + DataGrid detalhesGrid2 = DetalhesGrid; + obj = (object)(DetalheExtrato)((detalhesGrid2 != null) ? ((ItemsControl)detalhesGrid2).Items[((Selector)DetalhesGrid).SelectedIndex] : null); + goto IL_028e; + } + } + obj = ViewModel.SelectedDetalhe; + goto IL_028e; + IL_028e: + DetalheExtrato val = (DetalheExtrato)obj; + if (val != null) + { + await ViewModel.Criticar(val, critica: true); + LimparFiltros(); + } + } + + private async void Desconsiderar_OnClick(object sender, RoutedEventArgs e) + { + if (((Selector)DetalhesGrid).SelectedIndex < 0) + { + await ViewModel.ShowMessage("PARA DESCONSIDERAR O DOCUMENTO É NECESSÁRIO SELECIONAR UMA PARCELA"); + return; + } + DataGrid detalhesGrid = DetalhesGrid; + DetalheExtrato val = (DetalheExtrato)((detalhesGrid != null) ? ((ItemsControl)detalhesGrid).Items[((Selector)DetalhesGrid).SelectedIndex] : null); + if (val != null) + { + await ViewModel.Criticar(val, critica: false); + LimparFiltros(); + } + } + + private void CancelarCritica_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDetalhe != null) + { + ViewModel.SelectedDetalhe.Corrigir = false; + } + LimparFiltros(); + } + + private void LimparFiltros() + { + ViewModel.Criticando = false; + ViewModel.FiltrarDetalheExtrato(""); + ((UIElement)PainelCritica).Visibility = (Visibility)2; + ((UIElement)FiltroDetalhes).Visibility = (Visibility)0; + AutoCompleteCliente.Text = string.Empty; + ((UIElement)DetalhesGrid).Visibility = (Visibility)0; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + } + + private async void AbrirCritica_OnClick(object sender, RoutedEventArgs e) + { + if (((Selector)DetalhesGrid).SelectedIndex < 0) + { + await ViewModel.ShowMessage("PARA CRITICAR O DOCUMENTO É NECESSÁRIO SELECIONAR UMA PARCELA"); + return; + } + DataGrid detalhesGrid = DetalhesGrid; + DetalheExtrato val = (DetalheExtrato)((detalhesGrid != null) ? ((ItemsControl)detalhesGrid).Items[((Selector)DetalhesGrid).SelectedIndex] : null); + if (val != null) + { + ViewModel.Loading(isLoading: true); + ViewModel.IsVisibleDetalhes = (Visibility)2; + await AbrirCritica(val); + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.Loading(isLoading: false); + } + } + + private async void BaixarSelecionado_OnClick(object sender, RoutedEventArgs e) + { + ((MenuItem)sender).Click -= new RoutedEventHandler(BaixarSelecionado_OnClick); + if (ViewModel.SelectedExtrato == null) + { + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarSelecionado_OnClick); + return; + } + if (!(await ViewModel.ShowMessage("DESEJA BAIXAR TODAS AS PARCELAS PENDENTES DO EXTRATO " + ViewModel.SelectedExtrato.Numero + "?", "SIM", "NÃO"))) + { + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarSelecionado_OnClick); + return; + } + ViewModel.IsVisible = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)2; + ((UIElement)ProgressBar).Visibility = (Visibility)0; + ViewModel.EnableButtons = false; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.EnableButtons = false; + await ViewModel.BaixarExtrato(); + ViewModel.EnableButtons = true; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ViewModel.EnableButtons = true; + ((UIElement)ProgressBar).Visibility = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.IsVisible = (Visibility)0; + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarSelecionado_OnClick); + } + + private async void ExcluirExtrato_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedExtrato != null && await ViewModel.ShowMessage("DESEJA EXCLUIR O EXTRATO " + ViewModel.SelectedExtrato.Numero + "?", "SIM", "NÃO")) + { + ViewModel.IsVisible = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)2; + ((UIElement)ProgressBar).Visibility = (Visibility)0; + ViewModel.EnableButtons = false; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + await ViewModel.ExcluirExtrato(); + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ViewModel.EnableButtons = true; + ((UIElement)ProgressBar).Visibility = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.IsVisible = (Visibility)0; + } + } + + private async void DesfazerExtrato_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedExtrato != null && await ViewModel.ShowMessage("DESEJA DESFAZER A BAIXA DO EXTRATO " + ViewModel.SelectedExtrato.Numero + "?", "SIM", "NÃO")) + { + ViewModel.IsVisible = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)2; + ((UIElement)ProgressBar).Visibility = (Visibility)0; + ViewModel.EnableButtons = false; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + await ViewModel.DesfazerExtrato(); + ViewModel.EnableButtons = true; + ((UIElement)ProgressBar).Visibility = (Visibility)2; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.IsVisible = (Visibility)0; + } + } + + private async void DesfazerParcela_OnClick(object sender, RoutedEventArgs e) + { + DataGrid detalhesGrid = DetalhesGrid; + DetalheExtrato detalhe = (DetalheExtrato)((detalhesGrid != null) ? ((ItemsControl)detalhesGrid).Items[((Selector)DetalhesGrid).SelectedIndex] : null); + if (detalhe != null && await ViewModel.ShowMessage("DESEJA DESFAZER A BAIXA DA PARCELA DO CLIENTE " + detalhe.Cliente + "?", "SIM", "NÃO")) + { + ViewModel.Loading(isLoading: true); + ViewModel.IsVisibleDetalhes = (Visibility)2; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.EnableButtons = false; + bool desfeito = await ViewModel.DesfazerParcela(detalhe); + await ViewModel.CarregaDetalhes(ViewModel.SelectedExtrato); + ViewModel.ToggleSnackBar(desfeito ? "PARCELA DESFEITA COM SUCESSO" : "NÃO FOI POSSÍVEL DESFAZER A BAIXA DA PARCELA"); + if (desfeito && detalhe.Parcela.HasValue) + { + ViewModel.RegistrarAcao($"DESFEZ PARCELA DE ID \"{detalhe.Parcela}\"", detalhe.Parcela.Value, (TipoTela)35); + } + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ViewModel.EnableButtons = true; + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.Loading(isLoading: false); + } + } + + private void FiltroDataBox_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + DatePicker val = (DatePicker)sender; + if ((int)val != 0 && val.SelectedDate.HasValue) + { + ViewModel.SelecionaSeguradora(ViewModel.SelectedSeguradora, ViewModel.SelectedStatusExtrato); + } + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)7).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)7) + "."); + return; + } + if (ViewModel.SelectedExtrato == null) + { + await ViewModel.ShowMessage("SELECIONE ALGUM EXTRATO PARA VISUALIZAR O ARQUIVO DIGITAL"); + return; + } + List<IndiceArquivoDigital> list = await new ArquivoDigitalServico().BuscarPorTipo((TipoArquivoDigital)7, ((DomainBase)ViewModel.SelectedExtrato).Id); + if (list.Count == 1) + { + ViewModel.Download(list.First()); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedExtrato).Id, + Tipo = (TipoArquivoDigital)7, + Parente = ViewModel.SelectedExtrato + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void AdicionarFiltro_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdcionarFiltro(); + } + + private void ExcluirFiltro_onClick(object sender, RoutedEventArgs e) + { + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + string text = (string)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (text != null) + { + ViewModel.ExcluirFiltro(text); + } + } + } + + private async void AcessarApolice_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext == null || !((FrameworkElement)val).DataContext.GetType().Name.Equals("DetalheExtrato")) + { + return; + } + DetalheExtrato val2 = (DetalheExtrato)((FrameworkElement)val).DataContext; + if ((val2 == null || !val2.Documento.HasValue) && (val2 == null || !val2.Parcela.HasValue)) + { + return; + } + Documento val3; + if (val2.Documento.HasValue) + { + val3 = await ViewModel.CarregaApolice(val2.Documento.Value); + } + else + { + Documento val4 = ((!val2.Parcela.HasValue) ? null : (await ViewModel.CarregaApoliceParcela(val2.Parcela.Value))); + val3 = val4; + } + Documento val5 = val3; + if (val5 != null) + { + if (val5.Excluido) + { + await ViewModel.ShowMessage("NÃO É POSSIVE VISUALIZAR UM DOCUMENTO EXCLUIDO."); + } + else + { + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(val5, lockInsert: true, invoke: false, (AcessoApolice)0, 0L, consultaTela: true), "CADASTRO DE APÓLICE - " + val5.Controle.Cliente.Nome + " - " + val5.Apolice)).Show(); + } + } + } + + private async void AcessarApoliceCritica_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(await ViewModel.CarregaApolice(((DomainBase)ViewModel.SelectedDocumento).Id), lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICE - " + ViewModel.SelectedCliente.Nome + " - " + ViewModel.SelectedDocumento.Apolice)).Show(); + } + + private async void DesconsiderarTodas_Click(object sender, RoutedEventArgs e) + { + if (await ViewModel.ShowMessage("ESSA OPÇÃO DESCONSIDERA TODAS AS PARCELAS COM O STATUS DE DOCUMENTO NÃO ENCONTRADO OU PARCELA NÃO ENCONTRADA DO EXTRATO." + Environment.NewLine + "DESEJA CONTINUAR?", "SIM", "NÃO")) + { + await ViewModel.CriticarTodos(((DomainBase)ViewModel.SelectedExtrato).Id); + LimparFiltros(); + } + } + + private async void DesconsiderarSelacionadas_Click(object sender, RoutedEventArgs e) + { + if (await ViewModel.ShowMessage("ESSA OPÇÃO DESCONSIDERA TODAS AS PARCELAS QUE FORAM SELECIONADAS, COLOCANDO STATUS DE DESCONSIDERADA PELO USUÁRIO" + Environment.NewLine + "DESEJA CONTINUAR?", "SIM", "NÃO")) + { + await ViewModel.DesconsiderarSelecionadas(); + } + } + + private async void ArquivoDigitalButton_OnClick(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)2) + "."); + return; + } + ViewModel.SelectedDocumento.Controle.Cliente = ViewModel.SelectedCliente; + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedDocumento).Id, + Tipo = (TipoArquivoDigital)2, + Parente = ViewModel.SelectedDocumento + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void Atualizar_OnClick(object sender, RoutedEventArgs e) + { + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + ViewModel.SelecionaSeguradora(ViewModel.SelectedSeguradora, ViewModel.SelectedStatusExtrato, ViewModel.SelectedExtrato); + } + + private async void Imprimir_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedExtrato != null) + { + string value = await ViewModel.GerarHtml(); + if (!string.IsNullOrEmpty(value)) + { + string tempPath = Path.GetTempPath(); + string text = string.Format("{0}{1}_{2:ddMMyyyyhhmmss}.html", tempPath, new Regex("[" + Regex.Escape(new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars())) + "]").Replace("EXTRATO COMISSÃO", ""), Funcoes.GetNetworkTime()); + StreamWriter streamWriter = new StreamWriter(text, append: true, Encoding.UTF8); + streamWriter.Write(value); + streamWriter.Close(); + Process.Start(text); + ViewModel.RegistrarAcao($"IMPRIMIU EXTRATO DE ID \"{((DomainBase)ViewModel.SelectedExtrato).Id}\"", ((DomainBase)ViewModel.SelectedExtrato).Id, (TipoTela)35); + } + } + } + + private async void FinalizarSelecionado_OnClick(object sender, RoutedEventArgs e) + { + ((MenuItem)sender).Click -= new RoutedEventHandler(FinalizarSelecionado_OnClick); + if (ViewModel.SelectedExtrato == null) + { + ((MenuItem)sender).Click += new RoutedEventHandler(FinalizarSelecionado_OnClick); + return; + } + if (!(await ViewModel.ShowMessage("DESEJA FINALIZAR O EXTRATO " + ViewModel.SelectedExtrato.Numero + "?" + Environment.NewLine + "O EXTRATO SERÁ MARCADO COMO BAIXADO.", "SIM", "NÃO"))) + { + ((MenuItem)sender).Click += new RoutedEventHandler(FinalizarSelecionado_OnClick); + return; + } + ViewModel.IsVisible = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)2; + ((UIElement)ProgressBar).Visibility = (Visibility)0; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.EnableButtons = false; + await ViewModel.FinalizarExtrato(); + ViewModel.EnableButtons = true; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ((UIElement)ProgressBar).Visibility = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.IsVisible = (Visibility)0; + ((MenuItem)sender).Click += new RoutedEventHandler(FinalizarSelecionado_OnClick); + } + + private void Subtipo_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0015: Expected O, but got Unknown + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Invalid comparison between Unknown and I4 + //IL_002a: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Expected O, but got Unknown + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Invalid comparison between Unknown and I4 + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Invalid comparison between Unknown and I4 + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + if (!ViewModel.IsEnabled) + { + return; + } + ComboBox val = (ComboBox)sender; + if ((int)(SubTipo)((Selector)val).SelectedItem == 1) + { + DetalheExtrato val2 = (DetalheExtrato)((FrameworkElement)val).DataContext; + if (((int)(SubTipo)((Selector)val).SelectedItem == 1 && val2.NumeroParcela == "999") || (!val2.IsNormal && (int)val2.SubTipo.GetValueOrDefault() == 1)) + { + ((Selector)val).SelectedItem = _previousSubTipo; + } + } + } + + private void Subtipo_OnDropDownOpened(object sender, EventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + ComboBox val = (ComboBox)sender; + _previousSubTipo = (SubTipo)((Selector)val).SelectedItem; + } + + private async void BaixarParcelasSelecionadas_OnClick(object sender, RoutedEventArgs e) + { + ((MenuItem)sender).Click -= new RoutedEventHandler(BaixarParcelasSelecionadas_OnClick); + if (ViewModel.SelectedExtrato == null) + { + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarParcelasSelecionadas_OnClick); + return; + } + if (!(await ViewModel.ShowMessage("DESEJA BAIXAR TODAS AS PARCELAS SELECIONADAS DO EXTRATO " + ViewModel.SelectedExtrato.Numero + "?", "SIM", "NÃO"))) + { + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarParcelasSelecionadas_OnClick); + return; + } + ViewModel.IsVisible = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)2; + ((UIElement)ProgressBar).Visibility = (Visibility)0; + ViewModel.EnableButtons = false; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: false); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: false); + ViewModel.EnableButtons = false; + await ViewModel.BaixarExtrato(selecionados: true); + ViewModel.EnableButtons = true; + Gestor.Application.Actions.Actions.EnableMainMenu?.Invoke(obj: true); + Gestor.Application.Actions.Actions.EnableMenu?.Invoke(obj: true); + ViewModel.EnableButtons = true; + ((UIElement)ProgressBar).Visibility = (Visibility)2; + ViewModel.IsVisibleDetalhes = (Visibility)0; + ViewModel.IsVisible = (Visibility)0; + ViewModel.WorkOnSelectedStatus(); + ((MenuItem)sender).Click += new RoutedEventHandler(BaixarParcelasSelecionadas_OnClick); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/comissaoview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_00bf: Unknown result type (might be due to invalid IL or missing references) + //IL_00c9: Expected O, but got Unknown + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Expected O, but got Unknown + //IL_00d9: Unknown result type (might be due to invalid IL or missing references) + //IL_00e3: Expected O, but got Unknown + //IL_00e6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Expected O, but got Unknown + //IL_00f3: Unknown result type (might be due to invalid IL or missing references) + //IL_00fd: Expected O, but got Unknown + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Expected O, but got Unknown + //IL_0117: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Expected O, but got Unknown + //IL_012e: Unknown result type (might be due to invalid IL or missing references) + //IL_0138: Expected O, but got Unknown + //IL_013a: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Unknown result type (might be due to invalid IL or missing references) + //IL_0150: Expected O, but got Unknown + //IL_0152: Unknown result type (might be due to invalid IL or missing references) + //IL_015e: Unknown result type (might be due to invalid IL or missing references) + //IL_0168: Expected O, but got Unknown + //IL_016b: Unknown result type (might be due to invalid IL or missing references) + //IL_0175: Expected O, but got Unknown + //IL_0178: Unknown result type (might be due to invalid IL or missing references) + //IL_0182: Expected O, but got Unknown + //IL_0185: Unknown result type (might be due to invalid IL or missing references) + //IL_018f: Expected O, but got Unknown + //IL_0191: Unknown result type (might be due to invalid IL or missing references) + //IL_019d: Unknown result type (might be due to invalid IL or missing references) + //IL_01a7: Expected O, but got Unknown + //IL_01a9: Unknown result type (might be due to invalid IL or missing references) + //IL_01b5: Unknown result type (might be due to invalid IL or missing references) + //IL_01bf: Expected O, but got Unknown + //IL_01c1: Unknown result type (might be due to invalid IL or missing references) + //IL_01cd: Unknown result type (might be due to invalid IL or missing references) + //IL_01d7: Expected O, but got Unknown + //IL_01d9: Unknown result type (might be due to invalid IL or missing references) + //IL_01e5: Unknown result type (might be due to invalid IL or missing references) + //IL_01ef: Expected O, but got Unknown + //IL_01f1: Unknown result type (might be due to invalid IL or missing references) + //IL_01fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0207: Expected O, but got Unknown + //IL_0209: Unknown result type (might be due to invalid IL or missing references) + //IL_0215: Unknown result type (might be due to invalid IL or missing references) + //IL_021f: Expected O, but got Unknown + //IL_0222: Unknown result type (might be due to invalid IL or missing references) + //IL_022c: Expected O, but got Unknown + //IL_0239: Unknown result type (might be due to invalid IL or missing references) + //IL_0243: Expected O, but got Unknown + //IL_0245: Unknown result type (might be due to invalid IL or missing references) + //IL_0251: Unknown result type (might be due to invalid IL or missing references) + //IL_025b: Expected O, but got Unknown + //IL_025d: Unknown result type (might be due to invalid IL or missing references) + //IL_0269: Unknown result type (might be due to invalid IL or missing references) + //IL_0273: Expected O, but got Unknown + //IL_0275: Unknown result type (might be due to invalid IL or missing references) + //IL_0281: Unknown result type (might be due to invalid IL or missing references) + //IL_028b: Expected O, but got Unknown + //IL_028d: Unknown result type (might be due to invalid IL or missing references) + //IL_0299: Unknown result type (might be due to invalid IL or missing references) + //IL_02a3: Expected O, but got Unknown + //IL_02a6: Unknown result type (might be due to invalid IL or missing references) + //IL_02b0: Expected O, but got Unknown + //IL_02bd: Unknown result type (might be due to invalid IL or missing references) + //IL_02c7: Expected O, but got Unknown + //IL_02ca: Unknown result type (might be due to invalid IL or missing references) + //IL_02d4: Expected O, but got Unknown + //IL_02e1: Unknown result type (might be due to invalid IL or missing references) + //IL_02eb: Expected O, but got Unknown + //IL_02ed: Unknown result type (might be due to invalid IL or missing references) + //IL_02f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0303: Expected O, but got Unknown + //IL_0305: Unknown result type (might be due to invalid IL or missing references) + //IL_0311: Unknown result type (might be due to invalid IL or missing references) + //IL_031b: Expected O, but got Unknown + //IL_031e: Unknown result type (might be due to invalid IL or missing references) + //IL_0328: Expected O, but got Unknown + //IL_032b: Unknown result type (might be due to invalid IL or missing references) + //IL_0335: Expected O, but got Unknown + //IL_0338: Unknown result type (might be due to invalid IL or missing references) + //IL_0342: Expected O, but got Unknown + //IL_034f: Unknown result type (might be due to invalid IL or missing references) + //IL_0359: Expected O, but got Unknown + //IL_035c: Unknown result type (might be due to invalid IL or missing references) + //IL_0366: Expected O, but got Unknown + //IL_0369: Unknown result type (might be due to invalid IL or missing references) + //IL_0373: Expected O, but got Unknown + //IL_0376: Unknown result type (might be due to invalid IL or missing references) + //IL_0380: Expected O, but got Unknown + //IL_038d: Unknown result type (might be due to invalid IL or missing references) + //IL_0397: Expected O, but got Unknown + //IL_039a: Unknown result type (might be due to invalid IL or missing references) + //IL_03a4: Expected O, but got Unknown + //IL_03a7: Unknown result type (might be due to invalid IL or missing references) + //IL_03b1: Expected O, but got Unknown + //IL_03b4: Unknown result type (might be due to invalid IL or missing references) + //IL_03be: Expected O, but got Unknown + //IL_03c1: Unknown result type (might be due to invalid IL or missing references) + //IL_03cb: Expected O, but got Unknown + switch (connectionId) + { + case 1: + UsuarioBox = (ComboBox)target; + break; + case 2: + StatusBox = (ComboBox)target; + break; + case 3: + SeguradoraBox = (ComboBox)target; + break; + case 4: + Seguradora2Box = (ComboBox)target; + break; + case 5: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + break; + case 6: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + break; + case 7: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Atualizar_OnClick); + break; + case 8: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarFiltro_OnClick); + break; + case 10: + ExtratoGrid = (DataGrid)target; + break; + case 11: + ProgressBar2 = (Card)target; + break; + case 12: + ProgressBar = (Card)target; + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(AtualizarExtrato_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(FinalizarSelecionado_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(BaixarParcelasSelecionadas_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(BaixarSelecionado_OnClick); + break; + case 17: + ((MenuItem)target).Click += new RoutedEventHandler(DesconsiderarTodas_Click); + break; + case 18: + ((MenuItem)target).Click += new RoutedEventHandler(DesconsiderarSelacionadas_Click); + break; + case 19: + DesfazerExtratoButton = (MenuItem)target; + DesfazerExtratoButton.Click += new RoutedEventHandler(DesfazerExtrato_OnClick); + break; + case 20: + ((MenuItem)target).Click += new RoutedEventHandler(ExcluirExtrato_OnClick); + break; + case 21: + ((MenuItem)target).Click += new RoutedEventHandler(CriticarDocumento_OnClick); + break; + case 22: + ((MenuItem)target).Click += new RoutedEventHandler(Desconsiderar_OnClick); + break; + case 23: + ((MenuItem)target).Click += new RoutedEventHandler(CancelarCritica_OnClick); + break; + case 24: + DataBaixaBox = (DatePicker)target; + ((UIElement)DataBaixaBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + break; + case 25: + FiltroDetalhes = (TextBox)target; + ((TextBoxBase)FiltroDetalhes).TextChanged += new TextChangedEventHandler(AutoCompleteBoxDetalhe_OnTextChanged); + break; + case 26: + ((MenuItem)target).Click += new RoutedEventHandler(Imprimir_OnClick); + break; + case 27: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 28: + DetalhesGrid = (DataGrid)target; + break; + case 34: + PainelCritica = (Grid)target; + break; + case 35: + AutoCompleteCliente = (AutoCompleteBox)target; + AutoCompleteCliente.Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 36: + TipoDocumentoPrincipalBox = (TextBox)target; + break; + case 37: + DocumentoPrincipalBox = (TextBox)target; + break; + case 38: + FiltroApoliceBox = (TextBox)target; + ((TextBoxBase)FiltroApoliceBox).TextChanged += new TextChangedEventHandler(AutoCompleteBoxDocumento_OnTextChanged); + break; + case 39: + ApoliceGrid = (DataGrid)target; + break; + case 42: + ParcelaGrid = (DataGrid)target; + break; + case 43: + ParcelaColumn = (DataGridTextColumn)target; + break; + case 44: + FaturaGrid = (DataGrid)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Expected O, but got Unknown + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Expected O, but got Unknown + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Expected O, but got Unknown + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Expected O, but got Unknown + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0101: Expected O, but got Unknown + //IL_0103: Unknown result type (might be due to invalid IL or missing references) + //IL_010f: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Expected O, but got Unknown + switch (connectionId) + { + case 9: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirFiltro_onClick); + break; + case 29: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AcessarApolice_OnClick); + break; + case 30: + ((ComboBox)target).DropDownOpened += Subtipo_OnDropDownOpened; + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(Subtipo_OnSelectionChanged); + break; + case 31: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirCritica_OnClick); + break; + case 32: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Desconsiderar_OnClick); + break; + case 33: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(DesfazerParcela_OnClick); + break; + case 40: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AcessarApoliceCritica_OnClick); + break; + case 41: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ArquivoDigitalButton_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/ConsultaOriginalView.cs b/Decompiler/Gestor.Application.Views.Seguros/ConsultaOriginalView.cs new file mode 100644 index 0000000..ccc4de0 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/ConsultaOriginalView.cs @@ -0,0 +1,1317 @@ +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.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; +using System.Windows.Media; +using System.Windows.Threading; +using Gestor.Application.Actions; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +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; + +namespace Gestor.Application.Views.Seguros; + +public class ConsultaOriginalView : BaseUserControl, IComponentConnector, IStyleConnector +{ + public ConsultaViewModel ViewModel; + + private bool _carregarDocumetos = true; + + internal RadioButton ApoliceRadioButton; + + internal RadioButton EndossoRadioButton; + + internal MenuItem AcessarDocumentoMenuItem; + + internal DataGrid ApoliceGrid; + + internal DataGridTextColumn NomeField; + + internal DataGridTextColumn ApelidoField; + + internal DataGridTextColumn ApolicesComissaoColumn; + + internal DataGrid EndossoGrid; + + internal DataGridTextColumn EndossosComissaoColumn; + + internal WrapPanel Comissao; + + internal DataGrid ParcelaGrid; + + internal DataGridTextColumn ParcelasTotalColumn; + + internal DataGridTextColumn ParcelasRealizadoColumn; + + internal DataGridTextColumn ParcelasComissaoColumn; + + internal DataGridTextColumn ParcelasReciboColumn; + + internal DataGridTextColumn ParcelasValorComissaoDescColumn; + + internal DataGridTemplateColumn MaisInformacoesColumn; + + internal RadioButton AtivosRadioButton; + + internal RadioButton ApoliceItensRadioButton; + + internal RadioButton EndossoItensRadioButton; + + internal RadioButton InativosRadioButton; + + internal DataGrid ItemGrid; + + private bool _contentLoaded; + + private Documento _documentoAssistencia { get; set; } + + private string _linkAssistencia { get; set; } + + public ConsultaOriginalView(ConsultaViewModel viewModel) + { + ((FrameworkElement)this).Tag = "CONSULTA DE DOCUMENTOS"; + ViewModel = viewModel ?? new ConsultaViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Gestor.Application.Actions.Actions.UpdateRadioApolice = (Action<int>)Delegate.Combine(Gestor.Application.Actions.Actions.UpdateRadioApolice, new Action<int>(SelecionarRadios)); + Gestor.Application.Actions.Actions.ScrollDocumento = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.ScrollDocumento, new Action(ScrollDocumento)); + Gestor.Application.Actions.Actions.ScrollToItem = ScrollToItem; + Gestor.Application.Actions.Actions.ScrollToItem = (Action)Delegate.Combine(Gestor.Application.Actions.Actions.ScrollToItem, new Action(ScrollToItem)); + ((FrameworkElement)ItemGrid).DataContext = ViewModel; + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ScrollToItem() + { + if (((Selector)ItemGrid).SelectedItem != null) + { + ScrollToIndex(ItemGrid, ((Selector)ItemGrid).SelectedIndex); + } + } + + private void ContentLoad() + { + //IL_00a6: Unknown result type (might be due to invalid IL or missing references) + //IL_00b0: Expected O, but got Unknown + //IL_00bd: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: Expected O, but got Unknown + //IL_00d4: Unknown result type (might be due to invalid IL or missing references) + //IL_00de: Expected O, but got Unknown + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f5: Expected O, but got Unknown + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010c: Expected O, but got Unknown + //IL_0119: Unknown result type (might be due to invalid IL or missing references) + //IL_0123: Expected O, but got Unknown + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_013a: Expected O, but got Unknown + //IL_0147: Unknown result type (might be due to invalid IL or missing references) + //IL_0151: Expected O, but got Unknown + //IL_015e: Unknown result type (might be due to invalid IL or missing references) + //IL_0168: Expected O, but got Unknown + //IL_0175: Unknown result type (might be due to invalid IL or missing references) + //IL_017f: Expected O, but got Unknown + //IL_018c: Unknown result type (might be due to invalid IL or missing references) + //IL_0196: Expected O, but got Unknown + //IL_01a3: Unknown result type (might be due to invalid IL or missing references) + //IL_01ad: Expected O, but got Unknown + //IL_01c0: Unknown result type (might be due to invalid IL or missing references) + //IL_01f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0208: Unknown result type (might be due to invalid IL or missing references) + //IL_0217: Unknown result type (might be due to invalid IL or missing references) + //IL_024d: Unknown result type (might be due to invalid IL or missing references) + //IL_025c: Unknown result type (might be due to invalid IL or missing references) + //IL_026e: Unknown result type (might be due to invalid IL or missing references) + //IL_0283: Unknown result type (might be due to invalid IL or missing references) + //IL_028f: Unknown result type (might be due to invalid IL or missing references) + if (ConsultaViewModel.DocumentoSelecionado != null && ConsultaViewModel.DocumentoSelecionado.Tipo != 0) + { + ViewModel.FilterDocumento = 1; + } + ((DataGridColumn)NomeField).Visibility = (Visibility)(ViewModel.Apelido ? 2 : 0); + ((DataGridColumn)ApelidoField).Visibility = (Visibility)((!ViewModel.Apelido) ? 2 : 0); + ((ToggleButton)ApoliceRadioButton).IsChecked = ViewModel.FilterDocumento == 0; + ((ToggleButton)EndossoRadioButton).IsChecked = ViewModel.FilterDocumento == 1; + AjustaItem(); + ((Selector)ApoliceGrid).SelectionChanged += new SelectionChangedEventHandler(ApoliceGrid_OnSelectionChanged); + ((Control)ParcelaGrid).MouseDoubleClick += new MouseButtonEventHandler(ParcelaGrid_OnMouseDoubleClick); + ((Selector)EndossoGrid).SelectionChanged += new SelectionChangedEventHandler(EndossoGrid_OnSelectionChanged); + ((Control)EndossoGrid).MouseDoubleClick += new MouseButtonEventHandler(EndossoGrid_OnMouseDoubleClick); + ((ToggleButton)AtivosRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)ApoliceItensRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)EndossoItensRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)InativosRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)ApoliceRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((ToggleButton)EndossoRadioButton).Checked += new RoutedEventHandler(Documento_OnChecked); + ((Selector)ItemGrid).SelectionChanged += new SelectionChangedEventHandler(ItemGrid_OnSelectionChanged); + ((Control)ItemGrid).MouseDoubleClick += new MouseButtonEventHandler(ItemGrid_OnMouseDoubleClick); + Visibility val = (Visibility)(ViewModel.Restricao((TipoRestricao)14) ? 2 : 0); + ViewModel.ComissaoValorVisibility = (Visibility)(ViewModel.Restricao((TipoRestricao)14) ? 2 : 0); + bool flag = ViewModel.Restricao((TipoRestricao)95); + ((DataGridColumn)ApolicesComissaoColumn).Visibility = (Visibility)((!flag) ? ((int)val) : 0); + ((DataGridColumn)EndossosComissaoColumn).Visibility = (Visibility)((!flag) ? ((int)val) : 0); + ((UIElement)Comissao).Visibility = val; + bool flag2 = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 5); + ((DataGridColumn)ParcelasRealizadoColumn).Visibility = val; + ((DataGridColumn)ParcelasComissaoColumn).Visibility = (Visibility)((!flag) ? ((int)val) : 0); + ((DataGridColumn)ParcelasReciboColumn).Visibility = (Visibility)(flag2 ? 2 : ((int)val)); + ((DataGridColumn)ParcelasValorComissaoDescColumn).Visibility = (Visibility)((!flag2) ? 2 : ((int)val)); + ((DataGridColumn)MaisInformacoesColumn).Visibility = val; + } + + private void AjustaItem() + { + ((ToggleButton)AtivosRadioButton).IsChecked = ViewModel.FilterItens == 0; + ((ToggleButton)ApoliceItensRadioButton).IsChecked = ViewModel.FilterItens == 1; + ((ToggleButton)EndossoItensRadioButton).IsChecked = ViewModel.FilterItens == 2; + ((ToggleButton)InativosRadioButton).IsChecked = ViewModel.FilterItens == 3; + } + + private async void EndossoGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ((ToggleButton)AtivosRadioButton).IsChecked = true; + await ViewModel.SelecionaDocumento(1, (Documento)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, ""); + } + } + + private void ItemGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaItem((Item)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)3, ""); + } + } + + private void ItemGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + Item val2 = (Item)((Selector)val).SelectedItem; + if (!val2.Cancelado && !val2.Substituido.HasValue && val2.Status != null) + { + AjustaItem(); + } + ViewModel.SelecionaItem((Item)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void SelecionarRadios(int filter) + { + _carregarDocumetos = false; + ((ToggleButton)ApoliceRadioButton).IsChecked = filter == 0; + ((ToggleButton)EndossoRadioButton).IsChecked = filter == 1; + _carregarDocumetos = true; + } + + private void ScrollDocumento() + { + if (ViewModel.UpdatingScroll && ((Selector)ApoliceGrid).SelectedItem != null) + { + ApoliceGrid.ScrollIntoView(((Selector)ApoliceGrid).SelectedItem); + } + ViewModel.UpdatingScroll = false; + } + + private async void Documento_OnChecked(object sender, RoutedEventArgs e) + { + ((HeaderedItemsControl)AcessarDocumentoMenuItem).Header = ((ViewModel.FilterDocumento == 0) ? "ACESSAR APÓLICE" : "ACESSAR ENDOSSO"); + ((FrameworkElement)AcessarDocumentoMenuItem).ToolTip = ((ViewModel.FilterDocumento == 0) ? "CLIQUE PARA ACESSAR A TELA DA APÓLICE" : "CLIQUE PARA ACESSAR A TELA DE ENDOSSO"); + RadioButton val = (RadioButton)sender; + if (string.IsNullOrEmpty(val.GroupName)) + { + return; + } + string groupName = val.GroupName; + if (!(groupName == "Apolices")) + { + if (groupName == "Itens") + { + switch (((FrameworkElement)val).Name) + { + default: + await ViewModel.SelecionaItens(0, null, 0L); + break; + case "ApoliceItensRadioButton": + await ViewModel.SelecionaItens(1, null, 0L); + break; + case "EndossoItensRadioButton": + await ViewModel.SelecionaItens(2, null, 0L); + break; + case "InativosRadioButton": + await ViewModel.SelecionaItens(3, null, 0L); + break; + } + } + } + else + { + if (!_carregarDocumetos) + { + return; + } + if (!(((FrameworkElement)val).Name == "EndossoRadioButton")) + { + ((HeaderedItemsControl)AcessarDocumentoMenuItem).Header = "ACESSAR APÓLICE"; + ((FrameworkElement)AcessarDocumentoMenuItem).ToolTip = "CLIQUE PARA ACESSAR A TELA DA APÓLICE"; + ViewModel.CarregaDocumentos(0); + if (((Selector)ApoliceGrid).SelectedItem == null && ((CollectionView)((ItemsControl)ApoliceGrid).Items).Count > 0) + { + ((Selector)ApoliceGrid).SelectedItem = ((ItemsControl)ApoliceGrid).Items[0]; + } + if (((Selector)ApoliceGrid).SelectedItem != null) + { + await ViewModel.SelecionaDocumento(0, (Documento)((Selector)ApoliceGrid).SelectedItem); + } + } + else + { + ((HeaderedItemsControl)AcessarDocumentoMenuItem).Header = "ACESSAR ENDOSSO"; + ((FrameworkElement)AcessarDocumentoMenuItem).ToolTip = "CLIQUE PARA ACESSAR A TELA DE ENDOSSO"; + ViewModel.CarregaDocumentos(1); + if (((Selector)EndossoGrid).SelectedItem == null && ((CollectionView)((ItemsControl)EndossoGrid).Items).Count > 0) + { + ((Selector)EndossoGrid).SelectedItem = ((ItemsControl)EndossoGrid).Items[0]; + } + if (((Selector)EndossoGrid).SelectedItem != null) + { + await ViewModel.SelecionaDocumento(1, (Documento)((Selector)EndossoGrid).SelectedItem); + } + } + } + } + + public void ScrollToIndex(DataGrid grid, int index) + { + Visual descendantByType = GetDescendantByType((Visual)(object)grid, typeof(ScrollViewer)); + Visual obj = ((descendantByType is ScrollViewer) ? descendantByType : null); + int num = ((index - 5 > 0) ? (index - 5) : 0); + if (obj != null) + { + ((ScrollViewer)obj).ScrollToVerticalOffset((double)num); + } + } + + public Visual GetDescendantByType(Visual element, Type type) + { + if (element == null) + { + return null; + } + if (((object)element).GetType() == type) + { + return element; + } + Visual val = null; + FrameworkElement val2 = (FrameworkElement)(object)((element is FrameworkElement) ? element : null); + if (val2 != null) + { + val2.ApplyTemplate(); + } + for (int i = 0; i < VisualTreeHelper.GetChildrenCount((DependencyObject)(object)element); i++) + { + DependencyObject child = VisualTreeHelper.GetChild((DependencyObject)(object)element, i); + Visual element2 = (Visual)(object)((child is Visual) ? child : null); + val = GetDescendantByType(element2, type); + if (val != null) + { + break; + } + } + return val; + } + + private async void ApoliceGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + await ViewModel.SelecionaDocumento(0, (Documento)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + VisibilityValorPago(); + } + } + + private async void EndossoGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + await ViewModel.SelecionaDocumento(1, (Documento)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + VisibilityValorPago(); + } + } + + private void VisibilityValorPago() + { + DataGridTextColumn parcelasTotalColumn = ParcelasTotalColumn; + ObservableCollection<Parcela> parcelas = ViewModel.Parcelas; + ((DataGridColumn)parcelasTotalColumn).Visibility = (Visibility)((parcelas == null || !(parcelas.Sum((Parcela p) => p.ValorPago) > default(decimal))) ? 2 : 0); + } + + public async void Pesquisar(PesquisaAvancada pesquisa) + { + await ViewModel.Pesquisar(pesquisa); + if (ViewModel.SelectedControle != null) + { + ScrollToIndex(ApoliceGrid, ((Selector)ApoliceGrid).SelectedIndex); + } + if (ViewModel.SelectedEndosso != null) + { + ScrollToIndex(EndossoGrid, ((Selector)EndossoGrid).SelectedIndex); + } + if (ViewModel.SelectedItem != null) + { + ScrollToIndex(ItemGrid, ((Selector)ItemGrid).SelectedIndex); + } + if (ViewModel.SelectedParcela != null) + { + ScrollToIndex(ParcelaGrid, ((Selector)ParcelaGrid).SelectedIndex); + } + } + + private void ClienteView_Click(object sender, RoutedEventArgs e) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)1, ""); + } + + private async void ApoliceGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + DataGridRow val = (DataGridRow)sender; + if (val != null && !(((FrameworkElement)val).DataContext.GetType() != typeof(Documento))) + { + ((ToggleButton)AtivosRadioButton).IsChecked = true; + Documento val2 = (Documento)((val != null) ? val.Item : null); + if ((((int)val2 != 0) ? new long?(((DomainBase)val2).Id) : null) != ((DomainBase)ViewModel.SelectedControle).Id) + { + await ViewModel.SelecionaDocumento(0, (Documento)((val != null) ? val.Item : null)); + } + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, ""); + } + } + + private static void ParcelaGrid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ConsultaViewModel.ParcelaSelecionada = (Parcela)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null); + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, "Parcela"); + } + } + + private void ApoliceView_Click(object sender, RoutedEventArgs e) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, ""); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + FiltroArquivoDigital filtro = null; + ConsultaViewModel.DocumentoSelecionado.Controle.Cliente = ViewModel.SelectedCliente; + switch (((FrameworkElement)(Button)sender).Name) + { + case "Apolice": + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)2) + "."); + return; + } + ViewModel.SelectedControle.Controle.Cliente = ViewModel.SelectedCliente; + filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedControle).Id, + Tipo = (TipoArquivoDigital)2, + Parente = ViewModel.SelectedControle + }; + break; + case "Endosso": + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)2) + "."); + return; + } + ViewModel.SelectedEndosso.Controle.Cliente = ViewModel.SelectedCliente; + filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedEndosso).Id, + Tipo = (TipoArquivoDigital)2, + Parente = ViewModel.SelectedEndosso + }; + break; + case "Parcela": + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)3).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)3) + "."); + return; + } + ViewModel.SelectedParcela.Documento = ConsultaViewModel.DocumentoSelecionado; + filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedParcela).Id, + IdApolice = ((DomainBase)ViewModel.SelectedParcela.Documento).Id, + Tipo = (TipoArquivoDigital)3, + Parente = ViewModel.SelectedParcela + }; + break; + case "Item": + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)4).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)4) + "."); + return; + } + ViewModel.SelectedItem.Documento = ConsultaViewModel.DocumentoSelecionado; + filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedItem).Id, + IdApolice = ((DomainBase)ViewModel.SelectedItem.Documento).Id, + Tipo = (TipoArquivoDigital)4, + Parente = ViewModel.SelectedItem + }; + break; + } + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private void Item_Click(object sender, RoutedEventArgs e) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)3, ""); + } + + private async void ReordenarItem_Click(object sender, RoutedEventArgs e) + { + List<long> ids = ViewModel.Itens.Select((Item x) => ((DomainBase)x).Id).ToList(); + ConsultaViewModel viewModel = ViewModel; + viewModel.SalvarOrdem(await ViewModel.ShowReordenarItensDialog(ids)); + } + + private void Parcela_Click(object sender, RoutedEventArgs e) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, "Parcela"); + } + + private async void ValoresInfo_OnClick(object sender, RoutedEventArgs e) + { + bool restricaoInformacaoValores = ViewModel.Restricao((TipoRestricao)97); + if (!restricaoInformacaoValores) + { + Documento documento = await ViewModel.AbrirDetalhes(); + ViewModel.ShowDrawer(new ValoresApoliceDrawer(documento), 0); + } + if (restricaoInformacaoValores) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR MAIS INFORMAÇÕES."); + } + } + + private async void Renovar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)17)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA RENOVAR. PROCURE O ADMINSTRADOR DO SISTEMA."); + } + else if (!ViewModel.EnableRenovar) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL RENOVAR UM DOCUMENTO SEM EMISSÃO OU SEM FINAL DE VIGÊNCIA."); + } + else if ((int)ConsultaViewModel.DocumentoSelecionado.Situacao == 7) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL RENOVAR UM DOCUMENTO RECUSADO."); + } + else + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, "Renovar"); + } + } + + private async void Endossar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)33)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ENDOSSAR. PROCURE O ADMINSTRADOR DO SISTEMA."); + } + else if (!ViewModel.EnableEndossar) + { + List<KeyValuePair<string, string>> pairs = ViewModel.SelectedControle.ValidateEndossar(); + await ViewModel.ShowMessage(pairs, ViewModel.ErroCamposInvalidos, "OK"); + } + else if ((int)ConsultaViewModel.DocumentoSelecionado.Situacao == 7) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL ENDOSSAR UM DOCUMENTO RECUSADO."); + } + else + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)2, "Endossar"); + } + } + + private async void Recusar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)18)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA RECUSAR. PROCURE O ADMINSTRADOR DO SISTEMA."); + } + else + { + await ViewModel.RecusarDocumento(); + } + } + + private async void EditarParcelas_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.EditarParcelas(); + } + + private async void ValoresParcelaInfo_OnClick(object sender, RoutedEventArgs e) + { + Parcela parcela = await ViewModel.AbrirDetalhesParcela(); + ViewModel.ShowDrawer(new ValoresParcelaDrawer(parcela, ViewModel.SelectedControle), 0); + } + + private async void ManutecaoItens_OnClick(object sender, RoutedEventArgs e) + { + if ((ViewModel.FilterDocumento == 0 && (int)ViewModel.SelectedControle.Situacao == 7) || (ViewModel.FilterDocumento == 1 && (int)ViewModel.SelectedEndosso.Situacao == 7)) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL FAZER A MANUTENÇÃO DE ITENS DE UM DOCUMENTO RECUSADO."); + } + else + { + ViewModel.ManutecaoItens(); + } + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Expected O, but got Unknown + Tarefa tarefa = new Tarefa + { + IdCliente = ((DomainBase)ViewModel.SelectedCliente).Id, + Cliente = ViewModel.SelectedCliente.Nome, + Entidade = (TipoTarefa)0, + IdEntidade = ((DomainBase)ViewModel.SelectedControle).Id, + Titulo = ViewModel.SelectedCliente.Nome + " APÓLICE " + ViewModel.SelectedControle.Apolice + }; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa), 0, close: false); + } + + private async void TrocarCliente_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new TrocarClienteView(ViewModel.SelectedControle), "TROCAR CLIENTE", 500.0, 200.0)).ShowDialog(); + await ViewModel.SelecionaCliente(MainViewModel.ClienteSelecionado); + Gestor.Application.Actions.Actions.RecarregarDocumentos?.Invoke(null); + } + + private async void Extratos_OnClick(object sender, RoutedEventArgs e) + { + if (!(await ViewModel.VerificarRestricao((TipoRestricao)13)) || ((DomainBase)ViewModel.SelectedCliente).Id == 0L) + { + return; + } + ViewModel.Loading(isLoading: true); + if (ViewModel.SelectedControle == null) + { + ViewModel.ShowDrawer(new ExtratosDrawer(new List<ClientesAtivosInativos> + { + new ClientesAtivosInativos + { + Selecionado = true, + EntidadeCliente = ViewModel.SelectedCliente, + Id = ((DomainBase)ViewModel.SelectedCliente).Id, + Nome = ViewModel.SelectedCliente.Nome, + Documento = ViewModel.SelectedCliente.Documento + } + }, null, (Relatorio)0), 0, close: false); + ViewModel.Loading(isLoading: false); + return; + } + switch (ViewModel.FilterDocumento) + { + case 0: + if (ViewModel.SelectedControle != null) + { + ViewModel.ShowDrawer(new ExtratosDrawer(null, new List<Documento> { ViewModel.SelectedControle }, null, new List<long> { ((DomainBase)ViewModel.SelectedControle).Id }), 0, close: false); + } + break; + case 1: + if (ViewModel.SelectedEndosso != null) + { + ViewModel.ShowDrawer(new ExtratosDrawer(null, new List<Documento> { ViewModel.SelectedEndosso }, null, new List<long> { ((DomainBase)ViewModel.SelectedEndosso).Id }), 0, close: false); + } + break; + } + ViewModel.Loading(isLoading: false); + } + + private async void Perdido_OnClick(object sender, RoutedEventArgs e) + { + if ((int)ConsultaViewModel.DocumentoSelecionado.Situacao == 7) + { + await ViewModel.ShowMessage("NÃO É POSSÍVEL ALTERAR O STATUS PARA PERDIDO DE UM DOCUMENTO RECUSADO."); + return; + } + if (!(await ViewModel.ShowMessage("DESEJA REALMENTE ALTERAR O STATUS DO SEGURO PARA PERDIDO?", "SIM", "NÃO"))) + { + return; + } + ViewModel.Loading(isLoading: true); + Cliente cliente = await new ClienteServico().BuscarCliente(((DomainBase)ViewModel.SelectedControle.Controle.Cliente).Id); + Cliente val = cliente; + val.Telefones = await new ClienteServico().BuscarTelefonesAsync(((DomainBase)ViewModel.SelectedControle.Controle.Cliente).Id); + val = cliente; + val.Emails = await new ClienteServico().BuscarEmailsAsync(((DomainBase)ViewModel.SelectedControle.Controle.Cliente).Id); + if (!(await new ApoliceServico().Perdido(((DomainBase)ViewModel.SelectedControle.Controle).Id))) + { + ViewModel.Loading(isLoading: false); + return; + } + Prospeccao val2 = new Prospeccao + { + Nome = cliente.Nome, + Documento = cliente.Documento, + Nascimento = cliente.Nascimento + }; + ObservableCollection<ClienteTelefone> telefones = cliente.Telefones; + object obj; + if (telefones == null) + { + obj = null; + } + else + { + ClienteTelefone? obj2 = telefones.FirstOrDefault(); + obj = ((obj2 != null) ? ((TelefoneBase)obj2).Prefixo : null); + } + if (obj == null) + { + obj = ""; + } + val2.Prefixo1 = (string)obj; + ObservableCollection<ClienteTelefone> telefones2 = cliente.Telefones; + object obj3; + if (telefones2 == null) + { + obj3 = null; + } + else + { + ClienteTelefone? obj4 = telefones2.FirstOrDefault(); + obj3 = ((obj4 != null) ? ((TelefoneBase)obj4).Numero : null); + } + if (obj3 == null) + { + obj3 = ""; + } + val2.Telefone1 = (string)obj3; + val2.Prefixo2 = ((cliente.Telefones != null && cliente.Telefones.Count > 1) ? ((TelefoneBase)cliente.Telefones[1]).Prefixo : ""); + object telefone; + if (cliente.Telefones != null) + { + ObservableCollection<ClienteTelefone> telefones3 = cliente.Telefones; + if (telefones3 != null && telefones3.Count > 1) + { + telefone = ((TelefoneBase)cliente.Telefones[1]).Numero; + goto IL_04ad; + } + } + telefone = ""; + goto IL_04ad; + IL_04ad: + val2.Telefone2 = (string)telefone; + ObservableCollection<ClienteEmail> emails = cliente.Emails; + object obj5; + if (emails == null) + { + obj5 = null; + } + else + { + ClienteEmail? obj6 = emails.FirstOrDefault(); + obj5 = ((obj6 != null) ? ((EmailBase)obj6).Email : null); + } + if (obj5 == null) + { + obj5 = ""; + } + val2.Email = (string)obj5; + val2.VigenciaFinal = (ViewModel.SelectedControle.Vigencia2 ?? Funcoes.GetNetworkTime().Date).AddYears(1); + val2.Vendedor = ViewModel.SelectedControle.VendedorPrincipal; + Item? obj7 = ViewModel.Itens.FirstOrDefault(); + val2.Item = ((obj7 != null) ? obj7.Descricao : null); + val2.Tipo = "SEGURO PERDIDO"; + val2.Observacao = "SEGURO PERDIDO: PROPOSTA: " + ViewModel.SelectedControle.Proposta + ", APÓLICE: " + ViewModel.SelectedControle.Apolice; + val2.Status = (StatusProspeccao)1; + val2.Renovacao = true; + Prospeccao data = val2; + await AbrirProspeccao(data); + ViewModel.CarregaDocumentos(0); + await ViewModel.SelecionaCliente(ViewModel.SelectedCliente); + ((ToggleButton)ApoliceItensRadioButton).IsChecked = true; + if (ApoliceGrid != null && ((CollectionView)((ItemsControl)ApoliceGrid).Items).Count > 0 && ((Selector)ApoliceGrid).SelectedItem == null) + { + ((Selector)ApoliceGrid).SelectedItem = ((ItemsControl)ApoliceGrid).Items[0]; + ConsultaViewModel viewModel = ViewModel; + DataGrid apoliceGrid = ApoliceGrid; + await viewModel.SelecionaDocumento(0, (Documento)((apoliceGrid != null) ? ((Selector)apoliceGrid).SelectedItem : null)); + } + ViewModel.Loading(isLoading: false); + } + + private async Task AbrirProspeccao(Prospeccao data) + { + while (true) + { + if (await ViewModel.ShowProspeccaoDialog(data) == null) + { + if (await ViewModel.ShowMessage("DESEJA REALMENTE NÃO CADASTRAR UMA PROSPECÇÃO PARA ESSE DOCUMENTO?", "SIM", "NÃO")) + { + return; + } + continue; + } + List<KeyValuePair<string, string>> list = await ViewModel.SalvarProspeccao(data); + if (list == null || list.Count == 0) + { + break; + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + ViewModel.ToggleSnackBar("PROSPECÇÃO SALVA COM SUCESSO."); + } + + private void Sinistros_OnClick(object sender, RoutedEventArgs e) + { + Gestor.Application.Actions.Actions.AcessaTela?.Invoke((TipoTela)7, ""); + } + + private void Observacoes_OnClick(object sender, RoutedEventArgs e) + { + //IL_0004: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_0076: Unknown result type (might be due to invalid IL or missing references) + long id = 0L; + TipoTela tipo = (TipoTela)0; + switch (((FrameworkElement)(Button)sender).Name) + { + case "ObservacaoApolice": + id = ((DomainBase)ViewModel.SelectedControle).Id; + tipo = (TipoTela)2; + break; + case "EndossoInfo": + id = ((DomainBase)ViewModel.SelectedEndosso).Id; + tipo = (TipoTela)2; + break; + case "ObservacaoParcela": + id = ((DomainBase)ViewModel.SelectedParcela).Id; + tipo = (TipoTela)5; + break; + } + ViewModel.ShowDrawer(new ObservacoesDrawer(id, tipo), 0); + } + + private async void RelacaoItens_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.GerarExcel(ViewModel.FilterItens); + } + + private async void ExpedicaoInfo_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.VerificarPermissao((TipoTela)46)) + { + if (ConsultaViewModel.DocumentoSelecionado == null) + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR UM DOCUMENTO PARA EXIBIR AS INFORMAÇÕES DE EXPEDIÇÃO."); + } + else + { + ViewModel.ShowDrawer(new ExpedicaoDrawer(ConsultaViewModel.DocumentoSelecionado), 0, close: false); + } + } + } + + private async void PopupBox_OnOpened(object sender, RoutedEventArgs e) + { + PopupBox val = (PopupBox)sender; + _documentoAssistencia = (Documento)((FrameworkElement)val).DataContext; + _linkAssistencia = await ViewModel.CreateLink(_documentoAssistencia); + if (!string.IsNullOrEmpty(_linkAssistencia)) + { + string anotacoes = "Prezado(a) " + ValidationHelper.Captalize(ViewModel.SelectedCliente.Nome) + ", segue o link do seu Cartão Assistência 24 horas." + Environment.NewLine + Environment.NewLine + "LINK CARTÃO ASSISTÊNCIA 24 HORAS" + Environment.NewLine + _linkAssistencia; + ViewModel.Anotacoes = anotacoes; + } + } + + private async void EnviarPorWhatsApp_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Restricao((TipoRestricao)32)) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O WHATSAPP"); + return; + } + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext != null) + { + object dataContext = ((FrameworkElement)val).DataContext; + ClienteTelefone val2 = (ClienteTelefone)((dataContext is ClienteTelefone) ? dataContext : null); + if (val2 != null && !((((TelefoneBase)val2).Tipo.HasValue && (int)((TelefoneBase)val2).Tipo.GetValueOrDefault() == 8) ? (((TelefoneBase)val2).Prefixo + ((TelefoneBase)val2).Numero).Clear() : ("55" + ((TelefoneBase)val2).Prefixo + ((TelefoneBase)val2).Numero.Clear())).EnviarWhatsapp(ViewModel.Anotacoes)) + { + await 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"); + } + } + } + + private void EnviarPorEmail_OnClick(object sender, RoutedEventArgs e) + { + //IL_0009: Unknown result type (might be due to invalid IL or missing references) + //IL_000e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Expected O, but got Unknown + if (_documentoAssistencia != null) + { + MalaDireta val = new MalaDireta + { + Cliente = ViewModel.SelectedCliente, + Apolice = _documentoAssistencia + }; + if (Funcoes.IsWindowOpen<HosterWindow>("ENVIO DE E-MAIL")) + { + Funcoes.Destroy<HosterWindow>("ENVIO DE E-MAIL"); + } + ((Window)new HosterWindow((ContentControl)(object)new MalaDiretaView(new List<MalaDireta> { val }, "CARTÃO ASSISTÊNCIA 24 HORAS - " + val.Cliente.Nome + " " + val.Apolice.Apolice, "<p>Prezado(a) " + ValidationHelper.Captalize(ViewModel.SelectedCliente.Nome) + ", segue o link do seu Cartão Assistência 24 horas.</p><p><a target='_blank' href='" + _linkAssistencia + "'>LINK CARTÃO ASSITÊNCIA</a></p>"), "ENVIO DE E-MAIL", 1200.0, 600.0, canMaximize: true)).ShowDialog(); + } + } + + private void PopupBox_OnClosed(object sender, RoutedEventArgs e) + { + _documentoAssistencia = null; + ViewModel.Anotacoes = ""; + _linkAssistencia = ""; + } + + private async void MostrarItens_Click(object sender, RoutedEventArgs e) + { + int type = 0; + if (!((UIElement)ApoliceRadioButton).IsFocused) + { + RadioButton apoliceItensRadioButton = ApoliceItensRadioButton; + if (apoliceItensRadioButton == null || !((ToggleButton)apoliceItensRadioButton).IsChecked.GetValueOrDefault()) + { + goto IL_0041; + } + } + type = 1; + goto IL_0041; + IL_0041: + if (!((UIElement)EndossoRadioButton).IsFocused) + { + RadioButton endossoItensRadioButton = EndossoItensRadioButton; + if (endossoItensRadioButton == null || !((ToggleButton)endossoItensRadioButton).IsChecked.GetValueOrDefault()) + { + goto IL_006c; + } + } + type = 2; + goto IL_006c; + IL_006c: + if (((UIElement)InativosRadioButton).IsFocused) + { + type = 3; + } + await ViewModel.MostrarItens(type); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/consultaoriginalview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_00db: Unknown result type (might be due to invalid IL or missing references) + //IL_00e5: Expected O, but got Unknown + //IL_00e8: Unknown result type (might be due to invalid IL or missing references) + //IL_00f2: Expected O, but got Unknown + //IL_00f4: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Unknown result type (might be due to invalid IL or missing references) + //IL_010a: Expected O, but got Unknown + //IL_010d: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Expected O, but got Unknown + //IL_0124: Unknown result type (might be due to invalid IL or missing references) + //IL_012e: Expected O, but got Unknown + //IL_0130: Unknown result type (might be due to invalid IL or missing references) + //IL_013c: Unknown result type (might be due to invalid IL or missing references) + //IL_0146: Expected O, but got Unknown + //IL_0148: Unknown result type (might be due to invalid IL or missing references) + //IL_0154: Unknown result type (might be due to invalid IL or missing references) + //IL_015e: Expected O, but got Unknown + //IL_0160: Unknown result type (might be due to invalid IL or missing references) + //IL_016c: Unknown result type (might be due to invalid IL or missing references) + //IL_0176: Expected O, but got Unknown + //IL_0178: Unknown result type (might be due to invalid IL or missing references) + //IL_0184: Unknown result type (might be due to invalid IL or missing references) + //IL_018e: Expected O, but got Unknown + //IL_0190: Unknown result type (might be due to invalid IL or missing references) + //IL_019c: Unknown result type (might be due to invalid IL or missing references) + //IL_01a6: Expected O, but got Unknown + //IL_01a8: Unknown result type (might be due to invalid IL or missing references) + //IL_01b4: Unknown result type (might be due to invalid IL or missing references) + //IL_01be: Expected O, but got Unknown + //IL_01c0: Unknown result type (might be due to invalid IL or missing references) + //IL_01cc: Unknown result type (might be due to invalid IL or missing references) + //IL_01d6: Expected O, but got Unknown + //IL_01d8: Unknown result type (might be due to invalid IL or missing references) + //IL_01e4: Unknown result type (might be due to invalid IL or missing references) + //IL_01ee: Expected O, but got Unknown + //IL_01f0: Unknown result type (might be due to invalid IL or missing references) + //IL_01fc: Unknown result type (might be due to invalid IL or missing references) + //IL_0206: Expected O, but got Unknown + //IL_0208: Unknown result type (might be due to invalid IL or missing references) + //IL_0214: Unknown result type (might be due to invalid IL or missing references) + //IL_021e: Expected O, but got Unknown + //IL_0220: Unknown result type (might be due to invalid IL or missing references) + //IL_022c: Unknown result type (might be due to invalid IL or missing references) + //IL_0236: Expected O, but got Unknown + //IL_0238: Unknown result type (might be due to invalid IL or missing references) + //IL_0244: Unknown result type (might be due to invalid IL or missing references) + //IL_024e: Expected O, but got Unknown + //IL_0251: Unknown result type (might be due to invalid IL or missing references) + //IL_025b: Expected O, but got Unknown + //IL_025e: Unknown result type (might be due to invalid IL or missing references) + //IL_0268: Expected O, but got Unknown + //IL_026b: Unknown result type (might be due to invalid IL or missing references) + //IL_0275: Expected O, but got Unknown + //IL_0278: Unknown result type (might be due to invalid IL or missing references) + //IL_0282: Expected O, but got Unknown + //IL_0285: Unknown result type (might be due to invalid IL or missing references) + //IL_028f: Expected O, but got Unknown + //IL_0292: Unknown result type (might be due to invalid IL or missing references) + //IL_029c: Expected O, but got Unknown + //IL_029e: Unknown result type (might be due to invalid IL or missing references) + //IL_02aa: Unknown result type (might be due to invalid IL or missing references) + //IL_02b4: Expected O, but got Unknown + //IL_02b7: Unknown result type (might be due to invalid IL or missing references) + //IL_02c1: Expected O, but got Unknown + //IL_02c4: Unknown result type (might be due to invalid IL or missing references) + //IL_02ce: Expected O, but got Unknown + //IL_02d1: Unknown result type (might be due to invalid IL or missing references) + //IL_02db: Expected O, but got Unknown + //IL_02de: Unknown result type (might be due to invalid IL or missing references) + //IL_02e8: Expected O, but got Unknown + //IL_02eb: Unknown result type (might be due to invalid IL or missing references) + //IL_02f5: Expected O, but got Unknown + //IL_02f8: Unknown result type (might be due to invalid IL or missing references) + //IL_0302: Expected O, but got Unknown + //IL_0305: Unknown result type (might be due to invalid IL or missing references) + //IL_030f: Expected O, but got Unknown + //IL_0312: Unknown result type (might be due to invalid IL or missing references) + //IL_031c: Expected O, but got Unknown + //IL_031e: Unknown result type (might be due to invalid IL or missing references) + //IL_032a: Unknown result type (might be due to invalid IL or missing references) + //IL_0334: Expected O, but got Unknown + //IL_0336: Unknown result type (might be due to invalid IL or missing references) + //IL_0342: Unknown result type (might be due to invalid IL or missing references) + //IL_034c: Expected O, but got Unknown + //IL_034f: Unknown result type (might be due to invalid IL or missing references) + //IL_0359: Expected O, but got Unknown + //IL_035c: Unknown result type (might be due to invalid IL or missing references) + //IL_0366: Expected O, but got Unknown + //IL_0369: Unknown result type (might be due to invalid IL or missing references) + //IL_0373: Expected O, but got Unknown + //IL_0376: Unknown result type (might be due to invalid IL or missing references) + //IL_0380: Expected O, but got Unknown + //IL_0382: Unknown result type (might be due to invalid IL or missing references) + //IL_038e: Unknown result type (might be due to invalid IL or missing references) + //IL_0398: Expected O, but got Unknown + //IL_039a: Unknown result type (might be due to invalid IL or missing references) + //IL_03a6: Unknown result type (might be due to invalid IL or missing references) + //IL_03b0: Expected O, but got Unknown + //IL_03b3: Unknown result type (might be due to invalid IL or missing references) + //IL_03bd: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ApoliceRadioButton = (RadioButton)target; + break; + case 2: + EndossoRadioButton = (RadioButton)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(ClienteView_Click); + break; + case 4: + AcessarDocumentoMenuItem = (MenuItem)target; + AcessarDocumentoMenuItem.Click += new RoutedEventHandler(ApoliceView_Click); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Renovar_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Perdido_OnClick); + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Endossar_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Recusar_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(Extratos_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(TrocarCliente_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(EditarParcelas_OnClick); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(ExpedicaoInfo_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(ValoresInfo_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(ManutecaoItens_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(RelacaoItens_OnClick); + break; + case 17: + ApoliceGrid = (DataGrid)target; + break; + case 19: + NomeField = (DataGridTextColumn)target; + break; + case 20: + ApelidoField = (DataGridTextColumn)target; + break; + case 21: + ApolicesComissaoColumn = (DataGridTextColumn)target; + break; + case 27: + EndossoGrid = (DataGrid)target; + break; + case 28: + EndossosComissaoColumn = (DataGridTextColumn)target; + break; + case 31: + ((MenuItem)target).Click += new RoutedEventHandler(Parcela_Click); + break; + case 32: + Comissao = (WrapPanel)target; + break; + case 33: + ParcelaGrid = (DataGrid)target; + break; + case 34: + ParcelasTotalColumn = (DataGridTextColumn)target; + break; + case 35: + ParcelasRealizadoColumn = (DataGridTextColumn)target; + break; + case 36: + ParcelasComissaoColumn = (DataGridTextColumn)target; + break; + case 37: + ParcelasReciboColumn = (DataGridTextColumn)target; + break; + case 38: + ParcelasValorComissaoDescColumn = (DataGridTextColumn)target; + break; + case 39: + MaisInformacoesColumn = (DataGridTemplateColumn)target; + break; + case 43: + ((MenuItem)target).Click += new RoutedEventHandler(Item_Click); + break; + case 44: + ((MenuItem)target).Click += new RoutedEventHandler(Sinistros_OnClick); + break; + case 45: + AtivosRadioButton = (RadioButton)target; + break; + case 46: + ApoliceItensRadioButton = (RadioButton)target; + break; + case 47: + EndossoItensRadioButton = (RadioButton)target; + break; + case 48: + InativosRadioButton = (RadioButton)target; + break; + case 49: + ((MenuItem)target).Click += new RoutedEventHandler(MostrarItens_Click); + break; + case 50: + ((MenuItem)target).Click += new RoutedEventHandler(ReordenarItem_Click); + break; + case 51: + ItemGrid = (DataGrid)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_005b: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + //IL_007f: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Expected O, but got Unknown + //IL_00a9: Unknown result type (might be due to invalid IL or missing references) + //IL_00b5: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Expected O, but got Unknown + //IL_00c1: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Unknown result type (might be due to invalid IL or missing references) + //IL_00d7: Expected O, but got Unknown + //IL_00d8: Unknown result type (might be due to invalid IL or missing references) + //IL_00e4: Unknown result type (might be due to invalid IL or missing references) + //IL_00ee: Expected O, but got Unknown + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fc: Unknown result type (might be due to invalid IL or missing references) + //IL_0106: Expected O, but got Unknown + //IL_0108: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_011e: Expected O, but got Unknown + //IL_0120: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Unknown result type (might be due to invalid IL or missing references) + //IL_0136: Expected O, but got Unknown + //IL_0138: Unknown result type (might be due to invalid IL or missing references) + //IL_0144: Unknown result type (might be due to invalid IL or missing references) + //IL_014e: Expected O, but got Unknown + //IL_0150: Unknown result type (might be due to invalid IL or missing references) + //IL_015c: Unknown result type (might be due to invalid IL or missing references) + //IL_0166: Expected O, but got Unknown + //IL_0168: Unknown result type (might be due to invalid IL or missing references) + //IL_0174: Unknown result type (might be due to invalid IL or missing references) + //IL_017e: Expected O, but got Unknown + //IL_0180: Unknown result type (might be due to invalid IL or missing references) + //IL_018c: Unknown result type (might be due to invalid IL or missing references) + //IL_0196: Expected O, but got Unknown + //IL_0198: Unknown result type (might be due to invalid IL or missing references) + //IL_01a4: Unknown result type (might be due to invalid IL or missing references) + //IL_01ae: Expected O, but got Unknown + switch (connectionId) + { + case 18: + { + EventSetter val = new EventSetter(); + val.Event = Control.MouseDoubleClickEvent; + val.Handler = (Delegate)new MouseButtonEventHandler(ApoliceGrid_OnMouseDoubleClick); + ((Collection<SetterBase>)(object)((Style)target).Setters).Add((SetterBase)(object)val); + break; + } + case 22: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 23: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Observacoes_OnClick); + break; + case 24: + ((PopupBox)target).Opened += new RoutedEventHandler(PopupBox_OnOpened); + ((PopupBox)target).Closed += new RoutedEventHandler(PopupBox_OnClosed); + break; + case 25: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(EnviarPorWhatsApp_OnClick); + break; + case 26: + ((MenuItem)target).Click += new RoutedEventHandler(EnviarPorEmail_OnClick); + break; + case 29: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 30: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Observacoes_OnClick); + break; + case 40: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ValoresParcelaInfo_OnClick); + break; + case 41: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 42: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Observacoes_OnClick); + break; + case 52: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/CriticaApoliceView.cs b/Decompiler/Gestor.Application.Views.Seguros/CriticaApoliceView.cs new file mode 100644 index 0000000..296bea8 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/CriticaApoliceView.cs @@ -0,0 +1,1658 @@ +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.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; +using System.Windows.Threading; +using CsQuery.ExtensionMethods; +using CurrencyTextBoxControl; +using Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros.Itens; +using Gestor.Common.Helpers; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Views.Seguros; + +public class CriticaApoliceView : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal ComboBox UsuarioBox; + + internal ComboBox SeguradoraBox; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal ToggleButton CriticadoBox; + + internal DataGrid CriticaGrid; + + internal MenuItem ConcluirCriticaButton; + + internal MenuItem CancelarDocumento; + + internal ComboBox ProdutoBox; + + internal ComboBox NegocioCorretoraBox; + + internal ComboBox SituacaoBox; + + internal DatePicker TransmissaoBox; + + internal TextBox ApoliceBox; + + internal TextBox EndossoBox; + + internal DatePicker EmissaoBox; + + internal DatePicker Vigencia1Box; + + internal DatePicker Vigencia2Box; + + internal ToggleButton AdicionalBox; + + internal CustomIsReadOnlyControl Comissao; + + internal CurrencyTextBox ComissaoBox; + + internal CurrencyTextBox PremioLiquidoBox; + + internal CurrencyTextBox PremioAdicionalBox; + + internal CurrencyTextBox IofBox; + + internal CurrencyTextBox DiferencaBox; + + internal CurrencyTextBox PremioTotalBox; + + internal CurrencyTextBox ParcelasBox; + + internal ToggleButton SeguroCombinadoBox; + + internal MenuItem EditarVendedorButton; + + internal MenuItem SalvarVendedorButton; + + internal MenuItem CancelarVendedorButton; + + internal WrapPanel VendedorFields; + + internal ToggleButton CoCorretagemToogle; + + internal ComboBox TipoVendedorBox; + + internal ComboBox VendedorBox; + + internal CustomItemValidation ComissaoNovoBox; + + internal ComboBox ComissaoNovoComboBox; + + internal CustomItemValidation ComissaoRenovacaoBox; + + internal ComboBox ComissaoRenovacaoComboBox; + + internal CurrencyTextBox ValorRepasseBox; + + internal TextBox FormaRecebidaBox; + + internal DataGrid VendedorGrid; + + internal DataGridTextColumn RepasseVendedor; + + internal TextBox NomeBox; + + internal ComboBox TipoDocumentoPrincipalBox; + + internal TextBox DocumentoPrincipalBox; + + internal DatePicker NascimentoBox; + + internal TextBox IdentidadeBox; + + internal TextBox EmissorBox; + + internal TextBox EstadoEmissorBox; + + internal ListBox TelefoneListBox; + + internal ListBox EmailListBox; + + internal DataGrid ItemGrid; + + private bool _contentLoaded; + + public CriticaApoliceViewModel ViewModel { get; set; } + + private bool AdicionandoVendedor { get; set; } + + private int Ordem { get; set; } = 1; + + + public CriticaApoliceView() + { + ((FrameworkElement)this).Tag = "CRÍTICA DE IMPORTAÇÃO"; + ViewModel = new CriticaApoliceViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private async void ContentLoad() + { + ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_OnLostFocus); + TextBox documentoPrincipalBox = DocumentoPrincipalBox; + CriticaApoliceView criticaApoliceView = this; + ((UIElement)documentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(criticaApoliceView.SomenteNumeros); + CriticadoBox.Checked += new RoutedEventHandler(Criticado_OnChecked); + CriticadoBox.Unchecked += new RoutedEventHandler(Criticado_OnChecked); + ((Selector)UsuarioBox).SelectionChanged += new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + ((Selector)SeguradoraBox).SelectionChanged += new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)InicioBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + InicioBox.SelectedDateChanged += FiltroDataBox_OnSelectedDateChanged; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)FimBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + FimBox.SelectedDateChanged += FiltroDataBox_OnSelectedDateChanged; + ((UIElement)TransmissaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)TransmissaoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((UIElement)EmissaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)EmissaoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((UIElement)Vigencia1Box).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)Vigencia1Box).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((UIElement)Vigencia2Box).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)Vigencia2Box).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Selector)NegocioCorretoraBox).SelectionChanged += new SelectionChangedEventHandler(NegocioCorretoraBox_OnSelectionChanged); + ((UIElement)PremioLiquidoBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)PremioAdicionalBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)IofBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + ((UIElement)DiferencaBox).LostFocus += new RoutedEventHandler(AlteracaoDePremio_LostFocus); + AdicionalBox.Unchecked += new RoutedEventHandler(AdicionalBox_OnChecked); + AdicionalBox.Checked += new RoutedEventHandler(AdicionalBox_OnChecked); + ((Selector)VendedorBox).SelectionChanged += new SelectionChangedEventHandler(VendedorBox_OnSelectionChanged); + ((Selector)TipoVendedorBox).SelectionChanged += new SelectionChangedEventHandler(TipoVendedorBox_OnSelectionChanged); + ((Selector)TipoDocumentoPrincipalBox).SelectionChanged += new SelectionChangedEventHandler(TipoDocumentoPrincipalBox_OnSelectionChanged); + ((Selector)CriticaGrid).SelectionChanged += new SelectionChangedEventHandler(Grid_OnSelectionChanged); + ((DataGridColumn)RepasseVendedor).Visibility = (Visibility)(ViewModel.Restricao((TipoRestricao)95) ? 2 : 0); + await ViewModel.InitialLoad(); + } + + private void NegocioCorretoraBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + ComboBox val = (ComboBox)sender; + if ((((int)val != 0) ? ((Selector)val).SelectedItem : null) != null) + { + AlteracaoDePremio_LostFocus(PremioLiquidoBox, new RoutedEventArgs()); + if ((int)((UIElement)SalvarVendedorButton).Visibility == 0) + { + EditarVendedor(editar: true); + ComissaoVendedorBox_OnSelectionChanged(((int)((UIElement)ComissaoNovoBox).Visibility == 0) ? ComissaoNovoComboBox : ComissaoRenovacaoComboBox, e); + } + } + } + + private void DocumentoPrincipalBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + if (((Selector)TipoDocumentoPrincipalBox).SelectedItem == null) + { + ((Selector)TipoDocumentoPrincipalBox).SelectedItem = (object)(TipoDocumento)0; + } + if ((int)(TipoDocumento)((Selector)TipoDocumentoPrincipalBox).SelectedItem == 0) + { + TextBox val = (TextBox)sender; + val.Text = ValidationHelper.FormatDocument(val.Text); + } + } + + private void AlteracaoDePremio_LostFocus(object sender, RoutedEventArgs e) + { + //IL_001d: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + if (!ViewModel.AllowEditApolice || ViewModel.SelectedDocumento == null) + { + return; + } + CurrencyTextBox val = (CurrencyTextBox)sender; + if (val == null) + { + return; + } + string name = ((FrameworkElement)val).Name; + if ((name == "PremioLiquidoBox" || name == "PremioAdicionalBox") && IofBox.Number == 0m) + { + decimal num = PremioLiquidoBox.Number + PremioAdicionalBox.Number; + Ramo ramo = ViewModel.SelectedDocumento.Controle.Ramo; + decimal num2 = num * ((ramo != null) ? ramo.Iof : 0m); + IofBox.Number = num2; + CurrencyTextBox premioTotalBox = PremioTotalBox; + premioTotalBox.Number += num2; + } + PremioTotalBox.Number = PremioLiquidoBox.Number + PremioAdicionalBox.Number + IofBox.Number + DiferencaBox.Number; + switch (((FrameworkElement)val).Name) + { + case "PremioLiquidoBox": + case "PremioAdicionalBox": + case "ComissaoBox": + if (ViewModel.HabilitarVendedor().Count == 0) + { + ViewModel.RecalculaRepasses(); + } + break; + } + ValidarDocumento(); + } + + private void AdicionalBox_OnChecked(object sender, RoutedEventArgs e) + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + if (ViewModel.SelectedDocumento != null) + { + AlteracaoDePremio_LostFocus(PremioAdicionalBox, new RoutedEventArgs()); + } + } + + private void ValidarDocumento() + { + if (ViewModel.SelectedDocumento == null) + { + return; + } + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedDocumento.Validate(); + if (ViewModel.Telefones != null) + { + ExtensionMethods.ForEach<ClienteTelefone>((IEnumerable<ClienteTelefone>)ViewModel.Telefones, (Action<ClienteTelefone>)delegate(ClienteTelefone x) + { + List<KeyValuePair<string, string>> collection = x.Validate(); + errorMessages.AddRange(collection); + }); + } + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + ExtensionMethods.ForEach<DependencyObject>(Extentions.FindVisualChildren<DependencyObject>((DependencyObject)(object)TelefoneListBox), (Action<DependencyObject>)delegate(DependencyObject child) + { + child.ValidateFields(errorMessages, focusField: false); + }); + } + + private async void Criticado_OnChecked(object sender, RoutedEventArgs e) + { + ToggleButton val = (ToggleButton)sender; + if (val != null && val.IsChecked.HasValue) + { + ComboBox usuarioBox = UsuarioBox; + if (((usuarioBox != null) ? ((Selector)usuarioBox).SelectedItem : null) != null && !ViewModel.IsLoading) + { + bool ischecked = val.IsChecked.Value; + ((Selector)SeguradoraBox).SelectionChanged -= new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged -= new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked -= new RoutedEventHandler(Criticado_OnChecked); + await ViewModel.CarregarUsuarios(((DomainBase)(Usuario)((Selector)UsuarioBox).SelectedItem).Id, ischecked); + await ViewModel.CarregaCritica(((DomainBase)ViewModel.SelectedUsuario).Id, ((DomainBase)ViewModel.SelectedSeguradora).Id, ischecked); + ((Selector)SeguradoraBox).SelectionChanged += new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged += new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked += new RoutedEventHandler(Criticado_OnChecked); + } + } + } + + private async void Usuario_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + ComboBox val = (ComboBox)sender; + if (val != null && ((Selector)val).SelectedItem != null) + { + ToggleButton criticadoBox = CriticadoBox; + if (criticadoBox != null && criticadoBox.IsChecked.HasValue && ViewModel.SelectedSeguradora != null) + { + ((Selector)SeguradoraBox).SelectionChanged -= new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged -= new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked -= new RoutedEventHandler(Criticado_OnChecked); + ViewModel.SelectedUsuario = (Usuario)((Selector)val).SelectedItem; + await ViewModel.CarregaCritica(((DomainBase)(Usuario)((Selector)val).SelectedItem).Id, ((DomainBase)ViewModel.SelectedSeguradora).Id, ViewModel.Criticado); + ((Selector)SeguradoraBox).SelectionChanged += new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged += new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked += new RoutedEventHandler(Criticado_OnChecked); + } + } + } + + private async void Seguradora_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + ComboBox val = (ComboBox)sender; + if (val != null && ((Selector)val).SelectedItem != null) + { + ToggleButton criticadoBox = CriticadoBox; + if (criticadoBox != null && criticadoBox.IsChecked.HasValue) + { + ((Selector)SeguradoraBox).SelectionChanged -= new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged -= new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked -= new RoutedEventHandler(Criticado_OnChecked); + ViewModel.SelectedSeguradora = (Seguradora)((Selector)val).SelectedItem; + await ViewModel.CarregaCritica(((DomainBase)ViewModel.SelectedUsuario).Id, ((DomainBase)(Seguradora)((Selector)val).SelectedItem).Id, ViewModel.Criticado); + ((Selector)SeguradoraBox).SelectionChanged += new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged += new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked += new RoutedEventHandler(Criticado_OnChecked); + } + } + } + + private async void FiltroDataBox_OnSelectedDateChanged(object sender, SelectionChangedEventArgs e) + { + DatePicker val = (DatePicker)sender; + if ((int)val != 0 && val.SelectedDate.HasValue) + { + ComboBox usuarioBox = UsuarioBox; + if (((usuarioBox != null) ? ((Selector)usuarioBox).SelectedItem : null) != null) + { + ((Selector)SeguradoraBox).SelectionChanged -= new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged -= new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked -= new RoutedEventHandler(Criticado_OnChecked); + await ViewModel.CarregarUsuarios(((DomainBase)(Usuario)((Selector)UsuarioBox).SelectedItem).Id, ViewModel.Criticado); + await ViewModel.CarregaCritica(((DomainBase)ViewModel.SelectedUsuario).Id, ((DomainBase)ViewModel.SelectedSeguradora).Id, ViewModel.Criticado); + ((Selector)SeguradoraBox).SelectionChanged += new SelectionChangedEventHandler(Seguradora_OnSelectionChanged); + ((Selector)UsuarioBox).SelectionChanged += new SelectionChangedEventHandler(Usuario_OnSelectionChanged); + CriticadoBox.Checked += new RoutedEventHandler(Criticado_OnChecked); + } + } + } + + private async void EditarVendedorButton_OnClick(object sender, RoutedEventArgs e) + { + List<KeyValuePair<string, string>> list = ViewModel.SelectedDocumento.Validate(); + bool flag = list == null || list.Count == 0; + if (flag) + { + Parcela selectedParcela = ViewModel.SelectedParcela; + if (selectedParcela != null && selectedParcela.DataRecebimento.HasValue) + { + await ViewModel.ShowMessage("DOCUMENTO COM PARCELA(S) JÁ BAIXADA(S), NÃO É POSSÍVEL ALTERAR VENDEDORES!"); + return; + } + } + if (!flag) + { + ((DependencyObject)(object)this).ValidateFields(list); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + else + { + ViewModel.IncluirVendedor(); + EditarVendedor(editar: true); + ViewModel.VendedorCoCorretagem(); + } + } + + private void EditarVendedor(bool editar) + { + //IL_0154: Unknown result type (might be due to invalid IL or missing references) + //IL_015a: Invalid comparison between Unknown and I4 + AdicionandoVendedor = editar; + ((UIElement)SalvarVendedorButton).Visibility = (Visibility)((!editar) ? 2 : 0); + ((UIElement)CancelarVendedorButton).Visibility = (Visibility)((!editar) ? 2 : 0); + ((UIElement)EditarVendedorButton).Visibility = (Visibility)(editar ? 2 : 0); + ((UIElement)VendedorFields).Visibility = (Visibility)((!editar) ? 2 : 0); + ((UIElement)VendedorGrid).IsEnabled = !editar; + if (ViewModel.SelectedDocumento == null) + { + return; + } + if (editar && Recursos.Configuracoes.Any((ConfiguracaoSistema config) => (int)config.Configuracao == 56)) + { + ObservableCollection<VendedorParcela> pagamentos = ViewModel.Pagamentos; + int num; + if (pagamentos == null || pagamentos.Count != 1 || !ViewModel.Pagamentos.Any((VendedorParcela vendedor) => vendedor.Repasse == null)) + { + ObservableCollection<VendedorParcela> pagamentos2 = ViewModel.Pagamentos; + num = ((pagamentos2 != null && pagamentos2.Count == 0) ? 1 : 0); + } + else + { + num = 1; + } + bool isEnabled = (byte)num != 0; + ((UIElement)CoCorretagemToogle).IsEnabled = isEnabled; + ((UIElement)ComissaoNovoBox).Visibility = (Visibility)0; + ((UIElement)ComissaoRenovacaoBox).Visibility = (Visibility)2; + CoCorretagemToogle.IsChecked = false; + } + else + { + bool flag = (int)ViewModel.SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1; + ((UIElement)ComissaoNovoBox).Visibility = (Visibility)((!editar || flag) ? 2 : 0); + ((UIElement)ComissaoRenovacaoBox).Visibility = (Visibility)((!(editar && flag)) ? 2 : 0); + } + } + + private void VendedorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + ViewModel.FiltrarRepasse((Vendedor)((Selector)val).SelectedItem); + bool flag = (int)ViewModel.SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1; + if (flag && ViewModel.CoCorretagem) + { + ((UIElement)ComissaoNovoBox).Visibility = (Visibility)0; + ((UIElement)ComissaoRenovacaoBox).Visibility = (Visibility)2; + } + else + { + ((UIElement)ComissaoNovoBox).Visibility = (Visibility)(flag ? 2 : 0); + ((UIElement)ComissaoRenovacaoBox).Visibility = (Visibility)((!flag) ? 2 : 0); + } + } + } + + private void ComissaoVendedorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + //IL_00e7: Unknown result type (might be due to invalid IL or missing references) + //IL_00ed: Invalid comparison between Unknown and I4 + //IL_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Invalid comparison between Unknown and I4 + //IL_0103: Unknown result type (might be due to invalid IL or missing references) + //IL_0109: Invalid comparison between Unknown and I4 + //IL_0136: Unknown result type (might be due to invalid IL or missing references) + //IL_013b: Unknown result type (might be due to invalid IL or missing references) + //IL_0147: Expected O, but got Unknown + //IL_0191: Unknown result type (might be due to invalid IL or missing references) + //IL_0197: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem == null) + { + return; + } + Repasse val2 = (Repasse)((Selector)val).SelectedItem; + if (val2 != null && (int)val2.Tipo.GetValueOrDefault() == 3) + { + decimal num = ViewModel.SelectedDocumento.Comissao * (val2.ValorNovo * 0.01m) * 0.01m; + ViewModel.SelectedPagamento.ValorRepasse = ViewModel.SelectedDocumento.PremioTotal * num; + ValorRepasseBox.Number = ViewModel.SelectedPagamento.ValorRepasse.Value; + return; + } + ViewModel.SelectedPagamento.Repasse = val2; + ViewModel.SelectedPagamento.PorcentagemRepasse = (((int)ViewModel.SelectedDocumento.Situacao == 2 && (int)ViewModel.SelectedDocumento.Negocio.GetValueOrDefault() == 1) ? val2.ValorRenovacao : val2.ValorNovo); + if (ViewModel.SelectedParcela == null) + { + ViewModel.SelectedParcela = new Parcela + { + SubTipo = (SubTipo)1 + }; + } + ViewModel.SelectedParcela.Documento = ViewModel.SelectedDocumento; + ViewModel.SelectedPagamento.ValorRepasse = Funcoes.CalculaRepasse(val2, ViewModel.SelectedParcela, ViewModel.SelectedParcela == null || (int)ViewModel.SelectedParcela.SubTipo == 1); + ViewModel.SelectedPagamento.ValorTotal = ViewModel.SelectedPagamento.ValorRepasse; + ValorRepasseBox.Number = ViewModel.SelectedPagamento.ValorRepasse.Value; + FormaRecebidaBox.Text = EnumHelper.GetDescription<FormaRepasse?>(val2.Forma); + } + + private void TipoVendedorBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0048: Expected O, but got Unknown + //IL_0023: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Expected O, but got Unknown + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + if (ViewModel.SelectedPagamento == null) + { + ViewModel.SelectedPagamento = new VendedorParcela(); + } + ViewModel.SelectedPagamento.TipoVendedor = (TipoVendedor)((Selector)val).SelectedItem; + } + } + + private async void SalvarVendedor_Click(object sender, RoutedEventArgs e) + { + ((MenuItem)sender).Click -= new RoutedEventHandler(SalvarVendedor_Click); + bool flag = ViewModel.CoCorretagem; + if (flag) + { + flag = !(await ViewModel.ShowMessage("AO ADICIONAR CO-CORRETAGEM COMO VENDEDOR, O DOCUMENTO ACIMA SERÁ SALVO.\nDESEJÁ CONTINUAR?", "SIM", "NÃO")); + } + if (flag) + { + ((MenuItem)sender).Click += new RoutedEventHandler(SalvarVendedor_Click); + return; + } + bool flag2 = ViewModel.SelectedParcela == null || ((int)ViewModel.SelectedParcela.SubTipo == 1 && (int)ViewModel.SelectedDocumento.TipoRecebimento.GetValueOrDefault() == 1); + bool flag3 = (int)ViewModel.SelectedDocumento.NegocioCorretora.GetValueOrDefault() == 1; + if (((Selector)ComissaoRenovacaoComboBox).SelectedItem == null && ((Selector)ComissaoNovoComboBox).SelectedItem == null) + { + await ViewModel.ShowMessage("NECESSÁRIOS ESCOLHER O VALOR DE REPASSE ANTES DE ADICIONAR O VENDEDOR"); + ((MenuItem)sender).Click += new RoutedEventHandler(SalvarVendedor_Click); + return; + } + VendedorParcela selectedPagamento = ViewModel.SelectedPagamento; + int num; + if (selectedPagamento == null) + { + num = 0; + } + else + { + Repasse repasse = selectedPagamento.Repasse; + num = (((int)((repasse != null) ? repasse.Tipo : null).GetValueOrDefault() == 3) ? 1 : 0); + } + if (num != 0) + { + flag3 = false; + } + object obj = ((Selector)ComissaoRenovacaoComboBox).SelectedItem ?? ((Selector)ComissaoNovoComboBox).SelectedItem; + ViewModel.SelectedPagamento.PorcentagemRepasse = (flag3 ? ((Repasse)obj).ValorRenovacao : ((Repasse)obj).ValorNovo); + List<KeyValuePair<string, string>> list = ((!flag2) ? (await ViewModel.AdicionarVendedorParcelaEspecial()) : (await ViewModel.AdicionarVendedor())); + List<KeyValuePair<string, string>> list2 = list; + if (list2 == null || list2.Count == 0) + { + EditarVendedor(editar: false); + if (ViewModel.VerificaCoCorretagem()) + { + ((TextBoxBase)ComissaoBox).IsReadOnly = true; + ViewModel.ComissOriginalVisibility = (Visibility)0; + } + ((MenuItem)sender).Click += new RoutedEventHandler(SalvarVendedor_Click); + } + else + { + await ViewModel.ShowMessage(list2, ViewModel.ErroCamposInvalidos, "OK"); + ((MenuItem)sender).Click += new RoutedEventHandler(SalvarVendedor_Click); + } + } + + private void CancelarVendedor_Click(object sender, RoutedEventArgs e) + { + EditarVendedor(editar: false); + ViewModel.SelectedPagamento = null; + ViewModel.SelecionarVendedor(); + } + + private async void ConcluirCritica_OnClick(object sender, RoutedEventArgs e) + { + ConcluirCriticaButton.Click -= new RoutedEventHandler(ConcluirCritica_OnClick); + ViewModel.EnableGrid = false; + ExecutarValidacaoData(); + ((UIElement)NomeBox).Focus(); + if (ViewModel.CompararValores()) + { + PremioTotalBox.Number = PremioLiquidoBox.Number + PremioAdicionalBox.Number + IofBox.Number + DiferencaBox.Number; + } + await SalvarDocumento(); + ConcluirCriticaButton.Click += new RoutedEventHandler(ConcluirCritica_OnClick); + } + + private void ExecutarValidacaoData() + { + ViewModel.SelectedCliente.Nascimento = ((NascimentoBox.Text != null && DateTime.TryParse(ValidationHelper.FormatDate(NascimentoBox.Text), out var result)) ? new DateTime?(result) : null); + ViewModel.SelectedDocumento.Remessa = ((TransmissaoBox.Text != null && DateTime.TryParse(ValidationHelper.FormatDate(TransmissaoBox.Text), out result)) ? new DateTime?(result) : null); + ViewModel.SelectedDocumento.Emissao = ((EmissaoBox.Text != null && DateTime.TryParse(ValidationHelper.FormatDate(EmissaoBox.Text), out result)) ? new DateTime?(result) : null); + ViewModel.SelectedDocumento.Vigencia1 = ((Vigencia1Box.Text != null && DateTime.TryParse(ValidationHelper.FormatDate(Vigencia1Box.Text), out result)) ? result : Funcoes.GetNetworkTime().Date); + ViewModel.SelectedDocumento.Vigencia2 = ((Vigencia2Box.Text != null && DateTime.TryParse(ValidationHelper.FormatDate(Vigencia2Box.Text), out result)) ? new DateTime?(result) : null); + } + + private async Task SalvarDocumento() + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = null; + if (AdicionandoVendedor) + { + list = await ViewModel.AdicionarVendedor(); + } + if (list != null && list.Count != 0) + { + ViewModel.Loading(isLoading: false); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return; + } + list = await ViewModel.SalvarCliente(); + if (list != null && list.Count != 0) + { + ViewModel.Loading(isLoading: false); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return; + } + if (!ViewModel.StatusDocumento.HasValue) + { + list = new List<KeyValuePair<string, string>> + { + new KeyValuePair<string, string>("STATUS DO SEGURO", "OBRIGATÓRIO") + }; + } + if (list != null && list.Count != 0) + { + ViewModel.Loading(isLoading: false); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + return; + } + if (!ViewModel.StatusDocumento.HasValue) + { + ViewModel.SelectedDocumento.Situacao = (TipoSeguro)1; + } + list = await ViewModel.Salvar(critica: true); + if (list != null && list.Count != 0) + { + if (list.Any((KeyValuePair<string, string> x) => x.Value == "VIGENCIANAOACEITA")) + { + ViewModel.Loading(isLoading: false); + return; + } + ViewModel.Loading(isLoading: false); + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + else + { + await ViewModel.ConcluirCritica(); + EditarVendedor(editar: false); + ViewModel.EnableGrid = true; + SeguroCombinadoBox.IsChecked = false; + } + } + + private void OrdemBox_OnPreviewGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + TextBox val = (TextBox)((sender is TextBox) ? sender : null); + if (val != null && int.TryParse(val.Text, out var result)) + { + Ordem = result; + } + } + + private void ExcluirTelefone_OnClick(object sender, RoutedEventArgs e) + { + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ClienteTelefone telefone = (ClienteTelefone)((FrameworkElement)val).DataContext; + ViewModel.ExcluirTelefone(telefone); + } + } + + private void ExcluirEmail_OnClick(object sender, RoutedEventArgs e) + { + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + Button val = (Button)((sender is Button) ? sender : null); + if (val != null && ((FrameworkElement)val).DataContext != null) + { + ClienteEmail email = (ClienteEmail)((FrameworkElement)val).DataContext; + ViewModel.ExcluirEmail(email); + } + } + + private void TipoDocumentoPrincipalBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + ViewModel.AlteraDocumentoPrincipal(); + } + + private async void AbrirAquivoDigital_Click(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + EnumHelper.GetDescription<TipoArquivoDigital>((TipoArquivoDigital)2) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedCritica.Documento).Id, + Tipo = (TipoArquivoDigital)2, + Parente = ViewModel.SelectedCritica.Documento + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private async void ExcluirVendedor_OnClick(object sender, RoutedEventArgs e) + { + DataGrid vendedorGrid = VendedorGrid; + if (vendedorGrid == null || ((Selector)vendedorGrid).SelectedIndex >= 0) + { + DataGrid vendedorGrid2 = VendedorGrid; + VendedorParcela val = (VendedorParcela)((vendedorGrid2 != null) ? ((ItemsControl)vendedorGrid2).Items[((Selector)VendedorGrid).SelectedIndex] : null); + int num; + if (val == null) + { + num = 0; + } + else + { + Repasse repasse = val.Repasse; + num = (((int)((repasse != null) ? repasse.Tipo : null).GetValueOrDefault() == 3) ? 1 : 0); + } + bool deleteCoCorretagem = (byte)num != 0; + CriticaApoliceViewModel viewModel = ViewModel; + DataGrid vendedorGrid3 = VendedorGrid; + await viewModel.ExcluirVendedor((VendedorParcela)((vendedorGrid3 != null) ? ((ItemsControl)vendedorGrid3).Items[((Selector)VendedorGrid).SelectedIndex] : null)); + await ViewModel.SelecionaParcela(ViewModel.Parcelas.FirstOrDefault()); + ((TextBoxBase)ComissaoBox).IsReadOnly = ViewModel.VerificaCoCorretagem(); + ViewModel.ComissOriginalVisibility = (Visibility)((!((TextBoxBase)ComissaoBox).IsReadOnly) ? 2 : 0); + if (deleteCoCorretagem) + { + await ViewModel.AjusteComissãoCoCorretagem(removido: true); + } + } + } + + private async void Cliente_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(ViewModel.SelectedDocumento.Controle.Cliente, lockInsert: true), "CADASTRO DE CLIENTES - " + ViewModel.SelectedDocumento.Controle.Cliente.Nome)).ShowDialog(); + CriticaApoliceViewModel viewModel = ViewModel; + viewModel.SelectedCliente = await ViewModel.CarregaCliente(((DomainBase)ViewModel.SelectedCliente).Id); + await ViewModel.SelecionaCliente(ViewModel.SelectedCliente); + } + + private async void Apolice_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedDocumento != null) + { + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(ViewModel.SelectedDocumento, lockInsert: true, invoke: false, (AcessoApolice)0, 0L, consultaTela: true), "CADASTRO DE APÓLICES - " + ViewModel.SelectedDocumento.Controle.Cliente.Nome + " - " + ViewModel.SelectedDocumento.Apolice)).ShowDialog(); + await ViewModel.SelecionaDocumento(ViewModel.SelectedDocumento); + } + } + + private async void Item_Click(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext == null) + { + return; + } + Item val2 = (Item)((FrameworkElement)val).DataContext; + val2.Documento = ViewModel.SelectedDocumento; + long id = ((DomainBase)ViewModel.SelectedDocumento.Controle.Ramo).Id; + long num = id - 1; + if ((ulong)num <= 19uL) + { + switch (num) + { + case 4L: + goto IL_00f9; + case 0L: + case 1L: + case 2L: + case 14L: + case 17L: + goto IL_0120; + case 12L: + goto IL_0147; + case 19L: + goto IL_016e; + case 5L: + case 6L: + case 8L: + case 9L: + goto IL_0192; + case 3L: + case 7L: + case 10L: + case 11L: + case 13L: + case 15L: + case 16L: + case 18L: + goto IL_01da; + } + } + long num2 = id - 36; + if ((ulong)num2 <= 2uL) + { + switch (num2) + { + case 1L: + goto IL_00f9; + case 2L: + goto IL_0120; + case 0L: + goto IL_01b6; + } + } + if (id == 53) + { + goto IL_0192; + } + goto IL_01da; + IL_01b6: + UserControl control = (UserControl)(object)new ConsorcioView(null, lockInsert: true, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + IL_0192: + control = (UserControl)(object)new VidaView(null, lockInsert: true, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + IL_0147: + control = (UserControl)(object)new AeronauticoView(null, lockInsert: true, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + IL_016e: + control = (UserControl)(object)new GranizoView(null, lockInsert: true, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + IL_01da: + control = (UserControl)(object)new RiscosDiversosView(null, lockInsert: false, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + IL_01fc: + ((Window)new HosterWindow((ContentControl)(object)control, "CADASTRO DE CLIENTES - " + ViewModel.SelectedDocumento.Controle.Cliente.Nome)).ShowDialog(); + await ViewModel.SelecionaItens(((DomainBase)ViewModel.SelectedDocumento.Controle).Id); + return; + IL_00f9: + control = (UserControl)(object)new AutoView(null, lockInsert: true, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + IL_0120: + control = (UserControl)(object)new PatrimonialView(null, lockInsert: true, substituir: false, null, val2, ViewModel.SelectedDocumento.Controle.Ramo); + goto IL_01fc; + } + + private async void Perfil_OnClick(object sender, RoutedEventArgs e) + { + PerfilView perfilView = new PerfilView(ViewModel.SelectedDocumento.Controle); + if (await ViewModel.VerificarPermissao((TipoTela)32)) + { + ((Window)new HosterWindow((ContentControl)(object)perfilView, "PERFIL", 800.0, 370.0)).ShowDialog(); + } + } + + private void Tarefa_OnClick(object sender, RoutedEventArgs e) + { + //IL_0000: Unknown result type (might be due to invalid IL or missing references) + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Expected O, but got Unknown + Tarefa tarefa = new Tarefa + { + IdCliente = ((DomainBase)ViewModel.SelectedDocumento.Controle.Cliente).Id, + Cliente = ViewModel.SelectedDocumento.Controle.Cliente.Nome, + Entidade = (TipoTarefa)0, + IdEntidade = ((DomainBase)ViewModel.SelectedDocumento).Id, + Titulo = ViewModel.SelectedDocumento.Controle.Cliente.Nome + " APÓLICE " + ViewModel.SelectedDocumento.Apolice + }; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa), 0, close: false); + } + + private void Pesquisa_OnPreviewKeyDown(object sender, KeyEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Invalid comparison between Unknown and I4 + if ((int)e.Key == 6) + { + ViewModel.AdcionarFiltro(); + } + } + + private void AdicionarFiltro_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdcionarFiltro(); + } + + private void ExcluirFiltro_OnClick(object sender, RoutedEventArgs e) + { + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + string text = (string)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (text != null) + { + ViewModel.PesquisaCritica.Remove(text); + ViewModel.Pesquisar(); + } + } + } + + private async void Atualizar_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.CarregaCritica(((DomainBase)ViewModel.SelectedUsuario).Id, ((DomainBase)ViewModel.SelectedSeguradora).Id, ViewModel.Criticado); + } + + private async void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + ViewModel.EnableGrid = false; + if (Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 3)) + { + ((Selector)SituacaoBox).SelectedIndex = -1; + } + await ViewModel.SelecionaCritica(ViewModel.SelectedCritica); + ValidarDocumento(); + } + + private async void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Repasses.Where((VendedorParcela repasse) => !repasse.Vendedor.Corretora).Any()) + { + await ViewModel.ShowMessage("PARA CANCELAR AS ALTERAÇÕES É NECESSÁRIO REMOVER OS VENDEDORES COM REPASSE CONFIGURADO."); + } + else if ((!ViewModel.HasChange && (ViewModel.SelectedDocumento == null || !((DomainBase)ViewModel.SelectedDocumento).HasChange()) && (ViewModel.SelectedCliente == null || !((DomainBase)ViewModel.SelectedCliente).HasChange()) && (ViewModel.Telefones == null || !ViewModel.Telefones.Any((ClienteTelefone x) => ((DomainBase)x).HasChange()))) || await ViewModel.ShowMessage("HÁ ALTERAÇÕES PENDENTES AINDA NÃO SALVAS, DESEJA CONTINUAR? " + Environment.NewLine + "O PROCEDIMENTO IRÁ CANCELAR AS ALTERAÇÕES REALIZADAS.", "SIM", "NÃO")) + { + await ViewModel.SelecionaCritica(ViewModel.SelectedCritica); + ViewModel.Alterar(alterar: false); + ViewModel.EnableGrid = true; + } + } + + private void Initial_DatePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + DatePicker_OnLostKeyboardFocus(sender, e); + if (string.IsNullOrEmpty(Vigencia1Box.Text)) + { + Vigencia1Box.SelectedDate = DateTime.MinValue; + ViewModel.SelectedDocumento.Vigencia1 = DateTime.MinValue; + } + if (string.IsNullOrWhiteSpace(Vigencia2Box.Text)) + { + Vigencia2Box.DisplayDate = ValidationHelper.ToDateTime(Vigencia1Box.Text).AddYears(1); + Vigencia2Box.Text = Vigencia2Box.DisplayDate.ToShortDateString(); + } + } + + private async void Grid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (ViewModel.EnableGrid) + { + DataGrid val = (DataGrid)sender; + if (val != null && ((Selector)val).SelectedIndex >= 0) + { + ViewModel.EnableGrid = false; + ViewModel.Index = ((Selector)val).SelectedIndex; + await ViewModel.SelecionaCritica((CriticaApolice)((ItemsControl)val).Items[((Selector)val).SelectedIndex]); + ViewModel.EnableGrid = true; + } + } + } + + private void DocumentoPrincipalBox_LostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (!((TextBoxBase)(TextBox)sender).IsReadOnly) + { + string text = ValidationHelper.Clear(DocumentoPrincipalBox.Text); + if (!string.IsNullOrEmpty(text)) + { + DocumentoPrincipalBox.Text = ((text.Length == 11) ? ValidationHelper.FormatDocument(text.PadLeft(11, '0').Substring(0, 11)) : ValidationHelper.FormatDocument(text.PadLeft(14, '0').Substring(0, 14))); + ViewModel.JuridicaouFisica(DocumentoPrincipalBox.Text); + } + } + } + + private void OrdemBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + TextBox val = (TextBox)((sender is TextBox) ? sender : null); + if (val == null || ((TextBoxBase)val).IsReadOnly || !int.TryParse(val.Text, out var result)) + { + return; + } + WrapPanel val2 = Extentions.FindVisualAncestor<WrapPanel>((DependencyObject)(object)Extentions.FindVisualAncestor<CustomItemValidation>((DependencyObject)(object)val)); + ListBox val3 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val2); + if (val3 == null) + { + return; + } + for (int i = 0; i < ((CollectionView)((ItemsControl)val3).Items).Count; i++) + { + if (i != ((CollectionView)((ItemsControl)val3).Items).IndexOf(((FrameworkElement)val2).DataContext)) + { + ContentPresenter val4 = FindVisualChild.Find<ContentPresenter>((DependencyObject)(ListBoxItem)((ItemsControl)val3).ItemContainerGenerator.ContainerFromIndex(i)); + TextBox val5 = (TextBox)((FrameworkTemplate)val4.ContentTemplate).FindName("OrdemBox", (FrameworkElement)(object)val4); + if (int.TryParse(val5.Text, out var result2) && result2 == result) + { + val5.Text = Ordem.ToString(); + } + } + } + } + + private void TipoComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_003c: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Expected O, but got Unknown + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a3: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + CustomIsReadOnlyControl customIsReadOnlyControl = Extentions.FindVisualAncestor<CustomIsReadOnlyControl>((DependencyObject)(object)val); + if (customIsReadOnlyControl == null) + { + return; + } + WrapPanel val2 = Extentions.FindVisualAncestor<WrapPanel>((DependencyObject)(object)customIsReadOnlyControl); + ListBox val3 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val2); + ContentPresenter val4 = FindVisualChild.Find<ContentPresenter>((DependencyObject)(ListBoxItem)((ItemsControl)val3).ItemContainerGenerator.ContainerFromIndex(((CollectionView)((ItemsControl)val3).Items).IndexOf(((FrameworkElement)val2).DataContext))); + DataTemplate contentTemplate = val4.ContentTemplate; + CustomItemValidation customItemValidation = (CustomItemValidation)((FrameworkTemplate)contentTemplate).FindName("Prefixo", (FrameworkElement)(object)val4); + CustomItemValidation depObj = (CustomItemValidation)((FrameworkTemplate)contentTemplate).FindName("Telefone", (FrameworkElement)(object)val4); + TextBox? obj = ((DependencyObject)(object)customItemValidation).FindChildren<TextBox>().FirstOrDefault(); + TextBox val5 = ((DependencyObject)(object)depObj).FindChildren<TextBox>().FirstOrDefault(); + if (obj != null && val5 != null) + { + if ((int)(TipoTelefone)((Selector)val).SelectedValue != 8) + { + ((UIElement)customItemValidation).Visibility = (Visibility)0; + val5.MaxLength = 10; + int length = ((val5.Text.Length >= 10) ? 10 : val5.Text.Length); + val5.Text = val5.Text.Substring(0, length); + } + else + { + ((UIElement)customItemValidation).Visibility = (Visibility)2; + val5.MaxLength = 20; + } + } + } + + private void SituacaoBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + ComboBox val = (ComboBox)sender; + if (ViewModel.EnableFields) + { + ViewModel.StatusDocumento = (TipoSeguro?)((Selector)val).SelectedItem; + } + } + + private void AdicionarCoCorretagem_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ToggleButton val = (ToggleButton)sender; + bool flag = (int)val != 0 && val.IsChecked.GetValueOrDefault(); + ComboBox comissaoNovoComboBox = ComissaoNovoComboBox; + if (((comissaoNovoComboBox != null) ? ((Selector)comissaoNovoComboBox).SelectedItem : null) != null) + { + ((Selector)ComissaoNovoComboBox).SelectedItem = null; + } + if (flag) + { + ((Selector)TipoVendedorBox).SelectedIndex = 0; + } + else if (((Selector)TipoVendedorBox).SelectedItem != null) + { + ((Selector)TipoVendedorBox).SelectedItem = null; + } + ComboBox vendedorBox = VendedorBox; + if (((vendedorBox != null) ? ((Selector)vendedorBox).SelectedItem : null) != null) + { + ((Selector)VendedorBox).SelectedItem = null; + } + if (ValidationHelper.IsNotNullOrEmpty(((TextBox)ValorRepasseBox).Text)) + { + ((TextBox)ValorRepasseBox).Text = ""; + } + ViewModel.VendedorCoCorretagem(flag); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/criticaapoliceview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_012b: Unknown result type (might be due to invalid IL or missing references) + //IL_0135: Expected O, but got Unknown + //IL_0138: Unknown result type (might be due to invalid IL or missing references) + //IL_0142: Expected O, but got Unknown + //IL_0145: Unknown result type (might be due to invalid IL or missing references) + //IL_014f: Expected O, but got Unknown + //IL_015c: Unknown result type (might be due to invalid IL or missing references) + //IL_0166: Expected O, but got Unknown + //IL_0173: Unknown result type (might be due to invalid IL or missing references) + //IL_017d: Expected O, but got Unknown + //IL_018a: Unknown result type (might be due to invalid IL or missing references) + //IL_0194: Expected O, but got Unknown + //IL_0197: Unknown result type (might be due to invalid IL or missing references) + //IL_01a1: Expected O, but got Unknown + //IL_01ae: Unknown result type (might be due to invalid IL or missing references) + //IL_01b8: Expected O, but got Unknown + //IL_01c5: Unknown result type (might be due to invalid IL or missing references) + //IL_01cf: Expected O, but got Unknown + //IL_01dc: Unknown result type (might be due to invalid IL or missing references) + //IL_01e6: Expected O, but got Unknown + //IL_01e9: Unknown result type (might be due to invalid IL or missing references) + //IL_01f3: Expected O, but got Unknown + //IL_01f5: Unknown result type (might be due to invalid IL or missing references) + //IL_0201: Unknown result type (might be due to invalid IL or missing references) + //IL_020b: Expected O, but got Unknown + //IL_020d: Unknown result type (might be due to invalid IL or missing references) + //IL_0219: Unknown result type (might be due to invalid IL or missing references) + //IL_0223: Expected O, but got Unknown + //IL_0225: Unknown result type (might be due to invalid IL or missing references) + //IL_0231: Unknown result type (might be due to invalid IL or missing references) + //IL_023b: Expected O, but got Unknown + //IL_023e: Unknown result type (might be due to invalid IL or missing references) + //IL_0248: Expected O, but got Unknown + //IL_024a: Unknown result type (might be due to invalid IL or missing references) + //IL_0256: Unknown result type (might be due to invalid IL or missing references) + //IL_0260: Expected O, but got Unknown + //IL_0263: Unknown result type (might be due to invalid IL or missing references) + //IL_026d: Expected O, but got Unknown + //IL_027a: Unknown result type (might be due to invalid IL or missing references) + //IL_0284: Expected O, but got Unknown + //IL_0287: Unknown result type (might be due to invalid IL or missing references) + //IL_0291: Expected O, but got Unknown + //IL_029e: Unknown result type (might be due to invalid IL or missing references) + //IL_02a8: Expected O, but got Unknown + //IL_02aa: Unknown result type (might be due to invalid IL or missing references) + //IL_02b6: Unknown result type (might be due to invalid IL or missing references) + //IL_02c0: Expected O, but got Unknown + //IL_02c2: Unknown result type (might be due to invalid IL or missing references) + //IL_02ce: Unknown result type (might be due to invalid IL or missing references) + //IL_02d8: Expected O, but got Unknown + //IL_02da: Unknown result type (might be due to invalid IL or missing references) + //IL_02e6: Unknown result type (might be due to invalid IL or missing references) + //IL_02f0: Expected O, but got Unknown + //IL_02f2: Unknown result type (might be due to invalid IL or missing references) + //IL_02fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0308: Expected O, but got Unknown + //IL_030a: Unknown result type (might be due to invalid IL or missing references) + //IL_0316: Unknown result type (might be due to invalid IL or missing references) + //IL_0320: Expected O, but got Unknown + //IL_0323: Unknown result type (might be due to invalid IL or missing references) + //IL_032d: Expected O, but got Unknown + //IL_0330: Unknown result type (might be due to invalid IL or missing references) + //IL_033a: Expected O, but got Unknown + //IL_033d: Unknown result type (might be due to invalid IL or missing references) + //IL_0347: Expected O, but got Unknown + //IL_0354: Unknown result type (might be due to invalid IL or missing references) + //IL_035e: Expected O, but got Unknown + //IL_0361: Unknown result type (might be due to invalid IL or missing references) + //IL_036b: Expected O, but got Unknown + //IL_0378: Unknown result type (might be due to invalid IL or missing references) + //IL_0382: Expected O, but got Unknown + //IL_038f: Unknown result type (might be due to invalid IL or missing references) + //IL_0399: Expected O, but got Unknown + //IL_039c: Unknown result type (might be due to invalid IL or missing references) + //IL_03a6: Expected O, but got Unknown + //IL_03a9: Unknown result type (might be due to invalid IL or missing references) + //IL_03b3: Expected O, but got Unknown + //IL_03b6: Unknown result type (might be due to invalid IL or missing references) + //IL_03c0: Expected O, but got Unknown + //IL_03cd: Unknown result type (might be due to invalid IL or missing references) + //IL_03d7: Expected O, but got Unknown + //IL_03e4: Unknown result type (might be due to invalid IL or missing references) + //IL_03ee: Expected O, but got Unknown + //IL_03f1: Unknown result type (might be due to invalid IL or missing references) + //IL_03fb: Expected O, but got Unknown + //IL_0408: Unknown result type (might be due to invalid IL or missing references) + //IL_0412: Expected O, but got Unknown + //IL_041f: Unknown result type (might be due to invalid IL or missing references) + //IL_0429: Expected O, but got Unknown + //IL_042c: Unknown result type (might be due to invalid IL or missing references) + //IL_0436: Expected O, but got Unknown + //IL_0443: Unknown result type (might be due to invalid IL or missing references) + //IL_044d: Expected O, but got Unknown + //IL_045a: Unknown result type (might be due to invalid IL or missing references) + //IL_0464: Expected O, but got Unknown + //IL_0467: Unknown result type (might be due to invalid IL or missing references) + //IL_0471: Expected O, but got Unknown + //IL_0481: Unknown result type (might be due to invalid IL or missing references) + //IL_048b: Expected O, but got Unknown + //IL_048e: Unknown result type (might be due to invalid IL or missing references) + //IL_0498: Expected O, but got Unknown + //IL_049b: Unknown result type (might be due to invalid IL or missing references) + //IL_04a5: Expected O, but got Unknown + //IL_04a8: Unknown result type (might be due to invalid IL or missing references) + //IL_04b2: Expected O, but got Unknown + //IL_04b5: Unknown result type (might be due to invalid IL or missing references) + //IL_04bf: Expected O, but got Unknown + //IL_04c2: Unknown result type (might be due to invalid IL or missing references) + //IL_04cc: Expected O, but got Unknown + //IL_04cf: Unknown result type (might be due to invalid IL or missing references) + //IL_04d9: Expected O, but got Unknown + //IL_04dc: Unknown result type (might be due to invalid IL or missing references) + //IL_04e6: Expected O, but got Unknown + //IL_04e9: Unknown result type (might be due to invalid IL or missing references) + //IL_04f3: Expected O, but got Unknown + //IL_0500: Unknown result type (might be due to invalid IL or missing references) + //IL_050a: Expected O, but got Unknown + //IL_050d: Unknown result type (might be due to invalid IL or missing references) + //IL_0517: Expected O, but got Unknown + //IL_0524: Unknown result type (might be due to invalid IL or missing references) + //IL_052e: Expected O, but got Unknown + //IL_0531: Unknown result type (might be due to invalid IL or missing references) + //IL_053b: Expected O, but got Unknown + //IL_0548: Unknown result type (might be due to invalid IL or missing references) + //IL_0552: Expected O, but got Unknown + //IL_0555: Unknown result type (might be due to invalid IL or missing references) + //IL_055f: Expected O, but got Unknown + //IL_0562: Unknown result type (might be due to invalid IL or missing references) + //IL_056c: Expected O, but got Unknown + //IL_0579: Unknown result type (might be due to invalid IL or missing references) + //IL_0583: Expected O, but got Unknown + //IL_0586: Unknown result type (might be due to invalid IL or missing references) + //IL_0590: Expected O, but got Unknown + //IL_0593: Unknown result type (might be due to invalid IL or missing references) + //IL_059d: Expected O, but got Unknown + //IL_05ad: Unknown result type (might be due to invalid IL or missing references) + //IL_05b7: Expected O, but got Unknown + //IL_05c4: Unknown result type (might be due to invalid IL or missing references) + //IL_05ce: Expected O, but got Unknown + //IL_05de: Unknown result type (might be due to invalid IL or missing references) + //IL_05e8: Expected O, but got Unknown + //IL_05f5: Unknown result type (might be due to invalid IL or missing references) + //IL_05ff: Expected O, but got Unknown + //IL_0602: Unknown result type (might be due to invalid IL or missing references) + //IL_060c: Expected O, but got Unknown + //IL_060f: Unknown result type (might be due to invalid IL or missing references) + //IL_0619: Expected O, but got Unknown + //IL_061c: Unknown result type (might be due to invalid IL or missing references) + //IL_0626: Expected O, but got Unknown + //IL_0629: Unknown result type (might be due to invalid IL or missing references) + //IL_0633: Expected O, but got Unknown + //IL_0636: Unknown result type (might be due to invalid IL or missing references) + //IL_0640: Expected O, but got Unknown + //IL_0643: Unknown result type (might be due to invalid IL or missing references) + //IL_064d: Expected O, but got Unknown + //IL_0650: Unknown result type (might be due to invalid IL or missing references) + //IL_065a: Expected O, but got Unknown + //IL_0668: Unknown result type (might be due to invalid IL or missing references) + //IL_0672: Expected O, but got Unknown + //IL_067f: Unknown result type (might be due to invalid IL or missing references) + //IL_0689: Expected O, but got Unknown + //IL_068c: Unknown result type (might be due to invalid IL or missing references) + //IL_0696: Expected O, but got Unknown + //IL_06a3: Unknown result type (might be due to invalid IL or missing references) + //IL_06ad: Expected O, but got Unknown + //IL_06ba: Unknown result type (might be due to invalid IL or missing references) + //IL_06c4: Expected O, but got Unknown + //IL_06c7: Unknown result type (might be due to invalid IL or missing references) + //IL_06d1: Expected O, but got Unknown + //IL_06d4: Unknown result type (might be due to invalid IL or missing references) + //IL_06de: Expected O, but got Unknown + //IL_06e1: Unknown result type (might be due to invalid IL or missing references) + //IL_06eb: Expected O, but got Unknown + //IL_06ed: Unknown result type (might be due to invalid IL or missing references) + //IL_06f9: Unknown result type (might be due to invalid IL or missing references) + //IL_0703: Expected O, but got Unknown + //IL_0704: Unknown result type (might be due to invalid IL or missing references) + //IL_0710: Unknown result type (might be due to invalid IL or missing references) + //IL_071a: Expected O, but got Unknown + //IL_071b: Unknown result type (might be due to invalid IL or missing references) + //IL_0727: Unknown result type (might be due to invalid IL or missing references) + //IL_0731: Expected O, but got Unknown + //IL_0732: Unknown result type (might be due to invalid IL or missing references) + //IL_073e: Unknown result type (might be due to invalid IL or missing references) + //IL_0748: Expected O, but got Unknown + //IL_074b: Unknown result type (might be due to invalid IL or missing references) + //IL_0755: Expected O, but got Unknown + //IL_0758: Unknown result type (might be due to invalid IL or missing references) + //IL_0762: Expected O, but got Unknown + //IL_0765: Unknown result type (might be due to invalid IL or missing references) + //IL_076f: Expected O, but got Unknown + switch (connectionId) + { + case 1: + UsuarioBox = (ComboBox)target; + break; + case 2: + SeguradoraBox = (ComboBox)target; + break; + case 3: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)InicioBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)InicioBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 4: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)FimBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)FimBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 5: + CriticadoBox = (ToggleButton)target; + break; + case 6: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Atualizar_OnClick); + break; + case 7: + ((UIElement)(TextBox)target).PreviewKeyDown += new KeyEventHandler(Pesquisa_OnPreviewKeyDown); + break; + case 8: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarFiltro_OnClick); + break; + case 10: + CriticaGrid = (DataGrid)target; + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 12: + ConcluirCriticaButton = (MenuItem)target; + ConcluirCriticaButton.Click += new RoutedEventHandler(ConcluirCritica_OnClick); + break; + case 13: + CancelarDocumento = (MenuItem)target; + CancelarDocumento.Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(Cliente_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(Apolice_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(Tarefa_OnClick); + break; + case 17: + ((MenuItem)target).Click += new RoutedEventHandler(Perfil_OnClick); + break; + case 18: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirAquivoDigital_Click); + break; + case 19: + ProdutoBox = (ComboBox)target; + break; + case 20: + NegocioCorretoraBox = (ComboBox)target; + break; + case 21: + SituacaoBox = (ComboBox)target; + ((Selector)SituacaoBox).SelectionChanged += new SelectionChangedEventHandler(SituacaoBox_SelectionChanged); + break; + case 22: + TransmissaoBox = (DatePicker)target; + ((UIElement)TransmissaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)TransmissaoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 23: + ApoliceBox = (TextBox)target; + break; + case 24: + EndossoBox = (TextBox)target; + break; + case 25: + EmissaoBox = (DatePicker)target; + ((UIElement)EmissaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)EmissaoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 26: + Vigencia1Box = (DatePicker)target; + ((UIElement)Vigencia1Box).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Initial_DatePicker_OnLostKeyboardFocus); + ((Control)Vigencia1Box).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 27: + Vigencia2Box = (DatePicker)target; + ((UIElement)Vigencia2Box).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)Vigencia2Box).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 28: + AdicionalBox = (ToggleButton)target; + break; + case 29: + Comissao = (CustomIsReadOnlyControl)target; + break; + case 30: + ComissaoBox = (CurrencyTextBox)target; + break; + case 31: + PremioLiquidoBox = (CurrencyTextBox)target; + break; + case 32: + PremioAdicionalBox = (CurrencyTextBox)target; + break; + case 33: + IofBox = (CurrencyTextBox)target; + break; + case 34: + DiferencaBox = (CurrencyTextBox)target; + break; + case 35: + PremioTotalBox = (CurrencyTextBox)target; + break; + case 36: + ParcelasBox = (CurrencyTextBox)target; + break; + case 37: + SeguroCombinadoBox = (ToggleButton)target; + break; + case 38: + EditarVendedorButton = (MenuItem)target; + EditarVendedorButton.Click += new RoutedEventHandler(EditarVendedorButton_OnClick); + break; + case 39: + SalvarVendedorButton = (MenuItem)target; + SalvarVendedorButton.Click += new RoutedEventHandler(SalvarVendedor_Click); + break; + case 40: + CancelarVendedorButton = (MenuItem)target; + CancelarVendedorButton.Click += new RoutedEventHandler(CancelarVendedor_Click); + break; + case 41: + VendedorFields = (WrapPanel)target; + break; + case 42: + CoCorretagemToogle = (ToggleButton)target; + ((ButtonBase)CoCorretagemToogle).Click += new RoutedEventHandler(AdicionarCoCorretagem_OnClick); + break; + case 43: + TipoVendedorBox = (ComboBox)target; + break; + case 44: + VendedorBox = (ComboBox)target; + break; + case 45: + ComissaoNovoBox = (CustomItemValidation)target; + break; + case 46: + ComissaoNovoComboBox = (ComboBox)target; + ((Selector)ComissaoNovoComboBox).SelectionChanged += new SelectionChangedEventHandler(ComissaoVendedorBox_OnSelectionChanged); + break; + case 47: + ComissaoRenovacaoBox = (CustomItemValidation)target; + break; + case 48: + ComissaoRenovacaoComboBox = (ComboBox)target; + ((Selector)ComissaoRenovacaoComboBox).SelectionChanged += new SelectionChangedEventHandler(ComissaoVendedorBox_OnSelectionChanged); + break; + case 49: + ValorRepasseBox = (CurrencyTextBox)target; + break; + case 50: + FormaRecebidaBox = (TextBox)target; + break; + case 51: + VendedorGrid = (DataGrid)target; + break; + case 52: + RepasseVendedor = (DataGridTextColumn)target; + break; + case 54: + NomeBox = (TextBox)target; + break; + case 55: + TipoDocumentoPrincipalBox = (ComboBox)target; + break; + case 56: + DocumentoPrincipalBox = (TextBox)target; + ((UIElement)DocumentoPrincipalBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)DocumentoPrincipalBox).LostFocus += new RoutedEventHandler(DocumentoPrincipalBox_LostFocus); + break; + case 57: + NascimentoBox = (DatePicker)target; + ((UIElement)NascimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)NascimentoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 58: + IdentidadeBox = (TextBox)target; + break; + case 59: + EmissorBox = (TextBox)target; + break; + case 60: + EstadoEmissorBox = (TextBox)target; + break; + case 61: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)(DatePicker)target).PreviewTextInput += new TextCompositionEventHandler(base.SomenteData); + break; + case 62: + TelefoneListBox = (ListBox)target; + break; + case 68: + EmailListBox = (ListBox)target; + break; + case 71: + ItemGrid = (DataGrid)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Expected O, but got Unknown + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Expected O, but got Unknown + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Expected O, but got Unknown + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Expected O, but got Unknown + //IL_009e: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Unknown result type (might be due to invalid IL or missing references) + //IL_00b5: Expected O, but got Unknown + //IL_00b6: Unknown result type (might be due to invalid IL or missing references) + //IL_00c3: Unknown result type (might be due to invalid IL or missing references) + //IL_00cd: Expected O, but got Unknown + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00db: Unknown result type (might be due to invalid IL or missing references) + //IL_00e5: Expected O, but got Unknown + //IL_00e6: Unknown result type (might be due to invalid IL or missing references) + //IL_00f2: Unknown result type (might be due to invalid IL or missing references) + //IL_00fc: Expected O, but got Unknown + //IL_00fd: Unknown result type (might be due to invalid IL or missing references) + //IL_010a: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Expected O, but got Unknown + //IL_0116: Unknown result type (might be due to invalid IL or missing references) + //IL_0122: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Expected O, but got Unknown + //IL_012e: Unknown result type (might be due to invalid IL or missing references) + //IL_013a: Unknown result type (might be due to invalid IL or missing references) + //IL_0144: Expected O, but got Unknown + //IL_0145: Unknown result type (might be due to invalid IL or missing references) + //IL_0151: Unknown result type (might be due to invalid IL or missing references) + //IL_015b: Expected O, but got Unknown + //IL_015c: Unknown result type (might be due to invalid IL or missing references) + //IL_0169: Unknown result type (might be due to invalid IL or missing references) + //IL_0173: Expected O, but got Unknown + //IL_0175: Unknown result type (might be due to invalid IL or missing references) + //IL_0181: Unknown result type (might be due to invalid IL or missing references) + //IL_018b: Expected O, but got Unknown + //IL_018d: Unknown result type (might be due to invalid IL or missing references) + //IL_0199: Unknown result type (might be due to invalid IL or missing references) + //IL_01a3: Expected O, but got Unknown + switch (connectionId) + { + case 9: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirFiltro_OnClick); + break; + case 53: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirVendedor_OnClick); + break; + case 63: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(TipoComboBox_OnSelectionChanged); + break; + case 64: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 65: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 66: + ((UIElement)(TextBox)target).PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(OrdemBox_OnPreviewGotKeyboardFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(OrdemBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 67: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirTelefone_OnClick); + break; + case 69: + ((UIElement)(TextBox)target).PreviewGotKeyboardFocus += new KeyboardFocusChangedEventHandler(OrdemBox_OnPreviewGotKeyboardFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(OrdemBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 70: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirEmail_OnClick); + break; + case 72: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Item_Click); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/PerfilEmpresaView.cs b/Decompiler/Gestor.Application.Views.Seguros/PerfilEmpresaView.cs new file mode 100644 index 0000000..518ff56 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/PerfilEmpresaView.cs @@ -0,0 +1,261 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.Componentes; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Generic; +using Gestor.Common.Helpers; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Xceed.Wpf.Toolkit; + +namespace Gestor.Application.Views.Seguros; + +public class PerfilEmpresaView : BaseUserControl, IComponentConnector +{ + public PerfilEmpresaViewModel ViewModel; + + private Controle _controle; + + internal MenuItem CancelarApoliceButton; + + internal TextBox TextAtividade; + + internal CustomIsReadOnlyControl ComboSegurancaControl; + + internal CheckComboBox ComboSeguranca; + + internal CustomIsReadOnlyControl ComboIncendioControl; + + internal CheckComboBox ComboIncendio; + + internal CheckBox ExclusivoDeposito; + + internal CheckBox DivisaTerrenoBaldio; + + internal CheckBox PatrimonioHistorio; + + internal CheckBox PossuiTelhado; + + internal CheckBox CaixasEletronicos; + + internal CheckBox Isopainel; + + internal CheckBox ConstrucaoReforma; + + private bool _contentLoaded; + + public PerfilEmpresaView(Controle controle) + { + _controle = controle; + ((FrameworkElement)this).Tag = "CADASTRO DE PERFIL"; + ViewModel = new PerfilEmpresaViewModel(controle); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + LoadData(); + } + + private void LoadData() + { + ComboSeguranca.BindData<EquipamentoSeguranca>(withSelect: false); + ComboIncendio.BindData<EquipamentoIncendio>(withSelect: false); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.EnableIncluirPerfil = false; + ViewModel.Incluir(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ViewModel.Loading(isLoading: false); + if (list != null) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + PerfilEmpresa selectedPerfilEmpresa = ViewModel.SelectedPerfilEmpresa; + if ((selectedPerfilEmpresa != null && ((DomainBase)selectedPerfilEmpresa).Id == 0) || ViewModel.SelectedPerfilEmpresa == null) + { + ViewModel.EnableIncluirPerfil = true; + } + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Excluir(); + } + + private void VerificaOnSelected(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + ComboBox val = (ComboBox)sender; + if (((Selector)val).SelectedItem != null) + { + if (EnumHelper.GetDescription<object>(((Selector)val).SelectedItem) == EnumHelper.GetDescription<AtividadeEmpresa>((AtividadeEmpresa)0)) + { + ViewModel.AtivaCampos = (Visibility)0; + } + else if ((int)ViewModel.AtivaCampos == 0) + { + TextAtividade.Text = ""; + ViewModel.AtivaCampos = (Visibility)2; + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/perfilempresaview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Expected O, but got Unknown + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Expected O, but got Unknown + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a0: Expected O, but got Unknown + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ad: Expected O, but got Unknown + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Expected O, but got Unknown + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00eb: Unknown result type (might be due to invalid IL or missing references) + //IL_00f5: Expected O, but got Unknown + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0103: Unknown result type (might be due to invalid IL or missing references) + //IL_010d: Expected O, but got Unknown + //IL_0110: Unknown result type (might be due to invalid IL or missing references) + //IL_011a: Expected O, but got Unknown + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_0134: Expected O, but got Unknown + //IL_0144: Unknown result type (might be due to invalid IL or missing references) + //IL_014e: Expected O, but got Unknown + //IL_0151: Unknown result type (might be due to invalid IL or missing references) + //IL_015b: Expected O, but got Unknown + //IL_015e: Unknown result type (might be due to invalid IL or missing references) + //IL_0168: Expected O, but got Unknown + //IL_016b: Unknown result type (might be due to invalid IL or missing references) + //IL_0175: Expected O, but got Unknown + //IL_0178: Unknown result type (might be due to invalid IL or missing references) + //IL_0182: Expected O, but got Unknown + //IL_0185: Unknown result type (might be due to invalid IL or missing references) + //IL_018f: Expected O, but got Unknown + //IL_0192: Unknown result type (might be due to invalid IL or missing references) + //IL_019c: Expected O, but got Unknown + //IL_019f: Unknown result type (might be due to invalid IL or missing references) + //IL_01a9: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 4: + CancelarApoliceButton = (MenuItem)target; + CancelarApoliceButton.Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 6: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 7: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(VerificaOnSelected); + break; + case 8: + TextAtividade = (TextBox)target; + break; + case 9: + ComboSegurancaControl = (CustomIsReadOnlyControl)target; + break; + case 10: + ComboSeguranca = (CheckComboBox)target; + break; + case 11: + ComboIncendioControl = (CustomIsReadOnlyControl)target; + break; + case 12: + ComboIncendio = (CheckComboBox)target; + break; + case 13: + ExclusivoDeposito = (CheckBox)target; + break; + case 14: + DivisaTerrenoBaldio = (CheckBox)target; + break; + case 15: + PatrimonioHistorio = (CheckBox)target; + break; + case 16: + PossuiTelhado = (CheckBox)target; + break; + case 17: + CaixasEletronicos = (CheckBox)target; + break; + case 18: + Isopainel = (CheckBox)target; + break; + case 19: + ConstrucaoReforma = (CheckBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/PerfilView.cs b/Decompiler/Gestor.Application.Views.Seguros/PerfilView.cs new file mode 100644 index 0000000..54d6784 --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/PerfilView.cs @@ -0,0 +1,363 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Text.RegularExpressions; +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 Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Views.Seguros; + +public class PerfilView : BaseUserControl, IComponentConnector +{ + public PerfilViewModel ViewModel; + + private Controle _controle; + + internal MenuItem CancelarApoliceButton; + + internal DatePicker NascimentoBox; + + private bool _contentLoaded; + + public PerfilView(Controle controle) + { + _controle = controle; + ((FrameworkElement)this).Tag = "CADASTRO DE PERFIL"; + ViewModel = new PerfilViewModel(controle); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + ((UIElement)NascimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(Funcoes.DatePicker_OnLostKeyboardFocus); + ((UIElement)NascimentoBox).PreviewKeyDown += new KeyEventHandler(Funcoes.DatePicker_PreviewKeyDown); + } + + private void Incluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Incluir(); + ValidarTela(); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Alterar(alterar: true); + ValidarTela(); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (!num) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + } + + private async void Excluir_OnClick(object sender, RoutedEventArgs e) + { + await ViewModel.Excluir(); + } + + private void CpfBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + TextBox val = (TextBox)sender; + val.Text = ValidationHelper.FormatDocument(val.Text); + } + + private void RelacaoComboBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: Expected O, but got Unknown + if (((Selector)(ComboBox)sender).SelectedIndex != 0) + { + return; + } + Cliente cliente = _controle.Cliente; + string text = ValidationHelper.FormatDocument(ValidationHelper.Clear((cliente != null) ? cliente.Documento : null)); + bool flag = Regex.IsMatch(text, "\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}"); + Perfil val = (Perfil)((DomainBase)ViewModel.SelectedPerfil).Clone(); + val.Cpf = (flag ? text : ""); + val.Nome = _controle.Cliente.Nome; + val.Nascimento = _controle.Cliente.Nascimento; + val.Sexo = _controle.Cliente.Sexo; + val.EstadoCivil = _controle.Cliente.EstadoCivil; + val.Habilitacao = _controle.Cliente.Habilitacao; + if (_controle.Cliente.PrimeiraHabilitacao.HasValue) + { + DateTime networkTime = Funcoes.GetNetworkTime(); + DateTime? primeiraHabilitacao = _controle.Cliente.PrimeiraHabilitacao; + TimeSpan? timeSpan = networkTime - primeiraHabilitacao; + TimeSpan? timeSpan2 = timeSpan; + if (timeSpan2.Value.Days > 3650) + { + val.TempoHabilitacao = (TempoHabilitacao)10; + } + else + { + TimeSpan? timeSpan3 = timeSpan; + if (timeSpan3.Value.Days > 3285) + { + val.TempoHabilitacao = (TempoHabilitacao)9; + } + else + { + TimeSpan? timeSpan4 = timeSpan; + if (timeSpan4.Value.Days > 2920) + { + val.TempoHabilitacao = (TempoHabilitacao)8; + } + else + { + TimeSpan? timeSpan5 = timeSpan; + if (timeSpan5.Value.Days > 2555) + { + val.TempoHabilitacao = (TempoHabilitacao)7; + } + else + { + TimeSpan? timeSpan6 = timeSpan; + if (timeSpan6.Value.Days > 2190) + { + val.TempoHabilitacao = (TempoHabilitacao)6; + } + else + { + TimeSpan? timeSpan7 = timeSpan; + if (timeSpan7.Value.Days > 1825) + { + val.TempoHabilitacao = (TempoHabilitacao)5; + } + else + { + TimeSpan? timeSpan8 = timeSpan; + if (timeSpan8.Value.Days > 1460) + { + val.TempoHabilitacao = (TempoHabilitacao)4; + } + else + { + TimeSpan? timeSpan9 = timeSpan; + if (timeSpan9.Value.Days > 1095) + { + val.TempoHabilitacao = (TempoHabilitacao)3; + } + else + { + TimeSpan? timeSpan10 = timeSpan; + if (timeSpan10.Value.Days > 730) + { + val.TempoHabilitacao = (TempoHabilitacao)2; + } + else + { + TimeSpan? timeSpan11 = timeSpan; + if (timeSpan11.Value.Days > 365) + { + val.TempoHabilitacao = (TempoHabilitacao)1; + } + else + { + val.TempoHabilitacao = (TempoHabilitacao)0; + } + } + } + } + } + } + } + } + } + } + } + ViewModel.SelectedPerfil = val; + } + + private void ValidarTela() + { + if (ViewModel.SelectedPerfil != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedPerfil.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void PostcodeBox_OnLostFocus(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + TextBox val = (TextBox)sender; + if (!string.IsNullOrWhiteSpace(val.Text)) + { + string text = ValidationHelper.FormatPostCode(val.Text); + if (ValidationHelper.ValidatePostCode(text)) + { + val.Text = text; + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/perfilview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0042: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Expected O, but got Unknown + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Expected O, but got Unknown + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Unknown result type (might be due to invalid IL or missing references) + //IL_0088: Expected O, but got Unknown + //IL_008b: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Expected O, but got Unknown + //IL_00a2: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Expected O, but got Unknown + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Unknown result type (might be due to invalid IL or missing references) + //IL_00dc: Expected O, but got Unknown + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + //IL_00f5: Unknown result type (might be due to invalid IL or missing references) + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010c: Expected O, but got Unknown + //IL_010f: Unknown result type (might be due to invalid IL or missing references) + //IL_0119: Expected O, but got Unknown + //IL_0126: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Expected O, but got Unknown + //IL_013d: Unknown result type (might be due to invalid IL or missing references) + //IL_0147: Expected O, but got Unknown + //IL_0149: Unknown result type (might be due to invalid IL or missing references) + //IL_0156: Unknown result type (might be due to invalid IL or missing references) + //IL_0160: Expected O, but got Unknown + //IL_0162: Unknown result type (might be due to invalid IL or missing references) + //IL_016f: Unknown result type (might be due to invalid IL or missing references) + //IL_0179: Expected O, but got Unknown + //IL_017b: Unknown result type (might be due to invalid IL or missing references) + //IL_0188: Unknown result type (might be due to invalid IL or missing references) + //IL_0192: Expected O, but got Unknown + //IL_0194: Unknown result type (might be due to invalid IL or missing references) + //IL_01a0: Unknown result type (might be due to invalid IL or missing references) + //IL_01aa: Expected O, but got Unknown + //IL_01ab: Unknown result type (might be due to invalid IL or missing references) + //IL_01b8: Unknown result type (might be due to invalid IL or missing references) + //IL_01c2: Expected O, but got Unknown + //IL_01c4: Unknown result type (might be due to invalid IL or missing references) + //IL_01d0: Unknown result type (might be due to invalid IL or missing references) + //IL_01da: Expected O, but got Unknown + //IL_01db: Unknown result type (might be due to invalid IL or missing references) + //IL_01e8: Unknown result type (might be due to invalid IL or missing references) + //IL_01f2: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 4: + CancelarApoliceButton = (MenuItem)target; + CancelarApoliceButton.Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 6: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(RelacaoComboBox_OnSelectionChanged); + break; + case 7: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(CpfBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 8: + NascimentoBox = (DatePicker)target; + ((UIElement)NascimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)NascimentoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 9: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 10: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 11: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 12: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 13: + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(PostcodeBox_OnLostFocus); + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/SinistroView.cs b/Decompiler/Gestor.Application.Views.Seguros/SinistroView.cs new file mode 100644 index 0000000..6bee58a --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/SinistroView.cs @@ -0,0 +1,862 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +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 Gestor.Application.Componentes; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Generic; +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; + +namespace Gestor.Application.Views.Seguros; + +public class SinistroView : BaseUserControl, IComponentConnector +{ + public SinistroViewModel ViewModel; + + internal DataGrid ControleGrid; + + internal MenuItem SalvarSinistroButton; + + internal MenuItem CancelarApoliceButton; + + internal CustomIsReadOnlyControl TipoSinistroBox; + + internal ComboBox ParceiroMecanica; + + internal ComboBox ParceiroFunilaria; + + internal RadioButton AnotacoesButton; + + internal RadioButton AnotacoesInternasButton; + + internal CustomItemControl AnotacoesHoster; + + internal WebEditor Anotacoes; + + internal CustomItemControl ObservacoesHoster; + + internal WebEditor Observacoes; + + internal CustomItemControl AnotacoesInternasHoster; + + internal WebEditor AnotacoesInternas; + + internal CustomItemControl ObservacoesInternasHoster; + + internal WebEditor ObservacoesInternas; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + public SinistroView(Item item = null, bool attached = true) + { + item = item ?? ConsultaViewModel.ItemSelecionado; + ((FrameworkElement)this).Tag = "CADASTRO DE SINISTRO"; + ViewModel = new SinistroViewModel(item, attached); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + //IL_006f: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Expected O, but got Unknown + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0090: Expected O, but got Unknown + ((Selector)ControleGrid).SelectionChanged += new SelectionChangedEventHandler(SinistroGrid_OnSelectionChanged); + ((ToggleButton)AnotacoesButton).IsChecked = ViewModel.IsAnotacoes; + ((ToggleButton)AnotacoesInternasButton).IsChecked = !ViewModel.IsAnotacoes; + ToggleAnotacoes(ViewModel.IsAnotacoes); + ((ToggleButton)AnotacoesButton).Checked += new RoutedEventHandler(Anotacoes_OnChecked); + ((ToggleButton)AnotacoesInternasButton).Checked += new RoutedEventHandler(AnotacoesInternas_OnChecked); + } + + private void ToggleAnotacoes(bool anotacoes, bool inclusao = false) + { + if (anotacoes) + { + ViewModel.IsAnotacoes = true; + if (ViewModel.EnableFields || inclusao) + { + ((UIElement)AnotacoesHoster).Visibility = (Visibility)0; + ((UIElement)AnotacoesInternasHoster).Visibility = (Visibility)2; + } + else + { + ((UIElement)AnotacoesHoster).Visibility = (Visibility)2; + ((UIElement)AnotacoesInternasHoster).Visibility = (Visibility)2; + } + } + else + { + ViewModel.IsAnotacoes = false; + if (ViewModel.EnableFields || inclusao) + { + ((UIElement)AnotacoesHoster).Visibility = (Visibility)2; + ((UIElement)AnotacoesInternasHoster).Visibility = (Visibility)0; + } + else + { + ((UIElement)AnotacoesHoster).Visibility = (Visibility)2; + ((UIElement)AnotacoesInternasHoster).Visibility = (Visibility)2; + } + } + } + + private void Anotacoes_OnChecked(object sender, RoutedEventArgs e) + { + ToggleAnotacoes(anotacoes: true); + } + + private void AnotacoesInternas_OnChecked(object sender, RoutedEventArgs e) + { + ToggleAnotacoes(anotacoes: false); + } + + private void ItemGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaItem((Item)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void AutoCompleteBoxItem_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.ItemFiltrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Item>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBoxItem_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarItem(""); + } + } + + private void SinistroGrid_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0031: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Expected O, but got Unknown + DataGrid val = (DataGrid)sender; + if (val == null || ((Selector)val).SelectedIndex >= 0) + { + ViewModel.SelecionaControle((ControleSinistro)((val != null) ? ((ItemsControl)val).Items[((Selector)val).SelectedIndex] : null)); + } + } + + private void AutoCompleteBoxSinistro_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.SinistroFiltrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<ControleSinistro>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private void AutoCompleteBoxSinistro_OnTextChanged(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + if (string.IsNullOrWhiteSpace(((AutoCompleteBox)sender).Text)) + { + ViewModel.FiltrarSinistro(""); + } + } + + private async void Incluir_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedItem == null) + { + await ViewModel.ShowMessage("NECESSÁRIO INCLUIR O ITEM ANTES DE INCLUIR UM SINISTRO."); + return; + } + await ViewModel.IncluirSinistro(); + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedSinistro.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + ToggleAnotacoes(ViewModel.IsAnotacoes); + } + + private void IncluirEnvolvido_OnClick(object sender, RoutedEventArgs e) + { + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + ViewModel.IncluirEnvolvido(); + CustomIsReadOnlyControl tipoSinistroBox = TipoSinistroBox; + ControleSinistro selectedControle = ViewModel.SelectedControle; + int isEnabled; + if (selectedControle == null || selectedControle.Sinistros?.Any((Sinistro x) => x.TipoSinistro == (TipoSinistro?)0) != false) + { + Sinistro selectedSinistro = ViewModel.SelectedSinistro; + isEnabled = ((selectedSinistro != null && selectedSinistro.TipoSinistro == (TipoSinistro?)0) ? 1 : 0); + } + else + { + isEnabled = 1; + } + ((UIElement)tipoSinistroBox).IsEnabled = (byte)isEnabled != 0; + Sinistro selectedSinistro2 = ViewModel.SelectedSinistro; + List<KeyValuePair<string, string>> errorMessages = ((selectedSinistro2 != null) ? selectedSinistro2.Validate() : null); + ((DependencyObject)(object)this).ValidateFields(errorMessages); + ToggleAnotacoes(ViewModel.IsAnotacoes, inclusao: true); + } + + private void Alterar_OnClick(object sender, RoutedEventArgs e) + { + //IL_009f: Unknown result type (might be due to invalid IL or missing references) + //IL_00a3: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + if (ViewModel.SelectedSinistro != null) + { + ViewModel.Alterar(alterar: true); + CustomIsReadOnlyControl tipoSinistroBox = TipoSinistroBox; + ControleSinistro selectedControle = ViewModel.SelectedControle; + int isEnabled; + if (selectedControle == null || selectedControle.Sinistros?.Any((Sinistro x) => x.TipoSinistro == (TipoSinistro?)0) != false) + { + Sinistro selectedSinistro = ViewModel.SelectedSinistro; + isEnabled = ((selectedSinistro != null && selectedSinistro.TipoSinistro == (TipoSinistro?)0) ? 1 : 0); + } + else + { + isEnabled = 1; + } + ((UIElement)tipoSinistroBox).IsEnabled = (byte)isEnabled != 0; + ToggleAnotacoes(ViewModel.IsAnotacoes); + Sinistro selectedSinistro2 = ViewModel.SelectedSinistro; + if (selectedSinistro2 != null) + { + ((DomainBase)selectedSinistro2).Initialize(); + } + } + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + ViewModel.Anotacoes = Anotacoes.GetHtml(); + ViewModel.AnotacoesInternas = AnotacoesInternas.GetHtml(); + if (ViewModel.EditarObservacao) + { + ViewModel.SelectedSinistro.ObservacaoInterna = ObservacoesInternas.GetHtml(); + ViewModel.SelectedSinistro.Observacao = Observacoes.GetHtml(); + } + List<KeyValuePair<string, string>> list = await ViewModel.Salvar(); + ((DependencyObject)(object)this).ValidateFields(list); + bool num = list == null || list.Count == 0; + ViewModel.Loading(isLoading: false); + if (num) + { + Anotacoes.Initialize(); + AnotacoesInternas.Initialize(); + ToggleAnotacoes(ViewModel.IsAnotacoes); + } + else + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + + private void Cancelar_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.CancelarAlteracao(); + Anotacoes.Initialize(); + AnotacoesInternas.Initialize(); + ViewModel.EnableFields = false; + ToggleAnotacoes(ViewModel.IsAnotacoes); + } + + private void Excluir_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Excluir(); + } + + private async void ArquivoDigital_OnClick(object sender, RoutedEventArgs e) + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)5).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)5) + "."); + return; + } + FiltroArquivoDigital filtro = new FiltroArquivoDigital + { + Id = ((DomainBase)ViewModel.SelectedSinistro).Id, + IdApolice = ((DomainBase)ViewModel.SelectedSinistro.ControleSinistro.Item.Documento).Id, + Tipo = (TipoArquivoDigital)5, + Parente = ViewModel.SelectedSinistro + }; + ViewModel.ShowDrawer(new ArquivoDigitalDrawer(filtro), 0, close: false); + } + + private async void Tarefas_OnClick(object sender, RoutedEventArgs e) + { + Cliente val = await ViewModel.BuscarClienteSinistro(); + Tarefa tarefa = new Tarefa + { + IdCliente = ((DomainBase)ViewModel.SelectedSinistro).Id, + Cliente = val.Nome, + Entidade = (TipoTarefa)4, + IdEntidade = ((DomainBase)ViewModel.SelectedSinistro).Id, + Titulo = "SINISTRO " + ViewModel.SelectedSinistro.Numero + " ITEM " + ViewModel.SelectedSinistro.ItemSinistrado + }; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa), 0, close: false); + } + + private void ParceiroBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + ComboBox val = (ComboBox)sender; + if (val == null || ((Selector)val).SelectedItem == null) + { + return; + } + Parceiro val2 = (Parceiro)((Selector)val).SelectedItem; + if (((FrameworkElement)val).Name == "ParceiroMecanica") + { + if (ViewModel.SelectedSinistro.SinistroAuto.ParceiroMecanica == null) + { + ViewModel.SelectedSinistro.SinistroAuto.ParceiroMecanica = val2; + } + ParceiroMecanica.Text = val2.Nome; + ViewModel.TelefonesMecanica = ""; + bool flag = true; + if (!string.IsNullOrWhiteSpace(val2.Ddd1) || !string.IsNullOrWhiteSpace(val2.Telefone1)) + { + flag = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesMecanica = viewModel.TelefonesMecanica + "TELEFONE 1: (" + val2.Ddd1 + ") " + ValidationHelper.FormatarTelefone(val2.Telefone1); + } + if (!string.IsNullOrWhiteSpace(val2.Ddd2) || !string.IsNullOrWhiteSpace(val2.Telefone2)) + { + flag = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesMecanica = viewModel.TelefonesMecanica + "\nTELEFONE 2: (" + val2.Ddd2 + ") " + ValidationHelper.FormatarTelefone(val2.Telefone2); + } + if (!string.IsNullOrWhiteSpace(val2.Ddd3) || !string.IsNullOrWhiteSpace(val2.Telefone3)) + { + flag = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesMecanica = viewModel.TelefonesMecanica + "\nTELEFONE 3: (" + val2.Ddd3 + ") " + ValidationHelper.FormatarTelefone(val2.Telefone3); + } + if (!string.IsNullOrWhiteSpace(val2.Endereco) || !string.IsNullOrWhiteSpace(val2.Cidade) || !string.IsNullOrWhiteSpace(val2.Uf) || !string.IsNullOrWhiteSpace(val2.Bairro) || !string.IsNullOrWhiteSpace(val2.Cep) || !string.IsNullOrWhiteSpace(val2.Numero) || !string.IsNullOrWhiteSpace(val2.Complemento)) + { + flag = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesMecanica = viewModel.TelefonesMecanica + "\nENDEREÇO: " + val2.Endereco + ", " + val2.Numero + ", " + (string.IsNullOrWhiteSpace(val2.Complemento) ? "-" : (val2.Complemento ?? "")) + ", " + val2.Bairro + ", " + val2.Cidade + "/" + val2.Uf + " - " + val2.Cep; + } + if (!string.IsNullOrWhiteSpace(val2.Email)) + { + flag = false; + SinistroViewModel viewModel2 = ViewModel; + viewModel2.TelefonesMecanica = viewModel2.TelefonesMecanica + "\nEMAIL: " + val2.Email; + } + if (!string.IsNullOrWhiteSpace(val2.Cgccpf)) + { + flag = false; + SinistroViewModel viewModel3 = ViewModel; + viewModel3.TelefonesMecanica = viewModel3.TelefonesMecanica + "\nDOCUMENTO: " + val2.Cgccpf; + } + if (flag) + { + ViewModel.TelefonesMecanica = "PARCEIRO SEM MAIS INFORMAÇÕES"; + } + } + else + { + if (ViewModel.SelectedSinistro.SinistroAuto.ParceiroFunilaria == null) + { + ViewModel.SelectedSinistro.SinistroAuto.ParceiroFunilaria = val2; + } + ParceiroFunilaria.Text = val2.Nome; + ViewModel.TelefonesFunileiro = ""; + bool flag2 = true; + if (!string.IsNullOrWhiteSpace(val2.Ddd1) || !string.IsNullOrWhiteSpace(val2.Telefone1)) + { + flag2 = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesFunileiro = viewModel.TelefonesFunileiro + "TELEFONE 1: (" + val2.Ddd1 + ") " + ValidationHelper.FormatarTelefone(val2.Telefone1); + } + if (!string.IsNullOrWhiteSpace(val2.Ddd2) || !string.IsNullOrWhiteSpace(val2.Telefone2)) + { + flag2 = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesFunileiro = viewModel.TelefonesFunileiro + "\nTELEFONE 2: (" + val2.Ddd2 + ") " + ValidationHelper.FormatarTelefone(val2.Telefone2); + } + if (!string.IsNullOrWhiteSpace(val2.Ddd3) || !string.IsNullOrWhiteSpace(val2.Telefone3)) + { + flag2 = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesFunileiro = viewModel.TelefonesFunileiro + "\nTELEFONE 3: (" + val2.Ddd3 + ") " + ValidationHelper.FormatarTelefone(val2.Telefone3); + } + if (!string.IsNullOrWhiteSpace(val2.Endereco) || !string.IsNullOrWhiteSpace(val2.Cidade) || !string.IsNullOrWhiteSpace(val2.Uf) || !string.IsNullOrWhiteSpace(val2.Bairro) || !string.IsNullOrWhiteSpace(val2.Cep) || !string.IsNullOrWhiteSpace(val2.Numero) || !string.IsNullOrWhiteSpace(val2.Complemento)) + { + flag2 = false; + SinistroViewModel viewModel = ViewModel; + viewModel.TelefonesFunileiro = viewModel.TelefonesFunileiro + "\nENDEREÇO: " + val2.Endereco + ", " + val2.Numero + ", " + (string.IsNullOrWhiteSpace(val2.Complemento) ? "-" : (val2.Complemento ?? "")) + ", " + val2.Bairro + ", " + val2.Cidade + "/" + val2.Uf + " - " + val2.Cep; + } + if (!string.IsNullOrWhiteSpace(val2.Email)) + { + flag2 = false; + SinistroViewModel viewModel4 = ViewModel; + viewModel4.TelefonesFunileiro = viewModel4.TelefonesFunileiro + "\nEMAIL: " + val2.Email; + } + if (!string.IsNullOrWhiteSpace(val2.Cgccpf)) + { + flag2 = false; + SinistroViewModel viewModel5 = ViewModel; + viewModel5.TelefonesFunileiro = viewModel5.TelefonesFunileiro + "\nDOCUMENTO: " + val2.Cgccpf; + } + if (flag2) + { + ViewModel.TelefonesFunileiro = "PARCEIRO SEM MAIS INFORMAÇÕES"; + } + } + } + + private void SituacaoBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Invalid comparison between Unknown and I4 + ComboBox val = (ComboBox)sender; + if (val != null && ((Selector)val).SelectedItem != null) + { + if ((int)(StatusSinistro)((Selector)val).SelectedItem != 1) + { + ViewModel.LiquidacaoVisibility = (Visibility)0; + } + else + { + ViewModel.SelectedSinistro.DataLiquidacao = null; + ViewModel.LiquidacaoVisibility = (Visibility)2; + } + Validar(); + } + } + + private void Validar() + { + if (ViewModel.SelectedSinistro != null) + { + List<KeyValuePair<string, string>> errorMessages = ViewModel.SelectedSinistro.Validate(); + ((DependencyObject)(object)this).ValidateFields(errorMessages, focusField: false); + } + } + + private void ImprimirHistorico_OnClick(object sender, RoutedEventArgs e) + { + if (((DomainBase)ViewModel.SelectedSinistro).Id != 0L) + { + ViewModel.ImprimirHistorico(); + } + } + + private void AbrirLogEmail_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.SelectedSinistro != null) + { + ViewModel.AbrirLogEmail((TipoTela)7, ((DomainBase)ViewModel.SelectedSinistro).Id); + } + } + + private void EnviarHistorico_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.EnviarLogEmail(); + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + private void MecanicaButton_OnClick(object sender, RoutedEventArgs e) + { + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + CadastroParceiroView view = new CadastroParceiroView((ViewModel.SelectedSinistro.SinistroAuto.ParceiroMecanica == null || ((DomainBase)ViewModel.SelectedSinistro.SinistroAuto.ParceiroMecanica).Id == 0L) ? null : ViewModel.SelectedSinistro.SinistroAuto.ParceiroMecanica); + ((Window)new HosterWindow((ContentControl)(object)view, "CADASTRO DE PARCEIROS", 1000.0, 600.0)).ShowDialog(); + Parceiro val = (Parceiro)((Selector)ParceiroFunilaria).SelectedItem; + long id = (((int)val != 0) ? ((DomainBase)val).Id : 0); + ViewModel.CarregarParceiros(); + ((Selector)ParceiroFunilaria).SelectedItem = ((id <= 0) ? null : ViewModel.Parceiros?.FirstOrDefault((Func<Parceiro, bool>)((Parceiro x) => ((DomainBase)x).Id == id))); + ((Selector)ParceiroMecanica).SelectedItem = ViewModel.Parceiros?.FirstOrDefault((Func<Parceiro, bool>)delegate(Parceiro x) + { + long id2 = ((DomainBase)x).Id; + Parceiro selectedParceiro = view.ViewModel.SelectedParceiro; + return id2 == ((selectedParceiro != null) ? new long?(((DomainBase)selectedParceiro).Id) : null); + }); + } + + private void FunilariaButton_OnClick(object sender, RoutedEventArgs e) + { + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009a: Unknown result type (might be due to invalid IL or missing references) + CadastroParceiroView view = new CadastroParceiroView((ViewModel.SelectedSinistro.SinistroAuto.ParceiroFunilaria == null || ((DomainBase)ViewModel.SelectedSinistro.SinistroAuto.ParceiroFunilaria).Id == 0L) ? null : ViewModel.SelectedSinistro.SinistroAuto.ParceiroFunilaria); + ((Window)new HosterWindow((ContentControl)(object)view, "CADASTRO DE PARCEIROS", 1000.0, 600.0)).ShowDialog(); + Parceiro val = (Parceiro)((Selector)ParceiroMecanica).SelectedItem; + long id = (((int)val != 0) ? ((DomainBase)val).Id : 0); + ViewModel.CarregarParceiros(); + ((Selector)ParceiroMecanica).SelectedItem = ((id <= 0) ? null : ViewModel.Parceiros?.FirstOrDefault((Func<Parceiro, bool>)((Parceiro x) => ((DomainBase)x).Id == id))); + ((Selector)ParceiroFunilaria).SelectedItem = ViewModel.Parceiros?.FirstOrDefault((Func<Parceiro, bool>)delegate(Parceiro x) + { + long id2 = ((DomainBase)x).Id; + Parceiro selectedParceiro = view.ViewModel.SelectedParceiro; + return id2 == ((selectedParceiro != null) ? new long?(((DomainBase)selectedParceiro).Id) : null); + }); + } + + private void AbrirInfo_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirInfo(); + } + + private void Log_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AbrirLog((TipoTela)7, ((DomainBase)ViewModel.SelectedSinistro).Id); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/sinistroview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_00ae: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Expected O, but got Unknown + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d1: Unknown result type (might be due to invalid IL or missing references) + //IL_00db: Expected O, but got Unknown + //IL_00de: Unknown result type (might be due to invalid IL or missing references) + //IL_00e8: Expected O, but got Unknown + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Expected O, but got Unknown + //IL_0102: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Expected O, but got Unknown + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_0126: Unknown result type (might be due to invalid IL or missing references) + //IL_0130: Expected O, but got Unknown + //IL_0132: Unknown result type (might be due to invalid IL or missing references) + //IL_013e: Unknown result type (might be due to invalid IL or missing references) + //IL_0148: Expected O, but got Unknown + //IL_014b: Unknown result type (might be due to invalid IL or missing references) + //IL_0155: Expected O, but got Unknown + //IL_0162: Unknown result type (might be due to invalid IL or missing references) + //IL_016c: Expected O, but got Unknown + //IL_016f: Unknown result type (might be due to invalid IL or missing references) + //IL_0179: Expected O, but got Unknown + //IL_0186: Unknown result type (might be due to invalid IL or missing references) + //IL_0190: Expected O, but got Unknown + //IL_0192: Unknown result type (might be due to invalid IL or missing references) + //IL_019e: Unknown result type (might be due to invalid IL or missing references) + //IL_01a8: Expected O, but got Unknown + //IL_01aa: Unknown result type (might be due to invalid IL or missing references) + //IL_01b6: Unknown result type (might be due to invalid IL or missing references) + //IL_01c0: Expected O, but got Unknown + //IL_01c2: Unknown result type (might be due to invalid IL or missing references) + //IL_01ce: Unknown result type (might be due to invalid IL or missing references) + //IL_01d8: Expected O, but got Unknown + //IL_01da: Unknown result type (might be due to invalid IL or missing references) + //IL_01e6: Unknown result type (might be due to invalid IL or missing references) + //IL_01f0: Expected O, but got Unknown + //IL_01f2: Unknown result type (might be due to invalid IL or missing references) + //IL_01fe: Unknown result type (might be due to invalid IL or missing references) + //IL_0208: Expected O, but got Unknown + //IL_020a: Unknown result type (might be due to invalid IL or missing references) + //IL_0216: Unknown result type (might be due to invalid IL or missing references) + //IL_0220: Expected O, but got Unknown + //IL_0222: Unknown result type (might be due to invalid IL or missing references) + //IL_022e: Unknown result type (might be due to invalid IL or missing references) + //IL_0238: Expected O, but got Unknown + //IL_023a: Unknown result type (might be due to invalid IL or missing references) + //IL_0246: Unknown result type (might be due to invalid IL or missing references) + //IL_0250: Expected O, but got Unknown + //IL_025f: Unknown result type (might be due to invalid IL or missing references) + //IL_026b: Unknown result type (might be due to invalid IL or missing references) + //IL_0275: Expected O, but got Unknown + //IL_0276: Unknown result type (might be due to invalid IL or missing references) + //IL_0282: Unknown result type (might be due to invalid IL or missing references) + //IL_028c: Expected O, but got Unknown + //IL_028d: Unknown result type (might be due to invalid IL or missing references) + //IL_0299: Unknown result type (might be due to invalid IL or missing references) + //IL_02a3: Expected O, but got Unknown + //IL_02a5: Unknown result type (might be due to invalid IL or missing references) + //IL_02b1: Unknown result type (might be due to invalid IL or missing references) + //IL_02bb: Expected O, but got Unknown + //IL_02bc: Unknown result type (might be due to invalid IL or missing references) + //IL_02c8: Unknown result type (might be due to invalid IL or missing references) + //IL_02d2: Expected O, but got Unknown + //IL_02d3: Unknown result type (might be due to invalid IL or missing references) + //IL_02df: Unknown result type (might be due to invalid IL or missing references) + //IL_02e9: Expected O, but got Unknown + //IL_02eb: Unknown result type (might be due to invalid IL or missing references) + //IL_02f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0301: Expected O, but got Unknown + //IL_0302: Unknown result type (might be due to invalid IL or missing references) + //IL_030e: Unknown result type (might be due to invalid IL or missing references) + //IL_0318: Expected O, but got Unknown + //IL_0319: Unknown result type (might be due to invalid IL or missing references) + //IL_0325: Unknown result type (might be due to invalid IL or missing references) + //IL_032f: Expected O, but got Unknown + //IL_0331: Unknown result type (might be due to invalid IL or missing references) + //IL_033d: Unknown result type (might be due to invalid IL or missing references) + //IL_0347: Expected O, but got Unknown + //IL_0349: Unknown result type (might be due to invalid IL or missing references) + //IL_0355: Unknown result type (might be due to invalid IL or missing references) + //IL_035f: Expected O, but got Unknown + //IL_0360: Unknown result type (might be due to invalid IL or missing references) + //IL_036c: Unknown result type (might be due to invalid IL or missing references) + //IL_0376: Expected O, but got Unknown + //IL_0377: Unknown result type (might be due to invalid IL or missing references) + //IL_0383: Unknown result type (might be due to invalid IL or missing references) + //IL_038d: Expected O, but got Unknown + //IL_038f: Unknown result type (might be due to invalid IL or missing references) + //IL_039c: Unknown result type (might be due to invalid IL or missing references) + //IL_03a6: Expected O, but got Unknown + //IL_03a8: Unknown result type (might be due to invalid IL or missing references) + //IL_03b5: Unknown result type (might be due to invalid IL or missing references) + //IL_03bf: Expected O, but got Unknown + //IL_03c0: Unknown result type (might be due to invalid IL or missing references) + //IL_03cd: Unknown result type (might be due to invalid IL or missing references) + //IL_03d7: Expected O, but got Unknown + //IL_03da: Unknown result type (might be due to invalid IL or missing references) + //IL_03e4: Expected O, but got Unknown + //IL_03f1: Unknown result type (might be due to invalid IL or missing references) + //IL_03fb: Expected O, but got Unknown + //IL_03fd: Unknown result type (might be due to invalid IL or missing references) + //IL_0409: Unknown result type (might be due to invalid IL or missing references) + //IL_0413: Expected O, but got Unknown + //IL_0416: Unknown result type (might be due to invalid IL or missing references) + //IL_0420: Expected O, but got Unknown + //IL_042d: Unknown result type (might be due to invalid IL or missing references) + //IL_0437: Expected O, but got Unknown + //IL_0439: Unknown result type (might be due to invalid IL or missing references) + //IL_0445: Unknown result type (might be due to invalid IL or missing references) + //IL_044f: Expected O, but got Unknown + //IL_0452: Unknown result type (might be due to invalid IL or missing references) + //IL_045c: Expected O, but got Unknown + //IL_045f: Unknown result type (might be due to invalid IL or missing references) + //IL_0469: Expected O, but got Unknown + //IL_04d4: Unknown result type (might be due to invalid IL or missing references) + //IL_04de: Expected O, but got Unknown + //IL_04e0: Unknown result type (might be due to invalid IL or missing references) + //IL_04ec: Unknown result type (might be due to invalid IL or missing references) + //IL_04f6: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxSinistro_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBoxSinistro_OnTextChanged); + break; + case 2: + ControleGrid = (DataGrid)target; + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(Incluir_OnClick); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(IncluirEnvolvido_OnClick); + break; + case 6: + ((MenuItem)target).Click += new RoutedEventHandler(Alterar_OnClick); + break; + case 7: + SalvarSinistroButton = (MenuItem)target; + SalvarSinistroButton.Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 8: + CancelarApoliceButton = (MenuItem)target; + CancelarApoliceButton.Click += new RoutedEventHandler(Cancelar_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Excluir_OnClick); + break; + case 10: + ((MenuItem)target).Click += new RoutedEventHandler(Tarefas_OnClick); + break; + case 11: + ((MenuItem)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick); + break; + case 12: + ((MenuItem)target).Click += new RoutedEventHandler(ImprimirHistorico_OnClick); + break; + case 13: + ((MenuItem)target).Click += new RoutedEventHandler(EnviarHistorico_OnClick); + break; + case 14: + ((MenuItem)target).Click += new RoutedEventHandler(Log_OnClick); + break; + case 15: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirLogEmail_OnClick); + break; + case 16: + ((MenuItem)target).Click += new RoutedEventHandler(AbrirInfo_OnClick); + break; + case 17: + TipoSinistroBox = (CustomIsReadOnlyControl)target; + break; + case 18: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 19: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 20: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 21: + ((Selector)(ComboBox)target).SelectionChanged += new SelectionChangedEventHandler(SituacaoBox_OnSelectionChanged); + break; + case 22: + ((UIElement)(DatePicker)target).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((UIElement)(DatePicker)target).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + ((Control)(DatePicker)target).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + break; + case 23: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 24: + ((UIElement)(TextBox)target).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(FormatarTelefone); + break; + case 25: + ParceiroMecanica = (ComboBox)target; + ((Selector)ParceiroMecanica).SelectionChanged += new SelectionChangedEventHandler(ParceiroBox_OnSelectionChanged); + break; + case 26: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(MecanicaButton_OnClick); + break; + case 27: + ParceiroFunilaria = (ComboBox)target; + ((Selector)ParceiroFunilaria).SelectionChanged += new SelectionChangedEventHandler(ParceiroBox_OnSelectionChanged); + break; + case 28: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(FunilariaButton_OnClick); + break; + case 29: + AnotacoesButton = (RadioButton)target; + break; + case 30: + AnotacoesInternasButton = (RadioButton)target; + break; + case 31: + AnotacoesHoster = (CustomItemControl)target; + break; + case 32: + Anotacoes = (WebEditor)target; + break; + case 33: + ObservacoesHoster = (CustomItemControl)target; + break; + case 34: + Observacoes = (WebEditor)target; + break; + case 35: + AnotacoesInternasHoster = (CustomItemControl)target; + break; + case 36: + AnotacoesInternas = (WebEditor)target; + break; + case 37: + ObservacoesInternasHoster = (CustomItemControl)target; + break; + case 38: + ObservacoesInternas = (WebEditor)target; + break; + case 39: + Snackbar = (Snackbar)target; + break; + case 40: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Views.Seguros/TrocarClienteView.cs b/Decompiler/Gestor.Application.Views.Seguros/TrocarClienteView.cs new file mode 100644 index 0000000..c8c26bb --- /dev/null +++ b/Decompiler/Gestor.Application.Views.Seguros/TrocarClienteView.cs @@ -0,0 +1,160 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.ViewModels.Seguros; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Views.Seguros; + +public class TrocarClienteView : BaseUserControl, IComponentConnector +{ + public TrocarClienteViewModel ViewModel; + + internal ProgressBar ProgressBar; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + public TrocarClienteView(Documento documento) + { + ViewModel = new TrocarClienteViewModel + { + SelectedDocumento = documento + }; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarCliente(ValidationHelper.RemoveDiacritics(e.Parameter.Trim()), null, (TipoFiltroCliente)2).ContinueWith(delegate(Task<List<Cliente>> searchResult) + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + //IL_0014: Unknown result type (might be due to invalid IL or missing references) + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + private async void Salvar_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.Salvar()) + { + ToggleSnackBar("CLIENTE TROCADO COM SUCESSO."); + } + else + { + ToggleSnackBar("ERRO AO TROCAR CLIENTE."); + } + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + public void ToggleSnackBar(string message, bool active = true) + { + ((ContentControl)Snackbar.Message).Content = message; + Snackbar.IsActive = active; + if (active) + { + Task.Factory.StartNew(CloseSlackBar); + } + } + + private void CloseSlackBar() + { + Thread.Sleep(5000); + Dispatcher dispatcher = ((DispatcherObject)ProgressBar).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + ToggleSnackBar("", active: false); + }); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/views/seguros/trocarclienteview.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + internal Delegate _CreateDelegate(Type delegateType, string handler) + { + return Delegate.CreateDelegate(delegateType, this, handler); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + //IL_002c: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_0042: Expected O, but got Unknown + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Expected O, but got Unknown + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_0067: Expected O, but got Unknown + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressBar = (ProgressBar)target; + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Salvar_OnClick); + break; + case 3: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 4: + Snackbar = (Snackbar)target; + break; + case 5: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } +} |