using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Net; using System.Net.Sockets; using System.Threading.Tasks; using CsQuery.ExtensionMethods; using Gestor.Application.Helpers; using Gestor.Application.Servicos.Generic; using Gestor.Application.ViewModels; using Gestor.Infrastructure.UnitOfWork.Generic; using Gestor.Infrastructure.UnitOfWork.Logic; using Gestor.Model.API; using Gestor.Model.Common; using Gestor.Model.Domain.Common; using Gestor.Model.Domain.Configuracoes; using Gestor.Model.Domain.Generic; using Gestor.Model.Domain.Relatorios; using Gestor.Model.Domain.Relatorios.Fechamento; using Gestor.Model.Domain.Relatorios.Tarefa; using Gestor.Model.Domain.Seguros; using Gestor.Model.License; using Newtonsoft.Json; namespace Gestor.Application.Servicos.Seguros; internal class ApoliceServico : BaseServico { private bool _carregando; internal async Task> BuscarApolicesAsync(long id, FiltroStatusDocumento status = 0, List vendedorVinculado = null) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (_carregando) { return new ObservableCollection(); } int tries = 3; return await Task.Run(delegate { //IL_00d4: 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) while (tries > 0) { try { _carregando = true; UnitOfWork read = Instancia.Read; try { ObservableCollection result = new ObservableCollection(read.DocumentoRepository.FindApoliceByCustomer(id, status, vendedorVinculado, LicenseHelper.Produtos, false, ((DomainBase)Recursos.Usuario).Id == 0, Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 43))); _carregando = false; return result; } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { bool assinatura = LicenseHelper.Produtos.Any((Licenca x) => (int)x.Produto == 86 && x.Status != 3); tries = Registrar(e, (TipoErro)1, tries, new { id, status, vendedorVinculado, assinatura }); } } _carregando = false; return new ObservableCollection(); }); } internal async Task> BuscarApolicesComissao(long id, FiltroStatusDocumento status = 0) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) int tries = 3; return await Task.Run(delegate { //IL_0052: 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) while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return new ObservableCollection(read.DocumentoRepository.FindApoliceByCustomer(id, status, (List)null, LicenseHelper.Produtos, true, false, false)); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)2, tries, new { id, status }); } } return new ObservableCollection(); }); } public async Task UpdateRange(Controle controle) { int tries = 3; Controle controleSalvo = controle; return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork unitOfWork = Instancia.Commited; try { controleSalvo = unitOfWork.ControleRepository.Merge(controleSalvo); controleSalvo.Documentos.ToList().ForEach(delegate(Documento x) { x = unitOfWork.DocumentoRepository.Merge(x); }); ((GenericUnitOfWork)unitOfWork).Commit(); return true; } finally { if (unitOfWork != null) { ((IDisposable)unitOfWork).Dispose(); } } } catch (Exception e) { tries = Registrar(e, (TipoErro)19, tries, controle); } } return false; }); } public async Task Excluir(Documento documento) { int tries = 3; base.Sucesso = true; Documento documentoOriginal = documento; DateTime now = Funcoes.GetNetworkTime(); return await Task.Run((Func)delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Expected O, but got Unknown while (tries > 0) { try { UnitOfWork commited = Instancia.Commited; try { TipoAcao acao = (TipoAcao)2; Controle controle = documento.Controle; if (controle == null) { controle = commited.DocumentoRepository.FindById(((DomainBase)documento).Id, false, false).Controle; documento.Controle = controle; } commited.ParcelaRepository.ExcluirVinculoParcelaPendenteDocExcluido(documento); Status status = documento.Status; if (status != null && ((DomainBase)status).Id == 0) { documento.Status = null; } documento = commited.DocumentoRepository.Merge(documento); documento.Controle = commited.ControleRepository.Merge(controle); IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); RegistroLog keyValues = new RegistroLog { Acao = acao, Usuario = Recursos.Usuario, DataHora = now, Descricao = JsonConvert.SerializeObject((object)documento, new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)1 }), EntidadeId = ((DomainBase)documento).Id, Tela = (TipoTela)2, Versao = LoginViewModel.VersaoAtual, NomeMaquina = Environment.MachineName, UsuarioMaquina = Environment.UserName, Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() }; SaveLog(keyValues, commited); ((GenericUnitOfWork)commited).Commit(); return documento; } finally { ((IDisposable)commited)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)20, tries, documento); } } return documentoOriginal; }); } public async Task AtualizarNumero(long id, string numero, string endosso, int tipoDocumento) { return await Task.Run(delegate { try { bool result = true; UnitOfWork commited = Instancia.Commited; try { result = commited.DocumentoRepository.AtualizarNumero(id, numero, endosso, tipoDocumento); ((GenericUnitOfWork)commited).Commit(); } finally { ((IDisposable)commited)?.Dispose(); } return result; } catch (Exception) { return false; } }); } public async Task Save(Controle controle, Cliente cliente) { int tries = 3; await Task.Run(delegate { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown while (tries > 0) { List logs = new List(); List logsTroca = new List(); try { UnitOfWork commited = Instancia.Commited; try { List diferenca = new List(); List diferencaTroca = new List(); diferenca.Insert(0, new Diferenca { Campo = "Cliente", Descricao = "NOME", ValorAtual = cliente.Nome, ValorAnterior = controle.Cliente.Nome }); diferencaTroca.Insert(0, new Diferenca { Campo = "Cliente", Descricao = "APÓLICE TROCADA DE CLIENTE", ValorAtual = cliente.Nome, ValorAnterior = controle.Cliente.Nome }); ExtensionMethods.ForEach((IEnumerable)controle.Documentos, (Action)delegate(Documento x) { logs.Add(CreateLog(((DomainBase)x).Id, diferenca, (TipoTela)2)); logsTroca.Add(CreateLog(((DomainBase)x).Id, diferencaTroca, (TipoTela)41)); }); commited.DocumentoRepository.TrocarCliente(controle, cliente); SaveLog(logs, commited); SaveLog(logsTroca, commited); ((GenericUnitOfWork)commited).Commit(); break; } finally { ((IDisposable)commited)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)325, tries, controle); } } }); } public async Task Save(Documento documento, bool updateParcelas, bool criarParcelas) { int tries = 3; base.Sucesso = true; Documento documentoOriginal = documento; DateTime now = Funcoes.GetNetworkTime(); List logs = new List(); return await Task.Run((Func)delegate { //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Invalid comparison between Unknown and I4 while (tries > 0) { try { UnitOfWork unitOfWork = Instancia.Commited; try { _ = ((DomainBase)documento).Id; bool num = ((DomainBase)documento).Id == 0; Controle controle = documento.Controle; ObservableCollection parcelas = documento.Parcelas; if (num) { controle = ((documento.Tipo > 0 && ((DomainBase)controle).Id > 0) ? controle : unitOfWork.ControleRepository.SaveOrUpdate(controle)); documento.Controle = controle; documento = unitOfWork.DocumentoRepository.SaveOrUpdate(documento); logs.Add(CreateLog(((DomainBase)documento).Id, ((DomainBase)documento).GetValorOriginal(), (TipoTela)2, (TipoAcao)0)); parcelas?.ToList().ForEach(delegate(Parcela p) { ObservableCollection vendedores3 = p.Vendedores; p.Documento = documento; p.IdEmpresa = documento.Controle.IdEmpresa; p = unitOfWork.ParcelaRepository.SaveOrUpdate(p); logs.Add(CreateLog(((DomainBase)documento).Id, ((DomainBase)p).GetValorOriginal(), (TipoTela)5, (TipoAcao)0)); vendedores3.ToList().ForEach(delegate(VendedorParcela v) { //IL_0047: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected I4, but got Unknown v.Documento = documento; v.Parcela = p; if (v.Repasse != null) { switch (v.Repasse.Base) { case 2L: v.DataPrePagamento = p.Vencimento; break; case 0L: v.DataPrePagamento = documento.Vigencia1; break; case 1L: v.DataPrePagamento = now; break; case 3L: v.DataPrePagamento = documento.Emissao; break; case 4L: v.DataPrePagamento = documento.Remessa; break; } } v = unitOfWork.VendedorParcelaRepository.SaveOrUpdate(v); logs.Add(CreateLog(((DomainBase)p).Id, ((DomainBase)v).GetValorOriginal(), (TipoTela)37, (TipoAcao)0)); }); p.Vendedores = vendedores3; }); } else { if (controle == null || ((controle != null) ? controle.Seguradora : null) == null) { controle = unitOfWork.DocumentoRepository.FindById(((DomainBase)documento).Id, false, false).Controle; documento.Controle = controle; } logs.Add(CreateLog(((DomainBase)documento).Id, documento, (TipoTela)2)); documento = unitOfWork.DocumentoRepository.Merge(documento); if ((int)documento.TipoRecebimento.GetValueOrDefault() == 1) { if (criarParcelas) { unitOfWork.ParcelaRepository.FindByDocumentId(((DomainBase)documento).Id)?.ForEach(delegate(Parcela pa) { logs.Add(CreateLog(((DomainBase)documento).Id, ((DomainBase)pa).GetValorOriginal(), (TipoTela)5, (TipoAcao)2)); }); unitOfWork.VendedorParcelaRepository.FindByDocumentId(((DomainBase)documento).Id)?.ForEach(delegate(VendedorParcela pa) { logs.Add(CreateLog(((DomainBase)pa.Parcela).Id, ((DomainBase)pa).GetValorOriginal(), (TipoTela)37, (TipoAcao)2)); }); unitOfWork.VendedorParcelaRepository.DeleteRange(((DomainBase)documento).Id); unitOfWork.ParcelaRepository.DeleteRange(((DomainBase)documento).Id); parcelas.ToList().ForEach(delegate(Parcela p) { ObservableCollection vendedores2 = p.Vendedores; p.Documento = documento; p.IdEmpresa = documento.Controle.IdEmpresa; p = unitOfWork.ParcelaRepository.SaveOrUpdate(p); vendedores2.ToList().ForEach(delegate(VendedorParcela v) { //IL_0047: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected I4, but got Unknown v.Documento = documento; v.Parcela = p; if (v.Repasse != null) { switch (v.Repasse.Base) { case 2L: v.DataPrePagamento = p.Vencimento; break; case 0L: v.DataPrePagamento = documento.Vigencia1; break; case 1L: v.DataPrePagamento = now; break; case 3L: v.DataPrePagamento = documento.Emissao; break; case 4L: v.DataPrePagamento = documento.Remessa; break; } } v = unitOfWork.VendedorParcelaRepository.SaveOrUpdate(v); logs.Add(CreateLog(((DomainBase)p).Id, ((DomainBase)v).GetValorOriginal(), (TipoTela)37, (TipoAcao)0)); }); p.Vendedores = vendedores2; logs.Add(CreateLog(((DomainBase)documento).Id, ((DomainBase)p).GetValorOriginal(), (TipoTela)5, (TipoAcao)0)); }); } if (updateParcelas && !criarParcelas) { List parcelasAnteriores = unitOfWork.ParcelaRepository.FindByDocumentId(((DomainBase)documento).Id); List vendedoresAnteriores = unitOfWork.VendedorParcelaRepository.FindByDocumentId(((DomainBase)documento).Id); parcelas.ToList().ForEach(delegate(Parcela p) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown ObservableCollection vendedores = p.Vendedores; p.Documento = documento; p = unitOfWork.ParcelaRepository.Merge(p); vendedores.ToList().ForEach(delegate(VendedorParcela v) { //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown v.Documento = documento; v.Parcela = p; int num2 = ((((DomainBase)v).Id <= 0) ? 1 : 0); v = ((((DomainBase)v).Id > 0) ? unitOfWork.VendedorParcelaRepository.Merge(v) : unitOfWork.VendedorParcelaRepository.SaveOrUpdate(v)); if (num2 == 0) { logs.Add(CreateLog(((DomainBase)p).Id, ((DomainBase)v).GetValorOriginal(), (TipoTela)37, (TipoAcao)0)); } VendedorParcela val2 = ((IEnumerable)vendedoresAnteriores).FirstOrDefault((Func)((VendedorParcela pa) => ((DomainBase)v).Id == ((DomainBase)pa).Id)); if (val2 != null) { List valorOriginal2 = ((DomainBase)val2).GetValorOriginal(); List list2 = ((DomainBase)v).Compare(valorOriginal2); if (list2.Count > 0) { list2.Insert(0, new Diferenca { Campo = "Vendedor", Descricao = "VENDEDOR", ValorAtual = v.Vendedor.Nome, ValorAnterior = v.Vendedor.Nome }); logs.Add(CreateLog(((DomainBase)p).Id, list2, (TipoTela)37)); } } }); p.Vendedores = vendedores; Parcela val = ((IEnumerable)parcelasAnteriores).FirstOrDefault((Func)((Parcela pa) => ((DomainBase)p).Id == ((DomainBase)pa).Id)); if (val != null) { List valorOriginal = ((DomainBase)val).GetValorOriginal(); List list = ((DomainBase)p).Compare(valorOriginal); if (list.Count > 0) { list.Insert(0, new Diferenca { Campo = "Parcela", Descricao = "PARCELA", ValorAtual = p.NumeroParcela.ToString(), ValorAnterior = p.NumeroParcela.ToString() }); logs.Add(CreateLog(((DomainBase)documento).Id, list, (TipoTela)5)); } } }); } } documento.Controle = unitOfWork.ControleRepository.Merge(controle); } documento.Parcelas = parcelas; SaveLog(logs, unitOfWork); ((GenericUnitOfWork)unitOfWork).Commit(); return documento; } finally { if (unitOfWork != null) { ((IDisposable)unitOfWork).Dispose(); } } } catch (Exception e) { tries = Registrar(e, (TipoErro)18, tries, new { documentoOriginal, updateParcelas, criarParcelas }); } } return documentoOriginal; }); } internal async Task ExcluirVinculo(long id) { await Task.Run(delegate { try { UnitOfWork commited = Instancia.Commited; try { commited.VinculoDocumentoRepository.Delete(id); ((GenericUnitOfWork)commited).Commit(); } finally { ((IDisposable)commited)?.Dispose(); } } catch (Exception) { } }); } public async Task BuscarApoliceAsync(long id, bool itens = false, bool sinistrosPorControle = false) { int tries = 3; return await Task.Run((Func)delegate { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.DocumentoRepository.FindById(id, itens, sinistrosPorControle); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)3, tries, id); } } return new Documento(); }); } public async Task BuscarVendedorPrincipal(long id) { int tries = 3; return await Task.Run((Func)delegate { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.VendedorParcelaRepository.BuscarVendedorPorControle(id); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)3, tries, id); } } return new Vendedor(); }); } public async Task> BuscarApolicesPorId(List ids) { int tries = 3; return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.DocumentoRepository.FindByIds(ids); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)3, tries, ids); } } return new List(); }); } public async Task> BuscarApolicesPorIdParcela(List ids) { int tries = 3; return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.DocumentoRepository.FindByParcelaIds(ids); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)3, tries, ids); } } return new List(); }); } public async Task BuscarControleAsync(long id) { int tries = 3; return await Task.Run((Func)delegate { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.ControleRepository.FindById(id); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)4, tries, id); } } return new Controle(); }); } public async Task ExcluirPagamento(List pagamentos) { int tries = 3; base.Sucesso = true; DateTime dateHora = Funcoes.GetNetworkTime(); return await Task.Run(delegate { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0064: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007c: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown while (tries > 0) { try { UnitOfWork commited = Instancia.Commited; try { commited.VendedorParcelaRepository.DeleteRange(pagamentos); IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); foreach (VendedorParcela pagamento in pagamentos) { RegistroLog keyValues = new RegistroLog { Acao = (TipoAcao)2, Usuario = Recursos.Usuario, DataHora = dateHora, Descricao = JsonConvert.SerializeObject((object)pagamento, new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)1 }), EntidadeId = ((DomainBase)pagamento.Parcela).Id, Tela = (TipoTela)37, Versao = LoginViewModel.VersaoAtual, NomeMaquina = Environment.MachineName, UsuarioMaquina = Environment.UserName, Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() }; SaveLog(keyValues, commited); ((GenericUnitOfWork)commited).Commit(); } return true; } finally { ((IDisposable)commited)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)21, tries, pagamentos); } } return false; }); } public async Task IncluirVendedor(VendedorParcela vendedor) { int tries = 3; base.Sucesso = true; VendedorParcela vendedorSalvo = vendedor; DateTime dateHora = Funcoes.GetNetworkTime(); return await Task.Run((Func)delegate { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown while (tries > 0) { try { UnitOfWork commited = Instancia.Commited; try { vendedorSalvo = commited.VendedorParcelaRepository.SaveOrUpdate(vendedorSalvo); IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); RegistroLog val = new RegistroLog(); val.Acao = (TipoAcao)0; val.Usuario = Recursos.Usuario; val.DataHora = dateHora; val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} INCLUIU, EM {dateHora}, O VENDEDOR DE " + $"ID: '{((DomainBase)vendedor).Id}'" + $", VALOR DO PAGAMENTO: 'R${vendedor.ValorRepasse}'" + $", VALOR TOTAL: 'R${vendedor.ValorTotal}'" + ", DATA DO PAGAMENTO: '" + ((!vendedor.DataPagamento.HasValue) ? "" : (vendedor.DataPagamento?.ToShortDateString() ?? "")) + "'" + $", PORCENTAGEM DO PAGAMENTO: '{vendedor.PorcentagemRepasse}%'."; val.EntidadeId = ((DomainBase)vendedor).Id; val.Tela = (TipoTela)37; val.Versao = LoginViewModel.VersaoAtual; val.NomeMaquina = Environment.MachineName; val.UsuarioMaquina = Environment.UserName; val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString(); RegistroLog keyValues = val; SaveLog(keyValues, commited); ((GenericUnitOfWork)commited).Commit(); return vendedorSalvo; } finally { ((IDisposable)commited)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)22, tries, vendedor); } } return vendedor; }); } public async Task> IncluirVendedores(List repasses) { int tries = 3; base.Sucesso = true; List repassesSalvos = repasses; DateTime now = Funcoes.GetNetworkTime(); return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork unitOfWork = Instancia.Commited; try { repassesSalvos = unitOfWork.VendedorParcelaRepository.AddRange(repassesSalvos); IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); repassesSalvos.ForEach(delegate(VendedorParcela x) { //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_000c: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0040: 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_0059: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown RegistroLog keyValues = new RegistroLog { Acao = (TipoAcao)0, Usuario = Recursos.Usuario, DataHora = now, Descricao = JsonConvert.SerializeObject((object)x, new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)1 }), EntidadeId = ((DomainBase)x.Parcela).Id, Tela = (TipoTela)37, Versao = LoginViewModel.VersaoAtual, NomeMaquina = Environment.MachineName, UsuarioMaquina = Environment.UserName, Ip = host.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() }; SaveLog(keyValues, unitOfWork); ((GenericUnitOfWork)unitOfWork).Commit(); }); return repassesSalvos; } finally { if (unitOfWork != null) { ((IDisposable)unitOfWork).Dispose(); } } } catch (Exception e) { tries = Registrar(e, (TipoErro)22, tries, repasses); } } return repasses; }); } public async Task> BuscarApolices(Filtros filtro, bool buscarAssinatura = false, bool painelBi = false) { int tries = 3; return await Task.Run(async delegate { while (tries > 0) { try { UnitOfWork unitOfWork = Instancia.Read; try { return await unitOfWork.DocumentoRepository.BuscaDocumentosPorVigencia(filtro, buscarAssinatura, painelBi); } finally { ((IDisposable)unitOfWork)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)5, tries, filtro); } } return new List(); }); } public async Task> BuscarEndossos(Filtros filtro, bool buscarAssinatura = false) { int tries = 3; return await Task.Run(async delegate { while (tries > 0) { try { UnitOfWork unitOfWork = Instancia.Read; try { return await unitOfWork.DocumentoRepository.FindEndossoByVigencia(filtro, buscarAssinatura); } finally { ((IDisposable)unitOfWork)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)5, tries, filtro); } } return new List(); }); } public async Task> BuscarApolicesVigenciaFinal(Filtros filtro, bool somarPremios = false) { int tries = 3; return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.DocumentoRepository.FindByVigenciaFinal(filtro, LicenseHelper.Produtos, somarPremios); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)6, tries, filtro); } } return new List(); }); } internal async Task BuscarCodDocumento(long pesquisa, List vendedorVinculado) { int tries = 3; return await Task.Run((Func)delegate { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.DocumentoRepository.FindById(pesquisa, vendedorVinculado); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)3, tries, pesquisa); } } return new Documento(); }); } internal async Task> BuscarApolice(string pesquisa, FiltroStatusDocumento status, List vendedorVinculado, string campo = "Apolice", bool tipobusca = false) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) int tries = 3; return await Task.Run(delegate { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.DocumentoRepository.FindApolice(pesquisa, status, vendedorVinculado, campo, (Recursos.Usuario.IdEmpresa == 1) ? 0 : Recursos.Usuario.IdEmpresa, Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 43), tipobusca); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)7, tries, new { pesquisa, status, campo }); } } return new List(); }); } public async Task> BuscarFechamento(Filtros filtro) { int tries = 3; return await Task.Run(async delegate { while (tries > 0) { try { UnitOfWork unitOfWork = Instancia.Read; try { return await unitOfWork.DocumentoRepository.Fechamento(filtro); } finally { ((IDisposable)unitOfWork)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)8, tries, filtro); } } return new List(); }); } public async Task Prorrogar(long id, DateTime vigencia2) { int tries = 3; base.Sucesso = true; DateTime now = Funcoes.GetNetworkTime(); return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork unitOfWork = Instancia.Commited; try { unitOfWork.DocumentoRepository.FindByControle(id).ForEach(delegate(Documento x) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_0124: Expected O, but got Unknown if (!x.NegocioCorretora.HasValue) { x.NegocioCorretora = (NegocioCorretora)((x.Negocio.HasValue && (int)x.Negocio.GetValueOrDefault() == 1) ? 1 : 0); } x.Vigencia2 = vigencia2; unitOfWork.DocumentoRepository.Merge(x); IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); RegistroLog keyValues = new RegistroLog { Acao = (TipoAcao)1, Usuario = Recursos.Usuario, DataHora = now, Descricao = JsonConvert.SerializeObject((object)x, new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)1 }), EntidadeId = ((DomainBase)x).Id, Tela = (TipoTela)2, Versao = LoginViewModel.VersaoAtual, NomeMaquina = Environment.MachineName, UsuarioMaquina = Environment.UserName, Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() }; SaveLog(keyValues, unitOfWork); }); ((GenericUnitOfWork)unitOfWork).Commit(); return true; } finally { if (unitOfWork != null) { ((IDisposable)unitOfWork).Dispose(); } } } catch (Exception e) { tries = Registrar(e, (TipoErro)23, tries, id); } } return false; }); } public async Task Reabilitar(long id) { int tries = 3; base.Sucesso = true; DateTime now = Funcoes.GetNetworkTime(); return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork unitOfWork = Instancia.Commited; try { unitOfWork.DocumentoRepository.FindByControle(id).ForEach(delegate(Documento x) { //IL_0046: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_00f7: Expected O, but got Unknown if (!x.TipoEndosso.HasValue || (int)x.TipoEndosso.GetValueOrDefault() != 2) { x.Situacao = (TipoSeguro)4; unitOfWork.DocumentoRepository.Merge(x); IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); RegistroLog keyValues = new RegistroLog { Acao = (TipoAcao)1, Usuario = Recursos.Usuario, DataHora = now, Descricao = JsonConvert.SerializeObject((object)x, new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)1 }), EntidadeId = ((DomainBase)x).Id, Tela = (TipoTela)2, Versao = LoginViewModel.VersaoAtual, NomeMaquina = Environment.MachineName, UsuarioMaquina = Environment.UserName, Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() }; SaveLog(keyValues, unitOfWork); } }); ((GenericUnitOfWork)unitOfWork).Commit(); return true; } finally { if (unitOfWork != null) { ((IDisposable)unitOfWork).Dispose(); } } } catch (Exception e) { tries = Registrar(e, (TipoErro)23, tries, id); } } return false; }); } public async Task Perdido(long id) { int tries = 3; base.Sucesso = true; DateTime now = Funcoes.GetNetworkTime(); return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork unitOfWork = Instancia.Commited; try { unitOfWork.DocumentoRepository.FindByControle(id).ForEach(delegate(Documento x) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0070: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown x.SituacaoAnterior = x.Situacao; x.Situacao = (TipoSeguro)6; unitOfWork.DocumentoRepository.Merge(x); IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); RegistroLog keyValues = new RegistroLog { Acao = (TipoAcao)1, Usuario = Recursos.Usuario, DataHora = now, Descricao = JsonConvert.SerializeObject((object)x, new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)1 }), EntidadeId = ((DomainBase)x).Id, Tela = (TipoTela)2, Versao = LoginViewModel.VersaoAtual, NomeMaquina = Environment.MachineName, UsuarioMaquina = Environment.UserName, Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() }; SaveLog(keyValues, unitOfWork); }); ((GenericUnitOfWork)unitOfWork).Commit(); return true; } finally { if (unitOfWork != null) { ((IDisposable)unitOfWork).Dispose(); } } } catch (Exception e) { tries = Registrar(e, (TipoErro)23, tries, id); } } return false; }); } public async Task> BuscarApolicesPendentes(Filtros filtro) { int tries = 3; return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.DocumentoRepository.FindPendenciasByVigencia(filtro); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)10, tries, filtro); } } return new List(); }); } public async Task Save(long id, string observacao) { int tries = 3; base.Sucesso = true; Funcoes.GetNetworkTime(); return await Task.Run(delegate { while (tries > 0) { List list = new List(); try { UnitOfWork commited = Instancia.Commited; try { Documento val = commited.DocumentoRepository.FindById(id, false, false); ((DomainBase)val).Initialize(); val.Observacao = observacao; list.Add(CreateLog(((DomainBase)val).Id, val, (TipoTela)2)); commited.DocumentoRepository.Merge(val); SaveLog(list, commited); ((GenericUnitOfWork)commited).Commit(); } finally { ((IDisposable)commited)?.Dispose(); } return observacao; } catch (Exception e) { tries = Registrar(e, (TipoErro)18, tries, new { id, observacao }); } } return ""; }); } public async Task ExcluirCritica(long id) { int tries = 3; base.Sucesso = true; DateTime now = Funcoes.GetNetworkTime(); return await Task.Run(delegate { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0059: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown while (tries > 0) { try { UnitOfWork commited = Instancia.Commited; try { CriticaApolice val = commited.CriticaApoliceRepository.FindByApolice(id); if (val == null) { return true; } commited.CriticaApoliceRepository.Delete(((DomainBase)val).Id); IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); RegistroLog keyValues = new RegistroLog { Acao = (TipoAcao)2, Tela = (TipoTela)20, Usuario = Recursos.Usuario, DataHora = now, Descricao = JsonConvert.SerializeObject((object)val, new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)1 }), EntidadeId = ((DomainBase)val).Id, Versao = LoginViewModel.VersaoAtual, NomeMaquina = Environment.MachineName, UsuarioMaquina = Environment.UserName, Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() }; SaveLog(keyValues, commited); ((GenericUnitOfWork)commited).Commit(); return true; } finally { ((IDisposable)commited)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)25, tries, id); } } return false; }); } public async Task> Auditoria(Filtros filtro) { int tries = 3; return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.DocumentoRepository.Auditoria(filtro); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)13, tries, filtro); } } return new List(); }); } public async Task BaixarParcelasCancelamento(Documento documento, bool estorno) { int tries = 3; base.Sucesso = true; DateTime now = Funcoes.GetNetworkTime(); return await Task.Run(delegate { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown while (tries > 0) { try { UnitOfWork unitOfWork = Instancia.Commited; try { unitOfWork.ParcelaRepository.FindByDocumentId(((DomainBase)documento).Id).ToList().ForEach(delegate(Parcela x) { List list = unitOfWork.VendedorParcelaRepository.FindByParcela(((DomainBase)x).Id); if (list.Count > 0) { if (estorno) { string documentoLabel = ((documento.Tipo == 0) ? (" PROPOSTA " + documento.Proposta + " DO CLIENTE " + documento.Controle.Cliente.Nome) : (" PROPOSTA DE ENDOSSO " + documento.PropostaEndosso + " DO CLIENTE " + documento.Controle.Cliente.Nome)); List list2 = (from v in list where v.DataPagamento.HasValue group v by ((DomainBase)v.Vendedor).Id).Select((Func, Adiantamento>)((IGrouping v) => new Adiantamento { Vendedor = v.First().Vendedor, Data = now, Valor = v.Where((VendedorParcela s) => s.ValorRepasse.HasValue).Sum(delegate(VendedorParcela s) { decimal value = s.ValorRepasse.Value; decimal value2 = 1; decimal? desconto = v.First().Vendedor.Desconto; return value * ((decimal?)value2 - desconto).GetValueOrDefault(); }), Historico = $"ESTORNO DEVIDO A RECUSA {documentoLabel} PARCELA {x.NumeroParcela}" })).ToList(); unitOfWork.AdiantamentoRepository.AddRange(list2); list.Where((VendedorParcela v) => !v.DataPagamento.HasValue).ToList().ForEach(delegate(VendedorParcela v) { v.ValorRepasse = default(decimal); v.DataPagamento = now; v.DataPrePagamento = v.DataPrePagamento.GetValueOrDefault(now); unitOfWork.VendedorParcelaRepository.Merge(v); }); } else { list.Where((VendedorParcela v) => !v.DataPrePagamento.HasValue).ToList().ForEach(delegate(VendedorParcela v) { v.ValorRepasse = default(decimal); v.DataPagamento = now; v.DataPrePagamento = v.DataPrePagamento.GetValueOrDefault(now); unitOfWork.VendedorParcelaRepository.Merge(v); }); } } if (!x.DataRecebimento.HasValue) { x.DataRecebimento = now; x.DataCredito = now; x.ValorComissao = 0m; x.ValorComDesconto = 0m; unitOfWork.ParcelaRepository.Merge(x); } }); unitOfWork.DocumentoRepository.Merge(documento); IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); RegistroLog keyValues = new RegistroLog { Acao = (TipoAcao)1, Usuario = Recursos.Usuario, DataHora = now, Descricao = JsonConvert.SerializeObject((object)documento, new JsonSerializerSettings { ReferenceLoopHandling = (ReferenceLoopHandling)1 }), EntidadeId = ((DomainBase)documento).Id, Tela = (TipoTela)2, Versao = LoginViewModel.VersaoAtual, NomeMaquina = Environment.MachineName, UsuarioMaquina = Environment.UserName, Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() }; SaveLog(keyValues, unitOfWork); ((GenericUnitOfWork)unitOfWork).Commit(); return true; } finally { if (unitOfWork != null) { ((IDisposable)unitOfWork).Dispose(); } } } catch (Exception e) { tries = Registrar(e, (TipoErro)26, tries, documento); } } return false; }); } public async Task Cotacoes(Filtros filtro) { int tries = 3; return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.DocumentoRepository.Cotacoes(filtro); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)14, tries, filtro); } } return 0; }); } public async Task> BuscarLicenciamentos(Filtros filtro) { int tries = 3; return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.DocumentoRepository.FindByLicenciamento(filtro); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)295, tries, filtro); } } return new List(); }); } public async Task> BuscarPlacas(Filtros filtro) { int tries = 3; return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.DocumentoRepository.FindByPlaca(filtro); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)327, tries, filtro); } } return new List(); }); } public async Task> BuscarTarefas(Filtros filtro) { int tries = 3; return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.TarefaRepository.BuscarTarefaPorFiltro(filtro.Inicio, filtro.Fim); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)97, tries, filtro); } } return new List(); }); } public async Task> BuscarPlanilhaCompleta(List ids, bool configFranquia, bool configPremio) { int tries = 3; return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.ReportRepository.PlanilhaCompleta(ids, configFranquia, configPremio); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)296, tries, ids); } } return (List)null; }); } public async Task> BuscarPlanilhaCompletaFatura(List ids, Relatorio relatorio, DateTime inicio, DateTime fim, bool configFranquia, bool configPremio) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) int tries = 3; return await Task.Run(delegate { //IL_0016: Unknown result type (might be due to invalid IL or missing references) while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.ReportRepository.PlanilhaCompletaFatura(ids, relatorio, inicio, fim, configFranquia, configPremio); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)296, tries, ids); } } return (List)null; }); } public async Task> BuscarPlanilhaCompletaProspeccao(List ids) { int tries = 3; return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.DocumentoRepository.BuscarPlanilhaCompletaProspeccao(ids); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)296, tries, ids); } } return (List)null; }); } public async Task BuscarLogAntigo(long id) { int tries = 3; return await Task.Run(delegate { while (tries > 0) { try { UnitOfWork read = Instancia.Read; try { return read.DocumentoRepository.BuscarLogAntigo(id, Connection.GetConnectionString()); } finally { ((IDisposable)read)?.Dispose(); } } catch (Exception e) { tries = Registrar(e, (TipoErro)319, tries, id); } } return (string)null; }); } public async Task SalvarAssistencia(string id, long controleId) { await Task.Run(delegate { try { UnitOfWork commited = Instancia.Commited; try { commited.DocumentoRepository.SalvarAssistencia(id, controleId); ((GenericUnitOfWork)commited).Commit(); } finally { ((IDisposable)commited)?.Dispose(); } } catch (Exception) { } }); } }