From 674ca83ba9243a9e95a7568c797668dab6aee26a Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:35:25 -0300 Subject: feat: upload files --- Gestor.Application/Servicos/LogServico.cs | 262 ++++++++++++++++++++++++++++++ 1 file changed, 262 insertions(+) create mode 100644 Gestor.Application/Servicos/LogServico.cs (limited to 'Gestor.Application/Servicos/LogServico.cs') diff --git a/Gestor.Application/Servicos/LogServico.cs b/Gestor.Application/Servicos/LogServico.cs new file mode 100644 index 0000000..bc61ed1 --- /dev/null +++ b/Gestor.Application/Servicos/LogServico.cs @@ -0,0 +1,262 @@ +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Infrastructure.Repository.Interface; +using Gestor.Infrastructure.UnitOfWork.Logic; +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; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Gestor.Application.Servicos +{ + public class LogServico : BaseServico + { + public LogServico() + { + } + + public async Task> BuscaLogParcelas(List ids) + { + int num = 3; + ObservableCollection observableCollection1 = await Task.Run>(() => { + ObservableCollection observableCollection; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + List registroLogs = read.get_RegistroLogRepository().BuscaLogParcelas(ids); + Func u003cu003e9_11 = LogServico.u003cu003ec.u003cu003e9__1_1; + if (u003cu003e9_11 == null) + { + u003cu003e9_11 = (RegistroLog x) => x.get_DataHora(); + LogServico.u003cu003ec.u003cu003e9__1_1 = u003cu003e9_11; + } + observableCollection = new ObservableCollection(registroLogs.OrderByDescending(u003cu003e9_11)); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 67, num, new { Parcela = 5, ids = ids }, true); + continue; + } + return observableCollection; + } + return new ObservableCollection(); + }); + return observableCollection1; + } + + public async Task> BuscarLogs(Filtros filtro) + { + int num = 3; + List registroAcaos1 = await Task.Run>(() => { + List registroAcaos; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + registroAcaos = read.get_RegistroAcaoRepository().Find(filtro); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 321, num, filtro, true); + continue; + } + return registroAcaos; + } + return new List(); + }); + return registroAcaos1; + } + + public async Task> BuscarLogsAntigos(Filtros filtro) + { + int num = 3; + List registroAcaos1 = await Task.Run>(() => { + List registroAcaos; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + registroAcaos = read.get_RegistroAcaoRepository().FindOld(filtro, Connection.GetConnectionString()); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 321, num, filtro, true); + continue; + } + return registroAcaos; + } + return new List(); + }); + return registroAcaos1; + } + + public async Task> BuscarLogsEnvio(Filtros filtro) + { + int num = 3; + List logsEnvios1 = await Task.Run>(() => { + List logsEnvios; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + logsEnvios = read.get_RegistroLogRepository().LogsEnvio(filtro); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 9, num, filtro, true); + continue; + } + return logsEnvios; + } + return new List(); + }); + return logsEnvios1; + } + + public async Task> FindAllByEntityId(TipoTela tela, long id) + { + int num = 3; + ObservableCollection observableCollection1 = await Task.Run>(() => { + ObservableCollection observableCollection; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + List registroLogs = read.get_RegistroLogRepository().FindByEntityId(tela, id); + Func u003cu003e9_41 = LogServico.u003cu003ec.u003cu003e9__4_1; + if (u003cu003e9_41 == null) + { + u003cu003e9_41 = (RegistroLog x) => x.get_DataHora(); + LogServico.u003cu003ec.u003cu003e9__4_1 = u003cu003e9_41; + } + observableCollection = new ObservableCollection(registroLogs.OrderByDescending(u003cu003e9_41)); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 67, num, new { tela = tela, id = id }, true); + continue; + } + return observableCollection; + } + return new ObservableCollection(); + }); + return observableCollection1; + } + + public async Task> FindByEntity(TipoTela tela, long id) + { + int num = 3; + ObservableCollection observableCollection1 = await Task.Run>(() => { + ObservableCollection observableCollection; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + List logEmails = read.get_RegistroLogRepository().FindByEntity(tela, id); + Func u003cu003e9_21 = LogServico.u003cu003ec.u003cu003e9__2_1; + if (u003cu003e9_21 == null) + { + u003cu003e9_21 = (LogEmail x) => x.get_Data(); + LogServico.u003cu003ec.u003cu003e9__2_1 = u003cu003e9_21; + } + observableCollection = new ObservableCollection(logEmails.OrderByDescending(u003cu003e9_21)); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 68, num, new { tela = tela, id = id }, true); + continue; + } + return observableCollection; + } + return new ObservableCollection(); + }); + return observableCollection1; + } + + public async Task> FindByEntityId(TipoTela tela, long id) + { + int num = 3; + ObservableCollection observableCollection1 = await Task.Run>(() => { + ObservableCollection observableCollection; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + List registroLogs = read.get_RegistroLogRepository().FindByEntityId(tela, id); + Func u003cu003e9_01 = LogServico.u003cu003ec.u003cu003e9__0_1; + if (u003cu003e9_01 == null) + { + u003cu003e9_01 = (RegistroLog x) => x.get_DataHora(); + LogServico.u003cu003ec.u003cu003e9__0_1 = u003cu003e9_01; + } + observableCollection = new ObservableCollection(registroLogs.OrderByDescending(u003cu003e9_01)); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 67, num, new { tela = tela, id = id }, true); + continue; + } + return observableCollection; + } + return new ObservableCollection(); + }); + return observableCollection1; + } + + public async Task> FindById(long id) + { + int num = 3; + ObservableCollection observableCollection1 = await Task.Run>(() => { + ObservableCollection observableCollection; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + observableCollection = new ObservableCollection(read.get_RegistroLogRepository().FindByIdSingle(id)); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 69, num, new { id = id }, true); + continue; + } + return observableCollection; + } + return new ObservableCollection(); + }); + return observableCollection1; + } + } +} \ No newline at end of file -- cgit v1.2.3