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.Componentes | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.Componentes')
48 files changed, 9011 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Componentes/CalculoControl.cs b/Decompiler/Gestor.Application.Componentes/CalculoControl.cs new file mode 100644 index 0000000..03c81ec --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CalculoControl.cs @@ -0,0 +1,2279 @@ +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.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Agger.Registro; +using CsQuery.ExtensionMethods.Internal; +using Gestor.Application.Actions; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.Servicos.Seguros.Itens; +using Gestor.Application.ViewModels; +using Gestor.Common.Helpers; +using Gestor.Model.CalculoWeb; +using Gestor.Model.CalculoWeb.Auto; +using Gestor.Model.CalculoWeb.Condominio; +using Gestor.Model.CalculoWeb.Empresa; +using Gestor.Model.CalculoWeb.Residencia; +using Gestor.Model.CalculoWeb.VidaIndividual; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.License; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Gestor.Application.Componentes; + +public class CalculoControl : UserControl, IComponentConnector +{ + [StructLayout(LayoutKind.Auto)] + [CompilerGenerated] + private struct _003CIniciarPipe_003Ed__29 : IAsyncStateMachine + { + private static class _003C_003Eo__29 + { + public static CallSite<Func<CallSite, object, object>> _003C_003Ep__0; + + public static CallSite<Func<CallSite, object, object>> _003C_003Ep__1; + + public static CallSite<Func<CallSite, object, bool>> _003C_003Ep__2; + + public static CallSite<Func<CallSite, object, object>> _003C_003Ep__3; + } + + public int _003C_003E1__state; + + public AsyncVoidMethodBuilder _003C_003Et__builder; + + public CalculoControl _003C_003E4__this; + + public object message; + + private object _003C_003Eu__1; + + private TaskAwaiter<bool> _003C_003Eu__2; + + private void MoveNext() + { + int num = _003C_003E1__state; + CalculoControl calculoControl = _003C_003E4__this; + try + { + TaskAwaiter<bool> awaiter; + dynamic awaiter2; + if (num != 0) + { + if (num == 1) + { + awaiter = _003C_003Eu__2; + _003C_003Eu__2 = default(TaskAwaiter<bool>); + num = (_003C_003E1__state = -1); + goto IL_02b9; + } + awaiter2 = calculoControl.CallPipe((dynamic)message).GetAwaiter(); + if (!(bool)awaiter2.IsCompleted) + { + num = (_003C_003E1__state = 0); + _003C_003Eu__1 = awaiter2; + ICriticalNotifyCompletion awaiter3 = awaiter2 as ICriticalNotifyCompletion; + if (awaiter3 == null) + { + INotifyCompletion awaiter4 = (INotifyCompletion)(object)awaiter2; + _003C_003Et__builder.AwaitOnCompleted(ref awaiter4, ref this); + awaiter4 = null; + } + else + { + _003C_003Et__builder.AwaitUnsafeOnCompleted(ref awaiter3, ref this); + } + awaiter3 = null; + return; + } + } + else + { + awaiter2 = _003C_003Eu__1; + _003C_003Eu__1 = null; + num = (_003C_003E1__state = -1); + } + dynamic result = awaiter2.GetResult(); + if (!(result ? true : false)) + { + awaiter = new DashboardViewModel().ShowMessage(calculoControl.MessageAggilizador).GetAwaiter(); + if (!awaiter.IsCompleted) + { + num = (_003C_003E1__state = 1); + _003C_003Eu__2 = awaiter; + _003C_003Et__builder.AwaitUnsafeOnCompleted(ref awaiter, ref this); + return; + } + goto IL_02b9; + } + goto end_IL_000e; + IL_02b9: + awaiter.GetResult(); + end_IL_000e:; + } + catch (Exception exception) + { + _003C_003E1__state = -2; + _003C_003Et__builder.SetException(exception); + return; + } + _003C_003E1__state = -2; + _003C_003Et__builder.SetResult(); + } + + void IAsyncStateMachine.MoveNext() + { + //ILSpy generated this explicit interface implementation from .override directive in MoveNext + this.MoveNext(); + } + + [DebuggerHidden] + private void SetStateMachine(IAsyncStateMachine stateMachine) + { + _003C_003Et__builder.SetStateMachine(stateMachine); + } + + void IAsyncStateMachine.SetStateMachine(IAsyncStateMachine stateMachine) + { + //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine + this.SetStateMachine(stateMachine); + } + } + + public static readonly DependencyProperty DocumentoIdProperty = DependencyProperty.Register("DocumentoId", typeof(object), typeof(CalculoControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty ClienteIdProperty = DependencyProperty.Register("ClienteId", typeof(object), typeof(CalculoControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty RamoIdProperty = DependencyProperty.Register("RamoId", typeof(object), typeof(CalculoControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty DocumentoProperty = DependencyProperty.Register("Documento", typeof(object), typeof(CalculoControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)string.Empty, (FrameworkPropertyMetadataOptions)256)); + + private string _messageAggilizadorWeb = "CRIADO COM SUCESSO!" + Environment.NewLine + "DESEJA ACESSAR A PAGINA DO AGGILIZADOR AGORA?"; + + private string MessageAggilizador = "NÃO FOI POSSÍVEL INICIAR A FUNÇÃO NO AGGILIZADOR DE CÁLCULOS." + Environment.NewLine + "CERTIFIQUE-SE QUE O AGGILIZADOR ESTÁ DEVIDAMENTE ATUALIZADO ANTES DE TENTAR NOVAMENTE."; + + internal Grid LayoutRoot; + + internal Button CalculoButton; + + private bool _contentLoaded; + + public object DocumentoId + { + get + { + return ((DependencyObject)this).GetValue(DocumentoIdProperty); + } + set + { + ((DependencyObject)this).SetValue(DocumentoIdProperty, value); + } + } + + public object ClienteId + { + get + { + return ((DependencyObject)this).GetValue(ClienteIdProperty); + } + set + { + ((DependencyObject)this).SetValue(ClienteIdProperty, value); + } + } + + public object RamoId + { + get + { + return ((DependencyObject)this).GetValue(RamoIdProperty); + } + set + { + ((DependencyObject)this).SetValue(RamoIdProperty, value); + } + } + + public string Documento + { + get + { + return (string)((DependencyObject)this).GetValue(DocumentoProperty); + } + set + { + ((DependencyObject)this).SetValue(DocumentoProperty, (object)value); + } + } + + public CalculoControl() + { + InitializeComponent(); + ((FrameworkElement)LayoutRoot).DataContext = this; + } + + private async void Calcular_OnClick(object sender, RoutedEventArgs e) + { + if (!(await VerificarPermissao())) + { + return; + } + if (DocumentoId == null) + { + Prospectar(); + } + else if (LicenseHelper.Produtos.Any((Licenca produto) => (int)produto.Produto == 91)) + { + if (string.IsNullOrEmpty(Recursos.Usuario.Email)) + { + await new DashboardViewModel().ShowMessage("USUÁRIO SEM E-MAIL CADASTRADO! O E-MAIL CADASTRADO DEVE SER O MESMO DO AGGILIZADOR."); + return; + } + string linkCalculo = await CalculoWeb(DocumentoId.ToString()); + if (!ExtensionMethods.IsNullOrEmpty<char>((IEnumerable<char>)linkCalculo) && await new DashboardViewModel().ShowMessage(_messageAggilizadorWeb, "SIM", "NÃO")) + { + try + { + Process.Start(new ProcessStartInfo(linkCalculo) + { + UseShellExecute = true + }); + } + catch + { + await new DashboardViewModel().ShowMessage("ERRO AO ABRIR CALCULO"); + } + } + } + else + { + await Iniciar(trazerParaFrente: true); + Documento val = await new ApoliceServico().BuscarApoliceAsync(long.Parse(DocumentoId.ToString()), itens: true); + long id = ((DomainBase)val.Controle.Cliente).Id; + long id2 = ((DomainBase)val).Id; + long id3 = ((DomainBase)val.Controle).Id; + List<Item> itensAtivo = val.ItensAtivo; + long? itemId; + if (itensAtivo == null) + { + itemId = null; + } + else + { + Item? obj2 = itensAtivo.FirstOrDefault(); + itemId = ((obj2 != null) ? new long?(((DomainBase)obj2).Id) : null); + } + dynamic val2 = new + { + ClientId = id, + DocumentId = id2, + ControlId = id3, + ItemId = itemId, + Branch = ((DomainBase)val.Controle.Ramo).Id + }; + IniciarPipe(val2); + } + } + + private async Task<string> CalculoWeb(string idDocumento) + { + long id = long.Parse(idDocumento); + Documento val = await new ApoliceServico().BuscarApoliceAsync(id, itens: true); + long id2 = ((DomainBase)val.Controle.Ramo).Id; + new Calculo(); + long num = id2 - 1; + if ((ulong)num <= 5uL) + { + Calculo val2; + List<Resultados> list; + Resultados item; + switch (num) + { + case 0L: + val2 = await ResidenciaCalculo(val); + goto IL_036e; + case 1L: + val2 = await EmpresaCalculo(val); + goto IL_036e; + case 2L: + val2 = await CondominioCalculo(val); + goto IL_036e; + case 4L: + val2 = await AutoCalculo(val); + goto IL_036e; + case 5L: + { + val2 = await VidaIndividualCalculo(val); + goto IL_036e; + } + IL_036e: + list = new List<Resultados>(); + item = new Resultados + { + Erros = null + }; + list.Add(item); + return await EnviaCalculoWeb(JsonConvert.SerializeObject((object)new Calculo + { + SerialNumber = Recursos.Empresa.Serial, + Usuario = new Usuario + { + Email = Recursos.Usuario.Email + }, + Resultados = list, + Auto = (val2.Auto ?? null), + Residencia = (val2.Residencia ?? null), + Empresa = (val2.Empresa ?? null), + Condominio = (val2.Condominio ?? null), + Vida = (val2.Vida ?? null) + })); + } + } + await new DashboardViewModel().ShowMessage("NÃO FOI POSSÍVEL CONCLUIR A INTEGRAÇÃO"); + return null; + } + + public static async Task<string> EnviaCalculoWeb(string body) + { + _ = 2; + try + { + HttpClient client = new HttpClient(); + try + { + string text = "qN7vHy58kLTm4PXEbUgfzMAKrZye2GVn3sdJx9oRWcl71tbvQMF3cU6A8xn5"; + Uri uri = Address.ApiCalculoWeb.Append("calculo").Append("negocio").Append("integracao"); + ((HttpHeaders)client.DefaultRequestHeaders).Clear(); + ((HttpHeaders)client.DefaultRequestHeaders).Add("Authorization", text); + StringContent val = new StringContent(body, (Encoding)null, "application/json"); + HttpResponseMessage val2 = await client.PostAsync(uri, (HttpContent)(object)val); + if (val2.StatusCode == HttpStatusCode.Unauthorized) + { + await new DashboardViewModel().ShowMessage("O E-MAIL CADASTRADO NO GESTOR É DIFERENTE DO E-MAIL CADASTRADO NO AGGILIZADOR!"); + return string.Empty; + } + string obj = await val2.Content.ReadAsStringAsync(); + JObject val3 = JObject.Parse(obj); + if (obj.Contains("erro")) + { + return ""; + } + return ((object)val3["url"])?.ToString(); + } + finally + { + ((IDisposable)client)?.Dispose(); + } + } + catch + { + return ""; + } + } + + private async Task<Calculo> AutoCalculo(Documento doc) + { + try + { + Cliente cliente = await BuscaClienteCompleto(((DomainBase)doc.Controle.Cliente).Id); + ObservableCollection<ClienteEmail> emails = cliente.Emails; + object obj; + if (emails == null) + { + obj = null; + } + else + { + ClienteEmail? obj2 = emails.FirstOrDefault(); + obj = ((obj2 != null) ? ((EmailBase)obj2).Email : null); + } + if (obj == null) + { + obj = string.Empty; + } + string email = (string)obj; + ClienteTelefone fone = cliente.Telefones?.FirstOrDefault() ?? null; + ClienteEndereco endereco = cliente.Enderecos?.FirstOrDefault() ?? null; + string s = (((cliente != null) ? cliente.PrimeiraHabilitacao : null) ?? DateTime.MinValue).ConvertTempoHabilitacaoCalculo(); + TempoHabilitacao tempoHabilitacao = Funcoes.ConvertTempoHabilitacao(int.Parse(s)); + List<Perfil> list = await new PerfilServico().BuscarPerfis(((DomainBase)doc.Controle).Id); + bool existPerfil = list.Count > 0; + Perfil perfilPrincipal = ((IEnumerable<Perfil>)list).FirstOrDefault((Func<Perfil, bool>)((Perfil p) => ((DomainBase)p.Controle).Id == ((DomainBase)doc.Controle).Id)); + Item? obj3 = doc.ItensAtivo.FirstOrDefault(); + long num = ((obj3 != null) ? ((DomainBase)obj3).Id : 0); + decimal num2 = default(decimal); + decimal num3 = default(decimal); + decimal num4 = default(decimal); + decimal num5 = default(decimal); + Auto automovel = new Auto(); + Item item = new Item(); + if (num > 0) + { + item = await new ItemServico().BuscarItemPorIdAsync(num); + automovel = await new ItemServico().BuscaAuto(((DomainBase)item).Id); + List<Cobertura> source = (await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item).Id)).ToList(); + source = source.Where((Cobertura cobertura) => cobertura.CoberturaPadrao != null).ToList(); + Cobertura? obj4 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)delegate(Cobertura x) + { + CoberturaPadrao coberturaPadrao5 = x.CoberturaPadrao; + return coberturaPadrao5 != null && coberturaPadrao5.IdRamo == 17; + }); + num2 = ((obj4 != null) ? obj4.Lmi : 0m); + Cobertura? obj5 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)delegate(Cobertura x) + { + CoberturaPadrao coberturaPadrao4 = x.CoberturaPadrao; + return coberturaPadrao4 != null && ((DomainBase)coberturaPadrao4).Id == 2; + }); + num3 = ((obj5 != null) ? obj5.Lmi : 0m); + Cobertura? obj6 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)delegate(Cobertura x) + { + CoberturaPadrao coberturaPadrao3 = x.CoberturaPadrao; + return coberturaPadrao3 != null && ((DomainBase)coberturaPadrao3).Id == 3; + }); + num4 = ((obj6 != null) ? obj6.Lmi : 0m); + Cobertura? obj7 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)delegate(Cobertura x) + { + CoberturaPadrao coberturaPadrao2 = x.CoberturaPadrao; + return coberturaPadrao2 != null && ((DomainBase)coberturaPadrao2).Id == 4; + }); + decimal obj9; + if (obj7 == null) + { + Cobertura? obj8 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)delegate(Cobertura x) + { + CoberturaPadrao coberturaPadrao = x.CoberturaPadrao; + return coberturaPadrao != null && ((DomainBase)coberturaPadrao).Id == 719; + }); + obj9 = ((obj8 != null) ? obj8.Lmi : 0m); + } + else + { + obj9 = obj7.Lmi; + } + num5 = obj9; + } + Calculo val = new Calculo(); + CalculoAuto val2 = new CalculoAuto(); + Segurado val3 = new Segurado + { + Email = email + }; + Telefone val4 = new Telefone(); + val4.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val4.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val4.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneResidencial = val4; + Telefone val5 = new Telefone(); + val5.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val5.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val5.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneCelular = val5; + val3.Cep = ((endereco != null) ? ((EnderecoBase)endereco).Cep : null); + val3.RelacaoSeguradoCondutor = null; + val3.Perfil = existPerfil; + val3.Uf = ((endereco != null) ? ((EnderecoBase)endereco).Estado : null) ?? null; + val3.NomeCompleto = cliente.Nome; + val3.CpfCnpj = cliente.Documento; + val3.DataNascimento = cliente.Nascimento; + val3.Sexo = ((cliente != null) ? EnumHelper.Value<Sexo?>(cliente.Sexo) : null); + val3.DataHabilitacao = cliente.PrimeiraHabilitacao; + val3.TempoHabilitacao = EnumHelper.Value<TempoHabilitacao>(tempoHabilitacao); + val3.EstadoCivil = ((cliente != null) ? EnumHelper.Value<EstadoCivil?>(cliente.EstadoCivil) : null); + val3.NumeroHabilitacao = ((cliente != null) ? cliente.Habilitacao : null) ?? null; + val3.Id = ((cliente != null) ? ((DomainBase)cliente).Id : 0); + val2.Segurado = val3; + CondutorPrincipal val6 = new CondutorPrincipal(); + val6.NomeCompleto = ((perfilPrincipal != null) ? perfilPrincipal.Nome : null) ?? null; + val6.CpfCnpj = ((perfilPrincipal != null) ? perfilPrincipal.Cpf : null) ?? null; + val6.DataNascimento = ((perfilPrincipal != null) ? perfilPrincipal.Nascimento : null); + val6.Sexo = ((perfilPrincipal != null) ? EnumHelper.Value<Sexo?>(perfilPrincipal.Sexo) : null); + val6.DataHabilitacao = null; + val6.TempoHabilitacao = ((perfilPrincipal != null) ? EnumHelper.Value<TempoHabilitacao?>(perfilPrincipal.TempoHabilitacao) : null) ?? null; + val6.EstadoCivil = ((perfilPrincipal != null) ? EnumHelper.Value<EstadoCivil?>(perfilPrincipal.EstadoCivil) : null) ?? null; + val6.NumeroHabilitacao = ((perfilPrincipal != null) ? perfilPrincipal.Habilitacao : null); + val6.Id = ((perfilPrincipal != null) ? ((DomainBase)perfilPrincipal).Id : 0); + val2.CondutorPrincipal = val6; + object veiculo; + if (automovel != null) + { + Veiculo val7 = new Veiculo(); + Auto obj10 = automovel; + val7.NumeroChassi = ((obj10 != null) ? obj10.Chassi : null); + Auto obj11 = automovel; + val7.Placa = ((obj11 != null) ? obj11.Placa : null); + val7.Uf = null; + Auto obj12 = automovel; + val7.Modelo = ((obj12 != null) ? obj12.Modelo : null); + Auto obj13 = automovel; + object fabricante; + if (obj13 == null) + { + fabricante = null; + } + else + { + Fabricante fabricante2 = obj13.Fabricante; + fabricante = ((fabricante2 != null) ? fabricante2.Descricao : null); + } + val7.Fabricante = (string)fabricante; + Auto obj14 = automovel; + val7.AnoFabricacao = ((obj14 != null) ? obj14.AnoFabricacao : null); + Auto obj15 = automovel; + val7.AnoModelo = ((obj15 != null) ? obj15.AnoModelo : null); + Auto obj16 = automovel; + val7.CodigoFipe = ((obj16 != null) ? obj16.Fipe : null); + Auto obj17 = automovel; + val7.Rastreador = ((obj17 != null) ? EnumHelper.Value<Rastreador>(obj17.Rastreador) : null) ?? "0"; + val7.Antifurto = ((perfilPrincipal != null) ? EnumHelper.Value<Antifurto?>(perfilPrincipal.AntiFurto) : null); + Auto obj18 = automovel; + val7.KitGas = ((obj18 == null) ? null : obj18.KitGas?.BoolToString()) ?? "0"; + Auto obj19 = automovel; + val7.ZeroKm = ((obj19 == null) ? null : obj19.ZeroKm?.BoolToString()) ?? "0"; + Auto obj20 = automovel; + val7.Alienado = ((obj20 == null) ? null : obj20.Financiado?.BoolToString()); + Auto obj21 = automovel; + object combustivel; + if (obj21 == null) + { + combustivel = null; + } + else + { + Combustivel? combustivel2 = obj21.Combustivel; + combustivel = (combustivel2.HasValue ? EnumHelper.Value<Combustivel>(combustivel2.GetValueOrDefault()) : null); + } + val7.Combustivel = (string)combustivel; + Auto obj22 = automovel; + val7.CepPernoite = ((obj22 != null) ? obj22.CepPernoite : null); + Fipe val8 = new Fipe(); + Auto obj23 = automovel; + val8.Codigo = ((obj23 != null) ? obj23.Fipe : null); + Auto obj24 = automovel; + val8.Modelo = ((obj24 != null) ? obj24.Modelo : null); + Auto obj25 = automovel; + object obj26; + if (obj25 == null) + { + obj26 = null; + } + else + { + Fabricante fabricante3 = obj25.Fabricante; + obj26 = ((fabricante3 != null) ? fabricante3.Descricao : null); + } + if (obj26 == null) + { + obj26 = string.Empty; + } + val8.Marca = (string)obj26; + Auto obj27 = automovel; + val8.AnoMaximo = ((obj27 != null) ? obj27.AnoFabricacao : null); + Auto obj28 = automovel; + val8.AnoMinimo = ((obj28 != null) ? obj28.AnoModelo : null); + Auto obj29 = automovel; + object combustivel3; + if (obj29 == null) + { + combustivel3 = null; + } + else + { + Combustivel? combustivel2 = obj29.Combustivel; + combustivel3 = (combustivel2.HasValue ? EnumHelper.Value<Combustivel>(combustivel2.GetValueOrDefault()) : null); + } + val8.Combustivel = (string)combustivel3; + val8.Valor = 0m; + val8.ValorAntigo = 0m; + Auto obj30 = automovel; + val8.AnoModelo = ((obj30 != null) ? obj30.AnoModelo : null); + val8.TipoVeiculo = 0; + Auto obj31 = automovel; + val8.ZeroKm = ((obj31 != null) ? obj31.ZeroKm : null).GetValueOrDefault(); + val8.Id = 0; + val7.Fipe = val8; + Auto obj32 = automovel; + val7.Blindado = ((obj32 == null) ? null : obj32.Blindagem?.BoolToString()) ?? string.Empty; + Auto obj33 = automovel; + val7.Id = ((obj33 != null) ? ((DomainBase)obj33).Id : 0); + veiculo = (object)val7; + } + else + { + veiculo = null; + } + val2.Veiculo = (Veiculo)veiculo; + QuestionarioAuto val9 = new QuestionarioAuto(); + val9.QuilometragemMensal = ((perfilPrincipal != null) ? perfilPrincipal.KmMensal : null); + Auto obj34 = automovel; + object obj35; + if (obj34 == null) + { + obj35 = null; + } + else + { + UsoVeiculo? usoVeiculo = obj34.UsoVeiculo; + obj35 = (usoVeiculo.HasValue ? EnumHelper.Value<UsoVeiculo>(usoVeiculo.GetValueOrDefault()) : null); + } + if (obj35 == null) + { + obj35 = null; + } + val9.UsoVeiculo = (string)obj35; + val9.GaragemEstudo = ((perfilPrincipal == null) ? null : perfilPrincipal.GaragemEstudo?.ConvertGaragemTrabalhoEstudoCalculo()) ?? null; + object obj36; + if (perfilPrincipal == null || (int)perfilPrincipal.GaragemResidencia.GetValueOrDefault() != 4) + { + if (perfilPrincipal == null) + { + obj36 = null; + } + else + { + GaragemResidencia? garagemResidencia = perfilPrincipal.GaragemResidencia; + obj36 = (garagemResidencia.HasValue ? EnumHelper.Value<GaragemResidencia>(garagemResidencia.GetValueOrDefault()) : null); + } + if (obj36 == null) + { + obj36 = null; + } + } + else + { + obj36 = null; + } + val9.GaragemResidencia = (string)obj36; + object obj37; + if (perfilPrincipal == null) + { + obj37 = null; + } + else + { + TipoResidencia? tipoResidencia = perfilPrincipal.TipoResidencia; + obj37 = (tipoResidencia.HasValue ? EnumHelper.Value<TipoResidencia>(tipoResidencia.GetValueOrDefault()) : null); + } + if (obj37 == null) + { + obj37 = null; + } + val9.TipoResidencia = (string)obj37; + object obj38; + if (perfilPrincipal == null) + { + obj38 = null; + } + else + { + UsoDependetes? usoDependentes = perfilPrincipal.UsoDependentes; + obj38 = (usoDependentes.HasValue ? EnumHelper.Value<UsoDependetes>(usoDependentes.GetValueOrDefault()) : null); + } + if (obj38 == null) + { + obj38 = null; + } + val9.UsoDependentes = (string)obj38; + val9.FaixaEtariaDependentes = null; + val9.IsencaoFiscal = null; + Auto obj39 = automovel; + val9.Pcd = ((obj39 == null) ? null : obj39.Pcd?.BoolToString()) ?? string.Empty; + val9.PeriodoUso = null; + val9.Associado = null; + Auto obj40 = automovel; + val9.Id = ((obj40 != null) ? ((DomainBase)obj40).Id : 0); + val2.Questionario = val9; + val2.Caminhao = new Caminhao + { + Carga = null, + Carroceria = null, + Equipamento = null, + GerenciamentoRisco = null, + Uso = null, + RegiaoCirculacao = null, + SeguroCarga = null, + Garagem = null, + ProprioEstado = null, + Periodo = null, + Id = 0 + }; + val2.Cobertura = new CoberturaAuto + { + DanosMorais = num2.ToString(), + DanosMateriais = num3.ToString(), + DanosCorporais = num4.ToString(), + MorteInvalidez = num5.ToString(), + FatorAjuste = 0m, + TipoCobertura = "", + TipoFranquia = "", + Assistencia = "", + CarroReserva = "", + Vidros = "", + DespesasExtras = "", + KitGas = 0m, + Carroceria = 0m, + Equipamento = 0m, + Blindagem = 0m, + ArCondicionado = "", + GarantiaZero = "", + ReparoRapido = "", + ProtecaoBuracos = "", + Id = 0 + }; + Seguro val10 = new Seguro + { + Comissao = doc.Comissao, + Agenciamento = 0m, + ComissaoSeguradora = new List<ComissaoSeguradora>() + }; + Documento obj41 = doc; + val10.VigenciaInicial = ((obj41 != null) ? obj41.Vigencia2 : null) ?? DateTime.MinValue; + Documento obj42 = doc; + val10.VigenciaFinal = ((obj42 != null) ? obj42.Vigencia2.Value.AddYears(1) : DateTime.MinValue); + Documento obj43 = doc; + val10.VigenciaFinalAnterior = ((obj43 != null) ? obj43.Vigencia2 : null) ?? DateTime.MinValue; + Documento obj44 = doc; + val10.TipoSeguro = ((obj44 != null) ? obj44.Situacao.ConvertTipoSeguroCalculo() : null); + val10.Banco = null; + Auto obj45 = automovel; + val10.Bonus = ((obj45 != null) ? obj45.Bonus.ToString() : null); + Documento obj46 = doc; + val10.SeguradoraAnterior = ((obj46 != null) ? obj46.Controle.Seguradora.Nome : null); + val10.CodigoIdentificacao = ""; + val10.NumeroApoliceAnterior = doc.Apolice; + val10.Sinistros = item.Sinistrado.BoolToString(); + val10.RenovacaoGarantida = false; + val10.Observacoes = doc.Observacao; + val10.Id = ((DomainBase)doc).Id; + val2.Seguro = val10; + val2.TipoVeiculo = 0; + val.Auto = val2; + return val; + } + catch (Exception) + { + return null; + } + } + + public static async Task<Cliente> BuscaClienteCompleto(long idCliente) + { + Cliente cliente = await new ClienteServico().BuscarCliente(idCliente); + ObservableCollection<ClienteTelefone> telefones = await new ClienteServico().BuscarTelefonesAsync(idCliente); + ObservableCollection<ClienteEmail> emails = await new ClienteServico().BuscarEmailsAsync(idCliente); + ObservableCollection<ClienteEndereco> collection = await new ClienteServico().BuscarEnderecosAsync(idCliente); + cliente.Telefones = new ObservableCollection<ClienteTelefone>(telefones); + cliente.Emails = new ObservableCollection<ClienteEmail>(emails); + cliente.Enderecos = new ObservableCollection<ClienteEndereco>(collection); + return cliente; + } + + private async Task<Calculo> ResidenciaCalculo(Documento doc) + { + Cliente cliente = await BuscaClienteCompleto(((DomainBase)doc.Controle.Cliente).Id); + ObservableCollection<ClienteEmail> emails = cliente.Emails; + object obj; + if (emails == null) + { + obj = null; + } + else + { + ClienteEmail? obj2 = emails.FirstOrDefault(); + obj = ((obj2 != null) ? ((EmailBase)obj2).Email : null); + } + if (obj == null) + { + obj = string.Empty; + } + string email = (string)obj; + ClienteTelefone fone = cliente.Telefones?.FirstOrDefault() ?? null; + ClienteEndereco endereco = cliente.Enderecos?.FirstOrDefault() ?? null; + string s = (((cliente != null) ? cliente.PrimeiraHabilitacao : null) ?? DateTime.MinValue).ConvertTempoHabilitacaoCalculo(); + TempoHabilitacao tempoHabilitacao = Funcoes.ConvertTempoHabilitacao(int.Parse(s)); + PerfilEmpresa perfilPrincipal = await new PerfilEmpresaServico().BuscarPerfis(((DomainBase)doc.Controle).Id); + bool existPerfil = perfilPrincipal != null; + Item? obj3 = doc.ItensAtivo.FirstOrDefault(); + Item item = ((((obj3 != null) ? ((DomainBase)obj3).Id : 0) != 0L) ? (await new ItemServico().BuscarItems(((DomainBase)doc).Id, (StatusItem)2)).ToList() : null)?.FirstOrDefault(); + Patrimonial patrimonial = new Patrimonial(); + decimal basica = default(decimal); + decimal danosMorais = default(decimal); + decimal responsabilidadeCivilFamiliar = default(decimal); + decimal danosEletricos = default(decimal); + decimal equipamentos = default(decimal); + decimal impactoVeiculos = default(decimal); + decimal aluguel = default(decimal); + decimal vidros = default(decimal); + decimal rouboFurto = default(decimal); + decimal vazamentos = default(decimal); + decimal vendaval = default(decimal); + decimal desmoronamento = default(decimal); + decimal tumultoGreve = default(decimal); + decimal recomposicaoDocumento = default(decimal); + decimal bike = default(decimal); + decimal num = default(decimal); + decimal placasSolares = default(decimal); + if (item != null) + { + patrimonial = item.Patrimonial; + List<Cobertura> source = (await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item).Id)).ToList(); + source = source.Where((Cobertura cobertura) => cobertura.CoberturaPadrao != null).ToList(); + Cobertura? obj4 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 8)); + basica = ((obj4 != null) ? obj4.Lmi : 0m); + Cobertura? obj5 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 262)); + danosMorais = ((obj5 != null) ? obj5.Lmi : 0m); + Cobertura? obj6 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 13)); + decimal obj8; + if (obj6 == null) + { + Cobertura? obj7 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 313)); + obj8 = ((obj7 != null) ? obj7.Lmi : 0m); + } + else + { + obj8 = obj6.Lmi; + } + responsabilidadeCivilFamiliar = obj8; + Cobertura? obj9 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 9)); + decimal obj12; + if (obj9 == null) + { + Cobertura? obj10 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 241)); + if (obj10 == null) + { + Cobertura? obj11 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 487)); + obj12 = ((obj11 != null) ? obj11.Lmi : 0m); + } + else + { + obj12 = obj10.Lmi; + } + } + else + { + obj12 = obj9.Lmi; + } + danosEletricos = obj12; + Cobertura? obj13 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 252)); + equipamentos = ((obj13 != null) ? obj13.Lmi : 0m); + Cobertura? obj14 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 26)); + decimal obj17; + if (obj14 == null) + { + Cobertura? obj15 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 260)); + if (obj15 == null) + { + Cobertura? obj16 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 275)); + obj17 = ((obj16 != null) ? obj16.Lmi : 0m); + } + else + { + obj17 = obj15.Lmi; + } + } + else + { + obj17 = obj14.Lmi; + } + impactoVeiculos = obj17; + Cobertura? obj18 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 27)); + aluguel = ((obj18 != null) ? obj18.Lmi : 0m); + Cobertura? obj19 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 12)); + vidros = ((obj19 != null) ? obj19.Lmi : 0m); + Cobertura? obj20 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 10)); + rouboFurto = ((obj20 != null) ? obj20.Lmi : 0m); + Cobertura? obj21 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 240)); + vazamentos = ((obj21 != null) ? obj21.Lmi : 0m); + Cobertura? obj22 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 11)); + vendaval = ((obj22 != null) ? obj22.Lmi : 0m); + Cobertura? obj23 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 39)); + desmoronamento = ((obj23 != null) ? obj23.Lmi : 0m); + Cobertura? obj24 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 151)); + tumultoGreve = ((obj24 != null) ? obj24.Lmi : 0m); + Cobertura? obj25 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 277)); + recomposicaoDocumento = ((obj25 != null) ? obj25.Lmi : 0m); + Cobertura? obj26 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1720)); + bike = ((obj26 != null) ? obj26.Lmi : 0m); + Cobertura? obj27 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1719)); + num = ((obj27 != null) ? obj27.Lmi : 0m); + Cobertura? obj28 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1667)); + placasSolares = ((obj28 != null) ? obj28.Lmi : 0m); + } + Calculo val = new Calculo(); + CalculoResidencia val2 = new CalculoResidencia(); + Segurado val3 = new Segurado + { + Email = email + }; + Telefone val4 = new Telefone(); + val4.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val4.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val4.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneResidencial = val4; + Telefone val5 = new Telefone(); + val5.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val5.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val5.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneCelular = val5; + val3.Cep = ((endereco != null) ? ((EnderecoBase)endereco).Cep : null); + val3.RelacaoSeguradoCondutor = null; + val3.Perfil = existPerfil; + val3.Uf = ((endereco != null) ? ((EnderecoBase)endereco).Estado : null) ?? null; + val3.NomeCompleto = cliente.Nome; + val3.CpfCnpj = cliente.Documento; + val3.DataNascimento = cliente.Nascimento; + val3.Sexo = ((cliente != null) ? EnumHelper.Value<Sexo?>(cliente.Sexo) : null); + val3.DataHabilitacao = cliente.PrimeiraHabilitacao; + val3.TempoHabilitacao = EnumHelper.Value<TempoHabilitacao>(tempoHabilitacao); + val3.EstadoCivil = EnumHelper.Value<EstadoCivil?>(cliente.EstadoCivil); + val3.NumeroHabilitacao = ((cliente != null) ? cliente.Habilitacao : null) ?? string.Empty; + val3.Id = ((cliente != null) ? ((DomainBase)cliente).Id : 0); + val2.Segurado = val3; + object imovel; + if (patrimonial != null) + { + Imovel val6 = new Imovel(); + EnderecoResidencia val7 = new EnderecoResidencia(); + Patrimonial obj29 = patrimonial; + val7.Cep = ((obj29 != null) ? ((EnderecoBase)obj29).Cep : null); + Patrimonial obj30 = patrimonial; + val7.Cidade = ((obj30 != null) ? ((EnderecoBase)obj30).Cidade : null); + Patrimonial obj31 = patrimonial; + val7.Estado = ((obj31 != null) ? ((EnderecoBase)obj31).Estado : null); + Patrimonial obj32 = patrimonial; + val7.Numero = ((obj32 != null) ? ((EnderecoBase)obj32).Numero : null); + Patrimonial obj33 = patrimonial; + val7.Logradouro = ((obj33 != null) ? ((EnderecoBase)obj33).Endereco : null); + Patrimonial obj34 = patrimonial; + val7.Complemento = ((obj34 != null) ? ((EnderecoBase)obj34).Complemento : null); + Patrimonial obj35 = patrimonial; + val7.Bairro = ((obj35 != null) ? ((EnderecoBase)obj35).Bairro : null); + val7.Id = 0; + val6.Endereco = val7; + val6.TipoOcupacao = null; + Patrimonial obj36 = patrimonial; + val6.TipoMoradia = ((obj36 != null) ? EnumHelper.Value<TipoMoradia>(obj36.TipoMoradia) : null); + val6.TipoConstrucao = null; + val6.Id = 0; + imovel = (object)val6; + } + else + { + imovel = null; + } + val2.Imovel = (Imovel)imovel; + Seguro val8 = new Seguro + { + Comissao = doc.Comissao, + Agenciamento = 0m, + ComissaoSeguradora = new List<ComissaoSeguradora>() + }; + val8.VigenciaInicial = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val8.VigenciaFinal = ((doc != null) ? doc.Vigencia2.Value.AddYears(1) : DateTime.MinValue); + val8.VigenciaFinalAnterior = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val8.TipoSeguro = doc.Situacao.ConvertTipoSeguroCalculo(); + val8.Banco = null; + val8.Bonus = null; + val8.SeguradoraAnterior = ((doc != null) ? doc.Controle.Seguradora.Nome : null); + val8.CodigoIdentificacao = ""; + val8.NumeroApoliceAnterior = ((doc != null) ? doc.Apolice : null); + val8.Sinistros = ((item != null) ? item.Sinistrado.BoolToString() : null); + val8.RenovacaoGarantida = false; + val8.Observacoes = doc.Observacao; + val8.Id = ((DomainBase)doc).Id; + val2.Seguro = val8; + QuestionarioResidencia val9 = new QuestionarioResidencia + { + ImovelDesocupado = "", + AreaRisco = "", + ZonaRural = "", + CondominioFechado = "", + SeguradoProprietario = "", + ImovelTombado = "" + }; + val9.AtividadeProfissional = ((perfilPrincipal != null) ? perfilPrincipal.AtividadePrincipal : null) ?? ""; + val9.EquipamentoSeguranca = ((perfilPrincipal != null) ? perfilPrincipal.EquipamentoSeguranca : null) ?? ""; + val9.Id = 0; + val2.Questionario = val9; + val2.Cobertura = new CoberturaResidencia + { + Basica = basica, + DanosMorais = danosMorais, + ResponsabilidadeCivilFamiliar = responsabilidadeCivilFamiliar, + DanosEletricos = danosEletricos, + Equipamentos = equipamentos, + ImpactoVeiculos = impactoVeiculos, + Aluguel = aluguel, + Vidros = vidros, + RouboFurto = rouboFurto, + Vazamentos = vazamentos, + Vendaval = vendaval, + Desmoronamento = desmoronamento, + TumultoGreve = tumultoGreve, + RecomposicaoDocumento = recomposicaoDocumento, + Bike = bike, + Assistencia = num.ToString(), + Verba = "0", + ValorNovo = "0", + Alagamento = 0m, + PlacasSolares = placasSolares, + Id = 0 + }; + val.Residencia = val2; + return val; + } + + private async Task<Calculo> EmpresaCalculo(Documento doc) + { + Cliente cliente = await BuscaClienteCompleto(((DomainBase)doc.Controle.Cliente).Id); + ObservableCollection<ClienteEmail> emails = cliente.Emails; + object obj; + if (emails == null) + { + obj = null; + } + else + { + ClienteEmail? obj2 = emails.FirstOrDefault(); + obj = ((obj2 != null) ? ((EmailBase)obj2).Email : null); + } + if (obj == null) + { + obj = string.Empty; + } + string email = (string)obj; + ClienteTelefone fone = cliente.Telefones?.FirstOrDefault() ?? null; + ClienteEndereco endereco = cliente.Enderecos?.FirstOrDefault() ?? null; + string s = (((cliente != null) ? cliente.PrimeiraHabilitacao : null) ?? DateTime.MinValue).ConvertTempoHabilitacaoCalculo(); + TempoHabilitacao tempoHabilitacao = Funcoes.ConvertTempoHabilitacao(int.Parse(s)); + PerfilEmpresa perfilPrincipal = await new PerfilEmpresaServico().BuscarPerfis(((DomainBase)doc.Controle).Id); + bool existPerfil = perfilPrincipal != null; + Item? obj3 = doc.ItensAtivo.FirstOrDefault(); + Item item = ((((obj3 != null) ? ((DomainBase)obj3).Id : 0) != 0L) ? (await new ItemServico().BuscarItems(((DomainBase)doc).Id, (StatusItem)2)).ToList() : null)?.FirstOrDefault(); + Patrimonial patrimonial = new Patrimonial(); + decimal value = default(decimal); + decimal value2 = default(decimal); + decimal value3 = default(decimal); + decimal value4 = default(decimal); + decimal value5 = default(decimal); + decimal value6 = default(decimal); + decimal value7 = default(decimal); + decimal value8 = default(decimal); + decimal value9 = default(decimal); + decimal value10 = default(decimal); + decimal value11 = default(decimal); + decimal value12 = default(decimal); + decimal value13 = default(decimal); + if (item != null) + { + patrimonial = item.Patrimonial; + List<Cobertura> source = (await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item).Id)).ToList(); + source = source.Where((Cobertura cobertura) => cobertura.CoberturaPadrao != null).ToList(); + Cobertura? obj4 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 28)); + decimal obj8; + if (obj4 == null) + { + Cobertura? obj5 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 469)); + if (obj5 == null) + { + Cobertura? obj6 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 488)); + if (obj6 == null) + { + Cobertura? obj7 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 720)); + obj8 = ((obj7 != null) ? obj7.Lmi : 0m); + } + else + { + obj8 = obj6.Lmi; + } + } + else + { + obj8 = obj5.Lmi; + } + } + else + { + obj8 = obj4.Lmi; + } + value = obj8; + Cobertura? obj9 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 29)); + value2 = ((obj9 != null) ? obj9.Lmi : 0m); + Cobertura? obj10 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 33)); + decimal obj12; + if (obj10 == null) + { + Cobertura? obj11 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 467)); + obj12 = ((obj11 != null) ? obj11.Lmi : 0m); + } + else + { + obj12 = obj10.Lmi; + } + value3 = obj12; + Cobertura? obj13 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 41)); + value4 = ((obj13 != null) ? obj13.Lmi : 0m); + Cobertura? obj14 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 30)); + value5 = ((obj14 != null) ? obj14.Lmi : 0m); + Cobertura? obj15 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 44)); + value6 = ((obj15 != null) ? obj15.Lmi : 0m); + Cobertura? obj16 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 46)); + value7 = ((obj16 != null) ? obj16.Lmi : 0m); + Cobertura? obj17 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 31)); + decimal obj19; + if (obj17 == null) + { + Cobertura? obj18 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 289)); + obj19 = ((obj18 != null) ? obj18.Lmi : 0m); + } + else + { + obj19 = obj17.Lmi; + } + value8 = obj19; + Cobertura? obj20 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 276)); + value9 = ((obj20 != null) ? obj20.Lmi : 0m); + Cobertura? obj21 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 274)); + decimal obj23; + if (obj21 == null) + { + Cobertura? obj22 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 492)); + obj23 = ((obj22 != null) ? obj22.Lmi : 0m); + } + else + { + obj23 = obj21.Lmi; + } + value10 = obj23; + Cobertura? obj24 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 43)); + value11 = ((obj24 != null) ? obj24.Lmi : 0m); + Cobertura? obj25 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 186)); + value12 = ((obj25 != null) ? obj25.Lmi : 0m); + Cobertura? obj26 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 579)); + value13 = ((obj26 != null) ? obj26.Lmi : 0m); + } + Calculo val = new Calculo(); + CalculoEmpresa val2 = new CalculoEmpresa(); + Segurado val3 = new Segurado + { + Email = email + }; + Telefone val4 = new Telefone(); + val4.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val4.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val4.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneResidencial = val4; + Telefone val5 = new Telefone(); + val5.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val5.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val5.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneCelular = val5; + val3.Cep = ((endereco != null) ? ((EnderecoBase)endereco).Cep : null); + val3.RelacaoSeguradoCondutor = null; + val3.Perfil = existPerfil; + val3.Uf = ((endereco != null) ? ((EnderecoBase)endereco).Estado : null) ?? null; + val3.NomeCompleto = cliente.Nome; + val3.CpfCnpj = cliente.Documento; + val3.DataNascimento = cliente.Nascimento; + val3.Sexo = ((cliente != null) ? EnumHelper.Value<Sexo?>(cliente.Sexo) : null); + val3.DataHabilitacao = cliente.PrimeiraHabilitacao; + val3.TempoHabilitacao = EnumHelper.Value<TempoHabilitacao>(tempoHabilitacao); + val3.EstadoCivil = EnumHelper.Value<EstadoCivil?>(cliente.EstadoCivil); + val3.NumeroHabilitacao = ((cliente != null) ? cliente.Habilitacao : null) ?? string.Empty; + val3.Id = ((cliente != null) ? ((DomainBase)cliente).Id : 0); + val2.Segurado = val3; + object endereco2; + if (patrimonial != null) + { + EnderecoEmpresa val6 = new EnderecoEmpresa(); + Patrimonial obj27 = patrimonial; + val6.Cep = ((obj27 != null) ? ((EnderecoBase)obj27).Cep : null); + Patrimonial obj28 = patrimonial; + val6.Cidade = ((obj28 != null) ? ((EnderecoBase)obj28).Cidade : null); + Patrimonial obj29 = patrimonial; + val6.Estado = ((obj29 != null) ? ((EnderecoBase)obj29).Estado : null); + Patrimonial obj30 = patrimonial; + val6.Numero = ((obj30 != null) ? ((EnderecoBase)obj30).Numero : null); + Patrimonial obj31 = patrimonial; + val6.Logradouro = ((obj31 != null) ? ((EnderecoBase)obj31).Endereco : null); + Patrimonial obj32 = patrimonial; + val6.Complemento = ((obj32 != null) ? ((EnderecoBase)obj32).Complemento : null); + Patrimonial obj33 = patrimonial; + val6.Bairro = ((obj33 != null) ? ((EnderecoBase)obj33).Bairro : null); + endereco2 = (object)val6; + } + else + { + endereco2 = null; + } + val2.Endereco = (EnderecoEmpresa)endereco2; + Seguro val7 = new Seguro + { + Comissao = doc.Comissao, + Agenciamento = 0m, + ComissaoSeguradora = new List<ComissaoSeguradora>() + }; + val7.VigenciaInicial = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val7.VigenciaFinal = ((doc != null) ? doc.Vigencia2.Value.AddYears(1) : DateTime.MinValue); + val7.VigenciaFinalAnterior = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val7.TipoSeguro = doc.Situacao.ConvertTipoSeguroCalculo(); + val7.Banco = null; + val7.Bonus = null; + val7.SeguradoraAnterior = ((doc != null) ? doc.Controle.Seguradora.Nome : null); + val7.CodigoIdentificacao = ""; + val7.NumeroApoliceAnterior = ((doc != null) ? doc.Apolice : null); + val7.Sinistros = ((item != null) ? item.Sinistrado.BoolToString() : null); + val7.RenovacaoGarantida = false; + val7.Observacoes = doc.Observacao; + val7.Id = ((DomainBase)doc).Id; + val2.Seguro = val7; + QuestionarioEmpresa val8 = new QuestionarioEmpresa(); + val8.Atividade = ((perfilPrincipal != null) ? perfilPrincipal.AtividadePrincipal : null) ?? ""; + object obj34; + if (perfilPrincipal == null) + { + obj34 = null; + } + else + { + TipoConstrucao? tipoConstrucao = perfilPrincipal.TipoConstrucao; + obj34 = (tipoConstrucao.HasValue ? EnumHelper.Value<TipoConstrucao>(tipoConstrucao.GetValueOrDefault()) : null); + } + if (obj34 == null) + { + obj34 = ""; + } + val8.TipoConstrucao = (string)obj34; + object obj35; + if (perfilPrincipal == null) + { + obj35 = null; + } + else + { + Localizacao? localizacao = perfilPrincipal.Localizacao; + obj35 = (localizacao.HasValue ? EnumHelper.Value<Localizacao>(localizacao.GetValueOrDefault()) : null); + } + if (obj35 == null) + { + obj35 = ""; + } + val8.Localizacao = (string)obj35; + val8.EquipamentoSeguranca = ((perfilPrincipal != null) ? perfilPrincipal.EquipamentoSeguranca : null) ?? ""; + val8.EquipamentoIncendio = ((perfilPrincipal != null) ? perfilPrincipal.EquipamentoIncendio : null) ?? ""; + object obj36; + if (perfilPrincipal == null) + { + obj36 = null; + } + else + { + TipoPavimentacao? tipoPavimento = perfilPrincipal.TipoPavimento; + obj36 = (tipoPavimento.HasValue ? EnumHelper.Value<TipoPavimentacao>(tipoPavimento.GetValueOrDefault()) : null); + } + if (obj36 == null) + { + obj36 = ""; + } + val8.Pavimento = (string)obj36; + val8.AnoConstrucao = ((perfilPrincipal != null) ? perfilPrincipal.AnoConstrucao : null) ?? DateTime.MinValue; + val8.Isopainel = ((perfilPrincipal == null) ? null : perfilPrincipal.Isopainel?.BoolToString()) ?? ""; + val8.EstruturaMetal = ""; + val8.TerrenoBaldio = ((perfilPrincipal == null) ? null : perfilPrincipal.DivisaTerrenoBaldio?.BoolToString()) ?? ""; + val8.ImovelTombado = ""; + val8.Deposito = ((perfilPrincipal == null) ? null : perfilPrincipal.ExclusivoDeposito?.BoolToString()) ?? ""; + val8.CaixaEletronico = ((perfilPrincipal == null) ? null : perfilPrincipal.CaixasEletronicos?.BoolToString()) ?? ""; + val8.Construcao = ((perfilPrincipal == null) ? null : perfilPrincipal.ConstrucaoReforma?.BoolToString()) ?? ""; + val8.Id = 0; + val2.Questionario = val8; + val2.Cobertura = new CoberturaEmpresa + { + Basica = value, + DanoEletrico = value2, + Vidro = value5, + RouboFurto = value3, + RouboValor = default(decimal), + Equipamento = value7, + Vendaval = value4, + ImpactoVeiculo = value10, + Desmoronamento = value11, + Anuncio = value12, + Aluguel = value8, + TumultoGreve = value6, + RecomposicaoDocumento = value9, + ResponsabilidadeCivil = value13, + DanoMoral = default(decimal), + DespesaFixa = default(decimal), + LucroCessante = default(decimal), + Empregador = default(decimal), + Vazamento = default(decimal), + Sprinkler = default(decimal), + Fidelidade = default(decimal), + Assistencia = "", + Verba = "", + ValorNovo = "", + Alagamento = default(decimal), + PlacasSolares = default(decimal), + ResponsabilidadeCivilGaragista = default(decimal), + ContaminacaoDeterioracao = default(decimal) + }; + val.Empresa = val2; + return val; + } + + private async Task<Calculo> CondominioCalculo(Documento doc) + { + Cliente cliente = await BuscaClienteCompleto(((DomainBase)doc.Controle.Cliente).Id); + ObservableCollection<ClienteEmail> emails = cliente.Emails; + object obj; + if (emails == null) + { + obj = null; + } + else + { + ClienteEmail? obj2 = emails.FirstOrDefault(); + obj = ((obj2 != null) ? ((EmailBase)obj2).Email : null); + } + if (obj == null) + { + obj = string.Empty; + } + string email = (string)obj; + ClienteTelefone fone = cliente.Telefones?.FirstOrDefault() ?? null; + ClienteEndereco endereco = cliente.Enderecos?.FirstOrDefault() ?? null; + string s = (((cliente != null) ? cliente.PrimeiraHabilitacao : null) ?? DateTime.MinValue).ConvertTempoHabilitacaoCalculo(); + TempoHabilitacao tempoHabilitacao = Funcoes.ConvertTempoHabilitacao(int.Parse(s)); + Item? obj3 = doc.ItensAtivo.FirstOrDefault(); + Item item = ((((obj3 != null) ? ((DomainBase)obj3).Id : 0) != 0L) ? (await new ItemServico().BuscarItems(((DomainBase)doc).Id, (StatusItem)2)).ToList() : null)?.FirstOrDefault(); + Patrimonial patrimonial = new Patrimonial(); + decimal value = default(decimal); + decimal value2 = default(decimal); + decimal value3 = default(decimal); + decimal value4 = default(decimal); + decimal value5 = default(decimal); + decimal value6 = default(decimal); + decimal value7 = default(decimal); + decimal value8 = default(decimal); + decimal value9 = default(decimal); + decimal value10 = default(decimal); + decimal value11 = default(decimal); + decimal value12 = default(decimal); + decimal value13 = default(decimal); + decimal value14 = default(decimal); + decimal value15 = default(decimal); + decimal value16 = default(decimal); + decimal value17 = default(decimal); + decimal value18 = default(decimal); + decimal value19 = default(decimal); + decimal value20 = default(decimal); + decimal value21 = default(decimal); + decimal value22 = default(decimal); + if (item != null) + { + patrimonial = item.Patrimonial; + List<Cobertura> source = (await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item).Id)).ToList(); + source = source.Where((Cobertura cobertura) => cobertura.CoberturaPadrao != null).ToList(); + Cobertura? obj4 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 64)); + decimal obj6; + if (obj4 == null) + { + Cobertura? obj5 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 245)); + obj6 = ((obj5 != null) ? obj5.Lmi : 0m); + } + else + { + obj6 = obj4.Lmi; + } + value = obj6; + Cobertura? obj7 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 65)); + value2 = ((obj7 != null) ? obj7.Lmi : 0m); + Cobertura? obj8 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 374)); + decimal obj12; + if (obj8 == null) + { + Cobertura? obj9 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1017)); + if (obj9 == null) + { + Cobertura? obj10 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1066)); + if (obj10 == null) + { + Cobertura? obj11 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1074)); + obj12 = ((obj11 != null) ? obj11.Lmi : 0m); + } + else + { + obj12 = obj10.Lmi; + } + } + else + { + obj12 = obj9.Lmi; + } + } + else + { + obj12 = obj8.Lmi; + } + value3 = obj12; + Cobertura? obj13 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 152)); + value4 = ((obj13 != null) ? obj13.Lmi : 0m); + Cobertura? obj14 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 69)); + decimal obj17; + if (obj14 == null) + { + Cobertura? obj15 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 601)); + if (obj15 == null) + { + Cobertura? obj16 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 709)); + obj17 = ((obj16 != null) ? obj16.Lmi : 0m); + } + else + { + obj17 = obj15.Lmi; + } + } + else + { + obj17 = obj14.Lmi; + } + value5 = obj17; + Cobertura? obj18 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 66)); + decimal obj21; + if (obj18 == null) + { + Cobertura? obj19 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 710)); + if (obj19 == null) + { + Cobertura? obj20 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1091)); + obj21 = ((obj20 != null) ? obj20.Lmi : 0m); + } + else + { + obj21 = obj19.Lmi; + } + } + else + { + obj21 = obj18.Lmi; + } + value6 = obj21; + Cobertura? obj22 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 477)); + decimal obj24; + if (obj22 == null) + { + Cobertura? obj23 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 710)); + obj24 = ((obj23 != null) ? obj23.Lmi : 0m); + } + else + { + obj24 = obj22.Lmi; + } + value7 = obj24; + Cobertura? obj25 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 295)); + decimal obj28; + if (obj25 == null) + { + Cobertura? obj26 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 788)); + if (obj26 == null) + { + Cobertura? obj27 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1062)); + obj28 = ((obj27 != null) ? obj27.Lmi : 0m); + } + else + { + obj28 = obj26.Lmi; + } + } + else + { + obj28 = obj25.Lmi; + } + value8 = obj28; + Cobertura? obj29 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1063)); + decimal obj31; + if (obj29 == null) + { + Cobertura? obj30 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1624)); + obj31 = ((obj30 != null) ? obj30.Lmi : 0m); + } + else + { + obj31 = obj29.Lmi; + } + value9 = obj31; + Cobertura? obj32 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 71)); + value10 = ((obj32 != null) ? obj32.Lmi : 0m); + Cobertura? obj33 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 375)); + value11 = ((obj33 != null) ? obj33.Lmi : 0m); + Cobertura? obj34 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 417)); + decimal obj36; + if (obj34 == null) + { + Cobertura? obj35 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1625)); + obj36 = ((obj35 != null) ? obj35.Lmi : 0m); + } + else + { + obj36 = obj34.Lmi; + } + value12 = obj36; + Cobertura? obj37 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 223)); + decimal obj42; + if (obj37 == null) + { + Cobertura? obj38 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 282)); + if (obj38 == null) + { + Cobertura? obj39 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1070)); + if (obj39 == null) + { + Cobertura? obj40 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1085)); + if (obj40 == null) + { + Cobertura? obj41 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1626)); + obj42 = ((obj41 != null) ? obj41.Lmi : 0m); + } + else + { + obj42 = obj40.Lmi; + } + } + else + { + obj42 = obj39.Lmi; + } + } + else + { + obj42 = obj38.Lmi; + } + } + else + { + obj42 = obj37.Lmi; + } + value13 = obj42; + Cobertura? obj43 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 222)); + decimal obj49; + if (obj43 == null) + { + Cobertura? obj44 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 282)); + if (obj44 == null) + { + Cobertura? obj45 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1046)); + if (obj45 == null) + { + Cobertura? obj46 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1070)); + if (obj46 == null) + { + Cobertura? obj47 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1085)); + if (obj47 == null) + { + Cobertura? obj48 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1627)); + obj49 = ((obj48 != null) ? obj48.Lmi : 0m); + } + else + { + obj49 = obj47.Lmi; + } + } + else + { + obj49 = obj46.Lmi; + } + } + else + { + obj49 = obj45.Lmi; + } + } + else + { + obj49 = obj44.Lmi; + } + } + else + { + obj49 = obj43.Lmi; + } + value14 = obj49; + Cobertura? obj50 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 474)); + value15 = ((obj50 != null) ? obj50.Lmi : 0m); + Cobertura? obj51 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 70)); + decimal obj55; + if (obj51 == null) + { + Cobertura? obj52 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1047)); + if (obj52 == null) + { + Cobertura? obj53 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1075)); + if (obj53 == null) + { + Cobertura? obj54 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1554)); + obj55 = ((obj54 != null) ? obj54.Lmi : 0m); + } + else + { + obj55 = obj53.Lmi; + } + } + else + { + obj55 = obj52.Lmi; + } + } + else + { + obj55 = obj51.Lmi; + } + value16 = obj55; + Cobertura? obj56 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1065)); + decimal obj59; + if (obj56 == null) + { + Cobertura? obj57 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1071)); + if (obj57 == null) + { + Cobertura? obj58 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1429)); + obj59 = ((obj58 != null) ? obj58.Lmi : 0m); + } + else + { + obj59 = obj57.Lmi; + } + } + else + { + obj59 = obj56.Lmi; + } + value17 = obj59; + Cobertura? obj60 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 601)); + decimal obj62; + if (obj60 == null) + { + Cobertura? obj61 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 709)); + obj62 = ((obj61 != null) ? obj61.Lmi : 0m); + } + else + { + obj62 = obj60.Lmi; + } + value18 = obj62; + Cobertura? obj63 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 86)); + decimal obj66; + if (obj63 == null) + { + Cobertura? obj64 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1108)); + if (obj64 == null) + { + Cobertura? obj65 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1628)); + obj66 = ((obj65 != null) ? obj65.Lmi : 0m); + } + else + { + obj66 = obj64.Lmi; + } + } + else + { + obj66 = obj63.Lmi; + } + value19 = obj66; + Cobertura? obj67 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 67)); + value20 = ((obj67 != null) ? obj67.Lmi : 0m); + Cobertura? obj68 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1064)); + decimal obj70; + if (obj68 == null) + { + Cobertura? obj69 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1071)); + obj70 = ((obj69 != null) ? obj69.Lmi : 0m); + } + else + { + obj70 = obj68.Lmi; + } + value21 = obj70; + Cobertura? obj71 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 526)); + decimal obj73; + if (obj71 == null) + { + Cobertura? obj72 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1073)); + obj73 = ((obj72 != null) ? obj72.Lmi : 0m); + } + else + { + obj73 = obj71.Lmi; + } + value22 = obj73; + } + Calculo val = new Calculo(); + CalculoCondominio val2 = new CalculoCondominio(); + Segurado val3 = new Segurado + { + Email = email + }; + Telefone val4 = new Telefone(); + val4.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val4.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val4.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneResidencial = val4; + Telefone val5 = new Telefone(); + val5.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val5.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val5.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneCelular = val5; + val3.Cep = ((endereco != null) ? ((EnderecoBase)endereco).Cep : null); + val3.RelacaoSeguradoCondutor = null; + val3.Uf = ((endereco != null) ? ((EnderecoBase)endereco).Estado : null) ?? null; + val3.NomeCompleto = cliente.Nome; + val3.CpfCnpj = cliente.Documento; + val3.DataNascimento = cliente.Nascimento; + val3.Sexo = ((cliente != null) ? EnumHelper.Value<Sexo?>(cliente.Sexo) : null); + val3.DataHabilitacao = cliente.PrimeiraHabilitacao; + val3.TempoHabilitacao = EnumHelper.Value<TempoHabilitacao>(tempoHabilitacao); + val3.EstadoCivil = EnumHelper.Value<EstadoCivil?>(cliente.EstadoCivil); + val3.NumeroHabilitacao = ((cliente != null) ? cliente.Habilitacao : null) ?? string.Empty; + val3.Id = ((cliente != null) ? ((DomainBase)cliente).Id : 0); + val2.Segurado = val3; + object endereco2; + if (patrimonial != null) + { + EnderecoEmpresa val6 = new EnderecoEmpresa(); + Patrimonial obj74 = patrimonial; + val6.Cep = ((obj74 != null) ? ((EnderecoBase)obj74).Cep : null); + Patrimonial obj75 = patrimonial; + val6.Cidade = ((obj75 != null) ? ((EnderecoBase)obj75).Cidade : null); + Patrimonial obj76 = patrimonial; + val6.Estado = ((obj76 != null) ? ((EnderecoBase)obj76).Estado : null); + Patrimonial obj77 = patrimonial; + val6.Numero = ((obj77 != null) ? ((EnderecoBase)obj77).Numero : null); + Patrimonial obj78 = patrimonial; + val6.Logradouro = ((obj78 != null) ? ((EnderecoBase)obj78).Endereco : null); + Patrimonial obj79 = patrimonial; + val6.Complemento = ((obj79 != null) ? ((EnderecoBase)obj79).Complemento : null); + Patrimonial obj80 = patrimonial; + val6.Bairro = ((obj80 != null) ? ((EnderecoBase)obj80).Bairro : null); + endereco2 = (object)val6; + } + else + { + endereco2 = null; + } + val2.Endereco = (EnderecoEmpresa)endereco2; + Seguro val7 = new Seguro + { + Comissao = doc.Comissao, + Agenciamento = 0m, + ComissaoSeguradora = new List<ComissaoSeguradora>() + }; + val7.VigenciaInicial = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val7.VigenciaFinal = ((doc != null) ? doc.Vigencia2.Value.AddYears(1) : DateTime.MinValue); + val7.VigenciaFinalAnterior = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val7.TipoSeguro = doc.Situacao.ConvertTipoSeguroCalculo(); + val7.Banco = null; + val7.Bonus = null; + val7.SeguradoraAnterior = ((doc != null) ? doc.Controle.Seguradora.Nome : null); + val7.CodigoIdentificacao = ""; + val7.NumeroApoliceAnterior = ((doc != null) ? doc.Apolice : null); + val7.Sinistros = ((item != null) ? item.Sinistrado.BoolToString() : null); + val7.RenovacaoGarantida = false; + val7.Observacoes = doc.Observacao; + val7.Id = ((DomainBase)doc).Id; + val2.Seguro = val7; + val2.Questionario = new QuestionarioCondominio + { + Ocupacao = "", + Estrutura = "", + AreaComercial = "", + ImovelTombado = "", + AreaConstruida = "", + AnoConstrucao = "", + Funcionarios = "", + Blocos = "", + Elevadores = "", + Pavimentos = "", + EquipamentoSeguranca = "", + EquipamentoIncendio = "", + Desmoronamento = "", + Id = 0 + }; + val2.Cobertura = new CoberturaCondominio + { + Basica = value, + DanosEletricos = value2, + DanosMorais = value3, + TumultoGreve = value4, + RouboBens = value5, + Vidros = value6, + Anuncios = value7, + Portoes = value8, + Alagamento = value9, + Desmoronamento = value10, + ImpactoVeiculo = value11, + DespesasFixas = value12, + Sindico = value13, + Condominio = value14, + Garagista = value15, + GaragistaExclusiva = default(decimal), + Vendaval = value16, + Vazamento = value17, + IncendioBens = default(decimal), + RouboCondominio = value18, + VidaFuncionario = value19, + Aluguel = value20, + Chuveiro = value21, + Empregador = value22, + Equipamento = default(decimal), + Assistencia = "", + ValorNovo = "", + PlacasSolares = default(decimal) + }; + val.Condominio = val2; + return val; + } + + private async Task<Calculo> VidaIndividualCalculo(Documento doc) + { + Cliente cliente = await BuscaClienteCompleto(((DomainBase)doc.Controle.Cliente).Id); + ObservableCollection<ClienteEmail> emails = cliente.Emails; + object obj; + if (emails == null) + { + obj = null; + } + else + { + ClienteEmail? obj2 = emails.FirstOrDefault(); + obj = ((obj2 != null) ? ((EmailBase)obj2).Email : null); + } + if (obj == null) + { + obj = string.Empty; + } + string email = (string)obj; + ClienteTelefone fone = cliente.Telefones?.FirstOrDefault() ?? null; + ClienteEndereco endereco = cliente.Enderecos?.FirstOrDefault() ?? null; + string s = (((cliente != null) ? cliente.PrimeiraHabilitacao : null) ?? DateTime.MinValue).ConvertTempoHabilitacaoCalculo(); + TempoHabilitacao tempoHabilitacao = Funcoes.ConvertTempoHabilitacao(int.Parse(s)); + Item? obj3 = doc.ItensAtivo.FirstOrDefault(); + Item item = ((((obj3 != null) ? ((DomainBase)obj3).Id : 0) != 0L) ? (await new ItemServico().BuscarItems(((DomainBase)doc).Id, (StatusItem)2)).ToList() : null)?.FirstOrDefault(); + Patrimonial vidaIndividual = new Patrimonial(); + decimal value = default(decimal); + decimal num = default(decimal); + decimal num2 = default(decimal); + decimal num3 = default(decimal); + decimal num4 = default(decimal); + decimal num5 = default(decimal); + decimal num6 = default(decimal); + decimal num7 = default(decimal); + decimal num8 = default(decimal); + if (item != null) + { + vidaIndividual = item.Patrimonial; + List<Cobertura> source = (await new ItemServico().BuscarCoberturasPorItemAsync(((DomainBase)item).Id)).ToList(); + source = source.Where((Cobertura cobertura) => cobertura.CoberturaPadrao != null).ToList(); + Cobertura? obj4 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1535)); + value = ((obj4 != null) ? obj4.Lmi : 0m); + Cobertura? obj5 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 56)); + num = ((obj5 != null) ? obj5.Lmi : 0m); + Cobertura? obj6 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 57)); + num2 = ((obj6 != null) ? obj6.Lmi : 0m); + Cobertura? obj7 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 58)); + num3 = ((obj7 != null) ? obj7.Lmi : 0m); + Cobertura? obj8 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 193)); + num4 = ((obj8 != null) ? obj8.Lmi : 0m); + Cobertura? obj9 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 62)); + decimal obj12; + if (obj9 == null) + { + Cobertura? obj10 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1069)); + if (obj10 == null) + { + Cobertura? obj11 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1647)); + obj12 = ((obj11 != null) ? obj11.Lmi : 0m); + } + else + { + obj12 = obj10.Lmi; + } + } + else + { + obj12 = obj9.Lmi; + } + num5 = obj12; + Cobertura? obj13 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 189)); + num6 = ((obj13 != null) ? obj13.Lmi : 0m); + Cobertura? obj14 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 59)); + decimal obj19; + if (obj14 == null) + { + Cobertura? obj15 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 463)); + if (obj15 == null) + { + Cobertura? obj16 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 464)); + if (obj16 == null) + { + Cobertura? obj17 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1170)); + if (obj17 == null) + { + Cobertura? obj18 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 1200)); + obj19 = ((obj18 != null) ? obj18.Lmi : 0m); + } + else + { + obj19 = obj17.Lmi; + } + } + else + { + obj19 = obj16.Lmi; + } + } + else + { + obj19 = obj15.Lmi; + } + } + else + { + obj19 = obj14.Lmi; + } + num7 = obj19; + Cobertura? obj20 = ((IEnumerable<Cobertura>)source).FirstOrDefault((Func<Cobertura, bool>)((Cobertura x) => ((DomainBase)x.CoberturaPadrao).Id == 63)); + num8 = ((obj20 != null) ? obj20.Lmi : 0m); + } + Calculo val = new Calculo(); + CalculoVidaIndividual val2 = new CalculoVidaIndividual(); + Segurado val3 = new Segurado + { + Email = email + }; + Telefone val4 = new Telefone(); + val4.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val4.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val4.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneResidencial = val4; + Telefone val5 = new Telefone(); + val5.Ddd = ((fone != null) ? ((TelefoneBase)fone).Prefixo : null) ?? string.Empty; + val5.Numero = ((fone != null) ? ((TelefoneBase)fone).Numero : null) ?? string.Empty; + val5.Id = ((fone != null) ? ((DomainBase)fone).Id : 0); + val3.TelefoneCelular = val5; + val3.Cep = ((endereco != null) ? ((EnderecoBase)endereco).Cep : null); + val3.RelacaoSeguradoCondutor = null; + val3.Uf = ((endereco != null) ? ((EnderecoBase)endereco).Estado : null) ?? null; + val3.NomeCompleto = cliente.Nome; + val3.CpfCnpj = cliente.Documento; + val3.DataNascimento = cliente.Nascimento; + val3.Sexo = ((cliente != null) ? EnumHelper.Value<Sexo?>(cliente.Sexo) : null); + val3.DataHabilitacao = cliente.PrimeiraHabilitacao; + val3.TempoHabilitacao = EnumHelper.Value<TempoHabilitacao>(tempoHabilitacao); + val3.EstadoCivil = EnumHelper.Value<EstadoCivil?>(cliente.EstadoCivil); + val3.NumeroHabilitacao = ((cliente != null) ? cliente.Habilitacao : null) ?? string.Empty; + val3.Id = ((cliente != null) ? ((DomainBase)cliente).Id : 0); + val2.Segurado = val3; + object endereco2; + if (vidaIndividual != null) + { + EnderecoEmpresa val6 = new EnderecoEmpresa(); + Patrimonial obj21 = vidaIndividual; + val6.Cep = ((obj21 != null) ? ((EnderecoBase)obj21).Cep : null); + Patrimonial obj22 = vidaIndividual; + val6.Cidade = ((obj22 != null) ? ((EnderecoBase)obj22).Cidade : null); + Patrimonial obj23 = vidaIndividual; + val6.Estado = ((obj23 != null) ? ((EnderecoBase)obj23).Estado : null); + Patrimonial obj24 = vidaIndividual; + val6.Numero = ((obj24 != null) ? ((EnderecoBase)obj24).Numero : null); + Patrimonial obj25 = vidaIndividual; + val6.Logradouro = ((obj25 != null) ? ((EnderecoBase)obj25).Endereco : null); + Patrimonial obj26 = vidaIndividual; + val6.Complemento = ((obj26 != null) ? ((EnderecoBase)obj26).Complemento : null); + Patrimonial obj27 = vidaIndividual; + val6.Bairro = ((obj27 != null) ? ((EnderecoBase)obj27).Bairro : null); + endereco2 = (object)val6; + } + else + { + endereco2 = null; + } + val2.Endereco = (EnderecoEmpresa)endereco2; + Seguro val7 = new Seguro + { + Comissao = doc.Comissao, + Agenciamento = 0m, + ComissaoSeguradora = new List<ComissaoSeguradora>() + }; + val7.VigenciaInicial = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val7.VigenciaFinal = ((doc != null) ? doc.Vigencia2.Value.AddYears(1) : DateTime.MinValue); + val7.VigenciaFinalAnterior = ((doc != null) ? doc.Vigencia2 : null) ?? DateTime.MinValue; + val7.TipoSeguro = doc.Situacao.ConvertTipoSeguroCalculo(); + val7.Banco = null; + val7.Bonus = null; + val7.SeguradoraAnterior = ((doc != null) ? doc.Controle.Seguradora.Nome : null); + val7.CodigoIdentificacao = ""; + val7.NumeroApoliceAnterior = ((doc != null) ? doc.Apolice : null); + val7.Sinistros = ((item != null) ? item.Sinistrado.BoolToString() : null); + val7.RenovacaoGarantida = false; + val7.Observacoes = doc.Observacao; + val7.Id = ((DomainBase)doc).Id; + val2.Seguro = val7; + val2.Questionario = new QuestionarioVidaIndividual + { + Peso = 0, + Altura = 0f, + RendaMensal = default(decimal), + Fumante = "", + Esporte = "", + Aposentado = "", + Profissoes = null, + Profissao = null + }; + val2.Cobertura = new CoberturaVidaIndividual + { + Capital = value, + CapitalDoenca = default(decimal), + CapitalDit = default(decimal), + CapitalDih = 0m, + Morte = num.ToString(), + MorteAcidental = num2.ToString(), + Ipa = num3.ToString(), + Ifpd = num4.ToString(), + AssistenciaFuneral = num7.ToString(), + CapitalIpa = default(decimal), + CapitalIfpd = default(decimal), + CapitalMorteAcidental = default(decimal), + DoencaGrave = num5.ToString(), + Dit = num6.ToString(), + Dih = num8.ToString() + }; + val.Vida = val2; + return val; + } + + private async Task<Calculo> VidaGlobalCalculo(Documento doc) + { + Cliente obj = await BuscaClienteCompleto(((DomainBase)doc.Controle.Cliente).Id); + ObservableCollection<ClienteEmail> emails = obj.Emails; + object obj2; + if (emails == null) + { + obj2 = null; + } + else + { + ClienteEmail? obj3 = emails.FirstOrDefault(); + obj2 = ((obj3 != null) ? ((EmailBase)obj3).Email : null); + } + if (obj2 == null) + { + _ = string.Empty; + } + obj.Telefones?.FirstOrDefault(); + obj.Enderecos?.FirstOrDefault(); + Funcoes.ConvertTempoHabilitacao(int.Parse((((obj != null) ? obj.PrimeiraHabilitacao : null) ?? DateTime.MinValue).ConvertTempoHabilitacaoCalculo())); + return new Calculo(); + } + + private async Task Iniciar(bool trazerParaFrente = false) + { + if (!"Aggilizador.Application".ProgramaEmExecucao()) + { + Gestor.Application.Actions.Actions.IniciarAggilizador?.Invoke(); + await Task.Delay(8000); + } + if (trazerParaFrente) + { + "Aggilizador.Application".BringToFront(); + } + } + + private unsafe async void IniciarPipe(dynamic message) + { + dynamic awaiter = CallPipe(message).GetAwaiter(); + if (!(bool)awaiter.IsCompleted) + { + ICriticalNotifyCompletion awaiter2 = awaiter as ICriticalNotifyCompletion; + AsyncVoidMethodBuilder asyncVoidMethodBuilder = default(AsyncVoidMethodBuilder); + if (awaiter2 == null) + { + INotifyCompletion awaiter3 = (INotifyCompletion)(object)awaiter; + asyncVoidMethodBuilder.AwaitOnCompleted(ref awaiter3, ref *(_003CIniciarPipe_003Ed__29*)/*Error near IL_017c: stateMachine*/); + } + else + { + asyncVoidMethodBuilder.AwaitUnsafeOnCompleted(ref awaiter2, ref *(_003CIniciarPipe_003Ed__29*)/*Error near IL_018f: stateMachine*/); + } + /*Error near IL_0198: leave MoveNext - await not detected correctly*/; + } + dynamic result = awaiter.GetResult(); + if (!(result ? true : false)) + { + await new DashboardViewModel().ShowMessage(MessageAggilizador); + } + } + + private async void Prospectar() + { + if (ClienteId != null && RamoId != null) + { + await Iniciar(trazerParaFrente: true); + dynamic val = new + { + ClientId = long.Parse(ClienteId.ToString()), + DocumentId = 0, + ControlId = 0, + ItemId = 0, + Branch = long.Parse(RamoId.ToString()) + }; + IniciarPipe(val); + } + } + + private async Task<bool> VerificarPermissao() + { + if (!Recursos.Usuario.PermissaoAggilizador.HasValue) + { + await new DashboardViewModel().ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR O AGGILIZADOR"); + return false; + } + if (LicenseHelper.Produtos.All((Licenca x) => (int)x.Produto != 79 && (int)x.Produto != 81 && (int)x.Produto != 91)) + { + await new DashboardViewModel().ShowMessage("VOCÊ AINDA NÃO POSSUI AGGILIZADOR DE CÁLCULOS, ENTRE EM CONTATO COM comercial@agger.com.br PARA SABER MAIS"); + return false; + } + return true; + } + + private async void VisualizarCalculos_OnClick(object sender, RoutedEventArgs e) + { + if (await VerificarPermissao() && !string.IsNullOrEmpty(Documento)) + { + Documento val = await new ApoliceServico().BuscarApoliceAsync(long.Parse(DocumentoId.ToString()), itens: true); + string chassi = null; + if (RamoId != null && long.Parse(RamoId.ToString()) == 5) + { + string text = ((val.ItensAtivo == null || val.ItensAtivo.Count <= 0) ? null : (await new AutoServico().BuscarChassi(((DomainBase)val.ItensAtivo.First()).Id))); + chassi = text; + } + await Iniciar(); + dynamic val2 = new + { + CpfCnpj = Documento.Clear() + }; + if (RamoId != null) + { + val2 = new + { + CpfCnpj = Documento.Clear(), + Branch = long.Parse(RamoId.ToString()) + }; + } + if (chassi != null && RamoId != null) + { + val2 = new + { + CpfCnpj = Documento.Clear(), + Branch = long.Parse(RamoId.ToString()), + Chassi = chassi + }; + } + IniciarPipe(val2); + } + } + + private async Task<bool> CallPipe(dynamic message) + { + int tries = 7; + PipeClient pipe = new PipeClient("AggilizadorPIPE"); + dynamic val = pipe.Send(message); + while (!val && tries > 0) + { + await Task.Delay(2000); + val = pipe.Send(message); + tries--; + } + return val; + } + + private void DropContextMenu_OnClick(object sender, RoutedEventArgs e) + { + if (string.IsNullOrEmpty(Documento)) + { + Calcular_OnClick(sender, e); + return; + } + Button val = (Button)((sender is Button) ? sender : null); + ContextMenu contextMenu = ((FrameworkElement)val).ContextMenu; + contextMenu.PlacementTarget = (UIElement)(object)val; + contextMenu.Placement = (PlacementMode)10; + contextMenu.IsOpen = true; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/calculocontrol.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_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LayoutRoot = (Grid)target; + break; + case 2: + CalculoButton = (Button)target; + ((ButtonBase)CalculoButton).Click += new RoutedEventHandler(DropContextMenu_OnClick); + break; + case 3: + ((MenuItem)target).Click += new RoutedEventHandler(Calcular_OnClick); + break; + case 4: + ((MenuItem)target).Click += new RoutedEventHandler(VisualizarCalculos_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CoberturaView.cs b/Decompiler/Gestor.Application.Componentes/CoberturaView.cs new file mode 100644 index 0000000..3ab59c9 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CoberturaView.cs @@ -0,0 +1,128 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.ViewModels; +using Gestor.Application.Views.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class CoberturaView : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal DataGrid CoberturaGrid; + + private bool _contentLoaded; + + public CoberturaViewModel ViewModel { get; set; } + + public CoberturaView(CoberturaViewModel viewModel) + { + ViewModel = viewModel ?? new CoberturaViewModel(); + InitializeComponent(); + ((FrameworkElement)CoberturaGrid).DataContext = ViewModel; + } + + private void ExcluirCobertura_OnClick(object sender, RoutedEventArgs e) + { + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + DataGrid coberturaGrid = CoberturaGrid; + if (coberturaGrid == null || ((Selector)coberturaGrid).SelectedIndex >= 0) + { + CoberturaViewModel viewModel = ViewModel; + DataGrid coberturaGrid2 = CoberturaGrid; + viewModel.ExcluirCobertura((Cobertura)((coberturaGrid2 != null) ? ((ItemsControl)coberturaGrid2).Items[((Selector)CoberturaGrid).SelectedIndex] : null)); + } + } + + private void AdicionaCobertura_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdicionaCobertura(); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (!ViewModel.IsEnabled || e.Parameter.Trim().Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarCobertura(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<CoberturaPadrao>> 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()); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/coberturaview.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_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: 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 + switch (connectionId) + { + case 1: + ((MenuItem)target).Click += new RoutedEventHandler(AdicionaCobertura_OnClick); + break; + case 2: + CoberturaGrid = (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_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + switch (connectionId) + { + case 3: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirCobertura_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/ContasDialog.cs b/Decompiler/Gestor.Application.Componentes/ContasDialog.cs new file mode 100644 index 0000000..bca8893 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/ContasDialog.cs @@ -0,0 +1,72 @@ +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.Markup; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Model.Domain.Financeiro; + +namespace Gestor.Application.Componentes; + +public class ContasDialog : UserControl, IComponentConnector +{ + internal Button ImportarButton; + + internal Button CancelarButton; + + private bool _contentLoaded; + + private ContasDialogModel ViewModel { get; set; } + + public ContasDialog(List<BancosContas> contas) + { + ViewModel = new ContasDialogModel(contas); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/contasdialog.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_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ImportarButton = (Button)target; + break; + case 2: + CancelarButton = (Button)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomIsReadOnlyControl.cs b/Decompiler/Gestor.Application.Componentes/CustomIsReadOnlyControl.cs new file mode 100644 index 0000000..b5a43b1 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomIsReadOnlyControl.cs @@ -0,0 +1,64 @@ +using System.Windows; + +namespace Gestor.Application.Componentes; + +public class CustomIsReadOnlyControl : CustomItemControl +{ + public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(CustomIsReadOnlyControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)false, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty HasValidationProperty = DependencyProperty.Register("HasValidation", typeof(bool), typeof(CustomIsReadOnlyControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)false, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(CustomIsReadOnlyControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)string.Empty, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty TextAlignmentProperty = DependencyProperty.Register("TextAlignment", typeof(TextAlignment), typeof(CustomIsReadOnlyControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)(TextAlignment)0, (FrameworkPropertyMetadataOptions)256)); + + public bool IsReadOnly + { + get + { + return (bool)((DependencyObject)this).GetValue(IsReadOnlyProperty); + } + set + { + ((DependencyObject)this).SetValue(IsReadOnlyProperty, (object)value); + } + } + + public bool HasValidation + { + get + { + return (bool)((DependencyObject)this).GetValue(HasValidationProperty); + } + set + { + ((DependencyObject)this).SetValue(HasValidationProperty, (object)value); + } + } + + public string Text + { + get + { + return (string)((DependencyObject)this).GetValue(TextProperty); + } + set + { + ((DependencyObject)this).SetValue(TextProperty, (object)value); + } + } + + public TextAlignment TextAlignment + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + return (TextAlignment)((DependencyObject)this).GetValue(TextAlignmentProperty); + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ((DependencyObject)this).SetValue(TextAlignmentProperty, (object)value); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomItemControl.cs b/Decompiler/Gestor.Application.Componentes/CustomItemControl.cs new file mode 100644 index 0000000..12adba1 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomItemControl.cs @@ -0,0 +1,39 @@ +using System.Windows; +using System.Windows.Controls; + +namespace Gestor.Application.Componentes; + +public class CustomItemControl : ItemsControl +{ + public static readonly DependencyProperty LabelProperty = DependencyProperty.Register("Label", typeof(string), typeof(CustomItemControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)string.Empty, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty LabelVisibilityProperty = DependencyProperty.Register("LabelVisibility", typeof(Visibility), typeof(CustomItemControl), (PropertyMetadata)new FrameworkPropertyMetadata((object)(Visibility)0, (FrameworkPropertyMetadataOptions)256)); + + public bool Entered { get; set; } + + public string Label + { + get + { + return (string)((DependencyObject)this).GetValue(LabelProperty); + } + set + { + ((DependencyObject)this).SetValue(LabelProperty, (object)value); + } + } + + public Visibility LabelVisibility + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + return (Visibility)((DependencyObject)this).GetValue(LabelVisibilityProperty); + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ((DependencyObject)this).SetValue(LabelVisibilityProperty, (object)value); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomItemValidation.cs b/Decompiler/Gestor.Application.Componentes/CustomItemValidation.cs new file mode 100644 index 0000000..be7b958 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomItemValidation.cs @@ -0,0 +1,5 @@ +namespace Gestor.Application.Componentes; + +public class CustomItemValidation : CustomItemControl +{ +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomLegendChart.cs b/Decompiler/Gestor.Application.Componentes/CustomLegendChart.cs new file mode 100644 index 0000000..5bf30bc --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomLegendChart.cs @@ -0,0 +1,133 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using System.Windows.Media; +using LiveCharts.Definitions.Series; +using LiveCharts.Wpf; +using LiveCharts.Wpf.Charts.Base; + +namespace Gestor.Application.Componentes; + +public class CustomLegendChart : UserControl, IChartLegend, INotifyPropertyChanged, IComponentConnector +{ + public static readonly DependencyProperty OrientationProperty = DependencyProperty.Register("Orientation", typeof(Orientation), typeof(CustomLegendChart), new PropertyMetadata((object)(Orientation)0)); + + internal ItemsControl itemsControl; + + private bool _contentLoaded; + + public Orientation Orientation + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + return (Orientation)((DependencyObject)this).GetValue(OrientationProperty); + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ((DependencyObject)this).SetValue(OrientationProperty, (object)value); + } + } + + public ObservableCollection<CustomSeriesViewModel> LegendEntries { get; } = new ObservableCollection<CustomSeriesViewModel>(); + + + public List<SeriesViewModel> Series + { + get + { + return LegendEntries.Select((CustomSeriesViewModel x) => x.SeriesViewModel).ToList(); + } + set + { + Chart ownerChart = GetOwnerChart(); + foreach (CustomSeriesViewModel item in LegendEntries.Where((CustomSeriesViewModel x) => !((IEnumerable<ISeriesView>)ownerChart.Series).Any((ISeriesView s) => s == x.View)).ToList()) + { + LegendEntries.Remove(item); + } + foreach (SeriesViewModel svm in value) + { + if (LegendEntries.All((CustomSeriesViewModel x) => x.Title != svm.Title)) + { + ISeriesView view = ((IEnumerable<ISeriesView>)ownerChart.Series).FirstOrDefault((Func<ISeriesView, bool>)((ISeriesView x) => x.Title == svm.Title)); + LegendEntries.Add(new CustomSeriesViewModel(svm, view)); + } + } + OnPropertyChanged("Series"); + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + public CustomLegendChart() + { + InitializeComponent(); + ((FrameworkElement)itemsControl).DataContext = this; + } + + private Chart GetOwnerChart() + { + return CustomLegendChart.FindParent<Chart>((DependencyObject)(object)this); + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = "") + { + if (this.PropertyChanged != null) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + public static T FindParent<T>(DependencyObject child) where T : DependencyObject + { + DependencyObject parent = VisualTreeHelper.GetParent(child); + if (parent == null) + { + return default(T); + } + T val = (T)(object)((parent is T) ? parent : null); + if (val != null) + { + return val; + } + return FindParent<T>(parent); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/customlegendchart.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_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Expected O, but got Unknown + if (connectionId == 1) + { + itemsControl = (ItemsControl)target; + } + else + { + _contentLoaded = true; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomPasswordBox.cs b/Decompiler/Gestor.Application.Componentes/CustomPasswordBox.cs new file mode 100644 index 0000000..39b5a0b --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomPasswordBox.cs @@ -0,0 +1,199 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes; + +public class CustomPasswordBox : UserControl, IComponentConnector +{ + public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(CustomPasswordBox), new PropertyMetadata((object)false, new PropertyChangedCallback(OnBoundIsReadOnlyChanged))); + + public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(CustomPasswordBox), new PropertyMetadata((object)string.Empty, new PropertyChangedCallback(OnBoundPasswordChanged))); + + public static readonly DependencyProperty PasswordViewProperty = DependencyProperty.Register("PasswordViewProperty", typeof(bool), typeof(CustomPasswordBox), new PropertyMetadata((object)false, new PropertyChangedCallback(OnBoundPasswordViewChanged))); + + private bool _typing; + + internal Grid LayoutRoot; + + internal TextBox TextRead; + + internal TextBox TextMask; + + internal PasswordBox PasswordBox; + + private bool _contentLoaded; + + public bool IsReadOnly + { + get + { + return (bool)((DependencyObject)this).GetValue(IsReadOnlyProperty); + } + set + { + ((DependencyObject)this).SetValue(IsReadOnlyProperty, (object)value); + } + } + + public string Text + { + get + { + return (string)((DependencyObject)this).GetValue(TextProperty); + } + set + { + ((DependencyObject)this).SetValue(TextProperty, (object)value); + } + } + + public bool PasswordView + { + get + { + return (bool)((DependencyObject)this).GetValue(PasswordViewProperty); + } + set + { + ((DependencyObject)this).SetValue(PasswordViewProperty, (object)value); + } + } + + private static void OnBoundIsReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomPasswordBox customPasswordBox = d as CustomPasswordBox; + if (d != null && customPasswordBox != null) + { + bool flag = (bool)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + ((UIElement)customPasswordBox.PasswordBox).Visibility = (Visibility)(flag ? 2 : 0); + ((UIElement)customPasswordBox.TextRead).Visibility = (Visibility)((!flag) ? 2 : 0); + ((UIElement)customPasswordBox.TextMask).Visibility = (Visibility)((!flag) ? 2 : 0); + } + } + + private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomPasswordBox customPasswordBox = d as CustomPasswordBox; + if (d != null && customPasswordBox != null) + { + string text = ((string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue) ?? ""; + if (!customPasswordBox._typing) + { + customPasswordBox.TextMask.Text = "".PadLeft(text.Length, '•'); + customPasswordBox.PasswordBox.Password = text; + } + } + } + + private static void OnBoundPasswordViewChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_007c: Unknown result type (might be due to invalid IL or missing references) + CustomPasswordBox customPasswordBox = d as CustomPasswordBox; + if (d != null && customPasswordBox != null) + { + bool flag = (bool)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + if (flag) + { + customPasswordBox.TextRead.Text = customPasswordBox.PasswordBox.Password; + } + else + { + customPasswordBox.PasswordBox.Password = customPasswordBox.TextRead.Text; + } + ((UIElement)customPasswordBox.PasswordBox).Visibility = (Visibility)(flag ? 2 : 0); + ((UIElement)customPasswordBox.TextRead).Visibility = (Visibility)((!flag) ? 2 : 0); + ((UIElement)customPasswordBox.TextMask).Visibility = ((UIElement)customPasswordBox.PasswordBox).Visibility; + } + } + + public CustomPasswordBox() + { + InitializeComponent(); + ((FrameworkElement)LayoutRoot).DataContext = this; + PasswordView = false; + } + + private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e) + { + _typing = true; + Text = PasswordBox.Password; + _typing = false; + TextMask.Text = "".PadLeft(PasswordBox.Password.Length, '•'); + } + + private void Eye_Click(object sender, RoutedEventArgs e) + { + if (!IsReadOnly) + { + PasswordView = !PasswordView; + } + } + + private void TextRead_PasswordChanged(object sender, TextChangedEventArgs e) + { + Text = TextRead.Text; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/custompasswordbox.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_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Expected O, but got Unknown + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Expected O, but got Unknown + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Expected O, but got Unknown + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Expected O, but got Unknown + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Expected O, but got Unknown + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LayoutRoot = (Grid)target; + break; + case 2: + TextRead = (TextBox)target; + ((TextBoxBase)TextRead).TextChanged += new TextChangedEventHandler(TextRead_PasswordChanged); + break; + case 3: + TextMask = (TextBox)target; + break; + case 4: + PasswordBox = (PasswordBox)target; + PasswordBox.PasswordChanged += new RoutedEventHandler(PasswordBox_PasswordChanged); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Eye_Click); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomSenhaLoginBox.cs b/Decompiler/Gestor.Application.Componentes/CustomSenhaLoginBox.cs new file mode 100644 index 0000000..90b1761 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomSenhaLoginBox.cs @@ -0,0 +1,343 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using System.Windows.Media; +using ControlzEx; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class CustomSenhaLoginBox : UserControl, IComponentConnector +{ + public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)string.Empty, new PropertyChangedCallback(OnBoundPasswordChanged))); + + public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)false, new PropertyChangedCallback(OnBoundIsReadOnlyChanged))); + + public static readonly DependencyProperty PlaceHolderProperty = DependencyProperty.Register("PlaceHolder", typeof(string), typeof(CustomSenhaLoginBox), (PropertyMetadata)new FrameworkPropertyMetadata((object)"SENHA", (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty BackgroundProperty = DependencyProperty.Register("Background", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnBackgroundChanged))); + + public static readonly DependencyProperty ForegroundProperty = DependencyProperty.Register("Foreground", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnForegroundChanged))); + + public static readonly DependencyProperty CaretBrushProperty = DependencyProperty.Register("CaretBrush", typeof(Brush), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnCaretBrushChanged))); + + public static readonly DependencyProperty FontFamilyProperty = DependencyProperty.Register("FontFamily", typeof(FontFamily), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnFontFamilyChanged))); + + public static readonly DependencyProperty FontSizeProperty = DependencyProperty.Register("FontSize", typeof(int), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)10, new PropertyChangedCallback(OnFontSizeChanged))); + + public static readonly DependencyProperty BorderThicknessProperty = DependencyProperty.Register("BorderThickness", typeof(Thickness), typeof(CustomSenhaLoginBox), new PropertyMetadata((object)new Thickness(1.0), new PropertyChangedCallback(OnBorderThicknessChanged))); + + internal Grid LayoutRoot; + + internal TextBox TextRead; + + internal PasswordBox PasswordBox; + + internal Button ButtonEye; + + private bool _contentLoaded; + + private static bool _typing { get; set; } + + public string Text + { + get + { + return (string)((DependencyObject)this).GetValue(TextProperty); + } + set + { + ((DependencyObject)this).SetValue(TextProperty, (object)value); + } + } + + public bool IsReadOnly + { + get + { + return (bool)((DependencyObject)this).GetValue(IsReadOnlyProperty); + } + set + { + ((DependencyObject)this).SetValue(IsReadOnlyProperty, (object)value); + } + } + + public string PlaceHolder + { + get + { + return (string)((DependencyObject)this).GetValue(PlaceHolderProperty); + } + set + { + ((DependencyObject)this).SetValue(PlaceHolderProperty, (object)value); + } + } + + public Brush Background + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + return (Brush)((DependencyObject)this).GetValue(BackgroundProperty); + } + set + { + ((DependencyObject)this).SetValue(BackgroundProperty, (object)value); + } + } + + public Brush Foreground + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + return (Brush)((DependencyObject)this).GetValue(ForegroundProperty); + } + set + { + ((DependencyObject)this).SetValue(ForegroundProperty, (object)value); + } + } + + public Brush CaretBrush + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + return (Brush)((DependencyObject)this).GetValue(CaretBrushProperty); + } + set + { + ((DependencyObject)this).SetValue(CaretBrushProperty, (object)value); + } + } + + public FontFamily FontFamily + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + return (FontFamily)((DependencyObject)this).GetValue(FontFamilyProperty); + } + set + { + ((DependencyObject)this).SetValue(FontFamilyProperty, (object)value); + } + } + + public int FontSize + { + get + { + return (int)((DependencyObject)this).GetValue(FontSizeProperty); + } + set + { + ((DependencyObject)this).SetValue(FontSizeProperty, (object)value); + } + } + + public Thickness BorderThickness + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + return (Thickness)((DependencyObject)this).GetValue(BorderThicknessProperty); + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ((DependencyObject)this).SetValue(BorderThicknessProperty, (object)value); + } + } + + private static void OnCaretBrushChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.CaretBrush = (Brush)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnBorderThicknessChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.BorderThickness = (Thickness)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnFontSizeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.FontSize = (int)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnFontFamilyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.FontFamily = (FontFamily)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnForegroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.Foreground = (Brush)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnBackgroundChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + customSenhaLoginBox.Background = (Brush)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + } + } + + private static void OnBoundPasswordChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomSenhaLoginBox customSenhaLoginBox = d as CustomSenhaLoginBox; + if (d != null && customSenhaLoginBox != null) + { + string password = ((string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue) ?? ""; + if (!_typing) + { + customSenhaLoginBox.PasswordBox.Password = password; + } + } + } + + private static void OnBoundIsReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + CustomPasswordBox customPasswordBox = d as CustomPasswordBox; + if (d != null && customPasswordBox != null) + { + bool flag = (bool)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + ((UIElement)customPasswordBox.PasswordBox).Visibility = (Visibility)(flag ? 2 : 0); + ((UIElement)customPasswordBox.TextRead).Visibility = (Visibility)((!flag) ? 2 : 0); + } + } + + public CustomSenhaLoginBox() + { + InitializeComponent(); + ((FrameworkElement)LayoutRoot).DataContext = this; + } + + private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e) + { + _typing = true; + Text = PasswordBox.Password; + _typing = false; + } + + private void Eye_Click(object sender, RoutedEventArgs e) + { + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Invalid comparison between Unknown and I4 + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Invalid comparison between Unknown and I4 + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: 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_006c: Invalid comparison between Unknown and I4 + //IL_007f: Expected O, but got Unknown + if (!IsReadOnly) + { + Button val = (Button)((sender is Button) ? sender : null); + ((UIElement)TextRead).Visibility = (Visibility)(((int)((UIElement)TextRead).Visibility != 2) ? 2 : 0); + ((UIElement)PasswordBox).Visibility = (Visibility)(((int)((UIElement)TextRead).Visibility != 2) ? 2 : 0); + if (val != null && ((ContentControl)val).Content != null) + { + ((PackIconBase<PackIconKind>)(PackIcon)((ContentControl)val).Content).Kind = (PackIconKind)(((int)((UIElement)TextRead).Visibility == 2) ? 1492 : 1497); + } + if ((int)((UIElement)PasswordBox).Visibility == 0) + { + ((UIElement)PasswordBox).Focus(); + PasswordBox.SelectAll(); + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/customsenhaloginbox.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_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Expected O, but got Unknown + //IL_005a: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Expected O, but got Unknown + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LayoutRoot = (Grid)target; + break; + case 2: + TextRead = (TextBox)target; + break; + case 3: + PasswordBox = (PasswordBox)target; + PasswordBox.PasswordChanged += new RoutedEventHandler(PasswordBox_PasswordChanged); + break; + case 4: + ButtonEye = (Button)target; + ((ButtonBase)ButtonEye).Click += new RoutedEventHandler(Eye_Click); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/CustomSeriesViewModel.cs b/Decompiler/Gestor.Application.Componentes/CustomSeriesViewModel.cs new file mode 100644 index 0000000..30af3ef --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/CustomSeriesViewModel.cs @@ -0,0 +1,55 @@ +using System.ComponentModel; +using System.Runtime.CompilerServices; +using System.Windows; +using System.Windows.Media; +using LiveCharts.Definitions.Series; +using LiveCharts.Wpf; + +namespace Gestor.Application.Componentes; + +public class CustomSeriesViewModel : INotifyPropertyChanged +{ + public string Title => SeriesViewModel.Title; + + public Brush Fill => SeriesViewModel.Fill ?? SeriesViewModel.Stroke; + + public SeriesViewModel SeriesViewModel { get; } + + public ISeriesView View { get; } + + public bool IsVisible + { + get + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Invalid comparison between Unknown and I4 + return (int)((UIElement)View).Visibility == 0; + } + set + { + //IL_000f: Unknown result type (might be due to invalid IL or missing references) + if (IsVisible != value) + { + ((UIElement)View).Visibility = (Visibility)(!value); + OnPropertyChanged("IsVisible"); + } + } + } + + public event PropertyChangedEventHandler PropertyChanged; + + public CustomSeriesViewModel(SeriesViewModel svm, ISeriesView view) + { + SeriesViewModel = svm; + View = view; + } + + protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = "") + { + if (this.PropertyChanged != null) + { + this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DefaultDialog.cs b/Decompiler/Gestor.Application.Componentes/DefaultDialog.cs new file mode 100644 index 0000000..f02d882 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DefaultDialog.cs @@ -0,0 +1,39 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Markup; +using Gestor.Application.Views.Generic; + +namespace Gestor.Application.Componentes; + +public class DefaultDialog : BaseUserControl, IComponentConnector +{ + private bool _contentLoaded; + + public DefaultDialog() + { + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/defaultdialog.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) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogAdvertising.cs b/Decompiler/Gestor.Application.Componentes/DialogAdvertising.cs new file mode 100644 index 0000000..4c2f5f8 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogAdvertising.cs @@ -0,0 +1,106 @@ +using System; +using System.CodeDom.Compiler; +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.ViewModels.Generic; +using MaterialDesignThemes.Wpf; +using Newtonsoft.Json.Linq; + +namespace Gestor.Application.Componentes; + +public class DialogAdvertising : UserControl, IComponentConnector +{ + private DialogAdvertisingViewModel ViewModel; + + private readonly bool _isPromocao; + + internal Label Titulo; + + private bool _contentLoaded; + + public DialogAdvertising(JObject jsonAd, bool isPromo = true) + { + ViewModel = new DialogAdvertisingViewModel(jsonAd, isPromo); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void LinkImage_MouseDown(object sender, MouseButtonEventArgs e) + { + try + { + if (!_isPromocao) + { + ViewModel.EnviarPesquisa(); + } + Process.Start(ViewModel.Url); + } + catch + { + } + } + + private void Lido_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.SalvaEditarArquivoConfig(visto: true); + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)null); + } + + private void CloseOnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)null); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogadvertising.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_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Expected O, but got Unknown + //IL_0040: 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_0056: Expected O, but got Unknown + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + switch (connectionId) + { + case 1: + Titulo = (Label)target; + break; + case 2: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CloseOnClick); + break; + case 3: + ((UIElement)(Image)target).MouseDown += new MouseButtonEventHandler(LinkImage_MouseDown); + break; + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Lido_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogAnaliticoBi.cs b/Decompiler/Gestor.Application.Componentes/DialogAnaliticoBi.cs new file mode 100644 index 0000000..6c50ba7 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogAnaliticoBi.cs @@ -0,0 +1,469 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Reflection; +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 Gestor.Application.Helpers; +using Gestor.Application.ViewModels; +using Gestor.Application.Views.Ferramentas; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Model.Attributes; +using Gestor.Model.Common; +using Gestor.Model.Domain.BI; +using Gestor.Model.Domain.Configuracoes; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.MalaDireta; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogAnaliticoBi : BaseUserControl, IComponentConnector, IStyleConnector +{ + internal AnaliticoViewModel ViewModel; + + internal Grid MainGrid; + + internal DataGrid Grid; + + internal DataGridTemplateColumn InfoButton; + + internal TextBlock Totalizacao; + + private bool _contentLoaded; + + public List<Analitico> Lista { get; set; } + + public List<string> Campos { get; set; } + + public DialogAnaliticoBi(string titulo, List<Analitico> analitico, string tipo, List<string> campos) + { + ViewModel = new AnaliticoViewModel(tipo); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + ViewModel.Head = titulo; + Lista = analitico; + Campos = campos; + ConstruirLista(); + } + + private void ConstruirLista() + { + ViewModel.Loading(isLoading: true); + PropertyInfo[] properties = ((object)Lista.First()).GetType().GetProperties(); + Campos.ForEach(delegate(string x) + { + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00b4: Expected O, but got Unknown + //IL_00c8: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Expected O, but got Unknown + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Unknown result type (might be due to invalid IL or missing references) + //IL_0153: Expected O, but got Unknown + //IL_0167: Unknown result type (might be due to invalid IL or missing references) + //IL_016e: Expected O, but got Unknown + //IL_0237: Unknown result type (might be due to invalid IL or missing references) + //IL_023c: Unknown result type (might be due to invalid IL or missing references) + //IL_0243: Unknown result type (might be due to invalid IL or missing references) + //IL_024a: Unknown result type (might be due to invalid IL or missing references) + //IL_024b: Unknown result type (might be due to invalid IL or missing references) + //IL_0250: 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_0266: Expected O, but got Unknown + //IL_0266: 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_027a: Expected O, but got Unknown + //IL_027a: 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_028f: Expected O, but got Unknown + //IL_018e: Unknown result type (might be due to invalid IL or missing references) + //IL_0195: Expected O, but got Unknown + //IL_01a9: Unknown result type (might be due to invalid IL or missing references) + //IL_01b0: Expected O, but got Unknown + //IL_01cd: Unknown result type (might be due to invalid IL or missing references) + //IL_01d4: Expected O, but got Unknown + //IL_01e8: Unknown result type (might be due to invalid IL or missing references) + //IL_01ef: Expected O, but got Unknown + //IL_0205: Unknown result type (might be due to invalid IL or missing references) + //IL_020c: Expected O, but got Unknown + //IL_0220: Unknown result type (might be due to invalid IL or missing references) + //IL_0227: Expected O, but got Unknown + PropertyInfo propertyInfo = properties.FirstOrDefault((PropertyInfo p) => p.Name == x); + if (!(propertyInfo == null)) + { + object obj = propertyInfo.GetCustomAttributes(typeof(DescriptionAttribute), inherit: true).FirstOrDefault(); + string header = propertyInfo.Name.ToUpper(); + if (obj != null) + { + header = ((DescriptionAttribute)obj).Description; + } + object obj2 = propertyInfo.GetCustomAttributes(typeof(TipoAttribute), inherit: true).FirstOrDefault(); + string text = ""; + if (obj2 != null) + { + text = ((TipoAttribute)obj2).Description; + } + string stringFormat = ""; + Style elementStyle = (Style)Application.Current.Resources[(object)"VerticalCenterStyle3"]; + Style headerStyle = (Style)Application.Current.Resources[(object)"MaterialDesignDataGridColumnHeader"]; + switch (text) + { + case "DATA": + case "DATA?": + stringFormat = "d"; + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterStyle2"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterHeaderStyle"]; + break; + case "PERCENTUAL": + stringFormat = "{0:0.00}%"; + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalRightStyle"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalRightHeaderStyle"]; + break; + case "VALOR": + case "VALOR?": + stringFormat = "c"; + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalRightStyle"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalRightHeaderStyle"]; + break; + case "QUANTIDADE": + elementStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterStyle2"]; + headerStyle = (Style)Application.Current.Resources[(object)"HorizontalCenterHeaderStyle"]; + break; + } + Grid.Columns.Add((DataGridColumn)new MaterialDataGridTextColumn + { + IsReadOnly = true, + Header = header, + Binding = (BindingBase)new Binding + { + Path = new PropertyPath(propertyInfo.Name, Array.Empty<object>()), + StringFormat = stringFormat, + UpdateSourceTrigger = (UpdateSourceTrigger)1 + }, + ElementStyle = elementStyle, + HeaderStyle = headerStyle + }); + } + }); + ((ItemsControl)Grid).ItemsSource = Lista; + Totalizar(); + ViewModel.Loading(isLoading: false); + } + + private void Totalizar() + { + switch (ViewModel.Tipo) + { + case "CLIENTES": + Totalizacao.Text = $"TOTAL DE {Lista.Count} CLIENTES"; + break; + default: + Totalizacao.Text = $"TOTAL DE {Lista.Count} SEGUROS SOMANDO O VALOR DE {Lista.Sum((Analitico x) => x.PremioLiquido):c}"; + break; + case "PARCELAS": + Totalizacao.Text = $"TOTAL DE {Lista.Count} SEGUROS SOMANDO O VALOR DE {Lista.Sum((Analitico x) => x.Valor):c}"; + break; + case "COMISSÃO": + Totalizacao.Text = $"TOTAL DE {Lista.Count} SEGUROS SOMANDO O VALOR DE COMISSÃO RECEBIDA DE {Lista.Sum((Analitico x) => x.ValorComissao):c}"; + break; + } + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + Lista.ForEach(delegate(Analitico x) + { + x.Selecionado = !x.Selecionado; + }); + ((ItemsControl)Grid).ItemsSource = null; + ((ItemsControl)Grid).ItemsSource = Lista; + } + + private async void Tarefas_OnClick(object sender, RoutedEventArgs e) + { + Tarefa data = new Tarefa + { + Entidade = (TipoTarefa)1, + Titulo = ViewModel.Head, + Usuario = Recursos.Usuario, + Agendamento = Funcoes.GetNetworkTime() + }; + await AbrirTarefa(data); + List<Analitico> second = Lista.Where((Analitico x) => x.Selecionado).ToList(); + Lista = Lista.Except(second).ToList(); + ((ItemsControl)Grid).ItemsSource = null; + ((ItemsControl)Grid).ItemsSource = Lista; + Totalizar(); + } + + private async Task AbrirTarefa(Tarefa data) + { + ViewModel.Loading(isLoading: true); + Tarefa tarefa; + while (true) + { + tarefa = await ViewModel.ShowTarefaDialog(data, nota: true); + List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>>(); + if (tarefa == null) + { + ViewModel.Loading(isLoading: false); + return; + } + tarefa.AgendamentoRetroativo = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 45); + List<KeyValuePair<string, string>> list2 = tarefa.Validate(); + if (list2 == null || list2.Count == 0) + { + break; + } + if (list2.Count > 0) + { + list.AddRange(list2); + } + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + if (tarefa.Usuario == null) + { + tarefa.Usuario = tarefa.UsuariosVinculados.FirstOrDefault(); + } + List<ResponsavelTarefa> responsaveis = ((IEnumerable<Usuario>)tarefa.UsuariosVinculados).Select((Func<Usuario, ResponsavelTarefa>)((Usuario x) => new ResponsavelTarefa + { + IdTarefa = ((DomainBase)tarefa).Id, + Usuario = x + })).ToList(); + List<Analitico> source = Lista.Where((Analitico x) => x.Selecionado).ToList(); + List<Tarefa> list3; + switch (ViewModel.Tipo) + { + case "CLIENTES": + list3 = ((IEnumerable<Analitico>)source).Select((Func<Analitico, Tarefa>)((Analitico x) => new Tarefa + { + Entidade = (TipoTarefa)2, + IdEntidade = x.Cliente.Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Usuario = tarefa.Usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Nome, + IdCliente = x.Cliente.Id, + Responsaveis = responsaveis + })).ToList(); + break; + default: + list3 = ((IEnumerable<Analitico>)source).Select((Func<Analitico, Tarefa>)((Analitico x) => new Tarefa + { + Entidade = (TipoTarefa)0, + IdEntidade = ((DomainBase)x.Documento).Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Usuario = tarefa.Usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Nome, + IdCliente = ((DomainBase)x.Documento.Controle.Cliente).Id, + Referencia = ((x.Documento.Tipo == 0 && !string.IsNullOrWhiteSpace(x.Documento.Apolice)) ? ("APÓLICE NÚMERO " + x.Documento.Apolice) : ((x.Documento.Tipo > 0) ? ("APÓLICE NÚMERO " + x.Documento.Apolice + " ENDOSSO " + x.Documento.Endosso) : ("PROPOSTA NÚMERO " + x.Documento.Proposta))), + Responsaveis = responsaveis + })).ToList(); + break; + case "PARCELAS": + case "COMISSÃO": + list3 = ((IEnumerable<Analitico>)source).Select((Func<Analitico, Tarefa>)((Analitico x) => new Tarefa + { + Entidade = (TipoTarefa)3, + IdEntidade = ((DomainBase)x.Parcela).Id, + Agendamento = tarefa.Agendamento, + Titulo = tarefa.Titulo, + Descricao = tarefa.Anotacoes, + Usuario = tarefa.Usuario, + UsuarioCadastro = Recursos.Usuario, + Cliente = x.Nome, + IdCliente = ((DomainBase)x.Parcela.Documento.Controle.Cliente).Id, + Referencia = ((x.Parcela.Documento.Tipo == 0 && !string.IsNullOrWhiteSpace(x.Parcela.Documento.Apolice)) ? $"PARCELA {x.NumeroParcela} DA APÓLICE {x.Parcela.Documento.Apolice}" : ((x.Documento.Tipo > 0) ? $"PARCELA {x.NumeroParcela} DA APÓLICE {x.Parcela.Documento.Apolice} ENDOSSO {x.Parcela.Documento.Endosso}" : $"PARCELA {x.NumeroParcela} DA PROPOSTA {x.Parcela.Documento.Proposta}")), + Responsaveis = responsaveis + })).ToList(); + break; + } + if (list3.Count == 0) + { + ViewModel.Loading(isLoading: false); + await ViewModel.ShowMessage("FALHA AO CRIAR TAREFA."); + return; + } + await ViewModel.Save(list3); + ViewModel.ToggleSnackBar("TAREFA SALVA COM SUCESSO."); + ViewModel.Alterar(alterar: false); + ViewModel.Loading(isLoading: false); + } + + private async void Email_OnClick(object sender, RoutedEventArgs e) + { + if (!Lista.Any((Analitico x) => x.Selecionado)) + { + await ViewModel.ShowMessage("NECESSÁRIO SELECIONAR AO MENOS UM CLIENTE PARA PROSSEGUIR"); + return; + } + if (Funcoes.IsWindowOpen<HosterWindow>("ENVIO DE E-MAIL")) + { + Funcoes.Destroy<HosterWindow>("ENVIO DE E-MAIL"); + } + ((Window)new HosterWindow((ContentControl)(object)new MalaDiretaView(Lista.Where((Analitico x) => x.Selecionado).Select((Func<Analitico, MalaDireta>)((Analitico x) => new MalaDireta + { + Cliente = new Cliente + { + Id = x.Cliente.Id, + Nome = x.Cliente.Nome, + Nascimento = x.Cliente.Nascimento, + VencimentoHabilitacao = x.Cliente.VencimentoCnh + }, + Apolice = x.Documento, + Parcela = x.Parcela, + Tela = ViewModel.Tela + })).ToList()), "ENVIO DE E-MAIL", 1200.0, 600.0, canMaximize: true)).Show(); + } + + private async void Grid_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + if (((Selector)Grid).SelectedItem != null && (!(ViewModel.Tipo == "PARCELAS") || !(ViewModel.Tipo == "APOLICES"))) + { + if (ViewModel.Tipo == "CLIENTES") + { + Analitico val = (Analitico)((Selector)Grid).SelectedItem; + Cliente val2 = await ViewModel.CarregaCliente(val.Cliente.Id); + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(val2, lockInsert: true), "CADASTRO DE CLIENTE - " + val2.Nome)).Show(); + } + else + { + Analitico val3 = (Analitico)((Selector)Grid).SelectedItem; + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(val3.Documento, lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + val3.Cliente.Nome)).Show(); + } + } + } + + private async void Print_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Loading(isLoading: true); + await ViewModel.Print(Grid); + ViewModel.Loading(isLoading: false); + } + + private async void Open_OnClick(object sender, RoutedEventArgs e) + { + if (((Selector)Grid).SelectedItem != null && (!(ViewModel.Tipo == "PARCELAS") || !(ViewModel.Tipo == "APOLICES"))) + { + if (ViewModel.Tipo == "CLIENTES") + { + Analitico val = (Analitico)((Selector)Grid).SelectedItem; + Cliente val2 = await ViewModel.CarregaCliente(val.Cliente.Id); + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(val2, lockInsert: true), "CADASTRO DE CLIENTE - " + val2.Nome)).Show(); + } + else + { + Analitico val3 = (Analitico)((Selector)Grid).SelectedItem; + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(val3.Documento, lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + val3.Cliente.Nome)).Show(); + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialoganaliticobi.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_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Expected O, but got Unknown + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_0093: Expected O, but got Unknown + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: Expected O, but got Unknown + //IL_00ad: 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 + switch (connectionId) + { + case 1: + MainGrid = (Grid)target; + break; + case 2: + Grid = (DataGrid)target; + ((Control)Grid).MouseDoubleClick += new MouseButtonEventHandler(Grid_OnMouseDoubleClick); + break; + case 4: + InfoButton = (DataGridTemplateColumn)target; + break; + case 6: + Totalizacao = (TextBlock)target; + break; + case 7: + ((MenuItem)target).Click += new RoutedEventHandler(Tarefas_OnClick); + break; + case 8: + ((MenuItem)target).Click += new RoutedEventHandler(Email_OnClick); + break; + case 9: + ((MenuItem)target).Click += new RoutedEventHandler(Print_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + //IL_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Expected O, but got Unknown + //IL_0039: 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_004f: Expected O, but got Unknown + switch (connectionId) + { + case 3: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Open_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogAnexar.cs b/Decompiler/Gestor.Application.Componentes/DialogAnexar.cs new file mode 100644 index 0000000..09cadae --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogAnexar.cs @@ -0,0 +1,112 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Common; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogAnexar : UserControl, IComponentConnector, IStyleConnector +{ + private DialogAnexarViewModel ViewModel; + + internal Button SalvarButton; + + internal Button CancelarButton; + + private bool _contentLoaded; + + public DialogAnexar(List<ArquivoDigital> arquivos) + { + ViewModel = new DialogAnexarViewModel(arquivos); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void Excluir_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) + { + ArquivoDigital removido = (ArquivoDigital)((FrameworkElement)val).DataContext; + ViewModel.Remover(removido); + } + } + + private void SalvarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)ViewModel.Arquivos.ToList(), (IInputElement)(object)SalvarButton); + } + + private void CancelarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)CancelarButton); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialoganexar.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_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: 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 + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + //IL_003a: Expected O, but got Unknown + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Expected O, but got Unknown + switch (connectionId) + { + case 2: + SalvarButton = (Button)target; + ((ButtonBase)SalvarButton).Click += new RoutedEventHandler(SalvarButton_OnClick); + break; + case 3: + CancelarButton = (Button)target; + ((ButtonBase)CancelarButton).Click += new RoutedEventHandler(CancelarButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + if (connectionId == 1) + { + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Excluir_OnClick); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogCopia.cs b/Decompiler/Gestor.Application.Componentes/DialogCopia.cs new file mode 100644 index 0000000..d4ecb7b --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogCopia.cs @@ -0,0 +1,159 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.MalaDireta; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogCopia : UserControl, IComponentConnector, IStyleConnector +{ + internal TextBox CopiaBox; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + public DialogCopiaViewModel ViewModel { get; set; } + + public DialogCopia(Copia copia) + { + ViewModel = new DialogCopiaViewModel(copia); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AdicionarCopia(object sender, RoutedEventArgs e) + { + ViewModel.AdicionarCopia(); + ToggleSnackBar(ViewModel.Erro); + } + + 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(3000); + Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + ToggleSnackBar("", active: false); + }); + } + } + + private void ExcluirComum_OnDeleteClick(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 + Chip val = (Chip)sender; + ViewModel.ExcluirCopia("CÓPIA COMUM", (string)((FrameworkElement)val).DataContext); + } + + private void ExcluirOculta_OnDeleteClick(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 + Chip val = (Chip)sender; + ViewModel.ExcluirCopia("CÓPIA OCULTA", (string)((FrameworkElement)val).DataContext); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogcopia.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_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + //IL_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + //IL_006f: 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 + switch (connectionId) + { + case 1: + CopiaBox = (TextBox)target; + break; + case 2: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarCopia); + break; + case 5: + ((MenuItem)target).Click += new RoutedEventHandler(AdicionarCopia); + break; + case 6: + Snackbar = (Snackbar)target; + break; + case 7: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0020: Expected O, but got Unknown + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Expected O, but got Unknown + switch (connectionId) + { + case 3: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirComum_OnDeleteClick); + break; + case 4: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirOculta_OnDeleteClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogCopiarCliente.cs b/Decompiler/Gestor.Application.Componentes/DialogCopiarCliente.cs new file mode 100644 index 0000000..beba697 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogCopiarCliente.cs @@ -0,0 +1,97 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Model.Common; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class DialogCopiarCliente : UserControl, IComponentConnector +{ + internal CopiarClienteViewModel ViewModel; + + internal AutoCompleteBox PesquisaCliente; + + internal Loading LoadingAutoComplete; + + private bool _contentLoaded; + + public DialogCopiarCliente() + { + InitializeComponent(); + ViewModel = new CopiarClienteViewModel(); + ((FrameworkElement)this).DataContext = ViewModel; + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Trim().Length < 3) + { + return; + } + e.Cancel = true; + ((UIElement)LoadingAutoComplete).Visibility = (Visibility)0; + ViewModel.BuscarCliente(e.Parameter.Trim(), null, (TipoFiltroCliente)2).ContinueWith(delegate(Task<List<Cliente>> searchResult) + { + //IL_0020: 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) + ((UIElement)LoadingAutoComplete).Visibility = (Visibility)2; + if (searchResult.Result != null) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + val.ItemsSource = searchResult.Result; + val.PopulateComplete(); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogcopiarcliente.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_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: 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 + switch (connectionId) + { + case 1: + PesquisaCliente = (AutoCompleteBox)target; + PesquisaCliente.Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + break; + case 2: + LoadingAutoComplete = (Loading)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogCopiarPermissao.cs b/Decompiler/Gestor.Application.Componentes/DialogCopiarPermissao.cs new file mode 100644 index 0000000..67c1e86 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogCopiarPermissao.cs @@ -0,0 +1,78 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class DialogCopiarPermissao : UserControl, IComponentConnector +{ + public DialogCopiarPermissaoViewModel ViewModel; + + private bool _contentLoaded; + + public DialogCopiarPermissao(DialogCopiarPermissaoViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Length < 3) + { + return; + } + e.Cancel = true; + ViewModel.BuscarUsuario(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Usuario>> 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()); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogcopiarpermissao.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_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + if (connectionId == 1) + { + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + } + else + { + _contentLoaded = true; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogDetalheExtrato.cs b/Decompiler/Gestor.Application.Componentes/DialogDetalheExtrato.cs new file mode 100644 index 0000000..7e19050 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogDetalheExtrato.cs @@ -0,0 +1,90 @@ +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.Markup; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Comissao; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Model.Common; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class DialogDetalheExtrato : UserControl, IComponentConnector, IStyleConnector +{ + internal DataGrid DetalhesGrid; + + private bool _contentLoaded; + + public ComissaoViewModel ViewModel { get; set; } + + public DialogDetalheExtrato(List<DetalheExtrato> detalhes) + { + InitializeComponent(); + ((ItemsControl)DetalhesGrid).ItemsSource = detalhes; + } + + private async void AcessarApolice_OnClick(object sender, RoutedEventArgs e) + { + DetalheExtrato val = (DetalheExtrato)((FrameworkElement)(Button)sender).DataContext; + if (((val != null && val.Documento.HasValue) || (val != null && val.Parcela.HasValue)) && val.Parcela.HasValue) + { + Documento val2 = ((!val.Documento.HasValue) ? (await new ParcelaServico().BuscarApolice(val.Parcela.Value)) : (await new ApoliceServico().BuscarApoliceAsync(val.Documento.Value))); + Documento val3 = val2; + if (val3 != null) + { + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(val3, lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICE - " + val3.Controle.Cliente.Nome + " - " + val3.Apolice)).Show(); + } + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogdetalheextrato.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_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Expected O, but got Unknown + if (connectionId == 1) + { + DetalhesGrid = (DataGrid)target; + } + else + { + _contentLoaded = true; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + if (connectionId == 2) + { + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AcessarApolice_OnClick); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogEditarParcelas.cs b/Decompiler/Gestor.Application.Componentes/DialogEditarParcelas.cs new file mode 100644 index 0000000..c0bbe85 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogEditarParcelas.cs @@ -0,0 +1,174 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.Actions; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogEditarParcelas : UserControl, IComponentConnector +{ + internal Snackbar Snackbar; + + internal DataGrid ParcelaGrid; + + internal DataGridTextColumn ParcelaColumn; + + internal Label LabelStatus; + + internal Button SalvarButton; + + internal Button FecharButton; + + private bool _contentLoaded; + + public DialogEditarParcelasViewModel ViewModel { get; set; } + + public DialogEditarParcelas(Documento documento) + { + ViewModel = new DialogEditarParcelasViewModel(documento); + ((FrameworkElement)this).DataContext = ViewModel; + Gestor.Application.Actions.Actions.AcionarSnackbar = (Action<string>)Delegate.Remove(Gestor.Application.Actions.Actions.AcionarSnackbar, new Action<string>(AcionarSnackBar)); + Gestor.Application.Actions.Actions.AcionarSnackbar = (Action<string>)Delegate.Combine(Gestor.Application.Actions.Actions.AcionarSnackbar, new Action<string>(AcionarSnackBar)); + InitializeComponent(); + } + + private void AcionarSnackBar(string message) + { + Snackbar.IsActive = true; + ((ContentControl)Snackbar.Message).Content = message; + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + Snackbar.IsActive = false; + } + + private async void SalvarButton_OnClick(object sender, RoutedEventArgs e) + { + if (await ViewModel.SalvarParcelas()) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)SalvarButton); + } + } + + private void FecharButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)SalvarButton); + } + + private void ParcelaGrid_OnCellEditEnding(object sender, DataGridCellEditEndingEventArgs e) + { + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + //IL_00f5: Unknown result type (might be due to invalid IL or missing references) + //IL_00ff: Expected O, but got Unknown + if (!(e.EditingElement is TextBox)) + { + return; + } + Parcela val = (Parcela)((FrameworkElement)e.Row).DataContext; + FrameworkElement editingElement = e.EditingElement; + TextBox val2 = (TextBox)(object)((editingElement is TextBox) ? editingElement : null); + if (val2 == null) + { + return; + } + if (e.Column.ClipboardContentBinding.StringFormat == "d") + { + val2.Text = ValidationHelper.FormatDate(val2.Text); + if (e.Column.Header.ToString() == "VENCIMENTO") + { + val.Vencimento = ((string.IsNullOrWhiteSpace(val2.Text) || !DateTime.TryParse(val2.Text, out var _)) ? DateTime.MinValue : DateTime.Parse(val2.Text)); + } + } + string text = e.Column.Header.ToString(); + if (!(text == "VALOR")) + { + if (text == "VENCIMENTO") + { + ViewModel.AlterandoVencimento((Parcela)((FrameworkElement)e.Row).DataContext); + } + } + else + { + ViewModel.AlterandoValor(); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogeditarparcelas.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_002b: Unknown result type (might be due to invalid IL or missing references) + //IL_0035: Expected O, but got Unknown + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Expected O, but got Unknown + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_00a5: Unknown result type (might be due to invalid IL or missing references) + //IL_00af: Expected O, but got Unknown + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00bc: Expected O, but got Unknown + //IL_00c9: Unknown result type (might be due to invalid IL or missing references) + //IL_00d3: Expected O, but got Unknown + switch (connectionId) + { + case 1: + Snackbar = (Snackbar)target; + break; + case 2: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + case 3: + ParcelaGrid = (DataGrid)target; + ParcelaGrid.CellEditEnding += ParcelaGrid_OnCellEditEnding; + break; + case 4: + ParcelaColumn = (DataGridTextColumn)target; + break; + case 5: + LabelStatus = (Label)target; + break; + case 6: + SalvarButton = (Button)target; + ((ButtonBase)SalvarButton).Click += new RoutedEventHandler(SalvarButton_OnClick); + break; + case 7: + FecharButton = (Button)target; + ((ButtonBase)FecharButton).Click += new RoutedEventHandler(FecharButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogEnviarEmails.cs b/Decompiler/Gestor.Application.Componentes/DialogEnviarEmails.cs new file mode 100644 index 0000000..e9f94ad --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogEnviarEmails.cs @@ -0,0 +1,67 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; + +namespace Gestor.Application.Componentes; + +public class DialogEnviarEmails : UserControl, IComponentConnector +{ + public DialogEnviarEmailsViewModel ViewModel; + + internal ProgressBar ProgressBar; + + private bool _contentLoaded; + + public DialogEnviarEmails(DialogEnviarEmailsViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void Enviar_Click(object sender, RoutedEventArgs e) + { + ViewModel.Enviar(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogenviaremails.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_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressBar = (ProgressBar)target; + break; + case 2: + ((MenuItem)target).Click += new RoutedEventHandler(Enviar_Click); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogExportarPermissao.cs b/Decompiler/Gestor.Application.Componentes/DialogExportarPermissao.cs new file mode 100644 index 0000000..0c24154 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogExportarPermissao.cs @@ -0,0 +1,119 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class DialogExportarPermissao : UserControl, IComponentConnector, IStyleConnector +{ + public DialogExportarPermissaoViewModel ViewModel; + + internal DataGrid UsuarioGrid; + + private bool _contentLoaded; + + public DialogExportarPermissao(DialogExportarPermissaoViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void AutoCompleteBoxUsuario_Populating(object sender, PopulatingEventArgs e) + { + e.Cancel = true; + ViewModel.Filtrar(ValidationHelper.RemoveDiacritics(e.Parameter.Trim())).ContinueWith(delegate(Task<List<Usuario>> 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 AutoCompleteBox_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.FiltrarUsuario(""); + } + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + ViewModel.Selecionar(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogexportarpermissao.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_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: Expected O, but got Unknown + //IL_0022: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: 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 + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBoxUsuario_Populating); + ((AutoCompleteBox)target).TextChanged += new RoutedEventHandler(AutoCompleteBox_OnTextChanged); + break; + case 2: + UsuarioGrid = (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_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + if (connectionId == 3) + { + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogExtratoComissao.cs b/Decompiler/Gestor.Application.Componentes/DialogExtratoComissao.cs new file mode 100644 index 0000000..5d07bf8 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogExtratoComissao.cs @@ -0,0 +1,210 @@ +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 System.Windows.Threading; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogExtratoComissao : BaseUserControl, IComponentConnector, IStyleConnector +{ + public ExtratoComissaoViewModel ViewModel; + + internal ComboBox SeguradoraBox; + + internal ComboBox SeguradoraSocialBox; + + internal DatePicker InicioBox; + + internal DatePicker FimBox; + + internal ProgressBar ProgressBar; + + internal DataGrid ExtratoGrid; + + internal Button ImportarButton; + + internal Button FecharButton; + + private bool _contentLoaded; + + public DialogExtratoComissao(List<Seguradora> seguradoras) + { + InitializeComponent(); + ViewModel = new ExtratoComissaoViewModel(seguradoras); + ((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_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 + InicioBox.SelectedDateChanged += DataBox_SelectedDateChanged; + FimBox.SelectedDateChanged += DataBox_SelectedDateChanged; + ((Selector)SeguradoraBox).SelectionChanged += new SelectionChangedEventHandler(SeguradoraBox_SelectionChanged); + ((Selector)SeguradoraSocialBox).SelectionChanged += new SelectionChangedEventHandler(SeguradoraSicialBox_SelectionChanged); + } + + private void SeguradoraSicialBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + ((Selector)SeguradoraBox).SelectedItem = ((Selector)SeguradoraSocialBox).SelectedItem; + CarregarExtratos(); + } + + private void SeguradoraBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + CarregarExtratos(); + } + + private void Importar_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)ViewModel.Selecionar(), (IInputElement)(object)ImportarButton); + } + + private void Fechar_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)FecharButton); + } + + private void DataBox_SelectedDateChanged(object sender, SelectionChangedEventArgs e) + { + CarregarExtratos(); + } + + private async void CarregarExtratos() + { + if (((Selector)SeguradoraBox).SelectedItem != null && InicioBox.SelectedDate.HasValue && FimBox.SelectedDate.HasValue) + { + ViewModel.IsEnabled = false; + ((UIElement)ProgressBar).Visibility = (Visibility)0; + await ViewModel.CarregarExtratos((Seguradora)((Selector)SeguradoraBox).SelectedItem, InicioBox.SelectedDate.Value, FimBox.SelectedDate.Value); + ((UIElement)ProgressBar).Visibility = (Visibility)2; + ViewModel.IsEnabled = true; + } + } + + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { + ViewModel.SelecionarTudo(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogextratocomissao.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_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Expected O, but got Unknown + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_0071: Unknown result type (might be due to invalid IL or missing references) + //IL_007b: Expected O, but got Unknown + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Expected O, but got Unknown + //IL_0095: Unknown result type (might be due to invalid IL or missing references) + //IL_009f: 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_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_00c6: Unknown result type (might be due to invalid IL or missing references) + //IL_00d0: Expected O, but got Unknown + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Expected O, but got Unknown + //IL_00ea: Unknown result type (might be due to invalid IL or missing references) + //IL_00f4: Expected O, but got Unknown + switch (connectionId) + { + case 1: + SeguradoraBox = (ComboBox)target; + break; + case 2: + SeguradoraSocialBox = (ComboBox)target; + break; + case 3: + InicioBox = (DatePicker)target; + ((UIElement)InicioBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + break; + case 4: + FimBox = (DatePicker)target; + ((UIElement)FimBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + break; + case 5: + ProgressBar = (ProgressBar)target; + break; + case 6: + ExtratoGrid = (DataGrid)target; + break; + case 8: + ImportarButton = (Button)target; + ((ButtonBase)ImportarButton).Click += new RoutedEventHandler(Importar_OnClick); + break; + case 9: + FecharButton = (Button)target; + ((ButtonBase)FecharButton).Click += new RoutedEventHandler(Fechar_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + if (connectionId == 7) + { + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogGrafico.cs b/Decompiler/Gestor.Application.Componentes/DialogGrafico.cs new file mode 100644 index 0000000..7543980 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogGrafico.cs @@ -0,0 +1,46 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes; + +public class DialogGrafico : UserControl, IComponentConnector +{ + private bool _contentLoaded; + + public DialogGrafico() + { + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialoggrafico.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) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogHoster.cs b/Decompiler/Gestor.Application.Componentes/DialogHoster.cs new file mode 100644 index 0000000..c144ee5 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogHoster.cs @@ -0,0 +1,81 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Media; + +namespace Gestor.Application.Componentes; + +public class DialogHoster : UserControl, IComponentConnector +{ + internal TextBlock Head; + + internal Button CloseButton; + + internal ContentControl Content; + + private bool _contentLoaded; + + public DialogHoster(object view, string head) + { + InitializeComponent(); + Content.Content = view; + Head.Text = head; + } + + private void TopControls_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: 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_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_001d: 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) + //IL_0038: Expected O, but got Unknown + ((Control)(Button)sender).Background = (Brush)((((FrameworkElement)(Button)sender).Name == "CloseButton") ? new SolidColorBrush(Colors.Red) : new SolidColorBrush(Colors.DimGray)); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialoghoster.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_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Expected O, but got Unknown + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Expected O, but got Unknown + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Expected O, but got Unknown + switch (connectionId) + { + case 1: + Head = (TextBlock)target; + break; + case 2: + CloseButton = (Button)target; + break; + case 3: + Content = (ContentControl)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogInstalacoes.cs b/Decompiler/Gestor.Application.Componentes/DialogInstalacoes.cs new file mode 100644 index 0000000..2fc1403 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogInstalacoes.cs @@ -0,0 +1,118 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Model.License; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogInstalacoes : UserControl, IComponentConnector +{ + internal DataGrid InstalacoesView; + + internal Button ValidarButton; + + internal Button FecharButton; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + public DialogInstalacoes(List<Instalacao> instalacoes) + { + InitializeComponent(); + ((ItemsControl)InstalacoesView).ItemsSource = instalacoes.Where((Instalacao i) => !string.IsNullOrEmpty(i.Gerenciador))?.ToList(); + ((Selector)InstalacoesView).SelectedIndex = -1; + } + + private void ValidarButton_OnClick(object sender, RoutedEventArgs e) + { + //IL_0037: Unknown result type (might be due to invalid IL or missing references) + //IL_0047: Expected O, but got Unknown + object selectedItem = ((Selector)InstalacoesView).SelectedItem; + if (selectedItem == null) + { + ((ContentControl)Snackbar.Message).Content = "SELECIONE A INSTALAÇÃO A SER SUBSTITUÍDA"; + Snackbar.IsActive = true; + } + else + { + DialogHost.CloseDialogCommand.Execute((object)(Instalacao)selectedItem, (IInputElement)(object)ValidarButton); + } + } + + private void FecharButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)FecharButton); + } + + private void SnackbarMessage_ActionClick(object sender, RoutedEventArgs e) + { + ((ContentControl)Snackbar.Message).Content = ""; + Snackbar.IsActive = false; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialoginstalacoes.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_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Expected O, but got Unknown + //IL_0044: Unknown result type (might be due to invalid IL or missing references) + //IL_004e: Expected O, but got Unknown + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Expected O, but got Unknown + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0072: Expected O, but got Unknown + //IL_0075: Unknown result type (might be due to invalid IL or missing references) + //IL_007f: Expected O, but got Unknown + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_008d: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Expected O, but got Unknown + switch (connectionId) + { + case 1: + InstalacoesView = (DataGrid)target; + break; + case 2: + ValidarButton = (Button)target; + ((ButtonBase)ValidarButton).Click += new RoutedEventHandler(ValidarButton_OnClick); + break; + case 3: + FecharButton = (Button)target; + ((ButtonBase)FecharButton).Click += new RoutedEventHandler(FecharButton_OnClick); + break; + case 4: + Snackbar = (Snackbar)target; + break; + case 5: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogLogAcesso.cs b/Decompiler/Gestor.Application.Componentes/DialogLogAcesso.cs new file mode 100644 index 0000000..7b6e940 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogLogAcesso.cs @@ -0,0 +1,72 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Drawer; +using Gestor.Model.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Gestor.Model.Validation; + +namespace Gestor.Application.Componentes; + +public class DialogLogAcesso : UserControl, IComponentConnector +{ + internal ProgressBar ProgressBar; + + internal TextBlock TitleText; + + private bool _contentLoaded; + + public LogViewModel ViewModel { get; set; } + + public DialogLogAcesso(TipoTela tela, Usuario usuario) + { + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Unknown result type (might be due to invalid IL or missing references) + //IL_0069: Unknown result type (might be due to invalid IL or missing references) + ViewModel = new LogViewModel(tela, ((DomainBase)usuario).Id); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + ViewModel.RegistrarAcao($"ACESSOU LOG DE ACESSO DO USUÁRIO {usuario.Nome}, ID \"{((DomainBase)usuario).Id}\"", ((DomainBase)usuario).Id, tela, $"ID ENTIDADE: {((DomainBase)usuario).Id}\nTIPO: {Funcoes.GetDescription((Enum)(object)tela)}"); + TitleText.Text = $"LOG DE ACESSO DO USUARIO: {usuario.Nome}, ID {((DomainBase)usuario).Id}"; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialoglogacesso.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_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressBar = (ProgressBar)target; + break; + case 2: + TitleText = (TextBlock)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogMedalha.cs b/Decompiler/Gestor.Application.Componentes/DialogMedalha.cs new file mode 100644 index 0000000..a5a01fc --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogMedalha.cs @@ -0,0 +1,44 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; + +namespace Gestor.Application.Componentes; + +public class DialogMedalha : UserControl, IComponentConnector +{ + private bool _contentLoaded; + + private DialogMedalhaViewModel ViewModel { get; } + + public DialogMedalha(int liquido, int comissao, int resultado, int media) + { + ViewModel = new DialogMedalhaViewModel(liquido, comissao, resultado, media); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogmedalha.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) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogObservacao.cs b/Decompiler/Gestor.Application.Componentes/DialogObservacao.cs new file mode 100644 index 0000000..ba3c0a4 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogObservacao.cs @@ -0,0 +1,90 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogObservacao : UserControl, IComponentConnector +{ + internal TextBox TextBox; + + internal Button SalvarButton; + + internal Button CancelarButton; + + private bool _contentLoaded; + + public DialogObservacao() + { + InitializeComponent(); + } + + private void SalvarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)TextBox.Text, (IInputElement)(object)SalvarButton); + } + + private void CancelarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)CancelarButton); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogobservacao.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_0018: Unknown result type (might be due to invalid IL or missing references) + //IL_0022: Expected O, but got Unknown + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: 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_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Expected O, but got Unknown + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_006a: Expected O, but got Unknown + switch (connectionId) + { + case 1: + TextBox = (TextBox)target; + break; + case 2: + SalvarButton = (Button)target; + ((ButtonBase)SalvarButton).Click += new RoutedEventHandler(SalvarButton_OnClick); + break; + case 3: + CancelarButton = (Button)target; + ((ButtonBase)CancelarButton).Click += new RoutedEventHandler(CancelarButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogPesquisaAvancada.cs b/Decompiler/Gestor.Application.Componentes/DialogPesquisaAvancada.cs new file mode 100644 index 0000000..8c99bef --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogPesquisaAvancada.cs @@ -0,0 +1,124 @@ +using System; +using System.CodeDom.Compiler; +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.Generic; +using Gestor.Common.Validation; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogPesquisaAvancada : UserControl, IComponentConnector +{ + internal DataGrid Grid; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + public DialogPesquisaAvancadaViewModel ViewModel { get; set; } + + public DialogPesquisaAvancada(DialogPesquisaAvancadaViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + ViewModel.GetTipoTela(); + ViewModel.HabilitarBusca(); + } + + 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(3000); + Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + ToggleSnackBar("", active: false); + }); + } + } + + private async void Pesquisar_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Pesquisa == null) + { + ToggleSnackBar("INFORME QUAL " + ValidationHelper.GetDescription((Enum)(object)ViewModel.Tipo) + " DESEJA PROCURAR"); + return; + } + await ViewModel.Pesquisar(); + if (ViewModel.Pesquisas.Count == 0) + { + ToggleSnackBar("NÃO HÁ DOCUMENTOS ENCONTRADOS."); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogpesquisaavancada.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_001b: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Expected O, but got Unknown + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Expected O, but got Unknown + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Expected O, but got Unknown + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((MenuItem)target).Click += new RoutedEventHandler(Pesquisar_OnClick); + break; + case 2: + Grid = (DataGrid)target; + break; + case 3: + Snackbar = (Snackbar)target; + break; + case 4: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogPrint.cs b/Decompiler/Gestor.Application.Componentes/DialogPrint.cs new file mode 100644 index 0000000..31ece9d --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogPrint.cs @@ -0,0 +1,172 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.ViewModels.Relatorios; +using Gestor.Model.Common; +using Gestor.Model.Domain.Relatorios; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogPrint : UserControl, IComponentConnector, IStyleConnector +{ + internal ProgressBar ProgressBar; + + internal CheckBox Landscape; + + internal CheckBox Portrait; + + internal Button ValidarButton; + + internal Button FecharButton; + + private bool _contentLoaded; + + public DialogPrintViewModel ViewModel { get; set; } + + public DialogPrint(Relatorio relatorio, Type tipo) + { + //IL_0007: Unknown result type (might be due to invalid IL or missing references) + ViewModel = new DialogPrintViewModel(relatorio, tipo); + ((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() + { + ViewModel.Carregando = true; + await ViewModel.Carregar(); + ((ToggleButton)Landscape).IsChecked = true; + ViewModel.Carregando = false; + } + + private void ToggleButton_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.Selecionar(); + } + + private void ImprimirButton_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Configuracoes.Campos = ViewModel.Configuracoes.Campos.Where((ParametrosRelatorio x) => x.Selecionado).ToList(); + DialogHost.CloseDialogCommand.Execute((object)ViewModel.Configuracoes, (IInputElement)(object)ValidarButton); + ViewModel.Configuracoes.OrientacaoImpressao = ViewModel.OrientacaoImpressao; + } + + private void CancelarButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)FecharButton); + } + + private void ToggleButtonLandscape_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.OrientacaoImpressao = false; + ViewModel.OrientacaoImpressaoPortrait = false; + ((ToggleButton)Portrait).IsChecked = false; + } + + private void ToggleButtonPortrait_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.OrientacaoImpressao = true; + ViewModel.OrientacaoImpressaoLandscape = false; + ((ToggleButton)Landscape).IsChecked = false; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogprint.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_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Expected O, but got Unknown + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Expected O, but got Unknown + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Expected O, but got Unknown + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: 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_007c: Unknown result type (might be due to invalid IL or missing references) + //IL_0086: Expected O, but got Unknown + //IL_0093: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Expected O, but got Unknown + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00aa: Expected O, but got Unknown + //IL_00b7: Unknown result type (might be due to invalid IL or missing references) + //IL_00c1: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ProgressBar = (ProgressBar)target; + break; + case 3: + Landscape = (CheckBox)target; + ((ToggleButton)Landscape).Checked += new RoutedEventHandler(ToggleButtonLandscape_OnChecked); + break; + case 4: + Portrait = (CheckBox)target; + ((ToggleButton)Portrait).Checked += new RoutedEventHandler(ToggleButtonPortrait_OnChecked); + break; + case 5: + ValidarButton = (Button)target; + ((ButtonBase)ValidarButton).Click += new RoutedEventHandler(ImprimirButton_OnClick); + break; + case 6: + FecharButton = (Button)target; + ((ButtonBase)FecharButton).Click += new RoutedEventHandler(CancelarButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + //IL_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0028: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Expected O, but got Unknown + if (connectionId == 2) + { + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(ToggleButton_OnChecked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(ToggleButton_OnChecked); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogProtocolo.cs b/Decompiler/Gestor.Application.Componentes/DialogProtocolo.cs new file mode 100644 index 0000000..1a033de --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogProtocolo.cs @@ -0,0 +1,46 @@ +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.Markup; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class DialogProtocolo : UserControl, IComponentConnector +{ + private bool _contentLoaded; + + private ProtocoloViewModel ViewModel { get; } + + public DialogProtocolo(List<Documento> itens) + { + ViewModel = new ProtocoloViewModel(itens); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogprotocolo.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) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogReordenarItens.cs b/Decompiler/Gestor.Application.Componentes/DialogReordenarItens.cs new file mode 100644 index 0000000..f5a1e4b --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogReordenarItens.cs @@ -0,0 +1,69 @@ +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.Markup; +using Gestor.Application.ViewModels.Generic; + +namespace Gestor.Application.Componentes; + +public class DialogReordenarItens : UserControl, IComponentConnector +{ + internal ProgressBar ProgressRing; + + private bool _contentLoaded; + + private ReordenarItensViewModel ViewModel { get; } + + public DialogReordenarItens(List<long> ids) + { + ViewModel = new ReordenarItensViewModel(ids); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void ReordenarAutomaticamente_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.ReordenarAutomaticamente(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogreordenaritens.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_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + //IL_0021: 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 + switch (connectionId) + { + case 1: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ReordenarAutomaticamente_OnClick); + break; + case 2: + ProgressRing = (ProgressBar)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogSelecionarItens.cs b/Decompiler/Gestor.Application.Componentes/DialogSelecionarItens.cs new file mode 100644 index 0000000..6261190 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogSelecionarItens.cs @@ -0,0 +1,44 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; + +namespace Gestor.Application.Componentes; + +public class DialogSelecionarItens : UserControl, IComponentConnector +{ + private bool _contentLoaded; + + private SelecionarItensViewModel ViewModel { get; } + + public DialogSelecionarItens(long id) + { + ViewModel = new SelecionarItensViewModel(id); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogselecionaritens.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) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogSenhaAdm.cs b/Decompiler/Gestor.Application.Componentes/DialogSenhaAdm.cs new file mode 100644 index 0000000..863b0ac --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogSenhaAdm.cs @@ -0,0 +1,132 @@ +using System; +using System.CodeDom.Compiler; +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.Servicos.Ferramentas; +using Gestor.Common.Helpers; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class DialogSenhaAdm : UserControl, IComponentConnector +{ + internal TextBlock MensagemBlock; + + internal CustomPasswordBox SenhaBox; + + internal TextBlock MensagemErro; + + internal Button ValidarButton; + + internal Button FecharButton; + + private bool _contentLoaded; + + public DialogSenhaAdm(string mensagem) + { + InitializeComponent(); + MensagemBlock.Text = mensagem; + } + + private void PasswordBox_OnKeyDown(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) + { + DialogHost.CloseDialogCommand.Execute((object)Validar(), (IInputElement)(object)ValidarButton); + } + } + + private void ValidarButton_OnClick(object sender, RoutedEventArgs e) + { + if (!Validar()) + { + ((UIElement)MensagemErro).Visibility = (Visibility)0; + } + else + { + DialogHost.CloseDialogCommand.Execute((object)Validar(), (IInputElement)(object)ValidarButton); + } + } + + private void FecharButton_OnClick(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)null, (IInputElement)(object)FecharButton); + } + + private bool Validar() + { + return SenhaBox.Text == EncryptionHelper.Decrypt(new EmpresaServico().BuscarSenhaAdm()); + } + + private void PasswordBox_LostFocus(object sender, RoutedEventArgs e) + { + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogsenhaadm.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_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Expected O, but got Unknown + //IL_005e: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Expected O, but got Unknown + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0075: Expected O, but got Unknown + //IL_0082: Unknown result type (might be due to invalid IL or missing references) + //IL_008c: Expected O, but got Unknown + switch (connectionId) + { + case 1: + MensagemBlock = (TextBlock)target; + break; + case 2: + SenhaBox = (CustomPasswordBox)target; + break; + case 3: + MensagemErro = (TextBlock)target; + break; + case 4: + ValidarButton = (Button)target; + ((ButtonBase)ValidarButton).Click += new RoutedEventHandler(ValidarButton_OnClick); + break; + case 5: + FecharButton = (Button)target; + ((ButtonBase)FecharButton).Click += new RoutedEventHandler(FecharButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogTarefa.cs b/Decompiler/Gestor.Application.Componentes/DialogTarefa.cs new file mode 100644 index 0000000..a177436 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogTarefa.cs @@ -0,0 +1,398 @@ +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.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Input; +using System.Windows.Markup; +using System.Windows.Threading; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using MaterialDesignThemes.Wpf; +using Xceed.Wpf.AvalonDock.Controls; + +namespace Gestor.Application.Componentes; + +public class DialogTarefa : UserControl, IComponentConnector, IStyleConnector +{ + internal Button ClienteButton; + + internal Button ApoliceButton; + + internal Button SinistroButton; + + internal TextBox TituloBox; + + internal DatePicker AgendamentoBox; + + internal RadioButton AnotacoesButton; + + internal TextBox AnotacoesBox; + + internal ComboBox ResponsavelBox; + + internal DatePicker ConclusaoBox; + + internal MenuItem SalvarButton; + + internal Snackbar Snackbar; + + private bool _contentLoaded; + + private DialogTarefaViewModel ViewModel { get; } + + public DialogTarefa(Tarefa tarefa, List<TelefoneBase> telefones, bool nota = false, bool agendamento = false) + { + ViewModel = new DialogTarefaViewModel(tarefa, telefones, nota, agendamento); + ((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 + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_0056: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected I4, but got Unknown + //IL_010d: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Expected O, but got Unknown + ((UIElement)AgendamentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((UIElement)AgendamentoBox).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ViewModel.PermissaoWhatsapp = ViewModel.Restricao((TipoRestricao)32); + TipoTarefa entidade = ViewModel.Tarefa.Entidade; + switch ((int)entidade) + { + default: + ((UIElement)ClienteButton).Visibility = (Visibility)2; + ((UIElement)ApoliceButton).Visibility = (Visibility)2; + break; + case 0: + ((UIElement)ClienteButton).Visibility = (Visibility)0; + ((UIElement)ApoliceButton).Visibility = (Visibility)0; + break; + case 3: + ((UIElement)ClienteButton).Visibility = (Visibility)0; + ((UIElement)ApoliceButton).Visibility = (Visibility)0; + break; + case 2: + ((UIElement)ClienteButton).Visibility = (Visibility)0; + break; + case 4: + ((UIElement)ClienteButton).Visibility = (Visibility)0; + ((UIElement)SinistroButton).Visibility = (Visibility)0; + break; + } + ((ToggleButton)AnotacoesButton).IsChecked = ViewModel.IsAnotacoes; + ((ToggleButton)AnotacoesButton).Checked += new RoutedEventHandler(Anotacoes_OnChecked); + } + + private void Anotacoes_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.IsAnotacoes = true; + } + + private void AnotacoesInternas_OnChecked(object sender, RoutedEventArgs e) + { + ViewModel.IsAnotacoes = false; + } + + private void CopyTelefoneToClipBoard_Click(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Expected O, but got Unknown + TelefoneBase val = (TelefoneBase)((FrameworkElement)(Button)sender).DataContext; + (val.Prefixo + val.Numero).CopyToClipboard(); + ToggleSnackBar("NÚMERO COPIADO COM SUCESSO"); + } + + private async void WhatsAppMessage_Click(object sender, RoutedEventArgs e) + { + TelefoneBase val = (TelefoneBase)((FrameworkElement)(Button)sender).DataContext; + if (!((val.Tipo.HasValue && (int)val.Tipo.GetValueOrDefault() == 8) ? (val.Prefixo + val.Numero).Clear() : ("55" + val.Prefixo + val.Numero.Clear())).EnviarWhatsapp()) + { + 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 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(3000); + Dispatcher dispatcher = ((DispatcherObject)App.ProgressRing).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)4, (Delegate)(Action)delegate + { + ToggleSnackBar("", active: false); + }); + } + } + + private void DatePicker_PreviewKeyDown(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 + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + if ((int)e.Key == 6) + { + ((DatePicker)sender).Text = Funcoes.GetNetworkTime().Date.ToString("dd/MM/yyyy"); + } + } + + private void DatePicker_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) + DatePicker val = (DatePicker)sender; + val.Text = ValidationHelper.FormatDate(val.Text); + } + + private void TimePicker_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + //IL_0007: Expected O, but got Unknown + TimePicker val = (TimePicker)sender; + val.TextBox.Text = ValidationHelper.FormatTime(val.TextBox.Text); + } + + private async void AcessarApolice_OnClick(object sender, RoutedEventArgs e) + { + Documento documentoSelecionado = (((int)ViewModel.Tarefa.Entidade != 3) ? (await ViewModel.CarregaApolice(ViewModel.Tarefa.IdEntidade)) : (await ViewModel.CarregaApoliceParcela(ViewModel.Tarefa.IdEntidade))); + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(documentoSelecionado, lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + ViewModel.Tarefa.Cliente)).Show(); + } + + private async void AcessarCliente_OnClick(object sender, RoutedEventArgs e) + { + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(await ViewModel.CarregaCliente(ViewModel.Tarefa.IdCliente), lockInsert: true), "CADASTRO DE CLIENTE - " + ViewModel.Tarefa.Cliente)).Show(); + } + + private async void AcessarSinistro_OnClick(object sender, RoutedEventArgs e) + { + Sinistro val = await ViewModel.CarregaSinistroApolice(ViewModel.Tarefa.IdEntidade); + ((Window)new HosterWindow((ContentControl)(object)new SinistroView(val.ControleSinistro.Item, attached: false), "CADASTRO DE SINISTRO - " + val.ControleSinistro.Item.Descricao)).Show(); + } + + private void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + ((DatePicker)sender).SelectedDate = Funcoes.GetNetworkTime().Date; + } + + private void AdicionarResponsavel_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdcionarResponsavel(); + } + + private void ExcluirResponsavel_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 + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + Usuario val3 = (Usuario)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.RemoverResponsavel(val3); + } + } + } + + private void MenuItem_OnClick(object sender, RoutedEventArgs e) + { + if (ViewModel.Tarefa.UsuariosVinculados == null) + { + ViewModel.Tarefa.UsuariosVinculados = new List<Usuario>(); + } + DialogHost.CloseDialogCommand.Execute((object)ViewModel.Tarefa, (IInputElement)(object)SalvarButton); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogtarefa.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_004f: Unknown result type (might be due to invalid IL or missing references) + //IL_0059: Expected O, but got Unknown + //IL_0066: Unknown result type (might be due to invalid IL or missing references) + //IL_0070: Expected O, but got Unknown + //IL_0073: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Expected O, but got Unknown + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: 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_00bb: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Expected O, but got Unknown + //IL_00c8: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: Expected O, but got Unknown + //IL_00df: Unknown result type (might be due to invalid IL or missing references) + //IL_00e9: Expected O, but got Unknown + //IL_00f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0100: Expected O, but got Unknown + //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_011d: Unknown result type (might be due to invalid IL or missing references) + //IL_0127: Expected O, but got Unknown + //IL_0129: Unknown result type (might be due to invalid IL or missing references) + //IL_0135: Unknown result type (might be due to invalid IL or missing references) + //IL_013f: Expected O, but got Unknown + //IL_0142: Unknown result type (might be due to invalid IL or missing references) + //IL_014c: Expected O, but got Unknown + //IL_0159: Unknown result type (might be due to invalid IL or missing references) + //IL_0163: Expected O, but got Unknown + //IL_0170: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: 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_01a1: Unknown result type (might be due to invalid IL or missing references) + //IL_01ab: Expected O, but got Unknown + //IL_01ad: Unknown result type (might be due to invalid IL or missing references) + //IL_01b9: Unknown result type (might be due to invalid IL or missing references) + //IL_01c3: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ClienteButton = (Button)target; + ((ButtonBase)ClienteButton).Click += new RoutedEventHandler(AcessarCliente_OnClick); + break; + case 2: + ApoliceButton = (Button)target; + ((ButtonBase)ApoliceButton).Click += new RoutedEventHandler(AcessarApolice_OnClick); + break; + case 3: + SinistroButton = (Button)target; + ((ButtonBase)SinistroButton).Click += new RoutedEventHandler(AcessarSinistro_OnClick); + break; + case 6: + TituloBox = (TextBox)target; + break; + case 7: + AgendamentoBox = (DatePicker)target; + ((UIElement)AgendamentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((Control)AgendamentoBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick); + break; + case 8: + AnotacoesButton = (RadioButton)target; + break; + case 9: + AnotacoesBox = (TextBox)target; + break; + case 10: + ResponsavelBox = (ComboBox)target; + break; + case 11: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(AdicionarResponsavel_OnClick); + break; + case 13: + ConclusaoBox = (DatePicker)target; + ((UIElement)ConclusaoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((Control)ConclusaoBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick); + break; + case 14: + SalvarButton = (MenuItem)target; + SalvarButton.Click += new RoutedEventHandler(MenuItem_OnClick); + break; + case 15: + Snackbar = (Snackbar)target; + break; + case 16: + ((SnackbarMessage)target).ActionClick += new RoutedEventHandler(SnackbarMessage_ActionClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_000f: 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_0025: Expected O, but got Unknown + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_003d: Expected O, but got Unknown + //IL_003f: Unknown result type (might be due to invalid IL or missing references) + //IL_004b: Unknown result type (might be due to invalid IL or missing references) + //IL_0055: Expected O, but got Unknown + switch (connectionId) + { + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CopyTelefoneToClipBoard_Click); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(WhatsAppMessage_Click); + break; + case 12: + ((Chip)target).DeleteClick += new RoutedEventHandler(ExcluirResponsavel_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogTransferencia.cs b/Decompiler/Gestor.Application.Componentes/DialogTransferencia.cs new file mode 100644 index 0000000..f07e81b --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogTransferencia.cs @@ -0,0 +1,116 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using Assinador.Infrastructure.Helpers; +using CurrencyTextBoxControl; +using Gestor.Application.ViewModels.Financeiro; +using Gestor.Common.Validation; +using Gestor.Model.Domain.Financeiro; + +namespace Gestor.Application.Componentes; + +public class DialogTransferencia : UserControl, IComponentConnector +{ + internal ComboBox ContaOrigemBox; + + internal CurrencyTextBox ValorBox; + + internal DatePicker VencimentoBox; + + internal ComboBox ContaDestinoBox; + + private bool _contentLoaded; + + private TranferenciaViewModel ViewModel { get; } + + public DialogTransferencia(Transferencia transferencia) + { + ViewModel = new TranferenciaViewModel(transferencia); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + public void DatePicker_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) + DatePicker val = (DatePicker)sender; + val.Text = ValidationHelper.FormatDate(val.Text); + } + + public void DatePicker_PreviewKeyDown(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 + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + if ((int)e.Key == 6) + { + ((DatePicker)sender).Text = Functions.GetNetworkTime().Date.ToString("dd/MM/yyyy"); + } + } + + private void DataAtual_OnDoubleClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + ((DatePicker)sender).SelectedDate = Functions.GetNetworkTime().Date; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogtransferencia.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_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + //IL_0036: Unknown result type (might be due to invalid IL or missing references) + //IL_0040: Expected O, but got Unknown + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Expected O, but got Unknown + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_007b: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Expected O, but got Unknown + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ContaOrigemBox = (ComboBox)target; + break; + case 2: + ValorBox = (CurrencyTextBox)target; + break; + case 3: + VencimentoBox = (DatePicker)target; + ((UIElement)VencimentoBox).PreviewKeyDown += new KeyEventHandler(DatePicker_PreviewKeyDown); + ((UIElement)VencimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(DatePicker_OnLostKeyboardFocus); + ((Control)VencimentoBox).MouseDoubleClick += new MouseButtonEventHandler(DataAtual_OnDoubleClick); + break; + case 4: + ContaDestinoBox = (ComboBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogTrilha.cs b/Decompiler/Gestor.Application.Componentes/DialogTrilha.cs new file mode 100644 index 0000000..cb766eb --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogTrilha.cs @@ -0,0 +1,143 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using System.Windows.Media; +using Gestor.Application.Helpers; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Ferramentas; + +namespace Gestor.Application.Componentes; + +public class DialogTrilha : UserControl, IComponentConnector, IStyleConnector +{ + private bool _contentLoaded; + + public DialogTrilhaViewModel ViewModel { get; set; } + + public DialogTrilha(DialogTrilhaViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void UIElement_OnGotFocus(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_0021: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Expected O, but got Unknown + DependencyObject parent = VisualTreeHelper.GetParent((DependencyObject)(UIElement)sender); + while (!(parent is ListBoxItem)) + { + if (parent != null) + { + parent = VisualTreeHelper.GetParent(parent); + } + } + ListBoxItem val = (ListBoxItem)parent; + if (!val.IsSelected) + { + val.IsSelected = true; + } + } + + private void AdicionarFase_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.AdicionarFase(); + } + + private void ExcluirFase_OnClick(object sender, RoutedEventArgs e) + { + //IL_0001: Unknown result type (might be due to invalid IL or missing references) + object dataContext = ((FrameworkElement)(Button)sender).DataContext; + Fase val = (Fase)((dataContext is Fase) ? dataContext : null); + if (val != null) + { + ViewModel.ExcluirFase(val); + } + } + + private void UIElement_OnLostFocus(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 + ListBox val = ((DependencyObject)(TextBox)sender).FindAncestor<ListBox>().FirstOrDefault(); + if (val != null) + { + ViewModel.UpdateFase(((Selector)val).SelectedIndex); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogtrilha.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_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + if (connectionId == 1) + { + ((MenuItem)target).Click += new RoutedEventHandler(AdicionarFase_OnClick); + } + else + { + _contentLoaded = true; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0016: 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) + //IL_002c: Expected O, but got Unknown + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_0043: Expected O, but got Unknown + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: 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_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Expected O, but got Unknown + switch (connectionId) + { + case 2: + ((UIElement)(TextBox)target).GotFocus += new RoutedEventHandler(UIElement_OnGotFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(UIElement_OnLostFocus); + break; + case 3: + ((UIElement)(TextBox)target).GotFocus += new RoutedEventHandler(UIElement_OnGotFocus); + ((UIElement)(TextBox)target).LostFocus += new RoutedEventHandler(UIElement_OnLostFocus); + break; + case 4: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ExcluirFase_OnClick); + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/DialogVinculo.cs b/Decompiler/Gestor.Application.Componentes/DialogVinculo.cs new file mode 100644 index 0000000..cfeb995 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/DialogVinculo.cs @@ -0,0 +1,86 @@ +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.Markup; +using Gestor.Application.ViewModels.Generic; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class DialogVinculo : UserControl, IComponentConnector +{ + internal TextBlock TitleBox; + + internal ComboBox TipoVendedorBox; + + internal ComboBox VendedorBox; + + internal ComboBox TipoVendedorVinculoBox; + + internal ComboBox RepasseVinculoBox; + + private bool _contentLoaded; + + private DialogVinculoViewModel ViewModel { get; } + + public DialogVinculo(VinculoRepasse vinculo, List<Repasse> repasses, Repasse repasse) + { + ViewModel = new DialogVinculoViewModel(vinculo, repasses, repasse); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/dialogvinculo.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_0020: Unknown result type (might be due to invalid IL or missing references) + //IL_002a: Expected O, but got Unknown + //IL_002d: Unknown result type (might be due to invalid IL or missing references) + //IL_0037: Expected O, but got Unknown + //IL_003a: Unknown result type (might be due to invalid IL or missing references) + //IL_0044: Expected O, but got Unknown + //IL_0047: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Expected O, but got Unknown + //IL_0054: Unknown result type (might be due to invalid IL or missing references) + //IL_005e: Expected O, but got Unknown + switch (connectionId) + { + case 1: + TitleBox = (TextBlock)target; + break; + case 2: + TipoVendedorBox = (ComboBox)target; + break; + case 3: + VendedorBox = (ComboBox)target; + break; + case 4: + TipoVendedorVinculoBox = (ComboBox)target; + break; + case 5: + RepasseVinculoBox = (ComboBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/ErrorDialog.cs b/Decompiler/Gestor.Application.Componentes/ErrorDialog.cs new file mode 100644 index 0000000..44875f5 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/ErrorDialog.cs @@ -0,0 +1,39 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Markup; +using Gestor.Application.Views.Generic; + +namespace Gestor.Application.Componentes; + +public class ErrorDialog : BaseUserControl, IComponentConnector +{ + private bool _contentLoaded; + + public ErrorDialog() + { + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/errordialog.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) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/GridRelatorio.cs b/Decompiler/Gestor.Application.Componentes/GridRelatorio.cs new file mode 100644 index 0000000..9a107ae --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/GridRelatorio.cs @@ -0,0 +1,607 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Data; +using System.Windows.Markup; +using Gestor.Application.Drawers; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos; +using Gestor.Application.Servicos.Seguros; +using Gestor.Application.ViewModels.Generic; +using Gestor.Application.ViewModels.Relatorios; +using Gestor.Application.Views.Generic; +using Gestor.Application.Views.Seguros; +using Gestor.Application.Views.Seguros.Itens; +using Gestor.Common.Validation; +using Gestor.Model.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios.ApolicePendente; +using Gestor.Model.Domain.Relatorios.Log; +using Gestor.Model.Domain.Relatorios.LogsEnvio; +using Gestor.Model.Domain.Relatorios.Sinistro; +using Gestor.Model.Domain.Relatorios.Tarefa; +using Gestor.Model.Domain.Seguros; + +namespace Gestor.Application.Componentes; + +public class GridRelatorio : UserControl, IComponentConnector, IStyleConnector +{ + internal Grid LayoutRoot; + + internal DataGrid DataGrid; + + internal DataGridTemplateColumn InfoButton; + + internal DataGridTemplateColumn ArquivoButton; + + internal DataGridTemplateColumn VinculoButton; + + internal DataGridTemplateColumn CalculoButton; + + internal DataGridTemplateColumn AssinaturaButton; + + internal Expander Totalizacao; + + internal ItemsControl SinteticoGrid; + + private bool _contentLoaded; + + private RelatorioViewModel ViewModel { get; } + + private int _index { get; set; } = -1; + + + private ListSortDirection _sortDirection { get; set; } + + public GridRelatorio(RelatorioViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + ViewModel.Totalizacao = true; + InitializeComponent(); + ((FrameworkElement)LayoutRoot).DataContext = this; + TipoRelatorio(); + } + + private void TipoRelatorio() + { + //IL_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Invalid comparison between Unknown and I4 + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Invalid comparison between Unknown and I4 + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_004c: Invalid comparison between Unknown and I4 + //IL_005d: Unknown result type (might be due to invalid IL or missing references) + //IL_010f: Unknown result type (might be due to invalid IL or missing references) + //IL_0114: Unknown result type (might be due to invalid IL or missing references) + //IL_0115: Unknown result type (might be due to invalid IL or missing references) + //IL_0118: Invalid comparison between Unknown and I4 + //IL_0127: Unknown result type (might be due to invalid IL or missing references) + //IL_012a: Unknown result type (might be due to invalid IL or missing references) + //IL_012c: Invalid comparison between Unknown and I4 + //IL_011a: Unknown result type (might be due to invalid IL or missing references) + //IL_011c: Invalid comparison between Unknown and I4 + //IL_012e: Unknown result type (might be due to invalid IL or missing references) + //IL_0131: Invalid comparison between Unknown and I4 + //IL_011e: Unknown result type (might be due to invalid IL or missing references) + //IL_0121: Unknown result type (might be due to invalid IL or missing references) + //IL_0123: Invalid comparison between Unknown and I4 + ((DataGridColumn)AssinaturaButton).Visibility = (Visibility)(((int)ViewModel.Relatorio != 2) ? 2 : 0); + ((DataGridColumn)VinculoButton).Visibility = (Visibility)(((int)ViewModel.Relatorio != 3) ? 2 : 0); + ((DataGridColumn)CalculoButton).Visibility = (Visibility)(((int)ViewModel.Relatorio != 4) ? 2 : 0); + string tipo = ValidationHelper.GetTipo((Enum)(object)ViewModel.Relatorio); + switch (tipo) + { + case "FECHAMENTO": + case "NOTA FISCAL": + ((DataGridColumn)InfoButton).Visibility = (Visibility)2; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + break; + case "TAREFA": + ((DataGridColumn)InfoButton).Visibility = (Visibility)0; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + break; + case "EXTRATO": + ((DataGridColumn)InfoButton).Visibility = (Visibility)2; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)0; + break; + default: + ((DataGridColumn)InfoButton).Visibility = (Visibility)0; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)0; + break; + } + Relatorio relatorio = ViewModel.Relatorio; + if ((int)relatorio <= 15) + { + if ((int)relatorio != 8) + { + if (relatorio - 14 <= 1) + { + goto IL_014f; + } + } + else + { + ((DataGridColumn)InfoButton).Visibility = (Visibility)0; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)0; + } + } + else if (relatorio - 24 > 1) + { + if ((int)relatorio == 26) + { + goto IL_014f; + } + } + else + { + ((DataGridColumn)InfoButton).Visibility = (Visibility)0; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + } + goto IL_0181; + IL_0181: + ((UIElement)Totalizacao).Visibility = (Visibility)((!ViewModel.Totais) ? 2 : 0); + if (string.IsNullOrWhiteSpace(tipo)) + { + ((DataGridColumn)InfoButton).Visibility = (Visibility)2; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + } + return; + IL_014f: + ((DataGridColumn)InfoButton).Visibility = (Visibility)2; + ((DataGridColumn)ArquivoButton).Visibility = (Visibility)2; + goto IL_0181; + } + + private async void ArquivoDigital_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + object dataContext = ((FrameworkElement)val).DataContext; + FiltroArquivoDigital val2 = null; + switch (ValidationHelper.GetTipo((Enum)(object)ViewModel.Relatorio)) + { + case "CLIENTE": + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)1).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)1) + "."); + return; + } + if ((int)ViewModel.Relatorio == 17) + { + Item item = dataContext.GetValueFromType<Item>(); + Documento valueFromType3 = ((FrameworkElement)val).DataContext.GetValueFromType<Documento>(); + if (item == null) + { + return; + } + item.Documento = await new ApoliceServico().BuscarApoliceAsync(((DomainBase)valueFromType3).Id); + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)item).Id, + Tipo = (TipoArquivoDigital)4, + Parente = item + }; + } + else + { + Cliente valueFromType4 = dataContext.GetValueFromType<Cliente>(); + if (valueFromType4 == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType4).Id, + Tipo = (TipoArquivoDigital)1, + Parente = valueFromType4 + }; + } + break; + case "FECHAMENTO": + case "DOCUMENTO": + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)2).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)2) + "."); + return; + } + Documento valueFromType5 = dataContext.GetValueFromType<Documento>(); + if (valueFromType5 == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType5).Id, + Tipo = (TipoArquivoDigital)2, + Parente = valueFromType5 + }; + break; + } + case "PARCELA": + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)3).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)3) + "."); + return; + } + Parcela valueFromType2 = dataContext.GetValueFromType<Parcela>(); + if (valueFromType2 == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType2).Id, + IdApolice = ((DomainBase)valueFromType2.Documento).Id, + Tipo = (TipoArquivoDigital)3, + Parente = valueFromType2 + }; + break; + } + case "SINISTRO": + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)5).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)5) + "."); + return; + } + Sinistro valueFromType6 = dataContext.GetValueFromType<Sinistro>(); + if (valueFromType6 == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType6).Id, + IdApolice = ((DomainBase)valueFromType6.ControleSinistro.Item.Documento).Id, + Tipo = (TipoArquivoDigital)5, + Parente = valueFromType6 + }; + break; + } + case "EXTRATO": + { + if (!new PermissaoArquivoDigitalServico().BuscarPermissao(Recursos.Usuario, (TipoArquivoDigital)7).Consultar) + { + await ViewModel.ShowMessage("VOCÊ NÃO POSSUI PERMISSÃO PARA ACESSAR\nARQUIVO DIGITAL DE " + ValidationHelper.GetDescription((Enum)(object)(TipoArquivoDigital)7) + "."); + return; + } + Extrato valueFromType = dataContext.GetValueFromType<Extrato>(); + if (valueFromType == null) + { + return; + } + val2 = new FiltroArquivoDigital + { + Id = ((DomainBase)valueFromType).Id, + Tipo = (TipoArquivoDigital)7, + Parente = valueFromType + }; + break; + } + } + if (val2 == null) + { + await ViewModel.ShowMessage("ESSE TIPO DE RELATÓRIO NÃO POSSUI ARQUIVO DIGITAL"); + } + else + { + new BaseSegurosViewModel().ShowDrawer(new ArquivoDigitalDrawer(val2), 0, close: false); + } + } + + private async void CheckBox_Checked(object sender, RoutedEventArgs e) + { + ViewModel.Carregando = true; + ViewModel.IsEnabled = false; + await ViewModel.Selecionar(); + ViewModel.IsEnabled = true; + ViewModel.Carregando = false; + } + + private async void MaisInformacoes_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext == null) + { + return; + } + string tipo = ValidationHelper.GetTipo((Enum)(object)ViewModel.Relatorio); + if ((int)ViewModel.Relatorio == 17) + { + Item valueFromType = ((FrameworkElement)val).DataContext.GetValueFromType<Item>(); + Documento valueFromType2 = ((FrameworkElement)val).DataContext.GetValueFromType<Documento>(); + if (valueFromType != null) + { + valueFromType.Documento = valueFromType2; + ((Window)new HosterWindow((ContentControl)(object)new AutoView(null, lockInsert: true, substituir: false, null, valueFromType, valueFromType2.Controle.Ramo), "CADASTRO DE ITENS DO CLIENTE - " + valueFromType2.Controle.Cliente.Nome)).ShowDialog(); + } + } + else if ((int)ViewModel.Relatorio == 4 && ((FrameworkElement)val).DataContext.GetValueFromType<Prospeccao>() != null) + { + TipoDocumento valueFromType3 = ((FrameworkElement)val).DataContext.GetValueFromType<TipoDocumento>(); + if (((object)(TipoDocumento)(ref valueFromType3)).ToString() == "PROSPECÇÃO") + { + return; + } + Prospeccao val2 = await ViewModel.ShowProspeccaoDialog(((FrameworkElement)val).DataContext.GetValueFromType<Prospeccao>()); + if (val2 != null) + { + List<KeyValuePair<string, string>> list = await ViewModel.SalvarProspeccao(val2); + if (list != null && list.Count >= 1) + { + await ViewModel.ShowMessage(list, ViewModel.ErroCamposInvalidos, "OK"); + } + } + } + else + { + if (tipo == null) + { + return; + } + Documento valueFromType4; + switch (tipo.Length) + { + case 7: + switch (tipo[0]) + { + case 'C': + if (tipo == "CLIENTE") + { + Cliente valueFromType7 = ((FrameworkElement)val).DataContext.GetValueFromType<Cliente>(); + if (valueFromType7 != null) + { + valueFromType7 = await new ClienteServico().BuscarClienteAsync(((DomainBase)valueFromType7).Id); + ((Window)new HosterWindow((ContentControl)(object)new ClienteView(valueFromType7, lockInsert: true), "CADASTRO DE CLIENTES - " + valueFromType7.Nome)).ShowDialog(); + } + } + break; + case 'P': + { + if (!(tipo == "PARCELA")) + { + break; + } + Documento valueFromType5 = ((FrameworkElement)val).DataContext.GetValueFromType<Documento>(); + if (valueFromType5 != null) + { + Parcela valueFromType6 = ((FrameworkElement)val).DataContext.GetValueFromType<Parcela>(); + if (valueFromType6 != null) + { + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(valueFromType5, lockInsert: true, invoke: false, (AcessoApolice)1, ((DomainBase)valueFromType6).Id), "CADASTRO DE APÓLICES - " + valueFromType5.Controle.Cliente.Nome)).Show(); + } + } + break; + } + } + break; + case 10: + if (!(tipo == "FECHAMENTO")) + { + break; + } + goto IL_0453; + case 9: + if (!(tipo == "DOCUMENTO")) + { + break; + } + goto IL_0453; + case 8: + if (tipo == "SINISTRO") + { + Sinistro sinistroInfo = (Sinistro)((FrameworkElement)val).DataContext; + Sinistro valueFromType8 = ((FrameworkElement)val).DataContext.GetValueFromType<Sinistro>(); + if (valueFromType8 != null) + { + ((Window)new HosterWindow((ContentControl)(object)new SinistroView((await ViewModel.CarregaSinistroApolice(((DomainBase)valueFromType8).Id)).ControleSinistro.Item, attached: false), "CADASTRO DE SINISTROS - " + sinistroInfo.Nome + " - " + sinistroInfo.Apolice + " " + sinistroInfo.Endosso)).Show(); + } + } + break; + case 6: + if (tipo == "TAREFA") + { + Tarefa val4 = (Tarefa)((FrameworkElement)val).DataContext; + Tarefa tarefa = new Tarefa + { + Id = val4.Id, + IdCliente = val4.IdCliente, + Cliente = val4.Cliente, + IdEntidade = val4.IdEntidade, + Entidade = val4.Entidade, + Conclusao = val4.Conclusao + }; + ViewModel.ShowDrawer(new TarefaDrawer(tarefa, enableMenu: false), 0, close: false); + } + break; + case 4: + { + if (tipo == "LOGS") + { + if (((FrameworkElement)val).DataContext is LogAcaoRelatorio) + { + ViewModel.ShowDrawer(new LogUtilizacaoDrawer(((LogAcaoRelatorio)((FrameworkElement)val).DataContext).RegistroEntity, ViewModel.Relatorio), 0, close: false); + break; + } + LogsEnvio val3 = (LogsEnvio)((FrameworkElement)val).DataContext; + ViewModel.ShowDrawer(new LogEmailDrawer((TipoTela)17, val3.Id, singleMode: true), 0, close: false); + } + break; + } + IL_0453: + valueFromType4 = ((FrameworkElement)val).DataContext.GetValueFromType<Documento>(); + if (valueFromType4 != null) + { + valueFromType4 = await new ApoliceServico().BuscarApoliceAsync(((DomainBase)valueFromType4).Id); + ((Window)new HosterWindow((ContentControl)(object)new ApoliceView(valueFromType4, lockInsert: true, invoke: false, (AcessoApolice)0, 0L), "CADASTRO DE APÓLICES - " + valueFromType4.Controle.Cliente.Nome)).Show(); + } + break; + } + } + } + + private void Totalizacao_OnCollapsedExpanded(object sender, RoutedEventArgs e) + { + ViewModel.Totalizacao = Totalizacao.IsExpanded; + } + + private async void Vinculo_OnClick(object sender, RoutedEventArgs e) + { + Button val = (Button)sender; + if (((FrameworkElement)val).DataContext != null) + { + ApolicePendente pendencia = (ApolicePendente)((FrameworkElement)val).DataContext; + await ViewModel.RemoverVinculo(pendencia); + } + } + + private void Grid_Sorting(object sender, DataGridSortingEventArgs e) + { + _index = ((DataGridColumnEventArgs)e).Column.DisplayIndex; + _sortDirection = ((((DataGridColumnEventArgs)e).Column.SortDirection == ListSortDirection.Ascending) ? ListSortDirection.Descending : ListSortDirection.Ascending); + } + + public void SortDataGrid() + { + //IL_0048: Unknown result type (might be due to invalid IL or missing references) + DataGridColumn val = DataGrid.Columns[_index]; + ((Collection<SortDescription>)(object)((CollectionView)((ItemsControl)DataGrid).Items).SortDescriptions).Clear(); + ((Collection<SortDescription>)(object)((CollectionView)((ItemsControl)DataGrid).Items).SortDescriptions).Add(new SortDescription(val.SortMemberPath, _sortDirection)); + foreach (DataGridColumn column in DataGrid.Columns) + { + column.SortDirection = null; + } + val.SortDirection = _sortDirection; + ((CollectionView)((ItemsControl)DataGrid).Items).Refresh(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/gridrelatorio.xaml", UriKind.Relative); + Application.LoadComponent((object)this, uri); + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IComponentConnector.Connect(int connectionId, object target) + { + //IL_0043: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Expected O, but got Unknown + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Expected O, but got Unknown + //IL_0067: Unknown result type (might be due to invalid IL or missing references) + //IL_0071: Expected O, but got Unknown + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_007e: Expected O, but got Unknown + //IL_0081: Unknown result type (might be due to invalid IL or missing references) + //IL_008b: Expected O, but got Unknown + //IL_008e: Unknown result type (might be due to invalid IL or missing references) + //IL_0098: Expected O, but got Unknown + //IL_009b: Unknown result type (might be due to invalid IL or missing references) + //IL_00a5: Expected O, but got Unknown + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Expected O, but got Unknown + //IL_00b5: Unknown result type (might be due to invalid IL or missing references) + //IL_00bf: Expected O, but got Unknown + //IL_00cc: Unknown result type (might be due to invalid IL or missing references) + //IL_00d6: Expected O, but got Unknown + //IL_00e3: Unknown result type (might be due to invalid IL or missing references) + //IL_00ed: Expected O, but got Unknown + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fa: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LayoutRoot = (Grid)target; + break; + case 2: + DataGrid = (DataGrid)target; + DataGrid.Sorting += new DataGridSortingEventHandler(Grid_Sorting); + break; + case 4: + InfoButton = (DataGridTemplateColumn)target; + break; + case 6: + ArquivoButton = (DataGridTemplateColumn)target; + break; + case 8: + VinculoButton = (DataGridTemplateColumn)target; + break; + case 10: + CalculoButton = (DataGridTemplateColumn)target; + break; + case 11: + AssinaturaButton = (DataGridTemplateColumn)target; + break; + case 12: + Totalizacao = (Expander)target; + Totalizacao.Collapsed += new RoutedEventHandler(Totalizacao_OnCollapsedExpanded); + Totalizacao.Expanded += new RoutedEventHandler(Totalizacao_OnCollapsedExpanded); + break; + case 13: + SinteticoGrid = (ItemsControl)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0032: Unknown result type (might be due to invalid IL or missing references) + //IL_003c: Expected O, but got Unknown + //IL_003d: Unknown result type (might be due to invalid IL or missing references) + //IL_0049: Unknown result type (might be due to invalid IL or missing references) + //IL_0053: Expected O, but got Unknown + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Unknown result type (might be due to invalid IL or missing references) + //IL_006b: Expected O, but got Unknown + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Expected O, but got Unknown + //IL_0085: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Expected O, but got Unknown + switch (connectionId) + { + case 3: + ((ToggleButton)(CheckBox)target).Checked += new RoutedEventHandler(CheckBox_Checked); + ((ToggleButton)(CheckBox)target).Unchecked += new RoutedEventHandler(CheckBox_Checked); + break; + case 5: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(MaisInformacoes_OnClick); + break; + case 7: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(ArquivoDigital_OnClick); + break; + case 9: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Vinculo_OnClick); + break; + case 4: + case 6: + case 8: + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/Loading.cs b/Decompiler/Gestor.Application.Componentes/Loading.cs new file mode 100644 index 0000000..eed4f86 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/Loading.cs @@ -0,0 +1,39 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Markup; + +namespace Gestor.Application.Componentes; + +public class Loading : UserControl, IComponentConnector +{ + private bool _contentLoaded; + + public Loading() + { + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/loading.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) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/NRecoHtmlToPdfConverter.cs b/Decompiler/Gestor.Application.Componentes/NRecoHtmlToPdfConverter.cs new file mode 100644 index 0000000..6c4e8a3 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/NRecoHtmlToPdfConverter.cs @@ -0,0 +1,11 @@ +using NReco.PdfGenerator; + +namespace Gestor.Application.Componentes; + +public class NRecoHtmlToPdfConverter : HtmlToPdfConverter +{ + public NRecoHtmlToPdfConverter() + { + ((HtmlToPdfConverter)this).License.SetLicenseKey("PDF_Generator_Src_Examples_Pack_255474111334", "UN0G/w7zqQQlt19OtYHW14aK3o8N3sZ5gRq2SELQQjGKYV3luQETgIdsDxPl8e9ZYkRKlglzhNvxi7abVpvWeNYrTp45eL2lRgSIhMhV9Atpy1C12yBt/zG7141kzYD7hT9dmayX5d98MB0DPPlFL3A8b15f6w1qZ9ZVqBFE0w0="); + } +} diff --git a/Decompiler/Gestor.Application.Componentes/PassBox.cs b/Decompiler/Gestor.Application.Componentes/PassBox.cs new file mode 100644 index 0000000..7c25773 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/PassBox.cs @@ -0,0 +1,208 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Common.Validation; + +namespace Gestor.Application.Componentes; + +public class PassBox : UserControl, IComponentConnector +{ + public static readonly DependencyProperty ValueProperty = DependencyProperty.Register("Value", typeof(string), typeof(PassBox), (PropertyMetadata)new FrameworkPropertyMetadata((object)null, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty HintProperty = DependencyProperty.Register("Hint", typeof(string), typeof(PassBox), (PropertyMetadata)new FrameworkPropertyMetadata((object)"SENHA", (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty PasswordWidthProperty = DependencyProperty.Register("PasswordWidth", typeof(string), typeof(PassBox), new PropertyMetadata((object)null, new PropertyChangedCallback(OnBoundWidthChanged))); + + private bool _hidePasswordView; + + internal Grid LayoutRoot; + + internal Button ShowHidePassword; + + internal PasswordBox TextPassword; + + internal TextBox TextPasswordVisible; + + private bool _contentLoaded; + + public bool Visible { get; set; } + + public string Value + { + get + { + return (string)((DependencyObject)this).GetValue(ValueProperty); + } + set + { + ((DependencyObject)this).SetValue(ValueProperty, (object)value); + } + } + + public string Hint + { + get + { + return (string)((DependencyObject)this).GetValue(HintProperty); + } + set + { + ((DependencyObject)this).SetValue(HintProperty, (object)value); + } + } + + public string PasswordWidth + { + get + { + return (string)((DependencyObject)this).GetValue(PasswordWidthProperty); + } + set + { + ((DependencyObject)this).SetValue(PasswordWidthProperty, (object)value); + } + } + + public bool HidePasswordView + { + get + { + return _hidePasswordView; + } + set + { + if (value) + { + HidePassword(); + } + } + } + + private static void OnBoundWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + PassBox passBox = d as PassBox; + if (d != null && passBox != null) + { + string text = (string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + if (ValidationHelper.ValidateDouble(text)) + { + ((FrameworkElement)passBox.TextPassword).MinWidth = double.Parse(text); + ((FrameworkElement)passBox.TextPasswordVisible).MinWidth = double.Parse(text); + } + } + } + + public PassBox() + { + InitializeComponent(); + ((FrameworkElement)LayoutRoot).DataContext = this; + } + + public void ShowPassword() + { + ((UIElement)TextPasswordVisible).Visibility = (Visibility)0; + ((UIElement)TextPassword).Visibility = (Visibility)1; + ((UIElement)TextPasswordVisible).Focus(); + Visible = true; + } + + public void HidePassword() + { + ((UIElement)TextPasswordVisible).Visibility = (Visibility)1; + ((UIElement)TextPassword).Visibility = (Visibility)0; + ((UIElement)TextPassword).Focus(); + Visible = false; + } + + private void TextPassword_PasswordChanged(object sender, RoutedEventArgs e) + { + } + + private void ShowHidePassword_OnClick(object sender, RoutedEventArgs e) + { + if (Visible) + { + HidePassword(); + } + else + { + ShowPassword(); + } + } + + private void ShowHidePassword_OnMouseDown(object sender, MouseButtonEventArgs e) + { + ShowPassword(); + } + + private void ShowHidePassword_OnMouseUp(object sender, MouseButtonEventArgs e) + { + HidePassword(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/passbox.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_001c: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Expected O, but got Unknown + //IL_0029: Unknown result type (might be due to invalid IL or missing references) + //IL_0033: Expected O, but got Unknown + //IL_0040: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Expected O, but got Unknown + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0061: Expected O, but got Unknown + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + //IL_007b: Unknown result type (might be due to invalid IL or missing references) + //IL_0085: Expected O, but got Unknown + //IL_0088: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LayoutRoot = (Grid)target; + break; + case 2: + ShowHidePassword = (Button)target; + ((UIElement)ShowHidePassword).PreviewMouseDown += new MouseButtonEventHandler(ShowHidePassword_OnMouseDown); + ((UIElement)ShowHidePassword).PreviewMouseUp += new MouseButtonEventHandler(ShowHidePassword_OnMouseUp); + break; + case 3: + TextPassword = (PasswordBox)target; + TextPassword.PasswordChanged += new RoutedEventHandler(TextPassword_PasswordChanged); + break; + case 4: + TextPasswordVisible = (TextBox)target; + break; + default: + _contentLoaded = true; + break; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/ProgressDialog.cs b/Decompiler/Gestor.Application.Componentes/ProgressDialog.cs new file mode 100644 index 0000000..14474a7 --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/ProgressDialog.cs @@ -0,0 +1,39 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Markup; +using Gestor.Application.Views.Generic; + +namespace Gestor.Application.Componentes; + +public class ProgressDialog : BaseUserControl, IComponentConnector +{ + private bool _contentLoaded; + + public ProgressDialog() + { + InitializeComponent(); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/progressdialog.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) + { + _contentLoaded = true; + } +} diff --git a/Decompiler/Gestor.Application.Componentes/ProspeccaoDialog.cs b/Decompiler/Gestor.Application.Componentes/ProspeccaoDialog.cs new file mode 100644 index 0000000..e74440f --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/ProspeccaoDialog.cs @@ -0,0 +1,334 @@ +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.Data; +using System.Windows.Input; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Generic; +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.Componentes; + +public class ProspeccaoDialog : BaseUserControl, IComponentConnector, IStyleConnector +{ + public DialogProspeccaoViewModel ViewModel; + + internal TextBox DocumentoBox; + + internal DatePicker NascimentoBox; + + internal TextBox Prefixo1Box; + + internal TextBox Telefone1Box; + + internal TextBox Prefixo2Box; + + internal TextBox Telefone2Box; + + internal TextBox EmailBox; + + internal MenuItem SalvarButton; + + private bool _contentLoaded; + + public ProspeccaoDialog(Prospeccao prospeccao) + { + ViewModel = new DialogProspeccaoViewModel(prospeccao); + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void DocumentoBox_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 AutoCompleteBox_Populating(object sender, PopulatingEventArgs e) + { + if (e.Parameter.Trim().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 AutoCompleteBox_LostFocus(object sender, RoutedEventArgs e) + { + AutoCompleteBox val = (AutoCompleteBox)sender; + if (val.SelectedItem == null) + { + return; + } + Cliente val2 = await ViewModel.BuscarInfoCliente((Cliente)val.SelectedItem); + DocumentoBox.Text = val2.Documento; + NascimentoBox.SelectedDate = val2.Nascimento; + ObservableCollection<ClienteTelefone> telefones = val2.Telefones; + ClienteTelefone val3 = ((telefones != null && telefones.Count > 0) ? val2.Telefones[0] : null); + if (val3 != null && ((TelefoneBase)val3).Prefixo != null) + { + Prefixo1Box.Text = ((val3 != null) ? ((TelefoneBase)val3).Prefixo : null); + } + if (val3 != null && ((TelefoneBase)val3).Numero != null) + { + Telefone1Box.Text = ((val3 != null) ? ((TelefoneBase)val3).Numero : null); + } + ObservableCollection<ClienteTelefone> telefones2 = val2.Telefones; + ClienteTelefone val4 = ((telefones2 != null && telefones2.Count > 1) ? val2.Telefones[1] : null); + if (val4 != null && ((TelefoneBase)val4).Prefixo != null) + { + Prefixo2Box.Text = ((val4 != null) ? ((TelefoneBase)val4).Prefixo : null); + } + if (val4 != null && ((TelefoneBase)val4).Numero != null) + { + Telefone2Box.Text = ((val4 != null) ? ((TelefoneBase)val4).Numero : null); + } + ObservableCollection<ClienteEmail> emails = val2.Emails; + object obj; + if (emails == null) + { + obj = null; + } + else + { + ClienteEmail? obj2 = emails.FirstOrDefault(); + obj = ((obj2 != null) ? ((EmailBase)obj2).Email : null); + } + if (obj != null) + { + TextBox emailBox = EmailBox; + ObservableCollection<ClienteEmail> emails2 = val2.Emails; + object text; + if (emails2 == null) + { + text = null; + } + else + { + ClienteEmail? obj3 = emails2.FirstOrDefault(); + text = ((obj3 != null) ? ((EmailBase)obj3).Email : null); + } + emailBox.Text = (string)text; + } + } + + private void DeleteArquivo_OnDeleteClick(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 + Chip val = (Chip)((sender is Chip) ? sender : null); + if (val != null) + { + ListBox val2 = Extentions.FindVisualAncestor<ListBox>((DependencyObject)(object)val); + ArquivoDigital val3 = (ArquivoDigital)((ItemsControl)val2).Items[((CollectionView)((ItemsControl)val2).Items).IndexOf(((FrameworkElement)val).DataContext)]; + if (val3 != null) + { + ViewModel.Delete(val3); + } + } + } + + private void AnexarArquivos_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.Anexar(); + } + + private void SalvarButton_OnClick(object sender, RoutedEventArgs e) + { + ViewModel.SelectedProspeccao.Anexos = ViewModel.ArquivosAnexados?.ToList(); + DialogHost.CloseDialogCommand.Execute((object)ViewModel.SelectedProspeccao, (IInputElement)(object)SalvarButton); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/prospeccaodialog.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_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + //IL_006f: Expected O, but got Unknown + //IL_0072: Unknown result type (might be due to invalid IL or missing references) + //IL_007c: Expected O, but got Unknown + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0094: Expected O, but got Unknown + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ab: 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_0100: Unknown result type (might be due to invalid IL or missing references) + //IL_010a: Expected O, but got Unknown + //IL_0118: Unknown result type (might be due to invalid IL or missing references) + //IL_0122: Expected O, but got Unknown + //IL_0125: Unknown result type (might be due to invalid IL or missing references) + //IL_012f: 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_0155: Unknown result type (might be due to invalid IL or missing references) + //IL_015f: 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_017a: Unknown result type (might be due to invalid IL or missing references) + //IL_0184: Expected O, but got Unknown + //IL_0187: Unknown result type (might be due to invalid IL or missing references) + //IL_0191: 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 + //IL_01b7: Unknown result type (might be due to invalid IL or missing references) + //IL_01c1: Expected O, but got Unknown + //IL_01c4: Unknown result type (might be due to invalid IL or missing references) + //IL_01ce: Expected O, but got Unknown + //IL_01d0: Unknown result type (might be due to invalid IL or missing references) + //IL_01dc: Unknown result type (might be due to invalid IL or missing references) + //IL_01e6: Expected O, but got Unknown + //IL_01e7: Unknown result type (might be due to invalid IL or missing references) + //IL_01f3: Unknown result type (might be due to invalid IL or missing references) + //IL_01fd: Expected O, but got Unknown + //IL_01fe: Unknown result type (might be due to invalid IL or missing references) + //IL_020a: Unknown result type (might be due to invalid IL or missing references) + //IL_0214: Expected O, but got Unknown + //IL_0216: Unknown result type (might be due to invalid IL or missing references) + //IL_0222: Unknown result type (might be due to invalid IL or missing references) + //IL_022c: Expected O, but got Unknown + //IL_022d: Unknown result type (might be due to invalid IL or missing references) + //IL_0239: Unknown result type (might be due to invalid IL or missing references) + //IL_0243: Expected O, but got Unknown + //IL_0244: Unknown result type (might be due to invalid IL or missing references) + //IL_0250: Unknown result type (might be due to invalid IL or missing references) + //IL_025a: Expected O, but got Unknown + //IL_025c: Unknown result type (might be due to invalid IL or missing references) + //IL_0268: Unknown result type (might be due to invalid IL or missing references) + //IL_0272: Expected O, but got Unknown + //IL_0275: Unknown result type (might be due to invalid IL or missing references) + //IL_027f: Expected O, but got Unknown + //IL_028c: Unknown result type (might be due to invalid IL or missing references) + //IL_0296: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((AutoCompleteBox)target).Populating += new PopulatingEventHandler(AutoCompleteBox_Populating); + ((UIElement)(AutoCompleteBox)target).LostFocus += new RoutedEventHandler(AutoCompleteBox_LostFocus); + break; + case 2: + DocumentoBox = (TextBox)target; + ((UIElement)DocumentoBox).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + ((UIElement)DocumentoBox).LostFocus += new RoutedEventHandler(DocumentoBox_OnLostFocus); + break; + case 3: + NascimentoBox = (DatePicker)target; + ((UIElement)NascimentoBox).LostKeyboardFocus += new KeyboardFocusChangedEventHandler(base.DatePicker_OnLostKeyboardFocus); + ((Control)NascimentoBox).MouseDoubleClick += new MouseButtonEventHandler(base.DataAtual_OnDoubleClick); + ((UIElement)NascimentoBox).PreviewKeyDown += new KeyEventHandler(base.DatePicker_PreviewKeyDown); + break; + case 4: + Prefixo1Box = (TextBox)target; + ((UIElement)Prefixo1Box).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 5: + Telefone1Box = (TextBox)target; + ((UIElement)Telefone1Box).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)Telefone1Box).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 6: + Prefixo2Box = (TextBox)target; + ((UIElement)Prefixo2Box).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 7: + Telefone2Box = (TextBox)target; + ((UIElement)Telefone2Box).LostFocus += new RoutedEventHandler(FormatarTelefone); + ((UIElement)Telefone2Box).PreviewTextInput += new TextCompositionEventHandler(SomenteNumeros); + break; + case 8: + EmailBox = (TextBox)target; + break; + case 9: + ((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 10: + ((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 12: + ((MenuItem)target).Click += new RoutedEventHandler(AnexarArquivos_OnClick); + break; + case 13: + SalvarButton = (MenuItem)target; + SalvarButton.Click += new RoutedEventHandler(SalvarButton_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + if (connectionId == 11) + { + ((Chip)target).DeleteClick += new RoutedEventHandler(DeleteArquivo_OnDeleteClick); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/VincularLancamentoDialog.cs b/Decompiler/Gestor.Application.Componentes/VincularLancamentoDialog.cs new file mode 100644 index 0000000..498557e --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/VincularLancamentoDialog.cs @@ -0,0 +1,84 @@ +using System; +using System.CodeDom.Compiler; +using System.ComponentModel; +using System.Diagnostics; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Markup; +using Gestor.Application.ViewModels.Financeiro; +using MaterialDesignThemes.Wpf; + +namespace Gestor.Application.Componentes; + +public class VincularLancamentoDialog : UserControl, IComponentConnector, IStyleConnector +{ + internal DataGrid LancamentoGrid; + + internal Button CancelarButton; + + private bool _contentLoaded; + + public FinanceiroViewModel ViewModel { get; set; } + + public VincularLancamentoDialog(FinanceiroViewModel viewModel) + { + ViewModel = viewModel; + ((FrameworkElement)this).DataContext = ViewModel; + InitializeComponent(); + } + + private void Button_Click(object sender, RoutedEventArgs e) + { + DialogHost.CloseDialogCommand.Execute((object)ViewModel.LancamentoVinculo, (IInputElement)(object)CancelarButton); + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/vincularlancamentodialog.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_000c: Unknown result type (might be due to invalid IL or missing references) + //IL_0016: Expected O, but got Unknown + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + //IL_0023: Expected O, but got Unknown + switch (connectionId) + { + case 1: + LancamentoGrid = (DataGrid)target; + break; + case 3: + CancelarButton = (Button)target; + break; + default: + _contentLoaded = true; + break; + } + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + [EditorBrowsable(EditorBrowsableState.Never)] + void IStyleConnector.Connect(int connectionId, object target) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Expected O, but got Unknown + if (connectionId == 2) + { + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(Button_Click); + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/WebBrowser.cs b/Decompiler/Gestor.Application.Componentes/WebBrowser.cs new file mode 100644 index 0000000..57a468f --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/WebBrowser.cs @@ -0,0 +1,199 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.Net; +using System.Reflection; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Interop; +using System.Windows.Markup; +using System.Windows.Navigation; +using System.Windows.Threading; +using Gestor.Application.Properties; +using HtmlAgilityPack; +using mshtml; + +namespace Gestor.Application.Componentes; + +public class WebBrowser : UserControl, IComponentConnector +{ + public HTMLDocument HtmlDocument; + + public WebBrowser Browser; + + public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(WebBrowser), new PropertyMetadata((object)false)); + + internal Grid GridWebBrowser; + + private bool _contentLoaded; + + public bool IsReadOnly + { + get + { + return (bool)((DependencyObject)this).GetValue(IsReadOnlyProperty); + } + set + { + ((DependencyObject)this).SetValue(IsReadOnlyProperty, (object)value); + } + } + + public WebBrowser() + { + InitializeComponent(); + Dispatcher dispatcher = ((DispatcherObject)this).Dispatcher; + if (dispatcher != null) + { + dispatcher.BeginInvoke((DispatcherPriority)7, (Delegate)new Action(ContentLoad)); + } + } + + private void ContentLoad() + { + //IL_0008: Unknown result type (might be due to invalid IL or missing references) + //IL_0012: Expected O, but got Unknown + ((UIElement)this).PreviewKeyDown += new KeyEventHandler(Browser_PreviewKeyDown); + } + + private void Browser_PreviewKeyDown(object sender, KeyEventArgs e) + { + if (IsReadOnly) + { + ((RoutedEventArgs)e).Handled = true; + } + } + + public void InstanciateNew(string htmlData = null) + { + //IL_0015: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Expected O, but got Unknown + //IL_0052: Unknown result type (might be due to invalid IL or missing references) + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Expected O, but got Unknown + //IL_0070: Unknown result type (might be due to invalid IL or missing references) + //IL_007a: Expected O, but got Unknown + if (Browser != null) + { + Browser.LoadCompleted -= new LoadCompletedEventHandler(Completed); + ((HwndHost)Browser).Dispose(); + ((Panel)GridWebBrowser).Children.Remove((UIElement)(object)Browser); + } + HtmlDocument?.clear(); + Browser = new WebBrowser + { + IsEnabled = true + }; + Browser.LoadCompleted += new LoadCompletedEventHandler(Completed); + ((Panel)GridWebBrowser).Children.Add((UIElement)(object)Browser); + HideScriptErrors(); + htmlData = HtmlEncode(htmlData); + Browser.NavigateToString(string.IsNullOrEmpty(htmlData) ? Resources.New : htmlData); + HtmlDocument = Browser.Document as HTMLDocument; + if (HtmlDocument != null) + { + HtmlDocument.charset = "ISO-8859-1"; + HtmlDocument.designMode = "On"; + } + } + + public static string HtmlEncode(string html) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000a: Unknown result type (might be due to invalid IL or missing references) + //IL_0011: 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 (html == null) + { + return null; + } + HtmlDocument val = new HtmlDocument(); + val.LoadHtml(html); + val.OptionWriteEmptyNodes = true; + EncodeNode(val.DocumentNode); + return val.DocumentNode.InnerHtml; + } + + private static void EncodeNode(HtmlNode node) + { + //IL_0054: Unknown result type (might be due to invalid IL or missing references) + //IL_005a: Invalid comparison between Unknown and I4 + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Invalid comparison between Unknown and I4 + if (node.HasChildNodes) + { + foreach (HtmlNode item in (IEnumerable<HtmlNode>)node.ChildNodes) + { + if ((int)item.NodeType == 3) + { + item.InnerHtml = WebUtility.HtmlEncode(item.InnerHtml); + } + else + { + EncodeNode(item); + } + } + return; + } + if ((int)node.NodeType == 3) + { + node.InnerHtml = WebUtility.HtmlEncode(node.InnerHtml); + } + } + + private void HideScriptErrors() + { + FieldInfo field = typeof(WebBrowser).GetField("_axIWebBrowser2", BindingFlags.Instance | BindingFlags.NonPublic); + if (!(field == null)) + { + object value = field.GetValue(Browser); + value?.GetType().InvokeMember("Silent", BindingFlags.SetProperty, null, value, new object[1] { true }); + } + } + + private void Completed(object sender, NavigationEventArgs e) + { + HtmlDocument = Browser.Document as HTMLDocument; + if (HtmlDocument != null) + { + HtmlDocument.designMode = "On"; + } + } + + public void ReadOnly(bool isReadOnly) + { + IsReadOnly = isReadOnly; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/webbrowser.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_0006: Unknown result type (might be due to invalid IL or missing references) + //IL_0010: Expected O, but got Unknown + if (connectionId == 1) + { + GridWebBrowser = (Grid)target; + } + else + { + _contentLoaded = true; + } + } +} diff --git a/Decompiler/Gestor.Application.Componentes/WebEditor.cs b/Decompiler/Gestor.Application.Componentes/WebEditor.cs new file mode 100644 index 0000000..1957f8e --- /dev/null +++ b/Decompiler/Gestor.Application.Componentes/WebEditor.cs @@ -0,0 +1,633 @@ +using System; +using System.CodeDom.Compiler; +using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; +using System.IO; +using System.Net; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Controls.Primitives; +using System.Windows.Forms; +using System.Windows.Markup; +using System.Windows.Media; +using HtmlAgilityPack; +using Microsoft.Win32; +using mshtml; + +namespace Gestor.Application.Componentes; + +public class WebEditor : UserControl, IComponentConnector +{ + private ColorDialog ColorDialog; + + public static readonly DependencyProperty ImageVisibilityProperty = DependencyProperty.Register("ImageVisibility", typeof(Visibility), typeof(WebEditor), (PropertyMetadata)new FrameworkPropertyMetadata((object)(Visibility)2, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty BarVisibilityProperty = DependencyProperty.Register("BarVisibility", typeof(Visibility), typeof(WebEditor), (PropertyMetadata)new FrameworkPropertyMetadata((object)(Visibility)0, (FrameworkPropertyMetadataOptions)256)); + + public static readonly DependencyProperty BodyProperty = DependencyProperty.Register("Body", typeof(string), typeof(WebEditor), (PropertyMetadata)new FrameworkPropertyMetadata((object)string.Empty, new PropertyChangedCallback(OnBoundBodyChanged))); + + public static readonly DependencyProperty IsReadOnlyProperty = DependencyProperty.Register("IsReadOnly", typeof(bool), typeof(WebEditor), (PropertyMetadata)new FrameworkPropertyMetadata((object)false, new PropertyChangedCallback(OnBoundReadOnlyChanged))); + + internal WrapPanel PanelControls; + + internal ComboBox ComboTextFormat; + + internal ComboBox ComboFontFamily; + + internal ComboBox ComboFontSize; + + internal Button SettingsBold; + + internal Button SettingsItalic; + + internal Button SettingsUnderLine; + + internal Button SettingsFontColor; + + internal Button SettingsBullets; + + internal Button SettingsNumbered; + + internal Button SettingsLeftAlign; + + internal Button SettingsCenter; + + internal Button SettingsRightAlign; + + internal Button SettingsJustifyFull; + + internal Button SettingsLink; + + internal TextBox ImagemLink; + + internal WebBrowser WebBrowserEditor; + + internal ItemsControl LinkPanel; + + internal TextBox HrefLink; + + internal CustomItemControl DescricaoBox; + + internal TextBox DescricaoLink; + + private bool _contentLoaded; + + public Visibility ImageVisibility + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + return (Visibility)((DependencyObject)this).GetValue(ImageVisibilityProperty); + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ((DependencyObject)this).SetValue(ImageVisibilityProperty, (object)value); + } + } + + public Visibility BarVisibility + { + get + { + //IL_000b: Unknown result type (might be due to invalid IL or missing references) + return (Visibility)((DependencyObject)this).GetValue(BarVisibilityProperty); + } + set + { + //IL_0006: Unknown result type (might be due to invalid IL or missing references) + ((DependencyObject)this).SetValue(BarVisibilityProperty, (object)value); + } + } + + public string Body + { + get + { + return (string)((DependencyObject)this).GetValue(BodyProperty); + } + set + { + ((DependencyObject)this).SetValue(BodyProperty, (object)value); + } + } + + public bool IsReadOnly + { + get + { + return (bool)((DependencyObject)this).GetValue(IsReadOnlyProperty); + } + set + { + ((DependencyObject)this).SetValue(IsReadOnlyProperty, (object)value); + } + } + + public WebEditor() + { + //IL_000d: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Expected O, but got Unknown + InitializeComponent(); + ColorDialog = new ColorDialog(); + } + + private void SettingsBold_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("Bold", showUI: false, Type.Missing); + } + + private void SettingsItalic_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("Italic", showUI: false, Type.Missing); + } + + private void SettingsUnderLine_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("Underline", showUI: false, Type.Missing); + } + + private void SettingsRightAlign_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("JustifyRight", showUI: false, Type.Missing); + } + + private void SettingsLeftAlign_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("JustifyLeft", showUI: false, Type.Missing); + } + + private void SettingsCenter_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("JustifyCenter", showUI: false, Type.Missing); + } + + private void SettingsJustifyFull_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("JustifyFull", showUI: false, Type.Missing); + } + + private void SettingsInsertOrderedList_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("InsertOrderedList", showUI: false, Type.Missing); + } + + private void SettingsBullets_Click(object sender, RoutedEventArgs e) + { + WebBrowserEditor.HtmlDocument?.execCommand("InsertUnorderedList", showUI: false, Type.Missing); + } + + public void InsertText(string textToInsert) + { + ((dynamic)WebBrowserEditor.HtmlDocument?.selection?.createRange())?.pasteHTML(textToInsert); + } + + private void SettingsFontColor_Click(object sender, RoutedEventArgs e) + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + WebBrowserEditor.HtmlDocument = WebBrowserEditor.Browser.Document as HTMLDocument; + if (WebBrowserEditor.HtmlDocument != null) + { + Color val = Pick(); + string value = $"#{((Color)(ref val)).R:X2}{((Color)(ref val)).G:X2}{((Color)(ref val)).B:X2}"; + WebBrowserEditor.HtmlDocument.execCommand("ForeColor", showUI: false, value); + } + } + + public Color Pick() + { + //IL_0002: Unknown result type (might be due to invalid IL or missing references) + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_002c: Invalid comparison between Unknown and I4 + //IL_0098: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + Color result = default(Color); + ColorDialog.AllowFullOpen = true; + ColorDialog.FullOpen = true; + if ((int)((CommonDialog)ColorDialog).ShowDialog() != 1) + { + return result; + } + ((Color)(ref result)).A = ColorDialog.Color.A; + ((Color)(ref result)).B = ColorDialog.Color.B; + ((Color)(ref result)).G = ColorDialog.Color.G; + ((Color)(ref result)).R = ColorDialog.Color.R; + return result; + } + + private void ComboFontFamily_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + WebBrowserEditor.HtmlDocument = WebBrowserEditor.Browser.Document as HTMLDocument; + string value = ((Selector)ComboFontFamily).SelectedItem.ToString(); + WebBrowserEditor.HtmlDocument?.execCommand("FontName", showUI: false, value); + } + + private void ComboFontSize_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + WebBrowserEditor.HtmlDocument = WebBrowserEditor.Browser.Document as HTMLDocument; + WebBrowserEditor.HtmlDocument?.execCommand("FontSize", showUI: false, ((Selector)ComboFontSize).SelectedItem); + } + + private void ComboTextFormat_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + string value = ((Selector)ComboTextFormat).SelectedValue.ToString(); + WebBrowserEditor.HtmlDocument = WebBrowserEditor.Browser.Document as HTMLDocument; + WebBrowserEditor.HtmlDocument?.execCommand("FormatBlock", showUI: false, value); + } + + private void Window_Loaded(object sender, RoutedEventArgs e) + { + if (WebBrowserEditor.Browser == null) + { + WebBrowserEditor.InstanciateNew(); + } + FontFamilyInitialize(); + FontSizeInitialize(); + FontFormatInitialize(); + } + + private void FontFamilyInitialize() + { + ((ItemsControl)ComboFontFamily).ItemsSource = Fonts.SystemFontFamilies; + ComboFontFamily.Text = "Times New Roman"; + } + + private void FontFormatInitialize() + { + ((ItemsControl)ComboTextFormat).ItemsSource = new List<KeyValuePair<string, string>> + { + new KeyValuePair<string, string>("<p>", "Parágrafo"), + new KeyValuePair<string, string>("<h1>", "Título 1"), + new KeyValuePair<string, string>("<h2>", "Título 2"), + new KeyValuePair<string, string>("<h3>", "Título 3"), + new KeyValuePair<string, string>("<h4>", "Título 4"), + new KeyValuePair<string, string>("<h5>", "Título 5"), + new KeyValuePair<string, string>("<h6>", "Título 6"), + new KeyValuePair<string, string>("<address>", "Endereço"), + new KeyValuePair<string, string>("<pre>", "Pré-formatação") + }; + ((Selector)ComboTextFormat).SelectedValuePath = "Key"; + ((ItemsControl)ComboTextFormat).DisplayMemberPath = "Value"; + ((Selector)ComboTextFormat).SelectedIndex = 0; + } + + public string GetHtml() + { + string innerHTML = WebBrowserEditor.HtmlDocument.documentElement.innerHTML; + innerHTML = innerHTML.Replace("about:", string.Empty); + return HtmlDecode(innerHTML); + } + + public string GetText() + { + if (!(WebBrowserEditor.HtmlDocument.documentElement.innerText.Trim() == "new")) + { + return WebBrowserEditor.HtmlDocument.documentElement.innerText; + } + return ""; + } + + public string HtmlDecode(string html) + { + //IL_0005: Unknown result type (might be due to invalid IL or missing references) + //IL_000b: Expected O, but got Unknown + if (html == null) + { + return null; + } + HtmlDocument val = new HtmlDocument(); + val.LoadHtml(html); + val.OptionWriteEmptyNodes = true; + DecodeNode(val.DocumentNode); + return val.DocumentNode.InnerHtml; + } + + private void DecodeNode(HtmlNode node) + { + //IL_0055: Unknown result type (might be due to invalid IL or missing references) + //IL_005b: Invalid comparison between Unknown and I4 + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_0024: Invalid comparison between Unknown and I4 + if (node.HasChildNodes) + { + foreach (HtmlNode item in (IEnumerable<HtmlNode>)node.ChildNodes) + { + if ((int)item.NodeType == 3) + { + item.InnerHtml = WebUtility.HtmlDecode(item.InnerHtml); + } + else + { + DecodeNode(item); + } + } + return; + } + if ((int)node.NodeType == 3) + { + node.InnerHtml = WebUtility.HtmlDecode(node.InnerHtml); + } + } + + public void Initialize(string htmlData = null) + { + WebBrowserEditor.InstanciateNew(htmlData); + } + + private void FontSizeInitialize() + { + List<string> list = new List<string>(); + for (int i = 1; i <= 7; i++) + { + list.Add(i.ToString()); + } + ((ItemsControl)ComboFontSize).ItemsSource = list; + ComboFontSize.Text = "3"; + } + + private void SettingsImage_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_0010: Unknown result type (might be due to invalid IL or missing references) + //IL_001c: Expected O, but got Unknown + OpenFileDialog val = new OpenFileDialog + { + Title = "Selecione a imagem", + Filter = "Todos os formatos|*.jpg;*.jpeg;*.png|JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|Portable Network Graphic (*.png)|*.png" + }; + if (((CommonDialog)val).ShowDialog().GetValueOrDefault()) + { + string text = Path.GetExtension(((FileDialog)val).FileName).ToLower().Substring(1); + string text2 = Convert.ToBase64String(File.ReadAllBytes(((FileDialog)val).FileName)); + string text3 = "data:image/" + text + ";base64," + text2; + object obj = WebBrowserEditor.HtmlDocument?.selection?.createRange(); + string text4 = "<img alt=\"Imagem\" src=\"" + text3 + "\">"; + if (!string.IsNullOrEmpty(ImagemLink.Text.Trim())) + { + text4 = "<a href=\"" + ImagemLink.Text + "\">" + text4 + "</a>"; + } + ((dynamic)obj)?.pasteHTML(text4); + } + } + + private static void OnBoundBodyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + string htmlData = (string)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + if (d != null && d is WebEditor webEditor) + { + webEditor.WebBrowserEditor.InstanciateNew(htmlData); + } + } + + private static void OnBoundReadOnlyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) + { + bool flag = (bool)((DependencyPropertyChangedEventArgs)(ref e)).NewValue; + if (d != null && d is WebEditor webEditor) + { + webEditor.WebBrowserEditor.ReadOnly(flag); + ((UIElement)webEditor.PanelControls).IsEnabled = !flag; + } + } + + private void SettingsLink_OnClick(object sender, RoutedEventArgs e) + { + HTMLDocument htmlDocument = WebBrowserEditor.HtmlDocument; + ((UIElement)DescricaoBox).Visibility = (Visibility)0; + IHTMLSelectionObject selection = htmlDocument.selection; + if (selection != null && selection.createRange() is IHTMLTxtRange iHTMLTxtRange) + { + ((UIElement)DescricaoBox).Visibility = (Visibility)((!string.IsNullOrEmpty(iHTMLTxtRange.htmlText)) ? 2 : 0); + } + ((UIElement)LinkPanel).Visibility = (Visibility)0; + ((UIElement)WebBrowserEditor).Visibility = (Visibility)1; + } + + private void InsertLink_OnClick(object sender, RoutedEventArgs e) + { + if (string.IsNullOrWhiteSpace(HrefLink.Text)) + { + return; + } + IHTMLSelectionObject selection = WebBrowserEditor.HtmlDocument.selection; + if (selection != null && selection.createRange() is IHTMLTxtRange iHTMLTxtRange) + { + if (!string.IsNullOrEmpty(iHTMLTxtRange.htmlText)) + { + iHTMLTxtRange.pasteHTML("<a href=\"" + HrefLink.Text + "\">" + iHTMLTxtRange.htmlText + "</a>"); + } + else + { + iHTMLTxtRange.pasteHTML("<a href=\"" + HrefLink.Text + "\">" + DescricaoLink.Text + "</a>"); + } + } + ((UIElement)LinkPanel).Visibility = (Visibility)2; + ((UIElement)WebBrowserEditor).Visibility = (Visibility)0; + } + + private void CancelLink_OnClick(object sender, RoutedEventArgs e) + { + ((UIElement)LinkPanel).Visibility = (Visibility)2; + ((UIElement)WebBrowserEditor).Visibility = (Visibility)0; + } + + [DebuggerNonUserCode] + [GeneratedCode("PresentationBuildTasks", "4.0.0.0")] + public void InitializeComponent() + { + if (!_contentLoaded) + { + _contentLoaded = true; + Uri uri = new Uri("/Gestor.Application;component/componentes/webeditor.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_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_0098: Unknown result type (might be due to invalid IL or missing references) + //IL_00a2: Expected O, but got Unknown + //IL_00af: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Expected O, but got Unknown + //IL_00bc: Unknown result type (might be due to invalid IL or missing references) + //IL_00c6: Expected O, but got Unknown + //IL_00d3: Unknown result type (might be due to invalid IL or missing references) + //IL_00dd: Expected O, but got Unknown + //IL_00e0: Unknown result type (might be due to invalid IL or missing references) + //IL_00ea: Expected O, but got Unknown + //IL_00f7: Unknown result type (might be due to invalid IL or missing references) + //IL_0101: Expected O, but got Unknown + //IL_0104: Unknown result type (might be due to invalid IL or missing references) + //IL_010e: Expected O, but got Unknown + //IL_011b: Unknown result type (might be due to invalid IL or missing references) + //IL_0125: Expected O, but got Unknown + //IL_0128: Unknown result type (might be due to invalid IL or missing references) + //IL_0132: Expected O, but got Unknown + //IL_013f: Unknown result type (might be due to invalid IL or missing references) + //IL_0149: Expected O, but got Unknown + //IL_014c: Unknown result type (might be due to invalid IL or missing references) + //IL_0156: Expected O, but got Unknown + //IL_0163: Unknown result type (might be due to invalid IL or missing references) + //IL_016d: Expected O, but got Unknown + //IL_0170: Unknown result type (might be due to invalid IL or missing references) + //IL_017a: Expected O, but got Unknown + //IL_0187: Unknown result type (might be due to invalid IL or missing references) + //IL_0191: 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_01b8: Unknown result type (might be due to invalid IL or missing references) + //IL_01c2: Expected O, but got Unknown + //IL_01cf: Unknown result type (might be due to invalid IL or missing references) + //IL_01d9: 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_01f3: Unknown result type (might be due to invalid IL or missing references) + //IL_01fd: Expected O, but got Unknown + //IL_0200: Unknown result type (might be due to invalid IL or missing references) + //IL_020a: Expected O, but got Unknown + //IL_0217: Unknown result type (might be due to invalid IL or missing references) + //IL_0221: Expected O, but got Unknown + //IL_0224: Unknown result type (might be due to invalid IL or missing references) + //IL_022e: Expected O, but got Unknown + //IL_023b: Unknown result type (might be due to invalid IL or missing references) + //IL_0245: Expected O, but got Unknown + //IL_0248: Unknown result type (might be due to invalid IL or missing references) + //IL_0252: Expected O, but got Unknown + //IL_025f: Unknown result type (might be due to invalid IL or missing references) + //IL_0269: Expected O, but got Unknown + //IL_026c: Unknown result type (might be due to invalid IL or missing references) + //IL_0276: 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_0290: Unknown result type (might be due to invalid IL or missing references) + //IL_029a: Expected O, but got Unknown + //IL_029c: Unknown result type (might be due to invalid IL or missing references) + //IL_02a8: Unknown result type (might be due to invalid IL or missing references) + //IL_02b2: Expected O, but got Unknown + //IL_02c2: Unknown result type (might be due to invalid IL or missing references) + //IL_02cc: Expected O, but got Unknown + //IL_02ce: Unknown result type (might be due to invalid IL or missing references) + //IL_02da: Unknown result type (might be due to invalid IL or missing references) + //IL_02e4: 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_0301: Unknown result type (might be due to invalid IL or missing references) + //IL_030b: Expected O, but got Unknown + //IL_030d: Unknown result type (might be due to invalid IL or missing references) + //IL_0319: Unknown result type (might be due to invalid IL or missing references) + //IL_0323: Expected O, but got Unknown + switch (connectionId) + { + case 1: + ((FrameworkElement)(WebEditor)target).Loaded += new RoutedEventHandler(Window_Loaded); + break; + case 2: + PanelControls = (WrapPanel)target; + break; + case 3: + ComboTextFormat = (ComboBox)target; + ((Selector)ComboTextFormat).SelectionChanged += new SelectionChangedEventHandler(ComboTextFormat_SelectionChanged); + break; + case 4: + ComboFontFamily = (ComboBox)target; + ((Selector)ComboFontFamily).SelectionChanged += new SelectionChangedEventHandler(ComboFontFamily_SelectionChanged); + break; + case 5: + ComboFontSize = (ComboBox)target; + ((Selector)ComboFontSize).SelectionChanged += new SelectionChangedEventHandler(ComboFontSize_SelectionChanged); + break; + case 6: + SettingsBold = (Button)target; + ((ButtonBase)SettingsBold).Click += new RoutedEventHandler(SettingsBold_Click); + break; + case 7: + SettingsItalic = (Button)target; + ((ButtonBase)SettingsItalic).Click += new RoutedEventHandler(SettingsItalic_Click); + break; + case 8: + SettingsUnderLine = (Button)target; + ((ButtonBase)SettingsUnderLine).Click += new RoutedEventHandler(SettingsUnderLine_Click); + break; + case 9: + SettingsFontColor = (Button)target; + ((ButtonBase)SettingsFontColor).Click += new RoutedEventHandler(SettingsFontColor_Click); + break; + case 10: + SettingsBullets = (Button)target; + ((ButtonBase)SettingsBullets).Click += new RoutedEventHandler(SettingsBullets_Click); + break; + case 11: + SettingsNumbered = (Button)target; + ((ButtonBase)SettingsNumbered).Click += new RoutedEventHandler(SettingsInsertOrderedList_Click); + break; + case 12: + SettingsLeftAlign = (Button)target; + ((ButtonBase)SettingsLeftAlign).Click += new RoutedEventHandler(SettingsLeftAlign_Click); + break; + case 13: + SettingsCenter = (Button)target; + ((ButtonBase)SettingsCenter).Click += new RoutedEventHandler(SettingsCenter_Click); + break; + case 14: + SettingsRightAlign = (Button)target; + ((ButtonBase)SettingsRightAlign).Click += new RoutedEventHandler(SettingsRightAlign_Click); + break; + case 15: + SettingsJustifyFull = (Button)target; + ((ButtonBase)SettingsJustifyFull).Click += new RoutedEventHandler(SettingsJustifyFull_Click); + break; + case 16: + SettingsLink = (Button)target; + ((ButtonBase)SettingsLink).Click += new RoutedEventHandler(SettingsLink_OnClick); + break; + case 17: + ImagemLink = (TextBox)target; + break; + case 18: + ((MenuItem)target).Click += new RoutedEventHandler(SettingsImage_Click); + break; + case 19: + WebBrowserEditor = (WebBrowser)target; + break; + case 20: + LinkPanel = (ItemsControl)target; + break; + case 21: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(CancelLink_OnClick); + break; + case 22: + HrefLink = (TextBox)target; + break; + case 23: + DescricaoBox = (CustomItemControl)target; + break; + case 24: + DescricaoLink = (TextBox)target; + break; + case 25: + ((ButtonBase)(Button)target).Click += new RoutedEventHandler(InsertLink_OnClick); + break; + default: + _contentLoaded = true; + break; + } + } +} |