diff options
Diffstat (limited to 'Decompiler/Gestor.Application.Servicos/LogServico.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Servicos/LogServico.cs | 267 |
1 files changed, 267 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Servicos/LogServico.cs b/Decompiler/Gestor.Application.Servicos/LogServico.cs new file mode 100644 index 0000000..45c1289 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos/LogServico.cs @@ -0,0 +1,267 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Ferramentas; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.LogsEnvio; + +namespace Gestor.Application.Servicos; + +public class LogServico : BaseServico +{ + public async Task<ObservableCollection<RegistroLog>> FindByEntityId(TipoTela tela, long id) + { + //IL_0016: 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) + int tries = 3; + return await Task.Run(delegate + { + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection<RegistroLog>(from x in read.RegistroLogRepository.FindByEntityId(tela, id) + orderby x.DataHora descending + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)67, tries, new { tela, id }); + } + } + return new ObservableCollection<RegistroLog>(); + }); + } + + public async Task<ObservableCollection<RegistroLog>> BuscaLogParcelas(List<long> ids) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection<RegistroLog>(from x in read.RegistroLogRepository.BuscaLogParcelas(ids) + orderby x.DataHora descending + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)67, tries, new + { + Parcela = (TipoTela)5, + ids = ids + }); + } + } + return new ObservableCollection<RegistroLog>(); + }); + } + + public async Task<ObservableCollection<LogEmail>> FindByEntity(TipoTela tela, long id) + { + //IL_0016: 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) + int tries = 3; + return await Task.Run(delegate + { + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection<LogEmail>(from x in read.RegistroLogRepository.FindByEntity(tela, id) + orderby x.Data descending + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)68, tries, new { tela, id }); + } + } + return new ObservableCollection<LogEmail>(); + }); + } + + public async Task<ObservableCollection<LogEmail>> FindById(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection<LogEmail>(read.RegistroLogRepository.FindByIdSingle(id)); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)69, tries, new { id }); + } + } + return new ObservableCollection<LogEmail>(); + }); + } + + public async Task<ObservableCollection<RegistroLog>> FindAllByEntityId(TipoTela tela, long id) + { + //IL_0016: 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) + int tries = 3; + return await Task.Run(delegate + { + //IL_006b: Unknown result type (might be due to invalid IL or missing references) + //IL_0013: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection<RegistroLog>(from x in read.RegistroLogRepository.FindByEntityId(tela, id) + orderby x.DataHora descending + select x); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)67, tries, new { tela, id }); + } + } + return new ObservableCollection<RegistroLog>(); + }); + } + + public async Task<List<LogsEnvio>> BuscarLogsEnvio(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.RegistroLogRepository.LogsEnvio(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)9, tries, filtro); + } + } + return new List<LogsEnvio>(); + }); + } + + public async Task<List<RegistroAcao>> BuscarLogs(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.RegistroAcaoRepository.Find(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)321, tries, filtro); + } + } + return new List<RegistroAcao>(); + }); + } + + public async Task<List<RegistroAcao>> BuscarLogsAntigos(Filtros filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.RegistroAcaoRepository.FindOld(filtro, Connection.GetConnectionString()); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)321, tries, filtro); + } + } + return new List<RegistroAcao>(); + }); + } +} |