1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
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.Ferramentas;
internal class RamoServico : BaseServico
{
internal async Task<Ramo> Save(Ramo ramo, List<CoberturaPadrao> coberturas)
{
int tries = 3;
base.Sucesso = true;
DateTime now = Funcoes.GetNetworkTime();
Ramo ramoOriginal = ramo;
return await Task.Run((Func<Ramo>)delegate
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
//IL_00a0: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Expected O, but got Unknown
while (tries > 0)
{
ramo = ramoOriginal;
try
{
UnitOfWork unitOfWork = Instancia.Commited;
try
{
Ramo result = unitOfWork.RamoRepository.SaveOrUpdate(ramo);
coberturas?.ForEach(delegate(CoberturaPadrao x)
{
unitOfWork.CoberturaPadraoRepository.Merge(x);
});
IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
RegistroLog keyValues = new RegistroLog
{
Acao = (TipoAcao)1,
Usuario = Recursos.Usuario,
DataHora = now,
Descricao = JsonConvert.SerializeObject((object)ramo, new JsonSerializerSettings
{
ReferenceLoopHandling = (ReferenceLoopHandling)1
}),
EntidadeId = ((DomainBase)ramo).Id,
Tela = (TipoTela)12,
Versao = LoginViewModel.VersaoAtual,
NomeMaquina = Environment.MachineName,
UsuarioMaquina = Environment.UserName,
Ip = hostEntry.AddressList.FirstOrDefault((IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork)?.ToString()
};
SaveLog(keyValues, unitOfWork);
((GenericUnitOfWork)unitOfWork).Commit();
return result;
}
finally
{
if (unitOfWork != null)
{
((IDisposable)unitOfWork).Dispose();
}
}
}
catch (Exception e)
{
tries = Registrar(e, (TipoErro)228, tries, new { ramo, coberturas });
}
}
return ramoOriginal;
});
}
public async Task<List<Ramo>> BuscarRamos()
{
int tries = 3;
return await Task.Run(delegate
{
while (tries > 0)
{
try
{
UnitOfWork commited = Instancia.Commited;
try
{
return commited.RamoRepository.Find();
}
finally
{
((IDisposable)commited)?.Dispose();
}
}
catch (Exception e)
{
tries = Registrar(e, (TipoErro)169, tries);
}
}
return (List<Ramo>)null;
});
}
public async Task<Ramo> Insert(Ramo ramo)
{
int tries = 3;
base.Sucesso = true;
DateTime now = Funcoes.GetNetworkTime();
Ramo ramoOriginal = ramo;
return await Task.Run((Func<Ramo>)delegate
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Expected O, but got Unknown
while (tries > 0)
{
ramo = ramoOriginal;
try
{
UnitOfWork commited = Instancia.Commited;
try
{
ramo = commited.RamoRepository.SaveOrUpdate(ramo);
IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
RegistroLog keyValues = new RegistroLog
{
Acao = (TipoAcao)0,
Usuario = Recursos.Usuario,
DataHora = now,
Descricao = JsonConvert.SerializeObject((object)ramo, new JsonSerializerSettings
{
ReferenceLoopHandling = (ReferenceLoopHandling)1
}),
EntidadeId = ((DomainBase)ramo).Id,
Tela = (TipoTela)12,
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 ramo;
}
finally
{
((IDisposable)commited)?.Dispose();
}
}
catch (Exception e)
{
tries = Registrar(e, (TipoErro)230, tries, ramo);
}
}
return ramoOriginal;
});
}
}
|