summaryrefslogtreecommitdiff
path: root/Gestor.Application/Servicos/Financeiro/PlanosServico.cs
diff options
context:
space:
mode:
authorLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:35:25 +0000
committerLucas Faria Mendes <lucas.fariamo08@gmail.com>2026-03-30 13:35:25 +0000
commit674ca83ba9243a9e95a7568c797668dab6aee26a (patch)
tree4a905b3fb1d827665a34d63f67bc5559f8e7235b /Gestor.Application/Servicos/Financeiro/PlanosServico.cs
downloadgestor-674ca83ba9243a9e95a7568c797668dab6aee26a.tar.gz
gestor-674ca83ba9243a9e95a7568c797668dab6aee26a.zip
feat: upload files
Diffstat (limited to 'Gestor.Application/Servicos/Financeiro/PlanosServico.cs')
-rw-r--r--Gestor.Application/Servicos/Financeiro/PlanosServico.cs93
1 files changed, 93 insertions, 0 deletions
diff --git a/Gestor.Application/Servicos/Financeiro/PlanosServico.cs b/Gestor.Application/Servicos/Financeiro/PlanosServico.cs
new file mode 100644
index 0000000..b00efbe
--- /dev/null
+++ b/Gestor.Application/Servicos/Financeiro/PlanosServico.cs
@@ -0,0 +1,93 @@
+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