summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Servicos.Ferramentas/ImpostoServico.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Decompiler/Gestor.Application.Servicos.Ferramentas/ImpostoServico.cs')
-rw-r--r--Decompiler/Gestor.Application.Servicos.Ferramentas/ImpostoServico.cs175
1 files changed, 175 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Servicos.Ferramentas/ImpostoServico.cs b/Decompiler/Gestor.Application.Servicos.Ferramentas/ImpostoServico.cs
new file mode 100644
index 0000000..45b5b7b
--- /dev/null
+++ b/Decompiler/Gestor.Application.Servicos.Ferramentas/ImpostoServico.cs
@@ -0,0 +1,175 @@
+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.Ferramentas;
+using Gestor.Model.Domain.Generic;
+using Newtonsoft.Json;
+
+namespace Gestor.Application.Servicos.Ferramentas;
+
+public class ImpostoServico : BaseServico
+{
+ public async Task<List<Imposto>> Buscar(bool? ativo)
+ {
+ int tries = 3;
+ return await Task.Run(delegate
+ {
+ while (tries > 0)
+ {
+ try
+ {
+ UnitOfWork read = Instancia.Read;
+ try
+ {
+ return read.ImpostoRepository.DefaultSelect(ativo);
+ }
+ finally
+ {
+ ((IDisposable)read)?.Dispose();
+ }
+ }
+ catch (Exception e)
+ {
+ tries = Registrar(e, (TipoErro)317, tries, ativo);
+ }
+ }
+ return new List<Imposto>();
+ });
+ }
+
+ public async Task<List<Imposto>> BuscarPorSeguradora(long id)
+ {
+ int tries = 3;
+ return await Task.Run(delegate
+ {
+ while (tries > 0)
+ {
+ try
+ {
+ UnitOfWork read = Instancia.Read;
+ try
+ {
+ return read.ImpostoRepository.FindBySeguradora(id);
+ }
+ finally
+ {
+ ((IDisposable)read)?.Dispose();
+ }
+ }
+ catch (Exception e)
+ {
+ tries = Registrar(e, (TipoErro)317, tries, id);
+ }
+ }
+ return new List<Imposto>();
+ });
+ }
+
+ public async Task<List<Imposto>> BuscarPorRamo(long id)
+ {
+ int tries = 3;
+ return await Task.Run(delegate
+ {
+ while (tries > 0)
+ {
+ try
+ {
+ UnitOfWork read = Instancia.Read;
+ try
+ {
+ return read.ImpostoRepository.FindByRamo(id);
+ }
+ finally
+ {
+ ((IDisposable)read)?.Dispose();
+ }
+ }
+ catch (Exception e)
+ {
+ tries = Registrar(e, (TipoErro)317, tries, id);
+ }
+ }
+ return new List<Imposto>();
+ });
+ }
+
+ public async Task<Imposto> Salvar(Imposto imposto)
+ {
+ int tries = 3;
+ return await Task.Run((Func<Imposto>)delegate
+ {
+ //IL_0028: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0029: 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_0061: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0062: 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_0073: Unknown result type (might be due to invalid IL or missing references)
+ //IL_007e: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0080: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0085: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0091: Expected O, but got Unknown
+ //IL_0096: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00a2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00aa: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00b5: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00c0: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00cb: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0109: Expected O, but got Unknown
+ while (tries > 0)
+ {
+ base.Sucesso = true;
+ try
+ {
+ UnitOfWork commited = Instancia.Commited;
+ try
+ {
+ TipoAcao val = (TipoAcao)(((DomainBase)imposto).Id != 0L);
+ Imposto val2 = (((int)val == 0) ? commited.ImpostoRepository.SaveOrUpdate(imposto) : commited.ImpostoRepository.Merge(imposto));
+ IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
+ RegistroLog keyValues = new RegistroLog
+ {
+ Acao = val,
+ Usuario = Recursos.Usuario,
+ DataHora = Funcoes.GetNetworkTime(),
+ Descricao = JsonConvert.SerializeObject((object)val2, new JsonSerializerSettings
+ {
+ ReferenceLoopHandling = (ReferenceLoopHandling)1
+ }),
+ EntidadeId = ((DomainBase)val2).Id,
+ Tela = (TipoTela)56,
+ 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 val2;
+ }
+ finally
+ {
+ ((IDisposable)commited)?.Dispose();
+ }
+ }
+ catch (Exception e)
+ {
+ base.Sucesso = false;
+ tries = Registrar(e, (TipoErro)318, tries, imposto, abrirTela: false);
+ }
+ }
+ return imposto;
+ });
+ }
+}