summaryrefslogtreecommitdiff
path: root/Gestor.Application/Servicos/Financeiro
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:38:18 +0000
commit1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch)
treee1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Gestor.Application/Servicos/Financeiro
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Gestor.Application/Servicos/Financeiro')
-rw-r--r--Gestor.Application/Servicos/Financeiro/BancosContasServico.cs362
-rw-r--r--Gestor.Application/Servicos/Financeiro/CentroServico.cs92
-rw-r--r--Gestor.Application/Servicos/Financeiro/FinanceiroServico.cs738
-rw-r--r--Gestor.Application/Servicos/Financeiro/FornecedorServico.cs123
-rw-r--r--Gestor.Application/Servicos/Financeiro/PlanoServico.cs120
-rw-r--r--Gestor.Application/Servicos/Financeiro/PlanosServico.cs93
6 files changed, 0 insertions, 1528 deletions
diff --git a/Gestor.Application/Servicos/Financeiro/BancosContasServico.cs b/Gestor.Application/Servicos/Financeiro/BancosContasServico.cs
deleted file mode 100644
index 68c9a50..0000000
--- a/Gestor.Application/Servicos/Financeiro/BancosContasServico.cs
+++ /dev/null
@@ -1,362 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Infrastructure.UnitOfWork.Logic;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Financeiro
-{
- internal class BancosContasServico : BaseServico
- {
- public BancosContasServico()
- {
- }
-
- public async Task<List<BancosContas>> BuscarBancos()
- {
- int num = 3;
- List<BancosContas> bancosContas1 = await Task.Run<List<BancosContas>>(() => {
- List<BancosContas> bancosContas;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- bancosContas = read.get_BancosContasRepository().Find();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 145, num, null, true);
- continue;
- }
- return bancosContas;
- }
- return new List<BancosContas>();
- });
- return bancosContas1;
- }
-
- public async Task<Saldo> BuscarSaldo(DateTime inicio, long id)
- {
- int num = 3;
- Saldo saldo1 = await Task.Run<Saldo>(() => {
- Saldo saldo;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- saldo = read.get_SaldoRepository().BuscarPorData(inicio, id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 151, num, new { inicio = inicio, id = id }, true);
- continue;
- }
- return saldo;
- }
- return new Saldo();
- });
- return saldo1;
- }
-
- public async Task<Saldo> BuscarSaldoAberto(long id)
- {
- int num = 3;
- Saldo saldo1 = await Task.Run<Saldo>(() => {
- Saldo saldo;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- saldo = read.get_SaldoRepository().BuscarAberto(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 147, num, id, true);
- continue;
- }
- return saldo;
- }
- return new Saldo();
- });
- return saldo1;
- }
-
- public async Task<List<Saldo>> BuscarSaldoAberto(List<long> ids)
- {
- int num = 3;
- List<Saldo> saldos2 = await Task.Run<List<Saldo>>(() => {
- List<Saldo> saldos;
- while (num > 0)
- {
- try
- {
- List<Saldo> saldos1 = new List<Saldo>();
- using (UnitOfWork read = Instancia.Read)
- {
- ids.ForEach((long id) => {
- Saldo saldo = read.get_SaldoRepository().BuscarAberto(id);
- if (saldo == null)
- {
- return;
- }
- saldos1.Add(saldo);
- });
- }
- saldos = saldos1;
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 148, num, ids, true);
- continue;
- }
- return saldos;
- }
- return new List<Saldo>();
- });
- return saldos2;
- }
-
- public async Task<Saldo> BuscarSaldoInicial(long id)
- {
- int num = 3;
- Saldo saldo1 = await Task.Run<Saldo>(() => {
- Saldo saldo;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- saldo = read.get_SaldoRepository().BuscarPorMenorData(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 151, num, new { id = id }, true);
- continue;
- }
- return saldo;
- }
- return new Saldo();
- });
- return saldo1;
- }
-
- public async Task<List<Saldo>> BuscarSaldos(long id)
- {
- int num = 3;
- List<Saldo> saldos1 = await Task.Run<List<Saldo>>(() => {
- List<Saldo> saldos;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- saldos = read.get_SaldoRepository().BuscarPorConta(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 150, num, id, true);
- continue;
- }
- return saldos;
- }
- return new List<Saldo>();
- });
- return saldos1;
- }
-
- public async Task<bool> Delete(BancosContas bancosContas)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- registroLogs.Add(base.CreateLog(bancosContas.get_Id(), bancosContas.GetValorOriginal(), 26, 2));
- commited.get_BancosContasRepository().Delete(bancosContas.get_Id());
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 246, num, bancosContas, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<bool> DeleteSaldo(Saldo saldo)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- registroLogs.Add(base.CreateLog(saldo.get_Id(), saldo.GetValorOriginal(), 26, 2));
- commited.get_SaldoRepository().Delete(saldo.get_Id());
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 248, num, saldo, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<Saldo> FecharSaldo(Saldo saldo)
- {
- int num = 3;
- Saldo saldo1 = await Task.Run<Saldo>(() => {
- Saldo saldo2;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- saldo2 = read.get_LancamentoRepository().FecharSaldo(saldo);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 149, num, saldo, true);
- continue;
- }
- return saldo2;
- }
- return new Saldo();
- });
- return saldo1;
- }
-
- public async Task<BancosContas> Save(BancosContas bancosContas)
- {
- int num = 3;
- base.Sucesso = true;
- BancosContas bancosConta1 = bancosContas;
- BancosContas bancosConta2 = await Task.Run<BancosContas>(() => {
- BancosContas bancosConta;
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- bancosContas = bancosConta1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- flag = (bancosContas.get_Id() == 0 ? false : true);
- if (flag)
- {
- registroLogs.Add(base.CreateLog(bancosContas.get_Id(), bancosContas, 26));
- }
- bancosContas = (bancosContas.get_Id() == 0 ? commited.get_BancosContasRepository().SaveOrUpdate(bancosContas) : commited.get_BancosContasRepository().Merge(bancosContas));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(bancosContas.get_Id(), bancosContas.GetValorOriginal(), 26, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- bancosConta = bancosContas;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 245, num, bancosContas, true);
- continue;
- }
- return bancosConta;
- }
- return bancosConta1;
- });
- return bancosConta2;
- }
-
- public async Task<Saldo> Save(Saldo saldo)
- {
- int num = 3;
- base.Sucesso = true;
- Saldo saldo1 = saldo;
- Saldo saldo2 = await Task.Run<Saldo>(() => {
- Saldo saldo3;
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- saldo = saldo1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- flag = (saldo.get_Id() == 0 ? false : true);
- if (flag)
- {
- registroLogs.Add(base.CreateLog(saldo.get_Conta().get_Id(), saldo, 26));
- }
- saldo = (saldo.get_Id() == 0 ? commited.get_SaldoRepository().SaveOrUpdate(saldo) : commited.get_SaldoRepository().Merge(saldo));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(saldo.get_Conta().get_Id(), saldo.GetValorOriginal(), 26, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- saldo3 = saldo;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 247, num, saldo, true);
- continue;
- }
- return saldo3;
- }
- return saldo1;
- });
- return saldo2;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/Servicos/Financeiro/CentroServico.cs b/Gestor.Application/Servicos/Financeiro/CentroServico.cs
deleted file mode 100644
index 7d16a58..0000000
--- a/Gestor.Application/Servicos/Financeiro/CentroServico.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Infrastructure.UnitOfWork.Logic;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Financeiro
-{
- internal class CentroServico : BaseServico
- {
- public CentroServico()
- {
- }
-
- public async Task<List<Centro>> BuscarCentros()
- {
- int num = 3;
- List<Centro> centros1 = await Task.Run<List<Centro>>(() => {
- List<Centro> centros;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- centros = read.get_CentroRepository().Find();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 153, num, null, true);
- continue;
- }
- return centros;
- }
- return new List<Centro>();
- });
- return centros1;
- }
-
- public async Task<Centro> Save(Centro centro)
- {
- int num = 3;
- base.Sucesso = true;
- Centro centro1 = centro;
- Centro centro2 = await Task.Run<Centro>(() => {
- Centro centro3;
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- centro = centro1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- flag = (centro.get_Id() == 0 ? false : true);
- if (flag)
- {
- registroLogs.Add(base.CreateLog(centro.get_Id(), centro, 29));
- }
- centro = (centro.get_Id() == 0 ? commited.get_CentroRepository().SaveOrUpdate(centro) : commited.get_CentroRepository().Merge(centro));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(centro.get_Id(), centro.GetValorOriginal(), 29, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- centro3 = centro;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 249, num, centro, true);
- continue;
- }
- return centro3;
- }
- return centro1;
- });
- return centro2;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/Servicos/Financeiro/FinanceiroServico.cs b/Gestor.Application/Servicos/Financeiro/FinanceiroServico.cs
deleted file mode 100644
index 817dca0..0000000
--- a/Gestor.Application/Servicos/Financeiro/FinanceiroServico.cs
+++ /dev/null
@@ -1,738 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Infrastructure.UnitOfWork.Logic;
-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;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Financeiro
-{
- public class FinanceiroServico : BaseServico
- {
- public FinanceiroServico()
- {
- }
-
- public async Task<List<Lancamento>> AddRange(List<Lancamento> lancamentos)
- {
- int num = 3;
- base.Sucesso = true;
- DateTime networkTime = Funcoes.GetNetworkTime();
- List<Lancamento> lancamentos1 = lancamentos;
- List<Lancamento> lancamentos2 = await Task.Run<List<Lancamento>>(() => {
- List<Lancamento> lancamentos3;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- lancamentos = lancamentos1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- ControleFinanceiro controle = lancamentos.First<Lancamento>().get_Controle();
- controle = (controle.get_Id() == 0 ? commited.get_ControleFinanceiroRepository().SaveOrUpdate(controle) : commited.get_ControleFinanceiroRepository().Merge(controle));
- lancamentos.ForEach((Lancamento x) => {
- x.set_Controle(controle);
- x.set_DataLancamento(new DateTime?(networkTime));
- });
- lancamentos = commited.get_LancamentoRepository().AddRange(lancamentos);
- lancamentos.ForEach((Lancamento x) => this.logs.Add(base.CreateLog(x.get_Id(), x.GetValorOriginal(), 25, 0)));
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- lancamentos3 = lancamentos;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 279, num, lancamentos, true);
- continue;
- }
- return lancamentos3;
- }
- return lancamentos1;
- });
- return lancamentos2;
- }
-
- public async Task<List<Lancamento>> Atualizar(List<Lancamento> lancamentos)
- {
- int num = 3;
- base.Sucesso = true;
- Funcoes.GetNetworkTime();
- List<Lancamento> lancamentos1 = lancamentos;
- List<Lancamento> lancamentos2 = await Task.Run<List<Lancamento>>(() => {
- List<Lancamento> lancamentos3;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- lancamentos = lancamentos1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- lancamentos.ForEach((Lancamento lancamento) => {
- registroLogs.Add(base.CreateLog(lancamento.get_Id(), lancamento, 25));
- lancamento.set_Controle(commited.get_ControleFinanceiroRepository().Merge(lancamento.get_Controle()));
- lancamento = commited.get_LancamentoRepository().Merge(lancamento);
- });
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- lancamentos3 = lancamentos;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 280, num, lancamentos, true);
- continue;
- }
- return lancamentos3;
- }
- return lancamentos1;
- });
- return lancamentos2;
- }
-
- public async Task<List<Lancamento>> BuscarFechamento(FiltroFinanceiro filtro)
- {
- int num = 3;
- List<Lancamento> lancamentos1 = await Task.Run<List<Lancamento>>(() => {
- List<Lancamento> lancamentos;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- lancamentos = read.get_LancamentoRepository().Fechamento(filtro);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 294, num, filtro, true);
- continue;
- }
- return lancamentos;
- }
- return new List<Lancamento>();
- });
- return lancamentos1;
- }
-
- public async Task<Lancamento> BuscarLancamento(long id, int parcela)
- {
- int num = 3;
- Lancamento lancamento1 = await Task.Run<Lancamento>(() => {
- Lancamento lancamento;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- lancamento = read.get_LancamentoRepository().FindByControle(id, parcela);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 163, num, new { id = id, parcela = parcela }, true);
- continue;
- }
- return lancamento;
- }
- return new Lancamento();
- });
- return lancamento1;
- }
-
- public async Task<Lancamento> BuscarLancamento(long id)
- {
- int num = 3;
- Lancamento lancamento1 = await Task.Run<Lancamento>(() => {
- Lancamento lancamento;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- lancamento = read.get_LancamentoRepository().FindById(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 164, num, id, true);
- continue;
- }
- return lancamento;
- }
- return new Lancamento();
- });
- return lancamento1;
- }
-
- public async Task<List<Lancamento>> BuscarLancamentos(DateTime inicio, DateTime fim, StatusLancamento status)
- {
- int num = 3;
- List<Lancamento> lancamentos1 = await Task.Run<List<Lancamento>>(() => {
- List<Lancamento> list;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<Lancamento> lancamentos = read.get_LancamentoRepository().Find(inicio, fim, status);
- Func<Lancamento, DateTime> u003cu003e9_41 = FinanceiroServico.u003cu003ec.u003cu003e9__4_1;
- if (u003cu003e9_41 == null)
- {
- u003cu003e9_41 = (Lancamento x) => x.get_Vencimento();
- FinanceiroServico.u003cu003ec.u003cu003e9__4_1 = u003cu003e9_41;
- }
- list = lancamentos.OrderByDescending<Lancamento, DateTime>(u003cu003e9_41).ToList<Lancamento>();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 160, num, new { inicio = inicio, fim = fim, status = status }, true);
- continue;
- }
- return list;
- }
- return new List<Lancamento>();
- });
- return lancamentos1;
- }
-
- public async Task<List<Lancamento>> BuscarLancamentos(DateTime inicio, DateTime fim, long conta)
- {
- int num = 3;
- List<Lancamento> lancamentos1 = await Task.Run<List<Lancamento>>(() => {
- List<Lancamento> list;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<Lancamento> lancamentos = read.get_LancamentoRepository().FindLancamentosByConta(inicio, fim, conta);
- Func<Lancamento, DateTime> u003cu003e9_61 = FinanceiroServico.u003cu003ec.u003cu003e9__6_1;
- if (u003cu003e9_61 == null)
- {
- u003cu003e9_61 = (Lancamento x) => x.get_Vencimento();
- FinanceiroServico.u003cu003ec.u003cu003e9__6_1 = u003cu003e9_61;
- }
- list = lancamentos.OrderByDescending<Lancamento, DateTime>(u003cu003e9_61).ToList<Lancamento>();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 165, num, new { inicio = inicio, fim = fim, conta = conta }, true);
- continue;
- }
- return list;
- }
- return new List<Lancamento>();
- });
- return lancamentos1;
- }
-
- public async Task<List<Lancamento>> BuscarLancamentosPersonalizados(DateTime inicio, DateTime fim, StatusLancamento status, FiltroLancamentoData filtrodata)
- {
- int num = 3;
- List<Lancamento> lancamentos1 = await Task.Run<List<Lancamento>>(() => {
- List<Lancamento> list;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<Lancamento> lancamentos = read.get_LancamentoRepository().FindPersonalizado(inicio, fim, status, filtrodata);
- Func<Lancamento, DateTime> u003cu003e9_71 = FinanceiroServico.u003cu003ec.u003cu003e9__7_1;
- if (u003cu003e9_71 == null)
- {
- u003cu003e9_71 = (Lancamento x) => x.get_Vencimento();
- FinanceiroServico.u003cu003ec.u003cu003e9__7_1 = u003cu003e9_71;
- }
- list = lancamentos.OrderByDescending<Lancamento, DateTime>(u003cu003e9_71).ToList<Lancamento>();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 160, num, new { inicio = inicio, fim = fim, status = status }, true);
- continue;
- }
- return list;
- }
- return new List<Lancamento>();
- });
- return lancamentos1;
- }
-
- public async Task<List<Lancamento>> BuscarLancamentosPorBaixa(DateTime inicio, DateTime fim)
- {
- int num = 3;
- List<Lancamento> lancamentos1 = await Task.Run<List<Lancamento>>(() => {
- List<Lancamento> list;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<Lancamento> lancamentos = read.get_LancamentoRepository().FindByBaixa(inicio, fim);
- Func<Lancamento, DateTime?> u003cu003e9_81 = FinanceiroServico.u003cu003ec.u003cu003e9__8_1;
- if (u003cu003e9_81 == null)
- {
- u003cu003e9_81 = (Lancamento x) => x.get_Baixa();
- FinanceiroServico.u003cu003ec.u003cu003e9__8_1 = u003cu003e9_81;
- }
- list = lancamentos.OrderByDescending<Lancamento, DateTime?>(u003cu003e9_81).ToList<Lancamento>();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 161, num, new { inicio = inicio, fim = fim }, true);
- continue;
- }
- return list;
- }
- return new List<Lancamento>();
- });
- return lancamentos1;
- }
-
- public async Task<List<ExtratoConta>> BuscarLancamentosPorConta(DateTime inicio, DateTime fim, long id)
- {
- int num = 3;
- List<ExtratoConta> extratoContas1 = await Task.Run<List<ExtratoConta>>(() => {
- List<ExtratoConta> extratoContas;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- extratoContas = read.get_LancamentoRepository().FindByConta(inicio, fim, id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 165, num, new { inicio = inicio, fim = fim, id = id }, true);
- continue;
- }
- return extratoContas;
- }
- return new List<ExtratoConta>();
- });
- return extratoContas1;
- }
-
- public async Task<List<Lancamento>> BuscarLancamentosPorControle(long id)
- {
- int num = 3;
- List<Lancamento> lancamentos1 = await Task.Run<List<Lancamento>>(() => {
- List<Lancamento> lancamentos;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- lancamentos = read.get_LancamentoRepository().FindByControle(id, 2);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 158, num, new { id = id }, true);
- continue;
- }
- return lancamentos;
- }
- return new List<Lancamento>();
- });
- return lancamentos1;
- }
-
- public async Task<List<Lancamento>> BuscarLancamentosPorFornecedor(long id, StatusLancamento status)
- {
- int num = 3;
- List<Lancamento> lancamentos1 = await Task.Run<List<Lancamento>>(() => {
- List<Lancamento> list;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<Lancamento> lancamentos = read.get_LancamentoRepository().FindByFornecedor(id, status);
- Func<Lancamento, DateTime> u003cu003e9_11 = FinanceiroServico.u003cu003ec.u003cu003e9__1_1;
- if (u003cu003e9_11 == null)
- {
- u003cu003e9_11 = (Lancamento x) => x.get_Vencimento();
- FinanceiroServico.u003cu003ec.u003cu003e9__1_1 = u003cu003e9_11;
- }
- list = lancamentos.OrderByDescending<Lancamento, DateTime>(u003cu003e9_11).ToList<Lancamento>();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 157, num, new { id = id, status = status }, true);
- continue;
- }
- return list;
- }
- return new List<Lancamento>();
- });
- return lancamentos1;
- }
-
- public async Task<List<Lancamento>> BuscarLancamentosPorFornecedor(long id, DateTime date, Sinal sinal)
- {
- int num = 3;
- List<Lancamento> lancamentos1 = await Task.Run<List<Lancamento>>(() => {
- List<Lancamento> list;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<Lancamento> lancamentos = read.get_LancamentoRepository().FindByFornecedor(id, date, sinal);
- Func<Lancamento, DateTime> u003cu003e9_21 = FinanceiroServico.u003cu003ec.u003cu003e9__2_1;
- if (u003cu003e9_21 == null)
- {
- u003cu003e9_21 = (Lancamento x) => x.get_Vencimento();
- FinanceiroServico.u003cu003ec.u003cu003e9__2_1 = u003cu003e9_21;
- }
- list = lancamentos.OrderByDescending<Lancamento, DateTime>(u003cu003e9_21).ToList<Lancamento>();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 157, num, new { id = id, date = date }, true);
- continue;
- }
- return list;
- }
- return new List<Lancamento>();
- });
- return lancamentos1;
- }
-
- public async Task<List<Lancamento>> BuscarLancamentosPorLancamento(DateTime inicio, DateTime fim, StatusLancamento status)
- {
- int num = 3;
- List<Lancamento> lancamentos1 = await Task.Run<List<Lancamento>>(() => {
- List<Lancamento> list;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<Lancamento> lancamentos = read.get_LancamentoRepository().FindByLancamento(inicio, fim, status);
- Func<Lancamento, DateTime?> u003cu003e9_51 = FinanceiroServico.u003cu003ec.u003cu003e9__5_1;
- if (u003cu003e9_51 == null)
- {
- u003cu003e9_51 = (Lancamento x) => x.get_DataLancamento();
- FinanceiroServico.u003cu003ec.u003cu003e9__5_1 = u003cu003e9_51;
- }
- list = lancamentos.OrderByDescending<Lancamento, DateTime?>(u003cu003e9_51).ToList<Lancamento>();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 329, num, new { inicio = inicio, fim = fim, status = status }, true);
- continue;
- }
- return list;
- }
- return new List<Lancamento>();
- });
- return lancamentos1;
- }
-
- public async Task<List<Lancamento>> BuscarLancamentosPorPagamento(DateTime inicio, DateTime fim)
- {
- int num = 3;
- List<Lancamento> lancamentos1 = await Task.Run<List<Lancamento>>(() => {
- List<Lancamento> list;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<Lancamento> lancamentos = read.get_LancamentoRepository().FindByPagamento(inicio, fim);
- Func<Lancamento, DateTime?> u003cu003e9_91 = FinanceiroServico.u003cu003ec.u003cu003e9__9_1;
- if (u003cu003e9_91 == null)
- {
- u003cu003e9_91 = (Lancamento x) => x.get_Pagamento();
- FinanceiroServico.u003cu003ec.u003cu003e9__9_1 = u003cu003e9_91;
- }
- list = lancamentos.OrderBy<Lancamento, DateTime?>(u003cu003e9_91).ToList<Lancamento>();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 162, num, new { inicio = inicio, fim = fim }, true);
- continue;
- }
- return list;
- }
- return new List<Lancamento>();
- });
- return lancamentos1;
- }
-
- public async Task<bool> Excluir(List<Lancamento> lancamentos)
- {
- int num = 3;
- Funcoes.GetNetworkTime();
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- lancamentos.ForEach((Lancamento x) => {
- registroLogs.Add(base.CreateLog(x.get_Id(), x.GetValorOriginal(), 25, 2));
- if (commited.get_LancamentoRepository().FindByControle(x.get_Controle().get_Id(), 2).Count == 1)
- {
- commited.get_ControleFinanceiroRepository().Delete(x.get_Controle().get_Id());
- return;
- }
- x.get_Controle().set_Parcelas(x.get_Controle().get_Parcelas() - 1);
- commited.get_ControleFinanceiroRepository().Merge(x.get_Controle());
- commited.get_LancamentoRepository().Delete(x.get_Id());
- });
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- }
- flag = true;
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 282, num, lancamentos, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<bool> Excluir(Lancamento lancamento)
- {
- int num = 3;
- Funcoes.GetNetworkTime();
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- registroLogs.Add(base.CreateLog(lancamento.get_Id(), lancamento.GetValorOriginal(), 25, 2));
- if (commited.get_LancamentoRepository().FindByControle(lancamento.get_Controle().get_Id(), 2).Count != 1)
- {
- lancamento.get_Controle().set_Parcelas(lancamento.get_Controle().get_Parcelas() - 1);
- commited.get_ControleFinanceiroRepository().Merge(lancamento.get_Controle());
- commited.get_LancamentoRepository().Delete(lancamento.get_Id());
- }
- else
- {
- commited.get_ControleFinanceiroRepository().Delete(lancamento.get_Controle().get_Id());
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 282, num, lancamento, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<List<Lancamento>> IncluirRange(List<Lancamento> lancamentos)
- {
- int num = 3;
- base.Sucesso = true;
- Funcoes.GetNetworkTime();
- List<Lancamento> lancamentos1 = lancamentos;
- List<Lancamento> lancamentos2 = await Task.Run<List<Lancamento>>(() => {
- List<Lancamento> lancamentos3;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- lancamentos = lancamentos1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- lancamentos.ForEach((Lancamento lancamento) => {
- lancamento.set_Controle(commited.get_ControleFinanceiroRepository().Merge(lancamento.get_Controle()));
- lancamento = commited.get_LancamentoRepository().SaveOrUpdate(lancamento);
- registroLogs.Add(base.CreateLog(lancamento.get_Id(), lancamento.GetValorOriginal(), 25, 0));
- });
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- lancamentos3 = lancamentos;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 281, num, lancamentos, true);
- continue;
- }
- return lancamentos3;
- }
- return lancamentos1;
- });
- return lancamentos2;
- }
-
- public async Task<Lancamento> Save(Lancamento lancamento)
- {
- int num = 3;
- base.Sucesso = true;
- DateTime networkTime = Funcoes.GetNetworkTime();
- Lancamento lancamento1 = lancamento;
- Lancamento lancamento2 = await Task.Run<Lancamento>(() => {
- Lancamento lancamento3;
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- lancamento = lancamento1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- flag = (lancamento.get_Id() == 0 ? false : true);
- if (!flag)
- {
- lancamento.set_DataLancamento(new DateTime?(networkTime));
- }
- if (flag)
- {
- registroLogs.Add(base.CreateLog(lancamento.get_Id(), lancamento, 25));
- }
- ControleFinanceiro controle = lancamento.get_Controle();
- controle = (controle.get_Id() == 0 ? commited.get_ControleFinanceiroRepository().SaveOrUpdate(controle) : commited.get_ControleFinanceiroRepository().Merge(controle));
- lancamento.set_Controle(controle);
- lancamento = (lancamento.get_Id() == 0 ? commited.get_LancamentoRepository().SaveOrUpdate(lancamento) : commited.get_LancamentoRepository().Merge(lancamento));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(lancamento.get_Id(), lancamento.GetValorOriginal(), 25, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- lancamento3 = lancamento;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 279, num, lancamento, true);
- continue;
- }
- return lancamento3;
- }
- return lancamento1;
- });
- return lancamento2;
- }
-
- public async Task<bool> TemLancamentosPorFornecedor(long id)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- flag = read.get_LancamentoRepository().HasByFornecedor(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 154, num, id, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<bool> Transferir(Lancamento lancamentoOrigem, Lancamento lancamentoDestino)
- {
- int num = 3;
- Lancamento lancamento = lancamentoOrigem;
- Lancamento lancamento1 = lancamentoDestino;
- Funcoes.GetNetworkTime();
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- lancamentoOrigem = lancamento;
- lancamentoDestino = lancamento1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- ControleFinanceiro controle = lancamentoOrigem.get_Controle();
- controle = commited.get_ControleFinanceiroRepository().SaveOrUpdate(controle);
- lancamentoOrigem.set_Controle(controle);
- lancamentoDestino.set_Controle(controle);
- lancamentoOrigem = commited.get_LancamentoRepository().SaveOrUpdate(lancamentoOrigem);
- lancamentoDestino = commited.get_LancamentoRepository().SaveOrUpdate(lancamentoDestino);
- registroLogs.Add(base.CreateLog(lancamentoOrigem.get_Id(), lancamentoOrigem.GetValorOriginal(), 25, 0));
- registroLogs.Add(base.CreateLog(lancamentoDestino.get_Id(), lancamentoDestino.GetValorOriginal(), 25, 0));
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 283, num, new { lancamentoOrigem = lancamentoOrigem, lancamentoDestino = lancamentoDestino }, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/Servicos/Financeiro/FornecedorServico.cs b/Gestor.Application/Servicos/Financeiro/FornecedorServico.cs
deleted file mode 100644
index 674f46a..0000000
--- a/Gestor.Application/Servicos/Financeiro/FornecedorServico.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Infrastructure.UnitOfWork.Logic;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Financeiro
-{
- public class FornecedorServico : BaseServico
- {
- public FornecedorServico()
- {
- }
-
- public async Task<List<Fornecedor>> BuscarFornecedores()
- {
- int num = 3;
- List<Fornecedor> fornecedors1 = await Task.Run<List<Fornecedor>>(() => {
- List<Fornecedor> fornecedors;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- fornecedors = read.get_FornecedorRepository().Find();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 166, num, null, true);
- continue;
- }
- return fornecedors;
- }
- return new List<Fornecedor>();
- });
- return fornecedors1;
- }
-
- public async Task<bool> Delete(Fornecedor fornecedor)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- registroLogs.Add(base.CreateLog(fornecedor.get_Id(), fornecedor.GetValorOriginal(), 24, 2));
- commited.get_FornecedorRepository().Delete(fornecedor.get_Id());
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 244, num, fornecedor, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<Fornecedor> Save(Fornecedor fornecedor)
- {
- int num = 3;
- base.Sucesso = true;
- Fornecedor fornecedor1 = fornecedor;
- Fornecedor fornecedor2 = await Task.Run<Fornecedor>(() => {
- Fornecedor fornecedor3;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- fornecedor = fornecedor1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- TipoAcao tipoAcao = (fornecedor.get_Id() == 0 ? 0 : 1);
- if (tipoAcao == 1)
- {
- registroLogs.Add(base.CreateLog(fornecedor.get_Id(), fornecedor, 24));
- }
- fornecedor = (tipoAcao == null ? commited.get_FornecedorRepository().SaveOrUpdate(fornecedor) : commited.get_FornecedorRepository().Merge(fornecedor));
- if (tipoAcao == null)
- {
- registroLogs.Add(base.CreateLog(fornecedor.get_Id(), fornecedor.GetValorOriginal(), 24, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- fornecedor3 = fornecedor;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 243, num, fornecedor, true);
- continue;
- }
- return fornecedor3;
- }
- return fornecedor1;
- });
- return fornecedor2;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/Servicos/Financeiro/PlanoServico.cs b/Gestor.Application/Servicos/Financeiro/PlanoServico.cs
deleted file mode 100644
index 9fc078a..0000000
--- a/Gestor.Application/Servicos/Financeiro/PlanoServico.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Application.ViewModels;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Infrastructure.UnitOfWork.Logic;
-using Gestor.Model.Common;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using Newtonsoft.Json;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Linq;
-using System.Net;
-using System.Net.Sockets;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Financeiro
-{
- internal class PlanoServico : BaseServico
- {
- public PlanoServico()
- {
- }
-
- public async Task<List<Planos>> BuscarPlanos()
- {
- int num = 3;
- List<Planos> planos1 = await Task.Run<List<Planos>>(() => {
- List<Planos> planos;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- planos = read.get_PlanosRepository().Find();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 167, num, null, true);
- continue;
- }
- return planos;
- }
- return new List<Planos>();
- });
- return planos1;
- }
-
- public async Task<Plano> Save(Plano plano)
- {
- int num = 3;
- base.Sucesso = true;
- Plano plano2 = plano;
- Plano plano3 = await Task.Run<Plano>(() => {
- Plano plano4;
- string str;
- while (num > 0)
- {
- plano = plano2;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- TipoAcao tipoAcao = (plano.get_Id() == 0 ? 0 : 1);
- plano = (plano.get_Id() == 0 ? commited.get_PlanoRepository().SaveOrUpdate(plano) : commited.get_PlanoRepository().Merge(plano));
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(tipoAcao);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(Funcoes.GetNetworkTime());
- Plano plano1 = plano;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(plano1, jsonSerializerSetting));
- registroLog.set_EntidadeId(plano.get_Id());
- registroLog.set_Tela(27);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_01 = PlanoServico.u003cu003ec.u003cu003e9__0_1;
- if (u003cu003e9_01 == null)
- {
- u003cu003e9_01 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- PlanoServico.u003cu003ec.u003cu003e9__0_1 = u003cu003e9_01;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_01);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- plano4 = plano;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 250, num, plano, true);
- continue;
- }
- return plano4;
- }
- return plano2;
- });
- return plano3;
- }
- }
-} \ No newline at end of file
diff --git a/Gestor.Application/Servicos/Financeiro/PlanosServico.cs b/Gestor.Application/Servicos/Financeiro/PlanosServico.cs
deleted file mode 100644
index b00efbe..0000000
--- a/Gestor.Application/Servicos/Financeiro/PlanosServico.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Infrastructure.UnitOfWork.Logic;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Financeiro;
-using Gestor.Model.Domain.Generic;
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Financeiro
-{
- internal class PlanosServico : BaseServico
- {
- public PlanosServico()
- {
- }
-
- internal async Task<ObservableCollection<Planos>> BuscarPlanos()
- {
- int num = 3;
- ObservableCollection<Planos> observableCollection1 = await Task.Run<ObservableCollection<Planos>>(() => {
- ObservableCollection<Planos> observableCollection;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- observableCollection = new ObservableCollection<Planos>(read.get_PlanosRepository().Find());
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 168, num, null, true);
- continue;
- }
- return observableCollection;
- }
- return new ObservableCollection<Planos>();
- });
- return observableCollection1;
- }
-
- public async Task<Planos> Save(Planos planos)
- {
- int num = 3;
- base.Sucesso = true;
- Planos plano1 = planos;
- Planos plano2 = await Task.Run<Planos>(() => {
- Planos plano;
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- planos = plano1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- flag = (planos.get_Id() == 0 ? false : true);
- if (flag)
- {
- registroLogs.Add(base.CreateLog(planos.get_Id(), planos, 28));
- }
- planos = (planos.get_Id() == 0 ? commited.get_PlanosRepository().SaveOrUpdate(planos) : commited.get_PlanosRepository().Merge(planos));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(planos.get_Id(), planos.GetValorOriginal(), 28, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- plano = planos;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 251, num, planos, true);
- continue;
- }
- return plano;
- }
- return plano1;
- });
- return plano2;
- }
- }
-} \ No newline at end of file