summaryrefslogtreecommitdiff
path: root/Gestor.Application/Servicos/Seguros/Itens/VidaServico.cs
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/Seguros/Itens/VidaServico.cs
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Gestor.Application/Servicos/Seguros/Itens/VidaServico.cs')
-rw-r--r--Gestor.Application/Servicos/Seguros/Itens/VidaServico.cs156
1 files changed, 0 insertions, 156 deletions
diff --git a/Gestor.Application/Servicos/Seguros/Itens/VidaServico.cs b/Gestor.Application/Servicos/Seguros/Itens/VidaServico.cs
deleted file mode 100644
index 3e03bfb..0000000
--- a/Gestor.Application/Servicos/Seguros/Itens/VidaServico.cs
+++ /dev/null
@@ -1,156 +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.Generic;
-using Gestor.Model.Domain.Seguros;
-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.Seguros.Itens
-{
- internal class VidaServico : BaseServico
- {
- public VidaServico()
- {
- }
-
- public async Task<bool> Delete(Item item)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- long id;
- string str;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- if (item.get_Vida() != null && item.get_Vida().get_Id() > (long)0)
- {
- commited.get_VidaRepository().Delete(item.get_Vida().get_Id());
- }
- commited.get_CoberturaRepository().DeletebyItem(item.get_Id());
- commited.get_ControleSinistroRepository().DeleteByItem(item.get_Id());
- commited.get_ItemRepository().Delete(item.get_Id());
- DateTime networkTime = Funcoes.GetNetworkTime();
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(2);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(networkTime);
- Item item1 = item;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(item1, jsonSerializerSetting));
- Vida vida = item.get_Vida();
- id = (vida != null ? vida.get_Id() : (long)0);
- registroLog.set_EntidadeId(id);
- registroLog.set_Tela(3);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_11 = VidaServico.u003cu003ec.u003cu003e9__1_1;
- if (u003cu003e9_11 == null)
- {
- u003cu003e9_11 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- VidaServico.u003cu003ec.u003cu003e9__1_1 = u003cu003e9_11;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_11);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 201, num, null, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<Vida> Save(Vida vida)
- {
- Vida vida2 = await Task.Run<Vida>(() => {
- Vida vida3;
- string str;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- TipoAcao tipoAcao = (vida.get_Id() == 0 ? 0 : 1);
- vida = (vida.get_Id() == 0 ? commited.get_VidaRepository().SaveOrUpdate(vida) : commited.get_VidaRepository().Merge(vida));
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(tipoAcao);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(Funcoes.GetNetworkTime());
- Vida vida1 = vida;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(vida1, jsonSerializerSetting));
- registroLog.set_EntidadeId(vida.get_Id());
- registroLog.set_Tela(3);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_01 = VidaServico.u003cu003ec.u003cu003e9__0_1;
- if (u003cu003e9_01 == null)
- {
- u003cu003e9_01 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- VidaServico.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();
- vida3 = vida;
- }
- }
- catch (Exception exception)
- {
- vida3 = null;
- }
- return vida3;
- });
- return vida2;
- }
- }
-} \ No newline at end of file