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/Ferramentas/RamoServico.cs | |
| parent | 674ca83ba9243a9e95a7568c797668dab6aee26a (diff) | |
| download | gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip | |
chore: location
Diffstat (limited to 'Gestor.Application/Servicos/Ferramentas/RamoServico.cs')
| -rw-r--r-- | Gestor.Application/Servicos/Ferramentas/RamoServico.cs | 192 |
1 files changed, 0 insertions, 192 deletions
diff --git a/Gestor.Application/Servicos/Ferramentas/RamoServico.cs b/Gestor.Application/Servicos/Ferramentas/RamoServico.cs deleted file mode 100644 index a347e2c..0000000 --- a/Gestor.Application/Servicos/Ferramentas/RamoServico.cs +++ /dev/null @@ -1,192 +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.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.Ferramentas
-{
- internal class RamoServico : BaseServico
- {
- public RamoServico()
- {
- }
-
- public async Task<List<Ramo>> BuscarRamos()
- {
- int num = 3;
- List<Ramo> ramos1 = await Task.Run<List<Ramo>>(() => {
- List<Ramo> ramos;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- ramos = commited.get_RamoRepository().Find();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 169, num, null, true);
- continue;
- }
- return ramos;
- }
- return null;
- });
- return ramos1;
- }
-
- public async Task<Ramo> Insert(Ramo ramo)
- {
- int num = 3;
- base.Sucesso = true;
- DateTime networkTime = Funcoes.GetNetworkTime();
- Ramo ramo2 = ramo;
- Ramo ramo3 = await Task.Run<Ramo>(() => {
- Ramo ramo4;
- string str;
- while (num > 0)
- {
- ramo = ramo2;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- ramo = commited.get_RamoRepository().SaveOrUpdate(ramo);
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(0);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(networkTime);
- Ramo ramo1 = ramo;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(ramo1, jsonSerializerSetting));
- registroLog.set_EntidadeId(ramo.get_Id());
- registroLog.set_Tela(12);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_21 = RamoServico.u003cu003ec.u003cu003e9__2_1;
- if (u003cu003e9_21 == null)
- {
- u003cu003e9_21 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- RamoServico.u003cu003ec.u003cu003e9__2_1 = u003cu003e9_21;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_21);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- ramo4 = ramo;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 230, num, ramo, true);
- continue;
- }
- return ramo4;
- }
- return ramo2;
- });
- return ramo3;
- }
-
- internal async Task<Ramo> Save(Ramo ramo, List<CoberturaPadrao> coberturas)
- {
- int num = 3;
- base.Sucesso = true;
- DateTime networkTime = Funcoes.GetNetworkTime();
- Ramo ramo3 = ramo;
- Ramo ramo4 = await Task.Run<Ramo>(() => {
- Ramo ramo5;
- string str;
- while (num > 0)
- {
- ramo = ramo3;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- Ramo ramo1 = commited.get_RamoRepository().SaveOrUpdate(ramo);
- List<CoberturaPadrao> coberturaPadraos = coberturas;
- if (coberturaPadraos != null)
- {
- coberturaPadraos.ForEach((CoberturaPadrao x) => commited.get_CoberturaPadraoRepository().Merge(x));
- }
- else
- {
- }
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(1);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(networkTime);
- Ramo ramo2 = ramo;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(ramo2, jsonSerializerSetting));
- registroLog.set_EntidadeId(ramo.get_Id());
- registroLog.set_Tela(12);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_02 = RamoServico.u003cu003ec.u003cu003e9__0_2;
- if (u003cu003e9_02 == null)
- {
- u003cu003e9_02 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- RamoServico.u003cu003ec.u003cu003e9__0_2 = u003cu003e9_02;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_02);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- ramo5 = ramo1;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 228, num, new { ramo = ramo, coberturas = coberturas }, true);
- continue;
- }
- return ramo5;
- }
- return ramo3;
- });
- return ramo4;
- }
- }
-}
\ No newline at end of file |