summaryrefslogtreecommitdiff
path: root/Gestor.Application/Servicos/Ferramentas/SeguradoraServico.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/Ferramentas/SeguradoraServico.cs
parent674ca83ba9243a9e95a7568c797668dab6aee26a (diff)
downloadgestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.tar.gz
gestor-1f4e14b2e973ee7de337fd4866d9a5ceff5cb6d1.zip
chore: location
Diffstat (limited to 'Gestor.Application/Servicos/Ferramentas/SeguradoraServico.cs')
-rw-r--r--Gestor.Application/Servicos/Ferramentas/SeguradoraServico.cs372
1 files changed, 0 insertions, 372 deletions
diff --git a/Gestor.Application/Servicos/Ferramentas/SeguradoraServico.cs b/Gestor.Application/Servicos/Ferramentas/SeguradoraServico.cs
deleted file mode 100644
index fe44719..0000000
--- a/Gestor.Application/Servicos/Ferramentas/SeguradoraServico.cs
+++ /dev/null
@@ -1,372 +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.Collections.ObjectModel;
-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 SeguradoraServico : BaseServico
- {
- public SeguradoraServico()
- {
- }
-
- public async Task<List<SeguradoraContato>> BuscarAssistencias(long id)
- {
- int num = 3;
- List<SeguradoraContato> seguradoraContatos1 = await Task.Run<List<SeguradoraContato>>(() => {
- List<SeguradoraContato> seguradoraContatos;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- seguradoraContatos = read.get_SeguradoraContatoRepository().FindAssistencia(Recursos.Empresa.get_Id(), id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 125, num, new { Id = Recursos.Empresa.get_Id(), id = id }, true);
- continue;
- }
- return seguradoraContatos;
- }
- return new List<SeguradoraContato>();
- });
- return seguradoraContatos1;
- }
-
- internal async Task<List<ConfigExtratoImport>> BuscarConfig(long id)
- {
- int num = 3;
- List<ConfigExtratoImport> configExtratoImports1 = await Task.Run<List<ConfigExtratoImport>>(() => {
- List<ConfigExtratoImport> list;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<ConfigExtratoImport> configExtratoImports = read.get_ConfigExtratoImportRepository().FindBySeguradora(id);
- Func<ConfigExtratoImport, string> u003cu003e9_21 = SeguradoraServico.u003cu003ec.u003cu003e9__2_1;
- if (u003cu003e9_21 == null)
- {
- u003cu003e9_21 = (ConfigExtratoImport x) => x.get_Descricao();
- SeguradoraServico.u003cu003ec.u003cu003e9__2_1 = u003cu003e9_21;
- }
- list = configExtratoImports.OrderBy<ConfigExtratoImport, string>(u003cu003e9_21).ToList<ConfigExtratoImport>();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 124, num, id, true);
- continue;
- }
- return list;
- }
- return new List<ConfigExtratoImport>();
- });
- return configExtratoImports1;
- }
-
- public async Task<ObservableCollection<SeguradoraContato>> BuscarContatos(long id)
- {
- int num = 3;
- ObservableCollection<SeguradoraContato> observableCollection1 = await Task.Run<ObservableCollection<SeguradoraContato>>(() => {
- ObservableCollection<SeguradoraContato> observableCollection;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<SeguradoraContato> seguradoraContatos = read.get_SeguradoraContatoRepository().FindBySeguradora(Recursos.Empresa.get_Id(), id);
- Func<SeguradoraContato, string> u003cu003e9_31 = SeguradoraServico.u003cu003ec.u003cu003e9__3_1;
- if (u003cu003e9_31 == null)
- {
- u003cu003e9_31 = (SeguradoraContato x) => x.get_NomeContato();
- SeguradoraServico.u003cu003ec.u003cu003e9__3_1 = u003cu003e9_31;
- }
- observableCollection = new ObservableCollection<SeguradoraContato>(seguradoraContatos.OrderBy<SeguradoraContato, string>(u003cu003e9_31));
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 125, num, new { Id = Recursos.Empresa.get_Id(), id = id }, true);
- continue;
- }
- return observableCollection;
- }
- return new ObservableCollection<SeguradoraContato>();
- });
- return observableCollection1;
- }
-
- public async Task<ObservableCollection<SeguradoraEndereco>> BuscarEnderecos(long id)
- {
- int num = 3;
- ObservableCollection<SeguradoraEndereco> observableCollection1 = await Task.Run<ObservableCollection<SeguradoraEndereco>>(() => {
- ObservableCollection<SeguradoraEndereco> observableCollection;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<SeguradoraEndereco> seguradoraEnderecos = read.get_SeguradoraEnderecoRepository().FindBySeguradora(Recursos.Empresa.get_Id(), id);
- Func<SeguradoraEndereco, long> u003cu003e9_41 = SeguradoraServico.u003cu003ec.u003cu003e9__4_1;
- if (u003cu003e9_41 == null)
- {
- u003cu003e9_41 = (SeguradoraEndereco x) => x.get_Id();
- SeguradoraServico.u003cu003ec.u003cu003e9__4_1 = u003cu003e9_41;
- }
- observableCollection = new ObservableCollection<SeguradoraEndereco>(seguradoraEnderecos.OrderBy<SeguradoraEndereco, long>(u003cu003e9_41));
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 126, num, new { Id = Recursos.Empresa.get_Id(), id = id }, true);
- continue;
- }
- return observableCollection;
- }
- return new ObservableCollection<SeguradoraEndereco>();
- });
- return observableCollection1;
- }
-
- public async Task<Seguradora> BuscarSeguradora(long id)
- {
- int num = 3;
- Seguradora seguradora1 = await Task.Run<Seguradora>(() => {
- Seguradora seguradora;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- seguradora = read.get_SeguradoraRepository().FindById(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 128, num, null, true);
- continue;
- }
- return seguradora;
- }
- return new Seguradora();
- });
- return seguradora1;
- }
-
- public async Task<List<Seguradora>> BuscarSeguradoras()
- {
- int num = 3;
- List<Seguradora> seguradoras1 = await Task.Run<List<Seguradora>>(() => {
- List<Seguradora> seguradoras;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- seguradoras = read.get_SeguradoraRepository().Find();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 127, num, null, true);
- continue;
- }
- return seguradoras;
- }
- return new List<Seguradora>();
- });
- return seguradoras1;
- }
-
- public async Task<Seguradora> Insert(Seguradora seguradora)
- {
- int num = 3;
- base.Sucesso = true;
- DateTime networkTime = Funcoes.GetNetworkTime();
- Seguradora seguradora2 = seguradora;
- Seguradora seguradora3 = await Task.Run<Seguradora>(() => {
- Seguradora seguradora4;
- string str;
- while (num > 0)
- {
- seguradora = seguradora2;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- seguradora = commited.get_SeguradoraRepository().SaveOrUpdate(seguradora);
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(0);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(networkTime);
- Seguradora seguradora1 = seguradora;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(seguradora1, jsonSerializerSetting));
- registroLog.set_EntidadeId(seguradora.get_Id());
- registroLog.set_Tela(13);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_11 = SeguradoraServico.u003cu003ec.u003cu003e9__1_1;
- if (u003cu003e9_11 == null)
- {
- u003cu003e9_11 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- SeguradoraServico.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();
- seguradora4 = seguradora;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 234, num, seguradora, true);
- continue;
- }
- return seguradora4;
- }
- return seguradora2;
- });
- return seguradora3;
- }
-
- public async Task<Seguradora> Save(Seguradora seguradora, List<ConfigExtratoImport> config, bool primeiroAcesso = false)
- {
- Action<SeguradoraContato> action2 = null;
- int num = 3;
- base.Sucesso = true;
- DateTime networkTime = Funcoes.GetNetworkTime();
- Seguradora seguradora2 = seguradora;
- Seguradora seguradora3 = await Task.Run<Seguradora>(() => {
- Seguradora seguradora4;
- string str;
- while (num > 0)
- {
- seguradora = seguradora2;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- TipoAcao tipoAcao = (seguradora.get_Id() == 0 ? 0 : 1);
- List<SeguradoraContato> contatos = seguradora.get_Contatos();
- if (contatos != null)
- {
- List<SeguradoraContato> seguradoraContatos = contatos;
- Action<SeguradoraContato> u003cu003e9_1 = action2;
- if (u003cu003e9_1 == null)
- {
- Action<SeguradoraContato> action = (SeguradoraContato x) => x.set_Seguradora(seguradora);
- Action<SeguradoraContato> action1 = action;
- action2 = action;
- u003cu003e9_1 = action1;
- }
- seguradoraContatos.ForEach(u003cu003e9_1);
- contatos = commited.get_SeguradoraContatoRepository().Merge(contatos, seguradora, Recursos.Empresa.get_Id());
- }
- List<SeguradoraEndereco> enderecos = seguradora.get_Enderecos();
- if (contatos != null)
- {
- enderecos = commited.get_SeguradoraEnderecoRepository().Merge(enderecos, seguradora, Recursos.Empresa.get_Id());
- }
- if (contatos != null | primeiroAcesso)
- {
- seguradora = commited.get_SeguradoraRepository().Merge(seguradora);
- }
- seguradora.set_Contatos(contatos);
- seguradora.set_Enderecos(enderecos);
- List<ConfigExtratoImport> configExtratoImports = config;
- if (configExtratoImports != null)
- {
- configExtratoImports.ForEach((ConfigExtratoImport x) => commited.get_ConfigExtratoImportRepository().Merge(x));
- }
- else
- {
- }
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(tipoAcao);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(networkTime);
- Seguradora seguradora1 = seguradora;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(seguradora1, jsonSerializerSetting));
- registroLog.set_EntidadeId(seguradora.get_Id());
- registroLog.set_Tela(13);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_03 = SeguradoraServico.u003cu003ec.u003cu003e9__0_3;
- if (u003cu003e9_03 == null)
- {
- u003cu003e9_03 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- SeguradoraServico.u003cu003ec.u003cu003e9__0_3 = u003cu003e9_03;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_03);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- seguradora4 = seguradora;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 233, num, new { seguradora = seguradora, config = config }, true);
- continue;
- }
- return seguradora4;
- }
- return seguradora2;
- });
- return seguradora3;
- }
- }
-} \ No newline at end of file