diff options
Diffstat (limited to 'Decompiler/Gestor.Application.Servicos.Configuracoes/ConfuguracoesServico.cs')
| -rw-r--r-- | Decompiler/Gestor.Application.Servicos.Configuracoes/ConfuguracoesServico.cs | 479 |
1 files changed, 479 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Servicos.Configuracoes/ConfuguracoesServico.cs b/Decompiler/Gestor.Application.Servicos.Configuracoes/ConfuguracoesServico.cs new file mode 100644 index 0000000..a9b2290 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Configuracoes/ConfuguracoesServico.cs @@ -0,0 +1,479 @@ +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.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Validation; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Configuracoes; + +public class ConfuguracoesServico : BaseServico +{ + public async Task<List<ConfiguracaoSistema>> Buscar() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ConfiguracaoRepository.BuscarConfiguracoes(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)297, tries); + } + } + return (List<ConfiguracaoSistema>)null; + }); + } + + public async Task<ConfiguracaoSistema> Salvar(ConfiguracaoSistema configuracao) + { + int tries = 3; + return await Task.Run((Func<ConfiguracaoSistema>)delegate + { + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0034: Unknown result type (might be due to invalid IL or missing references) + //IL_003b: Unknown result type (might be due to invalid IL or missing references) + //IL_0046: Unknown result type (might be due to invalid IL or missing references) + //IL_004d: Unknown result type (might be due to invalid IL or missing references) + //IL_0064: Unknown result type (might be due to invalid IL or missing references) + //IL_007d: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_0091: Unknown result type (might be due to invalid IL or missing references) + //IL_009c: Unknown result type (might be due to invalid IL or missing references) + //IL_00a7: Unknown result type (might be due to invalid IL or missing references) + //IL_00b2: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + ConfiguracaoSistema val = commited.ConfiguracaoRepository.SaveOrUpdate(configuracao); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)0, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} ADICIONOU, EM {networkTime}, A CONFIGURAÇÃO {Funcoes.GetDescription((Enum)(object)val.Configuracao)} ", + EntidadeId = ((DomainBase)val).Id, + Tela = (TipoTela)50, + 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 val; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)298, tries, configuracao); + } + } + return configuracao; + }); + } + + public async Task<bool> Excluir(ConfiguracaoSistema configuracao) + { + int tries = 3; + return await Task.Run(delegate + { + //IL_0033: Unknown result type (might be due to invalid IL or missing references) + //IL_0038: Unknown result type (might be due to invalid IL or missing references) + //IL_003f: Unknown result type (might be due to invalid IL or missing references) + //IL_004a: Unknown result type (might be due to invalid IL or missing references) + //IL_0051: Unknown result type (might be due to invalid IL or missing references) + //IL_006d: Unknown result type (might be due to invalid IL or missing references) + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_0097: Unknown result type (might be due to invalid IL or missing references) + //IL_009f: 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_00fd: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork commited = Instancia.Commited; + try + { + commited.ConfiguracaoRepository.Delete(((DomainBase)configuracao).Id); + DateTime networkTime = Funcoes.GetNetworkTime(); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = networkTime, + Descricao = $"O USUÁRIO {Recursos.Usuario.Nome} EXCLUIU, EM {networkTime}, A CONFIGURAÇÃO {Funcoes.GetDescription((Enum)(object)configuracao.Configuracao)} ", + EntidadeId = ((DomainBase)configuracao).Id, + Tela = (TipoTela)50, + 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 true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)298, tries, configuracao); + } + } + return false; + }); + } + + public async Task<List<ParametrosRelatorio>> BuscarParametros(Relatorio relatorio) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParametrosRelatorioRepository.Find(((DomainBase)Recursos.Usuario).Id, relatorio); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)301, tries, new + { + ((DomainBase)Recursos.Usuario).Id, + relatorio + }); + } + } + return (List<ParametrosRelatorio>)null; + }); + } + + public List<ParametrosTotalizacao> BuscarParametroTotalizacao(Relatorio relatorio) + { + //IL_0041: Unknown result type (might be due to invalid IL or missing references) + //IL_001b: Unknown result type (might be due to invalid IL or missing references) + int num = 3; + while (num > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParametrosTotalizacaoRepository.Find(((DomainBase)Recursos.Usuario).Id, relatorio); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + num = Registrar(e, (TipoErro)302, num, new + { + ((DomainBase)Recursos.Usuario).Id, + relatorio + }); + } + } + return null; + } + + public async Task<List<ParametrosTotalizacao>> BuscarParametroTotalizacaoAsync(Relatorio relatorio) + { + //IL_0016: Unknown result type (might be due to invalid IL or missing references) + //IL_0017: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0050: Unknown result type (might be due to invalid IL or missing references) + //IL_001a: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.ParametrosTotalizacaoRepository.Find(((DomainBase)Recursos.Usuario).Id, relatorio); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)302, tries, new + { + ((DomainBase)Recursos.Usuario).Id, + relatorio + }); + } + } + return (List<ParametrosTotalizacao>)null; + }); + } + + public async Task<bool> Salvar(List<ParametrosRelatorio> parametrosSalvar, List<ParametrosRelatorio> parametrosDelete) + { + int tries = 3; + DateTime dateHora = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + //IL_006e: 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_009a: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ac: Unknown result type (might be due to invalid IL or missing references) + //IL_00b8: Unknown result type (might be due to invalid IL or missing references) + //IL_00c5: Unknown result type (might be due to invalid IL or missing references) + //IL_00d2: 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_00e5: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_00fb: Unknown result type (might be due to invalid IL or missing references) + //IL_019b: Unknown result type (might be due to invalid IL or missing references) + //IL_01a0: Unknown result type (might be due to invalid IL or missing references) + //IL_01a7: Unknown result type (might be due to invalid IL or missing references) + //IL_01b2: Unknown result type (might be due to invalid IL or missing references) + //IL_01be: Unknown result type (might be due to invalid IL or missing references) + //IL_01cb: Unknown result type (might be due to invalid IL or missing references) + //IL_01d8: Unknown result type (might be due to invalid IL or missing references) + //IL_01e0: Unknown result type (might be due to invalid IL or missing references) + //IL_01eb: Unknown result type (might be due to invalid IL or missing references) + //IL_01f6: Unknown result type (might be due to invalid IL or missing references) + //IL_0201: Unknown result type (might be due to invalid IL or missing references) + //IL_0139: Expected O, but got Unknown + //IL_023f: Expected O, but got Unknown + while (tries > 0) + { + try + { + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + UnitOfWork commited = Instancia.Commited; + try + { + foreach (ParametrosRelatorio item in parametrosSalvar) + { + if (item.IdUsuario == 0L) + { + item.Id = 0L; + item.IdUsuario = ((DomainBase)Recursos.Usuario).Id; + } + item.Ordem = parametrosSalvar.IndexOf(item); + TipoAcao acao = (TipoAcao)(item.Id != 0L); + ParametrosRelatorio val = ((item.Id == 0L) ? commited.ParametrosRelatorioRepository.SaveOrUpdate(item) : commited.ParametrosRelatorioRepository.Merge(item)); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = dateHora, + Descricao = JsonConvert.SerializeObject((object)val), + EntidadeId = val.Id, + Tela = (TipoTela)50, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + } + foreach (ParametrosRelatorio item2 in parametrosDelete) + { + if (item2.Id != 0L) + { + commited.ParametrosRelatorioRepository.Delete(item2.Id); + RegistroLog keyValues2 = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = dateHora, + Descricao = JsonConvert.SerializeObject((object)item2), + EntidadeId = item2.Id, + Tela = (TipoTela)50, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues2, commited); + } + } + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return true; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)303, tries, parametrosSalvar); + } + } + return false; + }); + } + + public async Task<bool> SalvarTotalizacoes(List<ParametrosTotalizacao> parametrosSalvar, List<ParametrosTotalizacao> parametrosDeletar) + { + int tries = 3; + DateTime dateHora = Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + //IL_0063: Unknown result type (might be due to invalid IL or missing references) + //IL_0089: Unknown result type (might be due to invalid IL or missing references) + //IL_008e: 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_0096: Unknown result type (might be due to invalid IL or missing references) + //IL_00a1: Unknown result type (might be due to invalid IL or missing references) + //IL_00ad: Unknown result type (might be due to invalid IL or missing references) + //IL_00ba: Unknown result type (might be due to invalid IL or missing references) + //IL_00c7: 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_00e5: Unknown result type (might be due to invalid IL or missing references) + //IL_00f0: Unknown result type (might be due to invalid IL or missing references) + //IL_0190: Unknown result type (might be due to invalid IL or missing references) + //IL_0195: Unknown result type (might be due to invalid IL or missing references) + //IL_019c: Unknown result type (might be due to invalid IL or missing references) + //IL_01a7: Unknown result type (might be due to invalid IL or missing references) + //IL_01b3: Unknown result type (might be due to invalid IL or missing references) + //IL_01c0: Unknown result type (might be due to invalid IL or missing references) + //IL_01cd: Unknown result type (might be due to invalid IL or missing references) + //IL_01d5: Unknown result type (might be due to invalid IL or missing references) + //IL_01e0: Unknown result type (might be due to invalid IL or missing references) + //IL_01eb: Unknown result type (might be due to invalid IL or missing references) + //IL_01f6: Unknown result type (might be due to invalid IL or missing references) + //IL_012e: Expected O, but got Unknown + //IL_0234: Expected O, but got Unknown + while (tries > 0) + { + try + { + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + UnitOfWork commited = Instancia.Commited; + try + { + foreach (ParametrosTotalizacao item in parametrosSalvar) + { + if (item.IdUsuario == 0L) + { + item.Id = 0L; + item.IdUsuario = ((DomainBase)Recursos.Usuario).Id; + } + item.Ativa = true; + TipoAcao acao = (TipoAcao)(item.Id != 0L); + ParametrosTotalizacao val = ((item.Id == 0L) ? commited.ParametrosTotalizacaoRepository.SaveOrUpdate(item) : commited.ParametrosTotalizacaoRepository.Merge(item)); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = dateHora, + Descricao = JsonConvert.SerializeObject((object)val), + EntidadeId = val.Id, + Tela = (TipoTela)50, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues, commited); + } + foreach (ParametrosTotalizacao item2 in parametrosDeletar) + { + if (item2.Id != 0L) + { + commited.ParametrosTotalizacaoRepository.Delete(item2.Id); + RegistroLog keyValues2 = new RegistroLog + { + Acao = (TipoAcao)2, + Usuario = Recursos.Usuario, + DataHora = dateHora, + Descricao = JsonConvert.SerializeObject((object)item2), + EntidadeId = item2.Id, + Tela = (TipoTela)50, + Versao = LoginViewModel.VersaoAtual, + NomeMaquina = Environment.MachineName, + UsuarioMaquina = Environment.UserName, + Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString() + }; + SaveLog(keyValues2, commited); + } + } + ((GenericUnitOfWork)commited).Commit(); + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + return true; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)304, tries, parametrosSalvar); + } + } + return false; + }); + } +} |