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 /Gestor.Application/Servicos/Seguros/PerfilServico.cs | |
| parent | 674ca83ba9243a9e95a7568c797668dab6aee26a (diff) | |
| download | gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip | |
chore: location
Diffstat (limited to 'Gestor.Application/Servicos/Seguros/PerfilServico.cs')
| -rw-r--r-- | Gestor.Application/Servicos/Seguros/PerfilServico.cs | 241 |
1 files changed, 0 insertions, 241 deletions
diff --git a/Gestor.Application/Servicos/Seguros/PerfilServico.cs b/Gestor.Application/Servicos/Seguros/PerfilServico.cs deleted file mode 100644 index 293af5c..0000000 --- a/Gestor.Application/Servicos/Seguros/PerfilServico.cs +++ /dev/null @@ -1,241 +0,0 @@ -using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Application.ViewModels;
-using Gestor.Common.Validation;
-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
-{
- internal class PerfilServico : BaseServico
- {
- public PerfilServico()
- {
- }
-
- internal async Task<List<Perfil>> BuscarPerfis(long controleId)
- {
- int num = 3;
- List<Perfil> perfils1 = await Task.Run<List<Perfil>>(() => {
- List<Perfil> perfils;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- perfils = read.get_PerfilRepository().FindByControleId(controleId);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 46, num, controleId, true);
- continue;
- }
- return perfils;
- }
- return new List<Perfil>();
- });
- return perfils1;
- }
-
- public async Task<bool> Delete(Perfil perfil)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- object obj;
- string str;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- commited.get_PerfilRepository().Delete(perfil.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);
- RegistroLog registroLog1 = registroLog;
- string[] description = new string[47];
- description[0] = string.Format("O USUÁRIO {0} EXCLUIU O PERFIL, EM {1}, DE ", Recursos.Usuario.get_Nome(), networkTime);
- description[1] = string.Format("ID: '{0}'", perfil.get_Id());
- description[2] = ", NOME: '";
- description[3] = (string.IsNullOrWhiteSpace(perfil.get_Nome()) ? "" : perfil.get_Nome() ?? "");
- description[4] = "', CPF: '";
- description[5] = (string.IsNullOrWhiteSpace(perfil.get_Cpf()) ? "" : perfil.get_Cpf() ?? "");
- description[6] = "', HABILITAÇÃO: '";
- description[7] = (string.IsNullOrWhiteSpace(perfil.get_Habilitacao()) ? "" : perfil.get_Habilitacao() ?? "");
- description[8] = "', TEMPO DE HABILITAÇÃO: '";
- description[9] = Gestor.Common.Validation.ValidationHelper.GetDescription(perfil.get_TempoHabilitacao());
- description[10] = "', NASCIMENTO: '";
- DateTime? nascimento = perfil.get_Nascimento();
- if (!nascimento.HasValue)
- {
- obj = "";
- }
- else
- {
- nascimento = perfil.get_Nascimento();
- obj = (nascimento.HasValue ? nascimento.GetValueOrDefault().ToShortDateString() : null) ?? "";
- }
- description[11] = (string)obj;
- description[12] = "', SEXO: '";
- description[13] = Gestor.Common.Validation.ValidationHelper.GetDescription(perfil.get_Sexo());
- description[14] = "', ESTADO CIVIL: '";
- description[15] = Gestor.Common.Validation.ValidationHelper.GetDescription(perfil.get_EstadoCivil());
- description[16] = "', OCUPAÇÃO: '";
- description[17] = Gestor.Common.Validation.ValidationHelper.GetDescription(perfil.get_Ocupacao());
- description[18] = "', RELAÇÃOO: '";
- description[19] = Gestor.Common.Validation.ValidationHelper.GetDescription(perfil.get_Relacao());
- description[20] = "', DISTÂNCIA DO TRABALHO: '";
- description[21] = Gestor.Common.Validation.ValidationHelper.GetDescription(perfil.get_DistanciaResidenciaTrabalho());
- description[22] = "', USO POR DEPENDENTES: '";
- description[23] = Gestor.Common.Validation.ValidationHelper.GetDescription(perfil.get_UsoDependentes());
- description[24] = "', TIPO DE RESIDÊNCIA: '";
- description[25] = Gestor.Common.Validation.ValidationHelper.GetDescription(perfil.get_TipoResidencia());
- description[26] = "', GARAGEM NA RESIDÊNCIA: '";
- description[27] = Gestor.Common.Validation.ValidationHelper.GetDescription(perfil.get_GaragemResidencia());
- description[28] = "', GARAGEM NO TRABALHO: '";
- description[29] = Gestor.Common.Validation.ValidationHelper.GetDescription(perfil.get_GaragemTrabalho());
- description[30] = "', GARAGEM NO ESTUDO: '";
- description[31] = Gestor.Common.Validation.ValidationHelper.GetDescription(perfil.get_GaragemEstudo());
- description[32] = "', VEÍCULOS NA RESIDÊNCIA: '";
- description[33] = (!perfil.get_VeiculoResidencia().HasValue ? "" : string.Format("{0}", perfil.get_VeiculoResidencia()));
- description[34] = "', ANTFURTO: '";
- description[35] = (!perfil.get_AntiFurto().HasValue ? "" : Gestor.Common.Validation.ValidationHelper.GetDescription(perfil.get_AntiFurto()));
- description[36] = "', SEGURO DE VIDA: '";
- description[37] = (!perfil.get_SeguroVida().HasValue ? "" : (perfil.get_SeguroVida().Value ? "SIM" : "NÃO"));
- description[38] = "', USO PROFISSIONAL: '";
- description[39] = (!perfil.get_UsoProfissional().HasValue ? "" : (perfil.get_UsoProfissional().Value ? "SIM" : "NÃO"));
- description[40] = "', COBERTURA ESTENDIDA: '";
- description[41] = (!perfil.get_EstenderCobertura().HasValue ? "" : (perfil.get_EstenderCobertura().Value ? "SIM" : "NÃO"));
- description[42] = "', CEP CIRCULAÇÃO: '";
- description[43] = (string.IsNullOrWhiteSpace(perfil.get_CepCirculacao()) ? "" : perfil.get_CepCirculacao() ?? "");
- description[44] = "', CEP PERNOITE: '";
- description[45] = (string.IsNullOrWhiteSpace(perfil.get_CepPernoite()) ? "" : perfil.get_CepPernoite() ?? "");
- description[46] = "'.";
- registroLog1.set_Descricao(string.Concat(description));
- registroLog.set_EntidadeId(perfil.get_Id());
- registroLog.set_Tela(3);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- RegistroLog registroLog2 = registroLog;
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_21 = PerfilServico.u003cu003ec.u003cu003e9__2_1;
- if (u003cu003e9_21 == null)
- {
- u003cu003e9_21 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- PerfilServico.u003cu003ec.u003cu003e9__2_1 = u003cu003e9_21;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_21);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog2.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 213, num, perfil, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<Perfil> Save(Perfil perfil)
- {
- int num = 3;
- base.Sucesso = true;
- Perfil perfil2 = perfil;
- Perfil perfil3 = await Task.Run<Perfil>(() => {
- Perfil perfil4;
- string str;
- while (num > 0)
- {
- perfil = perfil2;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- TipoAcao tipoAcao = (perfil.get_Id() == 0 ? 0 : 1);
- perfil = (perfil.get_Id() == 0 ? commited.get_PerfilRepository().SaveOrUpdate(perfil) : commited.get_PerfilRepository().Merge(perfil));
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(tipoAcao);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(Funcoes.GetNetworkTime());
- Perfil perfil1 = perfil;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(perfil1, jsonSerializerSetting));
- registroLog.set_EntidadeId(perfil.get_Id());
- registroLog.set_Tela(32);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_11 = PerfilServico.u003cu003ec.u003cu003e9__1_1;
- if (u003cu003e9_11 == null)
- {
- u003cu003e9_11 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- PerfilServico.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();
- perfil4 = perfil;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 212, num, perfil, true);
- continue;
- }
- return perfil4;
- }
- return perfil2;
- });
- return perfil3;
- }
- }
-}
\ No newline at end of file |