diff options
| author | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
|---|---|---|
| committer | Lucas Faria Mendes <lucas.fariamo08@gmail.com> | 2026-03-30 13:38:18 +0000 |
| commit | 1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1 (patch) | |
| tree | e1c3b20ea08f0cf71122a1e73f0d395f8fd83874 /Codemerx/Gestor.Application/Servicos/Financeiro/PlanoServico.cs | |
| parent | 674ca83ba9243a9e95a7568c797668dab6aee26a (diff) | |
| download | gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip | |
chore: location
Diffstat (limited to 'Codemerx/Gestor.Application/Servicos/Financeiro/PlanoServico.cs')
| -rw-r--r-- | Codemerx/Gestor.Application/Servicos/Financeiro/PlanoServico.cs | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/Codemerx/Gestor.Application/Servicos/Financeiro/PlanoServico.cs b/Codemerx/Gestor.Application/Servicos/Financeiro/PlanoServico.cs new file mode 100644 index 0000000..9fc078a --- /dev/null +++ b/Codemerx/Gestor.Application/Servicos/Financeiro/PlanoServico.cs @@ -0,0 +1,120 @@ +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 |