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.Servicos/ParcelaServico.cs | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.Servicos/ParcelaServico.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Servicos/ParcelaServico.cs | 994 |
1 files changed, 994 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Servicos/ParcelaServico.cs b/Decompiler/Gestor.Application.Servicos/ParcelaServico.cs new file mode 100644 index 0000000..4b00269 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/ParcelaServico.cs @@ -0,0 +1,994 @@ +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 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.PrevisaoPagamentoComissao; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos; + +internal class ParcelaServico : BaseServico +{ + internal async Task<ObservableCollection<Parcela>> BuscarParcelasAsync(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection<Parcela>(from x in read.ParcelaRepository.FindByDocumentId(id) + orderby x.NumeroParcela + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)73, tries, id); + } + } + return new ObservableCollection<Parcela>(); + }); + } + + internal async Task<ObservableCollection<Parcela>> BuscarParcelasPorDocumento(Documento documento) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection<Parcela>(from x in read.ParcelaRepository.FindByDocumento(documento) + orderby x.NumeroParcela + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)73, tries, ((DomainBase)documento).Id); + } + } + return new ObservableCollection<Parcela>(); + }); + } + + internal async Task<List<Parcela>> BuscarTodasParcelas(List<long> ids) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindByDocumentId(ids); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)73, tries, ids); + } + } + return new List<Parcela>(); + }); + } + + internal async Task<List<Parcela>> BuscarParcelas(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.ParcelaRepository.FindByDocumentId(id) + orderby x.NumeroParcela + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)73, tries, id); + } + } + return new List<Parcela>(); + }); + } + + internal async Task<List<Documento>> BuscarParcelas(string ids, List<Documento> documentos) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindByDocumentIds(ids, documentos); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)75, tries); + } + } + return new List<Documento>(); + }); + } + + internal async Task<List<Vendedor>> BuscarVendedores(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.VendedorParcelaRepository.FindByDocumentId(id) + group x by ((DomainBase)x.Vendedor).Id into x + select x.First().Vendedor).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)140, tries); + } + } + return new List<Vendedor>(); + }); + } + + public async Task<Parcela> Save(Parcela parcela, List<Parcela> todas, List<VendedorParcela> repasses = null, bool abrirTela = true) + { + int tries = 3; + base.Sucesso = true; + Parcela parcelaOriginal = parcela; + List<VendedorParcela> repassesOriginais = repasses; + Funcoes.GetNetworkTime(); + ObservableCollection<Parcela> oldParcelas = await BuscarParcelasAsync(((DomainBase)parcela.Documento).Id); + return await Task.Run<Parcela>(async delegate + { + while (tries > 0) + { + try + { + Parcela val = ((IEnumerable<Parcela>)oldParcelas).FirstOrDefault((Func<Parcela, bool>)((Parcela x) => ((DomainBase)x).Id == ((DomainBase)parcela).Id)); + List<RegistroLog> list = new List<RegistroLog>(); + UnitOfWork commited = Instancia.Commited; + try + { + bool flag = ((DomainBase)parcela).Id == 0; + parcela.IdEmpresa = parcela.Documento.Controle.IdEmpresa; + parcela = (flag ? commited.ParcelaRepository.SaveOrUpdate(parcela) : commited.ParcelaRepository.Merge(parcela)); + if (repasses != null) + { + foreach (VendedorParcela repass in repasses) + { + repass.Documento = parcela.Documento; + repass.Parcela = parcela; + if (((DomainBase)repass).Id == 0L) + { + commited.VendedorParcelaRepository.SaveOrUpdate(repass); + } + else + { + commited.VendedorParcelaRepository.Merge(repass); + } + } + parcela.Vendedores = new ObservableCollection<VendedorParcela>(repasses); + } + if (flag) + { + list.Add(CreateLog(((DomainBase)parcela).Id, ((DomainBase)parcela).GetValorOriginal(), (TipoTela)5, (TipoAcao)0)); + } + else + { + list.Add(CreateLog(((DomainBase)parcela).Id, ((DomainBase)parcela).Compare(((DomainBase)val).GetValorOriginal()), (TipoTela)5, (TipoAcao)1)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return parcela; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)24, tries, parcelaOriginal, abrirTela); + } + } + parcelaOriginal.Vendedores = ((repassesOriginais != null) ? new ObservableCollection<VendedorParcela>(repassesOriginais) : null); + return parcelaOriginal; + }); + } + + public async Task<VendedorParcela> Save(VendedorParcela pagamento) + { + int tries = 3; + base.Sucesso = true; + Funcoes.GetNetworkTime(); + return await Task.Run((Func<VendedorParcela>)delegate + { + while (tries > 0) + { + VendedorParcela val = pagamento; + try + { + List<RegistroLog> list = new List<RegistroLog>(); + UnitOfWork commited = Instancia.Commited; + try + { + val = ((((DomainBase)val).Id == 0L) ? commited.VendedorParcelaRepository.SaveOrUpdate(val) : commited.VendedorParcelaRepository.Merge(val)); + if (((DomainBase)pagamento).Id == 0L) + { + list.Add(CreateLog(((DomainBase)val).Id, ((DomainBase)val).GetValorOriginal(), (TipoTela)37, (TipoAcao)0)); + } + else + { + list.Add(CreateLog(((DomainBase)val).Id, ((DomainBase)val).Compare(((DomainBase)val).GetValorOriginal()), (TipoTela)37, (TipoAcao)1)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return val; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)189, tries, pagamento); + } + } + return pagamento; + }); + } + + public async Task<List<Parcela>> SaveRange(List<Parcela> parcela) + { + int tries = 3; + base.Sucesso = true; + return await Task.Run(delegate + { + while (tries > 0) + { + List<Parcela> list = parcela; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + foreach (Parcela item in list) + { + if (((DomainBase)item).Id == 0L) + { + item.IdEmpresa = item.Documento.Controle.IdEmpresa; + commited.ParcelaRepository.SaveOrUpdate(item); + } + else + { + commited.ParcelaRepository.Merge(item); + } + } + ((GenericUnitOfWork)commited).Commit(); + return list; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)24, tries, parcela); + } + } + return parcela; + }); + } + + public async Task<bool> SaveRange(List<VendedorParcela> repasses) + { + int tries = 3; + List<VendedorParcela> repassesOriginais = repasses; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + repasses = repassesOriginais; + try + { + List<RegistroLog> logs = new List<RegistroLog>(); + UnitOfWork unitOfWork = Instancia.Commited; + try + { + repasses?.ForEach(Action); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return true; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + void Action(VendedorParcela x) + { + _ = ((DomainBase)x).Id; + x = ((((DomainBase)x).Id == 0L) ? unitOfWork.VendedorParcelaRepository.SaveOrUpdate(x) : unitOfWork.VendedorParcelaRepository.Merge(x)); + if (((DomainBase)x).Id == 0L) + { + logs.Add(CreateLog(((DomainBase)x).Id, ((DomainBase)x).GetValorOriginal(), (TipoTela)37, (TipoAcao)0)); + } + else + { + logs.Add(CreateLog(((DomainBase)x).Id, ((DomainBase)x).Compare(((DomainBase)x).GetValorOriginal()), (TipoTela)37, (TipoAcao)1)); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)189, tries, repasses, abrirTela: false); + } + } + return false; + }); + } + + public async Task<bool> Delete(Parcela parcela, List<Parcela> todas) + { + int tries = 3; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.ParcelaRepository.Delete(((DomainBase)parcela).Id); + List<RegistroLog> keyValues = new List<RegistroLog> { CreateLog(((DomainBase)parcela).Id, ((DomainBase)parcela).GetValorOriginal(), (TipoTela)5, (TipoAcao)2) }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)190, tries, parcela); + } + } + return false; + }); + } + + public async Task<bool> DeletePagamentoRange(List<VendedorParcela> repasses) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.VendedorParcelaRepository.DeleteRange(repasses); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)21, tries, repasses, abrirTela: false); + } + } + return false; + }); + } + + public async Task<List<Parcela>> UpdateRange(List<Parcela> parcelas) + { + base.Sucesso = true; + int tries = 3; + List<Parcela> parcelasOriginais = parcelas; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + parcelas = parcelasOriginais; + try + { + List<RegistroLog> logs = new List<RegistroLog>(); + UnitOfWork unitOfWork = Instancia.Commited; + try + { + parcelas = unitOfWork.ParcelaRepository.UpdateRange(parcelas); + parcelas.ForEach(delegate(Parcela x) + { + logs.Add(CreateLog(((DomainBase)x).Id, ((DomainBase)x).Compare(((DomainBase)x).GetValorOriginal()), (TipoTela)5, (TipoAcao)1)); + SaveLog(logs, unitOfWork); + }); + ((GenericUnitOfWork)unitOfWork).Commit(); + return parcelas; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)24, tries, parcelas, abrirTela: false); + } + } + return parcelasOriginais; + }); + } + + public async Task<Parcela> BuscarParcela(long id) + { + int tries = 3; + return await Task.Run((Func<Parcela>)delegate + { + //IL_0059: Unknown result type (might be due to invalid IL or missing references) + //IL_005f: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)74, tries, id); + } + } + return new Parcela(); + }); + } + + public async Task<bool> UpdateDetalhes(List<DetalheExtrato> detalhes) + { + int tries = 3; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + bool flag = Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 51); + bool result = unitOfWork.ParcelaRepository.Update(detalhes, flag); + IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); + detalhes.ForEach(delegate(DetalheExtrato 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_004c: Unknown result type (might be due to invalid IL or missing references) + //IL_0054: 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_006a: 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_00b7: Expected O, but got Unknown + 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)23, + 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 result; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)192, tries, detalhes); + } + } + return false; + }); + } + + public async Task<List<Documento>> BuscarFaturas(Filtros filtro, bool buscaAssinaturas = 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.ParcelaRepository.BuscaDocumentosPorVigencia(filtro, buscaAssinaturas, painelBi); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)76, tries, filtro); + } + } + return new List<Documento>(); + }); + } + + public async Task<List<Documento>> BuscarFatura(string numero) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindNumFatura(numero); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)322, tries, numero); + } + } + return new List<Documento>(); + }); + } + + public async Task<List<Parcela>> BuscarParcelasRecebimento(Filtros filtro) + { + int tries = 3; + return await Task.Run(async delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Read; + try + { + return await unitOfWork.ParcelaRepository.FindByRecebimento(filtro); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)77, tries, filtro); + } + } + return new List<Parcela>(); + }); + } + + public async Task<List<Parcela>> BuscarParcelasPendentes(Filtros filtro, bool somenteAtivos = false) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindByPendente(filtro, true, somenteAtivos); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)78, tries, filtro); + } + } + return new List<Parcela>(); + }); + } + + public async Task<List<Parcela>> BuscarParcelas(Filtros filtro, bool somenteAtivos = false) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindByPendente(filtro, false, somenteAtivos); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)79, tries, filtro); + } + } + return new List<Parcela>(); + }); + } + + public async Task<List<VendedorParcela>> BuscarPagamentoVendedor(Filtros filtro, bool reciboPagamento, bool segundaViaReciboPagamento) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.FindByPagamento(filtro, reciboPagamento, segundaViaReciboPagamento, Recursos.Configuracoes.Any((ConfiguracaoSistema x) => (int)x.Configuracao == 34)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)80, tries, filtro); + } + } + return new List<VendedorParcela>(); + }); + } + + public async Task<bool> TemPagamento(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.VendedorParcelaRepository.TemPagamentoParcela(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)82, tries, id); + } + } + return false; + }); + } + + public async Task<bool> GerarPagamento(List<VendedorParcela> pagamentos) + { + int tries = 3; + DateTime now = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + if (!commited.VendedorParcelaRepository.GerarPagamento(pagamentos.Select((VendedorParcela x) => ((DomainBase)x).Id).ToList(), now)) + { + return false; + } + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)193, tries, pagamentos); + } + } + return false; + }); + } + + public async Task<Documento> BuscarApolice(long id) + { + int tries = 3; + return await Task.Run((Func<Documento>)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.ParcelaRepository.BuscarApolice(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)3, tries, id); + } + } + return new Documento(); + }); + } + + public async Task<string> SalvarObservacoes(long id, string observacao) + { + int tries = 3; + base.Sucesso = true; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + List<RegistroLog> list = new List<RegistroLog>(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + Parcela val = commited.ParcelaRepository.FindById(id); + ((DomainBase)val).Initialize(); + val.Observacao = observacao; + list.Add(CreateLog(((DomainBase)val).Id, val, (TipoTela)5)); + commited.ParcelaRepository.Merge(val); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return observacao; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)24, tries, new { id, observacao }); + } + } + return ""; + }); + } + + public async Task<List<Documento>> FaturaPendente(Filtros filtro) + { + int tries = 3; + return await Task.Run(async delegate + { + while (tries > 0) + { + try + { + UnitOfWork unitOfWork = Instancia.Read; + try + { + return await unitOfWork.ParcelaRepository.FaturaPendente(filtro); + } + finally + { + ((IDisposable)unitOfWork)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)83, tries, filtro); + } + } + return new List<Documento>(); + }); + } + + public async Task<List<PrevisaoPagamento>> BuscarPrevisaoPagamentoComissao(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.PrevisaoPagamentoComissao(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)316, tries, filtro); + } + } + return new List<PrevisaoPagamento>(); + }); + } + + public async Task<string> BuscarLogAntigo(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParcelaRepository.BuscarLogAntigo(id, Connection.GetConnectionString()); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)319, tries, id); + } + } + return (string)null; + }); + } +} |