diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 15:29:41 +0000 |
| commit | 225aa1499e37faf9d38257caabbadc68d78b427e (patch) | |
| tree | 102bb7a40c58595348ae9d3c7076201759fe0720 /Decompiler/Gestor.Application.Servicos.Ferramentas/RamoServico.cs | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.Servicos.Ferramentas/RamoServico.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Servicos.Ferramentas/RamoServico.cs | 191 |
1 files changed, 191 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/RamoServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/RamoServico.cs new file mode 100644 index 0000000..fc0dbe7 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/RamoServico.cs @@ -0,0 +1,191 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +using Gestor.Application.ViewModels; +using Gestor.Infrastructure.UnitOfWork.Generic; +using Gestor.Infrastructure.UnitOfWork.Logic; +using Gestor.Model.API; +using Gestor.Model.Common; +using Gestor.Model.Domain.Common; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Seguros; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Ferramentas; + +internal class RamoServico : BaseServico +{ + internal async Task<Ramo> Save(Ramo ramo, List<CoberturaPadrao> coberturas) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + Ramo ramoOriginal = ramo; + return await Task.Run((Func<Ramo>)delegate + { + //IL_0060: Unknown result type (might be due to invalid IL or missing references) + //IL_0065: Unknown result type (might be due to invalid IL or missing references) + //IL_006c: Unknown result type (might be due to invalid IL or missing references) + //IL_0077: Unknown result type (might be due to invalid IL or missing references) + //IL_0083: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_008f: Unknown result type (might be due to invalid IL or missing references) + //IL_009b: Expected O, but got Unknown + //IL_00a0: Unknown result type (might be due to invalid IL or missing references) + //IL_00b1: Unknown result type (might be due to invalid IL or missing references) + //IL_00b9: Unknown result type (might be due to invalid IL or missing references) + //IL_00c4: Unknown result type (might be due to invalid IL or missing references) + //IL_00cf: Unknown result type (might be due to invalid IL or missing references) + //IL_00da: Unknown result type (might be due to invalid IL or missing references) + //IL_0117: Expected O, but got Unknown + while (tries > 0) + { + ramo = ramoOriginal; + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + Ramo result = unitOfWork.RamoRepository.SaveOrUpdate(ramo); + coberturas?.ForEach(delegate(CoberturaPadrao x) + { + unitOfWork.CoberturaPadraoRepository.Merge(x); + }); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)1, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)ramo, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)ramo).Id, + Tela = (TipoTela)12, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return result; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)228, tries, new { ramo, coberturas }); + } + } + return ramoOriginal; + }); + } + + public async Task<List<Ramo>> BuscarRamos() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + return commited.RamoRepository.Find(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)169, tries); + } + } + return (List<Ramo>)null; + }); + } + + public async Task<Ramo> Insert(Ramo ramo) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + Ramo ramoOriginal = ramo; + return await Task.Run((Func<Ramo>)delegate + { + //IL_0039: Unknown result type (might be due to invalid IL or missing references) + //IL_003e: Unknown result type (might be due to invalid IL or missing references) + //IL_0045: Unknown result type (might be due to invalid IL or missing references) + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_0074: Expected O, but got Unknown + //IL_0079: Unknown result type (might be due to invalid IL or missing references) + //IL_008a: Unknown result type (might be due to invalid IL or missing references) + //IL_0092: Unknown result type (might be due to invalid IL or missing references) + //IL_009d: Unknown result type (might be due to invalid IL or missing references) + //IL_00a8: Unknown result type (might be due to invalid IL or missing references) + //IL_00b3: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Expected O, but got Unknown + while (tries > 0) + { + ramo = ramoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + ramo = commited.RamoRepository.SaveOrUpdate(ramo); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)0, + Usuario = Recursos.Usuario, + DataHora = now, + Descricao = JsonConvert.SerializeObject((object)ramo, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)ramo).Id, + Tela = (TipoTela)12, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + ((GenericUnitOfWork)commited).Commit(); + return ramo; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)230, tries, ramo); + } + } + return ramoOriginal; + }); + } +} |