From 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:38:18 -0300 Subject: chore: location --- .../Servicos/Seguros/ProfissaoServico.cs | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Codemerx/Gestor.Application/Servicos/Seguros/ProfissaoServico.cs (limited to 'Codemerx/Gestor.Application/Servicos/Seguros/ProfissaoServico.cs') diff --git a/Codemerx/Gestor.Application/Servicos/Seguros/ProfissaoServico.cs b/Codemerx/Gestor.Application/Servicos/Seguros/ProfissaoServico.cs new file mode 100644 index 0000000..f528fcb --- /dev/null +++ b/Codemerx/Gestor.Application/Servicos/Seguros/ProfissaoServico.cs @@ -0,0 +1,78 @@ +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 System; +using System.Diagnostics; +using System.Runtime.CompilerServices; +using System.Threading.Tasks; + +namespace Gestor.Application.Servicos.Seguros +{ + internal class ProfissaoServico : BaseServico + { + public ProfissaoServico() + { + } + + public async Task FindLastId() + { + int num1 = 3; + long num2 = await Task.Run(() => { + long num; + while (num1 > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + num = read.get_ProfissaoRepository().FindLastId(); + } + } + catch (Exception exception) + { + num1 = base.Registrar(exception, 17, num1, null, true); + continue; + } + return num; + } + return (long)0; + }); + return num2; + } + + public async Task Save(Profissao profissao) + { + int num = 3; + base.Sucesso = true; + Profissao profissao1 = profissao; + Profissao profissao2 = await Task.Run(() => { + Profissao profissao3; + while (num > 0) + { + profissao = profissao1; + try + { + using (UnitOfWork commited = Instancia.Commited) + { + profissao = (profissao.get_Id() == (long)0 ? commited.get_ProfissaoRepository().SaveOrUpdate(profissao) : commited.get_ProfissaoRepository().Merge(profissao)); + commited.Commit(); + profissao3 = profissao; + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 214, num, profissao, true); + continue; + } + return profissao3; + } + return profissao1; + }); + return profissao2; + } + } +} \ No newline at end of file -- cgit v1.2.3