summaryrefslogtreecommitdiff
path: root/Decompiler/Gestor.Application.Servicos.Seguros.Itens/AutoServico.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Decompiler/Gestor.Application.Servicos.Seguros.Itens/AutoServico.cs')
-rw-r--r--Decompiler/Gestor.Application.Servicos.Seguros.Itens/AutoServico.cs286
1 files changed, 286 insertions, 0 deletions
diff --git a/Decompiler/Gestor.Application.Servicos.Seguros.Itens/AutoServico.cs b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/AutoServico.cs
new file mode 100644
index 0000000..d3adcbc
--- /dev/null
+++ b/Decompiler/Gestor.Application.Servicos.Seguros.Itens/AutoServico.cs
@@ -0,0 +1,286 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Threading.Tasks;
+using Gestor.Application.Helpers;
+using Gestor.Application.Servicos.Generic;
+using Gestor.Application.ViewModels;
+using Gestor.Infrastructure.UnitOfWork.Generic;
+using Gestor.Infrastructure.UnitOfWork.Logic;
+using Gestor.Model.API;
+using Gestor.Model.Common;
+using Gestor.Model.Domain.Common;
+using Gestor.Model.Domain.Generic;
+using Gestor.Model.Domain.Seguros;
+using Newtonsoft.Json;
+
+namespace Gestor.Application.Servicos.Seguros.Itens;
+
+internal class AutoServico : BaseServico
+{
+ internal async Task<Documento> BuscarAuto(string value, long id, DateTime vigencia1, DateTime? vigencia2, long idSeguradora)
+ {
+ int tries = 3;
+ return await Task.Run((Func<Documento>)delegate
+ {
+ //IL_0077: Unknown result type (might be due to invalid IL or missing references)
+ //IL_007d: Expected O, but got Unknown
+ while (tries > 0)
+ {
+ try
+ {
+ UnitOfWork read = Instancia.Read;
+ try
+ {
+ return read.AutoRepository.FindByChassi(value, id, vigencia1, vigencia2, idSeguradora);
+ }
+ finally
+ {
+ ((IDisposable)read)?.Dispose();
+ }
+ }
+ catch (Exception e)
+ {
+ tries = Registrar(e, (TipoErro)50, tries, new { value, id });
+ }
+ }
+ return new Documento();
+ });
+ }
+
+ public async Task<Auto> Save(Auto auto)
+ {
+ return await Task.Run((Func<Auto>)delegate
+ {
+ //IL_0017: Unknown result type (might be due to invalid IL or missing references)
+ //IL_005a: Unknown result type (might be due to invalid IL or missing references)
+ //IL_005f: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0060: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0066: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0071: Unknown result type (might be due to invalid IL or missing references)
+ //IL_007c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0083: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0088: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0094: Expected O, but got Unknown
+ //IL_0099: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00aa: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00b1: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00bc: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00c7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_010f: Expected O, but got Unknown
+ try
+ {
+ UnitOfWork commited = Instancia.Commited;
+ try
+ {
+ TipoAcao acao = (TipoAcao)(((DomainBase)auto).Id != 0L);
+ auto = ((((DomainBase)auto).Id == 0L) ? commited.AutoRepository.SaveOrUpdate(auto) : commited.AutoRepository.Merge(auto));
+ IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
+ RegistroLog keyValues = new RegistroLog
+ {
+ Acao = acao,
+ Usuario = Recursos.Usuario,
+ DataHora = Funcoes.GetNetworkTime(),
+ Descricao = JsonConvert.SerializeObject((object)auto, new JsonSerializerSettings
+ {
+ ReferenceLoopHandling = (ReferenceLoopHandling)1
+ }),
+ EntidadeId = ((DomainBase)auto).Id,
+ Tela = (TipoTela)3,
+ Versao = LoginViewModel.VersaoAtual,
+ NomeMaquina = Environment.MachineName,
+ UsuarioMaquina = Environment.UserName,
+ Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString()
+ };
+ SaveLog(keyValues, commited);
+ ((GenericUnitOfWork)commited).Commit();
+ return auto;
+ }
+ finally
+ {
+ ((IDisposable)commited)?.Dispose();
+ }
+ }
+ catch (Exception)
+ {
+ return (Auto)null;
+ }
+ });
+ }
+
+ public async Task<bool> Delete(Item item)
+ {
+ int tries = 3;
+ return await Task.Run(delegate
+ {
+ //IL_009b: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00a0: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00a7: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00b9: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00c0: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00c5: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00d1: Expected O, but got Unknown
+ //IL_00d6: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00f4: Unknown result type (might be due to invalid IL or missing references)
+ //IL_00fb: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0106: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0111: Unknown result type (might be due to invalid IL or missing references)
+ //IL_011c: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0159: Expected O, but got Unknown
+ while (tries > 0)
+ {
+ try
+ {
+ UnitOfWork commited = Instancia.Commited;
+ try
+ {
+ if (item.Auto != null && ((DomainBase)item.Auto).Id > 0)
+ {
+ commited.AutoRepository.Delete(((DomainBase)item.Auto).Id);
+ }
+ commited.CoberturaRepository.DeletebyItem(((DomainBase)item).Id);
+ commited.ControleSinistroRepository.DeleteByItem(((DomainBase)item).Id);
+ commited.ItemRepository.Delete(((DomainBase)item).Id);
+ DateTime networkTime = Funcoes.GetNetworkTime();
+ IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
+ RegistroLog val = new RegistroLog
+ {
+ Acao = (TipoAcao)2,
+ Usuario = Recursos.Usuario,
+ DataHora = networkTime,
+ Descricao = JsonConvert.SerializeObject((object)item, new JsonSerializerSettings
+ {
+ ReferenceLoopHandling = (ReferenceLoopHandling)1
+ })
+ };
+ Auto auto = item.Auto;
+ val.EntidadeId = ((auto != null) ? ((DomainBase)auto).Id : 0);
+ val.Tela = (TipoTela)3;
+ val.Versao = LoginViewModel.VersaoAtual;
+ val.NomeMaquina = Environment.MachineName;
+ val.UsuarioMaquina = Environment.UserName;
+ val.Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString();
+ RegistroLog keyValues = val;
+ SaveLog(keyValues, commited);
+ ((GenericUnitOfWork)commited).Commit();
+ return true;
+ }
+ finally
+ {
+ ((IDisposable)commited)?.Dispose();
+ }
+ }
+ catch (Exception e)
+ {
+ tries = Registrar(e, (TipoErro)205, tries, item);
+ }
+ }
+ return false;
+ });
+ }
+
+ internal async Task<List<PesquisaAvancada>> BuscarPlaca(string placa, FiltroStatusDocumento status, List<VendedorUsuario> vendedorVinculado, bool tipobusca = false)
+ {
+ //IL_0016: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0017: Unknown result type (might be due to invalid IL or missing references)
+ return await Task.Run(delegate
+ {
+ //IL_0013: Unknown result type (might be due to invalid IL or missing references)
+ try
+ {
+ UnitOfWork read = Instancia.Read;
+ try
+ {
+ return read.AutoRepository.FindAuto(placa, status, vendedorVinculado, (TipoPesquisa)14, tipobusca);
+ }
+ finally
+ {
+ ((IDisposable)read)?.Dispose();
+ }
+ }
+ catch (Exception)
+ {
+ return (List<PesquisaAvancada>)null;
+ }
+ });
+ }
+
+ internal async Task<List<PesquisaAvancada>> BuscarChassi(string chassi, FiltroStatusDocumento status, List<VendedorUsuario> vendedorVinculado, bool tipobusca = false)
+ {
+ //IL_0016: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0017: Unknown result type (might be due to invalid IL or missing references)
+ return await Task.Run(delegate
+ {
+ //IL_0013: Unknown result type (might be due to invalid IL or missing references)
+ try
+ {
+ UnitOfWork read = Instancia.Read;
+ try
+ {
+ return read.AutoRepository.FindAuto(chassi, status, vendedorVinculado, (TipoPesquisa)0, tipobusca);
+ }
+ finally
+ {
+ ((IDisposable)read)?.Dispose();
+ }
+ }
+ catch (Exception)
+ {
+ return (List<PesquisaAvancada>)null;
+ }
+ });
+ }
+
+ public async Task<List<PesquisaAvancada>> BuscarItem(string item, FiltroStatusDocumento status, List<VendedorUsuario> vendedorVinculado, bool tipobusca = false)
+ {
+ //IL_0016: Unknown result type (might be due to invalid IL or missing references)
+ //IL_0017: Unknown result type (might be due to invalid IL or missing references)
+ return await Task.Run(delegate
+ {
+ //IL_0013: Unknown result type (might be due to invalid IL or missing references)
+ try
+ {
+ UnitOfWork read = Instancia.Read;
+ try
+ {
+ return read.AutoRepository.FindAuto(item, status, vendedorVinculado, (TipoPesquisa)6, tipobusca);
+ }
+ finally
+ {
+ ((IDisposable)read)?.Dispose();
+ }
+ }
+ catch (Exception)
+ {
+ return (List<PesquisaAvancada>)null;
+ }
+ });
+ }
+
+ public async Task<string> BuscarChassi(long id)
+ {
+ return await Task.Run(delegate
+ {
+ try
+ {
+ UnitOfWork read = Instancia.Read;
+ try
+ {
+ return read.AutoRepository.FindChassi(id);
+ }
+ finally
+ {
+ ((IDisposable)read)?.Dispose();
+ }
+ }
+ catch (Exception)
+ {
+ return (string)null;
+ }
+ });
+ }
+}