summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Servicos.Ferramentas/MetaSeguradoraServico.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 15:29:41 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 15:29:41 +0000
commit225aa1499e37faf9d38257caabbadc68d78b427e (patch)
tree102bb7a40c58595348ae9d3c7076201759fe0720 /Decompiler/Gestor.Application.Servicos.Ferramentas/MetaSeguradoraServico.cs
parent1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff)
downloadgestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz
gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.Servicos.Ferramentas/MetaSeguradoraServico.cs')
-rw-r--r--Decompiler/Gestor.Application.Servicos.Ferramentas/MetaSeguradoraServico.cs169
1 files changed, 169 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/MetaSeguradoraServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/MetaSeguradoraServico.cs
new file mode 100644
index 0000000..e7afb7b
--- /dev/null
+++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/MetaSeguradoraServico.cs
@@ -0,0 +1,169 @@
+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.Common.Validation;
+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.Relatorios;
+using Gestor.Model.Domain.Seguros;
+using Newtonsoft.Json;
+
+namespace Gestor.Application.Servicos.Ferramentas;
+
+internal class MetaSeguradoraServico : BaseServico
+{
+ public async Task<MetaSeguradora> Save(MetaSeguradora metaSeguradora)
+ {
+ int tries = 3;
+ base.Sucesso = true;
+ MetaSeguradora metaSeguradoraOriginal = metaSeguradora;
+ return await Task.Run((Func<MetaSeguradora>)delegate
+ {
+ //IL_0028: Unknown result type (might be due to invalid IL or missing references)
+ //IL_006b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0070: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0071: 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_0082: Unknown result type (might be due to invalid IL or missing references)
+ //IL_008d: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0094: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0099: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00a5: Expected O, but got Unknown
+ //IL_00aa: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00bb: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00c3: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00ce: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d9: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00e4: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0121: Expected O, but got Unknown
+ while (tries > 0)
+ {
+ metaSeguradora = metaSeguradoraOriginal;
+ try
+ {
+ UnitOfWork commited = Instancia.Commited;
+ try
+ {
+ TipoAcao acao = (TipoAcao)(((DomainBase)metaSeguradora).Id != 0L);
+ metaSeguradora = ((((DomainBase)metaSeguradora).Id == 0L) ? commited.MetaSeguradoraRepository.SaveOrUpdate(metaSeguradora) : commited.MetaSeguradoraRepository.Merge(metaSeguradora));
+ IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
+ RegistroLog keyValues = new RegistroLog
+ {
+ Acao = acao,
+ Usuario = Recursos.Usuario,
+ DataHora = Funcoes.GetNetworkTime(),
+ Descricao = JsonConvert.SerializeObject((object)metaSeguradora, new JsonSerializerSettings
+ {
+ ReferenceLoopHandling = (ReferenceLoopHandling)1
+ }),
+ EntidadeId = ((DomainBase)metaSeguradora).Id,
+ Tela = (TipoTela)31,
+ 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 metaSeguradora;
+ }
+ finally
+ {
+ ((IDisposable)commited)?.Dispose();
+ }
+ }
+ catch (Exception e)
+ {
+ tries = Registrar(e, (TipoErro)222, tries, metaSeguradora);
+ }
+ }
+ return metaSeguradoraOriginal;
+ });
+ }
+
+ public async Task<bool> Delete(MetaSeguradora meta)
+ {
+ int tries = 3;
+ return await Task.Run(delegate
+ {
+ //IL_0033: Unknown result type (might be due to invalid IL or missing references)
+ //IL_003a: Expected O, but got Unknown
+ //IL_00a8: Unknown result type (might be due to invalid IL or missing references)
+ while (tries > 0)
+ {
+ try
+ {
+ UnitOfWork commited = Instancia.Commited;
+ try
+ {
+ commited.MetaSeguradoraRepository.Delete(((DomainBase)meta).Id);
+ DateTime networkTime = Funcoes.GetNetworkTime();
+ IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
+ RegistroLog val = new RegistroLog();
+ val.Acao = (TipoAcao)2;
+ val.Usuario = Recursos.Usuario;
+ val.DataHora = networkTime;
+ val.Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} EXCLUIU, EM {networkTime}, A META DE" + $"ID: '{((DomainBase)meta).Id}'" + ", MÊS: '" + ValidationHelper.GetDescription((Enum)(object)meta.Mes) + "'" + $", ANO: '{meta.Ano}'" + $", VALOR: 'R${meta.Valor}'.";
+ val.EntidadeId = ((DomainBase)meta).Id;
+ val.Tela = (TipoTela)31;
+ val.Versao = LoginViewModel.VersaoAtual;
+ val.NomeMaquina = Environment.MachineName;
+ val.UsuarioMaquina = Environment.UserName;
+ val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString();
+ RegistroLog keyValues = val;
+ SaveLog(keyValues, commited);
+ ((GenericUnitOfWork)commited).Commit();
+ return true;
+ }
+ finally
+ {
+ ((IDisposable)commited)?.Dispose();
+ }
+ }
+ catch (Exception e)
+ {
+ tries = Registrar(e, (TipoErro)223, tries, meta);
+ }
+ }
+ return false;
+ });
+ }
+
+ public async Task<List<MetaSeguradora>> BuscarMetasSeguradoras(Filtros filtro)
+ {
+ int tries = 3;
+ return await Task.Run(delegate
+ {
+ while (tries > 0)
+ {
+ try
+ {
+ UnitOfWork read = Instancia.Read;
+ try
+ {
+ return read.MetaSeguradoraRepository.FindByMeta(filtro);
+ }
+ finally
+ {
+ ((IDisposable)read)?.Dispose();
+ }
+ }
+ catch (Exception e)
+ {
+ tries = Registrar(e, (TipoErro)284, tries, filtro);
+ }
+ }
+ return new List<MetaSeguradora>();
+ });
+ }
+}