summaryrefslogtreecommitdiff
path: root/Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs')
-rw-r--r--Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs124
1 files changed, 0 insertions, 124 deletions
diff --git a/Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs b/Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs
deleted file mode 100644
index 413a361..0000000
--- a/Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-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