summaryrefslogtreecommitdiff
path: root/Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:35:25 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:35:25 +0000
commit674ca83ba9243a9e95a7568c797668dab6aee26a (patch)
tree4a905b3fb1d827665a34d63f67bc5559f8e7235b /Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs
downloadgestor-674ca83ba9243a9e95a7568c797668dab6aee26a.tar.gz
gestor-674ca83ba9243a9e95a7568c797668dab6aee26a.zip
feat: upload files
Diffstat (limited to 'Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs')
-rw-r--r--Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs124
1 files changed, 124 insertions, 0 deletions
diff --git a/Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs b/Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs
new file mode 100644
index 0000000..413a361
--- /dev/null
+++ b/Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs
@@ -0,0 +1,124 @@
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos.Generic;
+using Gestor.Infrastructure.Repository.Interface;
+using Gestor.Infrastructure.UnitOfWork.Generic;
+using Gestor.Infrastructure.UnitOfWork.Logic;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Threading.Tasks;
+
+namespace Gestor.Application.Servicos.Ferramentas
+{
+ internal class EstipulanteServico : BaseServico
+ {
+ public EstipulanteServico()
+ {
+ }
+
+ internal async Task<Estipulante> BuscarEstipulantePorId(long id)
+ {
+ int num = 3;
+ Estipulante estipulante1 = await Task.Run<Estipulante>(() => {
+ Estipulante estipulante;
+ while (num > 0)
+ {
+ try
+ {
+ using (UnitOfWork read = Instancia.Read)
+ {
+ estipulante = read.get_EstipulanteRepository().FindById(id);
+ }
+ }
+ catch (Exception exception)
+ {
+ num = base.Registrar(exception, 110, num, id, true);
+ continue;
+ }
+ return estipulante;
+ }
+ return new Estipulante();
+ });
+ return estipulante1;
+ }
+
+ public async Task<bool> Delete(Estipulante estipulante)
+ {
+ int num = 3;
+ bool flag1 = await Task.Run<bool>(() => {
+ bool flag;
+ while (num > 0)
+ {
+ List<RegistroLog> registroLogs = new List<RegistroLog>();
+ try
+ {
+ using (UnitOfWork commited = Instancia.Commited)
+ {
+ registroLogs.Add(base.CreateLog(estipulante.get_Id(), estipulante.GetValorOriginal(), 9, 2));
+ commited.get_EstipulanteRepository().Delete(estipulante.get_Id());
+ base.SaveLog(registroLogs, commited);
+ commited.Commit();
+ flag = true;
+ }
+ }
+ catch (Exception exception)
+ {
+ num = base.Registrar(exception, 220, num, estipulante, true);
+ continue;
+ }
+ return flag;
+ }
+ return false;
+ });
+ return flag1;
+ }
+
+ public async Task<Estipulante> Save(Estipulante estipulante)
+ {
+ int num = 3;
+ base.Sucesso = true;
+ Estipulante estipulante1 = estipulante;
+ Estipulante estipulante2 = await Task.Run<Estipulante>(() => {
+ Estipulante estipulante3;
+ bool flag;
+ while (num > 0)
+ {
+ List<RegistroLog> registroLogs = new List<RegistroLog>();
+ estipulante = estipulante1;
+ try
+ {
+ using (UnitOfWork commited = Instancia.Commited)
+ {
+ estipulante.set_IdEmpresa(Recursos.Empresa.get_Id());
+ flag = (estipulante.get_Id() == 0 ? false : true);
+ if (flag)
+ {
+ registroLogs.Add(base.CreateLog(estipulante.get_Id(), estipulante, 9));
+ }
+ estipulante = (estipulante.get_Id() == 0 ? commited.get_EstipulanteRepository().SaveOrUpdate(estipulante) : commited.get_EstipulanteRepository().Merge(estipulante));
+ if (!flag)
+ {
+ registroLogs.Add(base.CreateLog(estipulante.get_Id(), estipulante.GetValorOriginal(), 9, 0));
+ }
+ base.SaveLog(registroLogs, commited);
+ commited.Commit();
+ estipulante3 = estipulante;
+ }
+ }
+ catch (Exception exception)
+ {
+ num = base.Registrar(exception, 219, num, estipulante, true);
+ continue;
+ }
+ return estipulante3;
+ }
+ return estipulante1;
+ });
+ return estipulante2;
+ }
+ }
+} \ No newline at end of file