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.Financeiro | |
| parent | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (diff) | |
| download | gestor-225aa1499e37faf9d38257caabbadc68d78b427e.tar.gz gestor-225aa1499e37faf9d38257caabbadc68d78b427e.zip | |
decompiler.com
Diffstat (limited to 'Decompiler/Gestor.Application.Servicos.Financeiro')
6 files changed, 1601 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Servicos.Financeiro/BancosContasServico.cs b/Decompiler/Gestor.Application.Servicos.Financeiro/BancosContasServico.cs new file mode 100644 index 0000000..a42dbf6 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Financeiro/BancosContasServico.cs @@ -0,0 +1,387 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +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.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Financeiro; + +internal class BancosContasServico : BaseServico +{ + public async Task<BancosContas> Save(BancosContas bancosContas) + { + int tries = 3; + base.Sucesso = true; + BancosContas bancosContasOriginal = bancosContas; + return await Task.Run((Func<BancosContas>)delegate + { + while (tries > 0) + { + List<RegistroLog> list = new List<RegistroLog>(); + bancosContas = bancosContasOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)bancosContas).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)bancosContas).Id, bancosContas, (TipoTela)26)); + } + bancosContas = ((((DomainBase)bancosContas).Id == 0L) ? commited.BancosContasRepository.SaveOrUpdate(bancosContas) : commited.BancosContasRepository.Merge(bancosContas)); + if (!num) + { + list.Add(CreateLog(((DomainBase)bancosContas).Id, ((DomainBase)bancosContas).GetValorOriginal(), (TipoTela)26, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return bancosContas; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)245, tries, bancosContas); + } + } + return bancosContasOriginal; + }); + } + + public async Task<Saldo> Save(Saldo saldo) + { + int tries = 3; + base.Sucesso = true; + Saldo saldoOriginal = saldo; + return await Task.Run((Func<Saldo>)delegate + { + while (tries > 0) + { + List<RegistroLog> list = new List<RegistroLog>(); + saldo = saldoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)saldo).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)saldo.Conta).Id, saldo, (TipoTela)26)); + } + saldo = ((((DomainBase)saldo).Id == 0L) ? commited.SaldoRepository.SaveOrUpdate(saldo) : commited.SaldoRepository.Merge(saldo)); + if (!num) + { + list.Add(CreateLog(((DomainBase)saldo.Conta).Id, ((DomainBase)saldo).GetValorOriginal(), (TipoTela)26, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return saldo; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)247, tries, saldo); + } + } + return saldoOriginal; + }); + } + + public async Task<bool> Delete(BancosContas bancosContas) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List<RegistroLog> list = new List<RegistroLog>(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)bancosContas).Id, ((DomainBase)bancosContas).GetValorOriginal(), (TipoTela)26, (TipoAcao)2)); + commited.BancosContasRepository.Delete(((DomainBase)bancosContas).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)246, tries, bancosContas); + } + } + return false; + }); + } + + public async Task<bool> DeleteSaldo(Saldo saldo) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List<RegistroLog> list = new List<RegistroLog>(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(((DomainBase)saldo).Id, ((DomainBase)saldo).GetValorOriginal(), (TipoTela)26, (TipoAcao)2)); + commited.SaldoRepository.Delete(((DomainBase)saldo).Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)248, tries, saldo); + } + } + return false; + }); + } + + public async Task<List<BancosContas>> BuscarBancos() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.BancosContasRepository.Find(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)145, tries); + } + } + return new List<BancosContas>(); + }); + } + + public async Task<Saldo> BuscarSaldoAberto(long id) + { + int tries = 3; + return await Task.Run((Func<Saldo>)delegate + { + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SaldoRepository.BuscarAberto(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)147, tries, id); + } + } + return new Saldo(); + }); + } + + public async Task<List<Saldo>> BuscarSaldoAberto(List<long> ids) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + List<Saldo> saldos = new List<Saldo>(); + UnitOfWork unitOfWork = Instancia.Read; + try + { + ids.ForEach(delegate(long id) + { + Saldo val = unitOfWork.SaldoRepository.BuscarAberto(id); + if (val != null) + { + saldos.Add(val); + } + }); + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + return saldos; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)148, tries, ids); + } + } + return new List<Saldo>(); + }); + } + + public async Task<Saldo> FecharSaldo(Saldo saldo) + { + int tries = 3; + return await Task.Run((Func<Saldo>)delegate + { + //IL_0057: Unknown result type (might be due to invalid IL or missing references) + //IL_005d: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.FecharSaldo(saldo); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)149, tries, saldo); + } + } + return new Saldo(); + }); + } + + public async Task<List<Saldo>> BuscarSaldos(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SaldoRepository.BuscarPorConta(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)150, tries, id); + } + } + return new List<Saldo>(); + }); + } + + public async Task<Saldo> BuscarSaldo(DateTime inicio, long id) + { + int tries = 3; + return await Task.Run((Func<Saldo>)delegate + { + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SaldoRepository.BuscarPorData(inicio, id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)151, tries, new { inicio, id }); + } + } + return new Saldo(); + }); + } + + public async Task<Saldo> BuscarSaldoInicial(long id) + { + int tries = 3; + return await Task.Run((Func<Saldo>)delegate + { + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.SaldoRepository.BuscarPorMenorData(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)151, tries, new { id }); + } + } + return new Saldo(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Financeiro/CentroServico.cs b/Decompiler/Gestor.Application.Servicos.Financeiro/CentroServico.cs new file mode 100644 index 0000000..0323595 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Financeiro/CentroServico.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +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.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Financeiro; + +internal class CentroServico : BaseServico +{ + public async Task<Centro> Save(Centro centro) + { + int tries = 3; + base.Sucesso = true; + Centro centroOriginal = centro; + return await Task.Run((Func<Centro>)delegate + { + while (tries > 0) + { + List<RegistroLog> list = new List<RegistroLog>(); + centro = centroOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)centro).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)centro).Id, centro, (TipoTela)29)); + } + centro = ((((DomainBase)centro).Id == 0L) ? commited.CentroRepository.SaveOrUpdate(centro) : commited.CentroRepository.Merge(centro)); + if (!num) + { + list.Add(CreateLog(((DomainBase)centro).Id, ((DomainBase)centro).GetValorOriginal(), (TipoTela)29, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return centro; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)249, tries, centro); + } + } + return centroOriginal; + }); + } + + public async Task<List<Centro>> BuscarCentros() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.CentroRepository.Find(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)153, tries); + } + } + return new List<Centro>(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Financeiro/FinanceiroServico.cs b/Decompiler/Gestor.Application.Servicos.Financeiro/FinanceiroServico.cs new file mode 100644 index 0000000..e57fb32 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Financeiro/FinanceiroServico.cs @@ -0,0 +1,789 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +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.Financeiro; +using Gestor.Model.Domain.Financeiro.Relatorios; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Financeiro; + +public class FinanceiroServico : BaseServico +{ + public async Task<bool> TemLancamentosPorFornecedor(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.HasByFornecedor(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)154, tries, id); + } + } + return false; + }); + } + + public async Task<List<Lancamento>> BuscarLancamentosPorFornecedor(long id, StatusLancamento status) + { + //IL_001e: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0074: Unknown result type (might be due to invalid IL or missing references) + //IL_0019: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindByFornecedor(id, status) + orderby x.Vencimento descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)157, tries, new { id, status }); + } + } + return new List<Lancamento>(); + }); + } + + public async Task<List<Lancamento>> BuscarLancamentosPorFornecedor(long id, DateTime date, Sinal sinal) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindByFornecedor(id, date, sinal) + orderby x.Vencimento descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)157, tries, new { id, date }); + } + } + return new List<Lancamento>(); + }); + } + + public async Task<List<Lancamento>> BuscarLancamentosPorControle(long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.FindByControle(id, (StatusLancamento)2); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)158, tries, new { id }); + } + } + return new List<Lancamento>(); + }); + } + + public async Task<List<Lancamento>> BuscarLancamentos(DateTime inicio, DateTime fim, StatusLancamento status) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.Find(inicio, fim, status) + orderby x.Vencimento descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)160, tries, new { inicio, fim, status }); + } + } + return new List<Lancamento>(); + }); + } + + public async Task<List<Lancamento>> BuscarLancamentosPorLancamento(DateTime inicio, DateTime fim, StatusLancamento status) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0080: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindByLancamento(inicio, fim, status) + orderby x.DataLancamento descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)329, tries, new { inicio, fim, status }); + } + } + return new List<Lancamento>(); + }); + } + + public async Task<List<Lancamento>> BuscarLancamentos(DateTime inicio, DateTime fim, long conta) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindLancamentosByConta(inicio, fim, conta) + orderby x.Vencimento descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)165, tries, new { inicio, fim, conta }); + } + } + return new List<Lancamento>(); + }); + } + + public async Task<List<Lancamento>> BuscarLancamentosPersonalizados(DateTime inicio, DateTime fim, StatusLancamento status, FiltroLancamentoData filtrodata) + { + //IL_0026: Unknown result type (might be due to invalid IL or missing references) + //IL_0027: Unknown result type (might be due to invalid IL or missing references) + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_0030: Unknown result type (might be due to invalid IL or missing references) + int tries = 3; + return await Task.Run(delegate + { + //IL_0086: Unknown result type (might be due to invalid IL or missing references) + //IL_001f: Unknown result type (might be due to invalid IL or missing references) + //IL_0025: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindPersonalizado(inicio, fim, status, filtrodata) + orderby x.Vencimento descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)160, tries, new { inicio, fim, status }); + } + } + return new List<Lancamento>(); + }); + } + + public async Task<List<Lancamento>> BuscarLancamentosPorBaixa(DateTime inicio, DateTime fim) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindByBaixa(inicio, fim) + orderby x.Baixa descending + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)161, tries, new { inicio, fim }); + } + } + return new List<Lancamento>(); + }); + } + + public async Task<List<Lancamento>> BuscarLancamentosPorPagamento(DateTime inicio, DateTime fim) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return (from x in read.LancamentoRepository.FindByPagamento(inicio, fim) + orderby x.Pagamento + select x).ToList(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)162, tries, new { inicio, fim }); + } + } + return new List<Lancamento>(); + }); + } + + public async Task<Lancamento> Save(Lancamento lancamento) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + Lancamento lancamentoOriginal = lancamento; + return await Task.Run((Func<Lancamento>)delegate + { + while (tries > 0) + { + List<RegistroLog> list = new List<RegistroLog>(); + lancamento = lancamentoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + int num; + if (((DomainBase)lancamento).Id != 0L) + { + num = 1; + if (num != 0) + { + goto IL_0047; + } + } + else + { + num = 0; + } + lancamento.DataLancamento = now; + goto IL_0047; + IL_0047: + if (num == 1) + { + list.Add(CreateLog(((DomainBase)lancamento).Id, lancamento, (TipoTela)25)); + } + ControleFinanceiro controle = lancamento.Controle; + controle = ((((DomainBase)controle).Id == 0L) ? commited.ControleFinanceiroRepository.SaveOrUpdate(controle) : commited.ControleFinanceiroRepository.Merge(controle)); + lancamento.Controle = controle; + lancamento = ((((DomainBase)lancamento).Id == 0L) ? commited.LancamentoRepository.SaveOrUpdate(lancamento) : commited.LancamentoRepository.Merge(lancamento)); + if (num == 0) + { + list.Add(CreateLog(((DomainBase)lancamento).Id, ((DomainBase)lancamento).GetValorOriginal(), (TipoTela)25, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return lancamento; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)279, tries, lancamento); + } + } + return lancamentoOriginal; + }); + } + + public async Task<List<Lancamento>> AddRange(List<Lancamento> lancamentos) + { + int tries = 3; + base.Sucesso = true; + DateTime now = Funcoes.GetNetworkTime(); + List<Lancamento> lancamentosOriginal = lancamentos; + return await Task.Run(delegate + { + while (tries > 0) + { + List<RegistroLog> logs = new List<RegistroLog>(); + lancamentos = lancamentosOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + ControleFinanceiro controle = lancamentos.First().Controle; + controle = ((((DomainBase)controle).Id == 0L) ? commited.ControleFinanceiroRepository.SaveOrUpdate(controle) : commited.ControleFinanceiroRepository.Merge(controle)); + lancamentos.ForEach(delegate(Lancamento x) + { + x.Controle = controle; + x.DataLancamento = now; + }); + lancamentos = commited.LancamentoRepository.AddRange(lancamentos); + lancamentos.ForEach(delegate(Lancamento x) + { + logs.Add(CreateLog(((DomainBase)x).Id, ((DomainBase)x).GetValorOriginal(), (TipoTela)25, (TipoAcao)0)); + }); + SaveLog(logs, commited); + ((GenericUnitOfWork)commited).Commit(); + return lancamentos; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)279, tries, lancamentos); + } + } + return lancamentosOriginal; + }); + } + + public async Task<List<Lancamento>> Atualizar(List<Lancamento> lancamentos) + { + int tries = 3; + base.Sucesso = true; + Funcoes.GetNetworkTime(); + List<Lancamento> lancamentosOriginal = lancamentos; + return await Task.Run(delegate + { + while (tries > 0) + { + List<RegistroLog> logs = new List<RegistroLog>(); + lancamentos = lancamentosOriginal; + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + lancamentos.ForEach(delegate(Lancamento lancamento) + { + logs.Add(CreateLog(((DomainBase)lancamento).Id, lancamento, (TipoTela)25)); + lancamento.Controle = unitOfWork.ControleFinanceiroRepository.Merge(lancamento.Controle); + lancamento = unitOfWork.LancamentoRepository.Merge(lancamento); + }); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return lancamentos; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)280, tries, lancamentos); + } + } + return lancamentosOriginal; + }); + } + + public async Task<List<Lancamento>> IncluirRange(List<Lancamento> lancamentos) + { + int tries = 3; + base.Sucesso = true; + Funcoes.GetNetworkTime(); + List<Lancamento> lancamentosOriginal = lancamentos; + return await Task.Run(delegate + { + while (tries > 0) + { + List<RegistroLog> logs = new List<RegistroLog>(); + lancamentos = lancamentosOriginal; + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + lancamentos.ForEach(delegate(Lancamento lancamento) + { + lancamento.Controle = unitOfWork.ControleFinanceiroRepository.Merge(lancamento.Controle); + lancamento = unitOfWork.LancamentoRepository.SaveOrUpdate(lancamento); + logs.Add(CreateLog(((DomainBase)lancamento).Id, ((DomainBase)lancamento).GetValorOriginal(), (TipoTela)25, (TipoAcao)0)); + }); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + return lancamentos; + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)281, tries, lancamentos); + } + } + return lancamentosOriginal; + }); + } + + public async Task<Lancamento> BuscarLancamento(long id, int parcela) + { + int tries = 3; + return await Task.Run((Func<Lancamento>)delegate + { + //IL_0068: Unknown result type (might be due to invalid IL or missing references) + //IL_006e: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.FindByControle(id, parcela); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)163, tries, new { id, parcela }); + } + } + return new Lancamento(); + }); + } + + public async Task<Lancamento> BuscarLancamento(long id) + { + int tries = 3; + return await Task.Run((Func<Lancamento>)delegate + { + //IL_005c: Unknown result type (might be due to invalid IL or missing references) + //IL_0062: Expected O, but got Unknown + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.FindById(id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)164, tries, id); + } + } + return new Lancamento(); + }); + } + + public async Task<bool> Excluir(List<Lancamento> lancamentos) + { + int tries = 3; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + List<RegistroLog> logs = new List<RegistroLog>(); + try + { + UnitOfWork unitOfWork = Instancia.Commited; + try + { + lancamentos.ForEach(delegate(Lancamento x) + { + bool num = unitOfWork.LancamentoRepository.FindByControle(((DomainBase)x.Controle).Id, (StatusLancamento)2).Count == 1; + logs.Add(CreateLog(((DomainBase)x).Id, ((DomainBase)x).GetValorOriginal(), (TipoTela)25, (TipoAcao)2)); + if (num) + { + unitOfWork.ControleFinanceiroRepository.Delete(((DomainBase)x.Controle).Id); + } + else + { + x.Controle.Parcelas = x.Controle.Parcelas - 1; + unitOfWork.ControleFinanceiroRepository.Merge(x.Controle); + unitOfWork.LancamentoRepository.Delete(((DomainBase)x).Id); + } + }); + SaveLog(logs, unitOfWork); + ((GenericUnitOfWork)unitOfWork).Commit(); + } + finally + { + if (unitOfWork != null) + { + ((IDisposable)unitOfWork).Dispose(); + } + } + return true; + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)282, tries, lancamentos); + } + } + return false; + }); + } + + public async Task<bool> Excluir(Lancamento lancamento) + { + int tries = 3; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + List<RegistroLog> list = new List<RegistroLog>(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = commited.LancamentoRepository.FindByControle(((DomainBase)lancamento.Controle).Id, (StatusLancamento)2).Count == 1; + list.Add(CreateLog(((DomainBase)lancamento).Id, ((DomainBase)lancamento).GetValorOriginal(), (TipoTela)25, (TipoAcao)2)); + if (num) + { + commited.ControleFinanceiroRepository.Delete(((DomainBase)lancamento.Controle).Id); + } + else + { + lancamento.Controle.Parcelas = lancamento.Controle.Parcelas - 1; + commited.ControleFinanceiroRepository.Merge(lancamento.Controle); + commited.LancamentoRepository.Delete(((DomainBase)lancamento).Id); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)282, tries, lancamento); + } + } + return false; + }); + } + + public async Task<List<ExtratoConta>> BuscarLancamentosPorConta(DateTime inicio, DateTime fim, long id) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.FindByConta(inicio, fim, id); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)165, tries, new { inicio, fim, id }); + } + } + return new List<ExtratoConta>(); + }); + } + + public async Task<bool> Transferir(Lancamento lancamentoOrigem, Lancamento lancamentoDestino) + { + int tries = 3; + Lancamento lancamentoOrigemOriginal = lancamentoOrigem; + Lancamento lancamentoDestinoOriginal = lancamentoDestino; + Funcoes.GetNetworkTime(); + return await Task.Run(delegate + { + while (tries > 0) + { + List<RegistroLog> list = new List<RegistroLog>(); + lancamentoOrigem = lancamentoOrigemOriginal; + lancamentoDestino = lancamentoDestinoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + ControleFinanceiro controle = lancamentoOrigem.Controle; + controle = commited.ControleFinanceiroRepository.SaveOrUpdate(controle); + lancamentoOrigem.Controle = controle; + lancamentoDestino.Controle = controle; + lancamentoOrigem = commited.LancamentoRepository.SaveOrUpdate(lancamentoOrigem); + lancamentoDestino = commited.LancamentoRepository.SaveOrUpdate(lancamentoDestino); + list.Add(CreateLog(((DomainBase)lancamentoOrigem).Id, ((DomainBase)lancamentoOrigem).GetValorOriginal(), (TipoTela)25, (TipoAcao)0)); + list.Add(CreateLog(((DomainBase)lancamentoDestino).Id, ((DomainBase)lancamentoDestino).GetValorOriginal(), (TipoTela)25, (TipoAcao)0)); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)283, tries, new { lancamentoOrigem, lancamentoDestino }); + } + } + return false; + }); + } + + public async Task<List<Lancamento>> BuscarFechamento(FiltroFinanceiro filtro) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.LancamentoRepository.Fechamento(filtro); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)294, tries, filtro); + } + } + return new List<Lancamento>(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Financeiro/FornecedorServico.cs b/Decompiler/Gestor.Application.Servicos.Financeiro/FornecedorServico.cs new file mode 100644 index 0000000..f26bc53 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Financeiro/FornecedorServico.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +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.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Financeiro; + +public class FornecedorServico : BaseServico +{ + public async Task<Fornecedor> Save(Fornecedor fornecedor) + { + int tries = 3; + base.Sucesso = true; + Fornecedor fornecedorOriginal = fornecedor; + return await Task.Run((Func<Fornecedor>)delegate + { + //IL_002e: Unknown result type (might be due to invalid IL or missing references) + //IL_002f: Unknown result type (might be due to invalid IL or missing references) + //IL_0031: Invalid comparison between Unknown and I4 + //IL_0058: Unknown result type (might be due to invalid IL or missing references) + //IL_0084: Unknown result type (might be due to invalid IL or missing references) + while (tries > 0) + { + List<RegistroLog> list = new List<RegistroLog>(); + fornecedor = fornecedorOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao val = (TipoAcao)(fornecedor.Id != 0L); + if ((int)val == 1) + { + list.Add(CreateLog(fornecedor.Id, fornecedor, (TipoTela)24)); + } + fornecedor = (((int)val == 0) ? commited.FornecedorRepository.SaveOrUpdate(fornecedor) : commited.FornecedorRepository.Merge(fornecedor)); + if ((int)val == 0) + { + list.Add(CreateLog(fornecedor.Id, ((DomainBase)fornecedor).GetValorOriginal(), (TipoTela)24, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return fornecedor; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)243, tries, fornecedor); + } + } + return fornecedorOriginal; + }); + } + + public async Task<bool> Delete(Fornecedor fornecedor) + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + List<RegistroLog> list = new List<RegistroLog>(); + try + { + UnitOfWork commited = Instancia.Commited; + try + { + list.Add(CreateLog(fornecedor.Id, ((DomainBase)fornecedor).GetValorOriginal(), (TipoTela)24, (TipoAcao)2)); + commited.FornecedorRepository.Delete(fornecedor.Id); + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return true; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)244, tries, fornecedor); + } + } + return false; + }); + } + + public async Task<List<Fornecedor>> BuscarFornecedores() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.FornecedorRepository.Find(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)166, tries); + } + } + return new List<Fornecedor>(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Financeiro/PlanoServico.cs b/Decompiler/Gestor.Application.Servicos.Financeiro/PlanoServico.cs new file mode 100644 index 0000000..166690d --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Financeiro/PlanoServico.cs @@ -0,0 +1,119 @@ +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.Financeiro; +using Gestor.Model.Domain.Generic; +using Newtonsoft.Json; + +namespace Gestor.Application.Servicos.Financeiro; + +internal class PlanoServico : BaseServico +{ + public async Task<Plano> Save(Plano plano) + { + int tries = 3; + base.Sucesso = true; + Plano planoOriginal = plano; + return await Task.Run((Func<Plano>)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) + { + plano = planoOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + TipoAcao acao = (TipoAcao)(((DomainBase)plano).Id != 0L); + plano = ((((DomainBase)plano).Id == 0L) ? commited.PlanoRepository.SaveOrUpdate(plano) : commited.PlanoRepository.Merge(plano)); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + RegistroLog keyValues = new RegistroLog + { + Acao = acao, + Usuario = Recursos.Usuario, + DataHora = Funcoes.GetNetworkTime(), + Descricao = JsonConvert.SerializeObject((object)plano, new JsonSerializerSettings + { + ReferenceLoopHandling = (ReferenceLoopHandling)1 + }), + EntidadeId = ((DomainBase)plano).Id, + Tela = (TipoTela)27, + 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 plano; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)250, tries, plano); + } + } + return planoOriginal; + }); + } + + public async Task<List<Planos>> BuscarPlanos() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return read.PlanosRepository.Find(); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)167, tries); + } + } + return new List<Planos>(); + }); + } +} diff --git a/Decompiler/Gestor.Application.Servicos.Financeiro/PlanosServico.cs b/Decompiler/Gestor.Application.Servicos.Financeiro/PlanosServico.cs new file mode 100644 index 0000000..1fbab43 --- /dev/null +++ b/Decompiler/Gestor.Application.Servicos.Financeiro/PlanosServico.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Threading.Tasks; +using Gestor.Application.Helpers; +using Gestor.Application.Servicos.Generic; +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.Financeiro; +using Gestor.Model.Domain.Generic; + +namespace Gestor.Application.Servicos.Financeiro; + +internal class PlanosServico : BaseServico +{ + internal async Task<ObservableCollection<Planos>> BuscarPlanos() + { + int tries = 3; + return await Task.Run(delegate + { + while (tries > 0) + { + try + { + UnitOfWork read = Instancia.Read; + try + { + return new ObservableCollection<Planos>(read.PlanosRepository.Find()); + } + finally + { + ((IDisposable)read)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)168, tries); + } + } + return new ObservableCollection<Planos>(); + }); + } + + public async Task<Planos> Save(Planos planos) + { + int tries = 3; + base.Sucesso = true; + Planos planosOriginal = planos; + return await Task.Run((Func<Planos>)delegate + { + while (tries > 0) + { + List<RegistroLog> list = new List<RegistroLog>(); + planos = planosOriginal; + try + { + UnitOfWork commited = Instancia.Commited; + try + { + bool num = ((DomainBase)planos).Id != 0L; + if (num) + { + list.Add(CreateLog(((DomainBase)planos).Id, planos, (TipoTela)28)); + } + planos = ((((DomainBase)planos).Id == 0L) ? commited.PlanosRepository.SaveOrUpdate(planos) : commited.PlanosRepository.Merge(planos)); + if (!num) + { + list.Add(CreateLog(((DomainBase)planos).Id, ((DomainBase)planos).GetValorOriginal(), (TipoTela)28, (TipoAcao)0)); + } + SaveLog(list, commited); + ((GenericUnitOfWork)commited).Commit(); + return planos; + } + finally + { + ((IDisposable)commited)?.Dispose(); + } + } + catch (Exception e) + { + tries = Registrar(e, (TipoErro)251, tries, planos); + } + } + return planosOriginal; + }); + } +} |