diff options
Diffstat (limited to 'Gestor.Application/Servicos/Ferramentas')
21 files changed, 0 insertions, 4315 deletions
diff --git a/Gestor.Application/Servicos/Ferramentas/AdiantamentoServico.cs b/Gestor.Application/Servicos/Ferramentas/AdiantamentoServico.cs deleted file mode 100644 index 24289ac..0000000 --- a/Gestor.Application/Servicos/Ferramentas/AdiantamentoServico.cs +++ /dev/null @@ -1,281 +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.Relatorios;
-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
-{
- public class AdiantamentoServico : BaseServico
- {
- public AdiantamentoServico()
- {
- }
-
- public async Task<List<Adiantamento>> BuscarAdiantamentos(long id, bool concluido)
- {
- int num = 3;
- List<Adiantamento> adiantamentos1 = await Task.Run<List<Adiantamento>>(() => {
- List<Adiantamento> adiantamentos;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- adiantamentos = read.get_AdiantamentoRepository().BuscarAdiantamentos(id, concluido);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 16, num, new { id = id, concluido = concluido }, true);
- continue;
- }
- return adiantamentos;
- }
- return new List<Adiantamento>();
- });
- return adiantamentos1;
- }
-
- public async Task<List<Adiantamento>> BuscarPorData(Filtros filtro, bool segundavia = false)
- {
- int num = 3;
- List<Adiantamento> adiantamentos1 = await Task.Run<List<Adiantamento>>(() => {
- List<Adiantamento> adiantamentos;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- adiantamentos = read.get_AdiantamentoRepository().FindByDate(filtro.get_Inicio(), filtro.get_Fim(), filtro.get_Vendedores(), segundavia);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 15, num, filtro, true);
- continue;
- }
- return adiantamentos;
- }
- return new List<Adiantamento>();
- });
- return adiantamentos1;
- }
-
- public async Task<bool> Delete(Adiantamento adiantamento)
- {
- int num = 3;
- DateTime networkTime = Funcoes.GetNetworkTime();
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- object obj;
- string str;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- commited.get_AdiantamentoRepository().Delete(adiantamento.get_Id());
- 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[] strArrays = new string[] { string.Format("O USUÁRIO {0} EXCLUIU, EM {1}, O PARCEIRO DE ", Recursos.Usuario.get_Nome(), networkTime), string.Format("ID: '{0}'", adiantamento.get_Id()), ", HISTÓRICO: '", null, null, null, null, null };
- strArrays[3] = (string.IsNullOrWhiteSpace(adiantamento.get_Historico()) ? "" : adiantamento.get_Historico() ?? "");
- strArrays[4] = "', DATA DO ADIANTAMENTO: '";
- DateTime? data = adiantamento.get_Data();
- if (!data.HasValue)
- {
- obj = "";
- }
- else
- {
- data = adiantamento.get_Data();
- obj = (data.HasValue ? data.GetValueOrDefault().ToShortDateString() : null) ?? "";
- }
- strArrays[5] = (string)obj;
- strArrays[6] = "'";
- strArrays[7] = string.Format(", VALOR DO ADIANTAMENTO: 'R${0}'.", adiantamento.get_Valor());
- registroLog1.set_Descricao(string.Concat(strArrays));
- registroLog.set_EntidadeId(adiantamento.get_Id());
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_Tela(36);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- RegistroLog registroLog2 = registroLog;
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_11 = AdiantamentoServico.u003cu003ec.u003cu003e9__1_1;
- if (u003cu003e9_11 == null)
- {
- u003cu003e9_11 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- AdiantamentoServico.u003cu003ec.u003cu003e9__1_1 = u003cu003e9_11;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_11);
- 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, 210, num, adiantamento, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task GerarPagamento(List<Adiantamento> adiantamentos)
- {
- int num = 3;
- DateTime networkTime = Funcoes.GetNetworkTime();
- await Task.Run(() => {
- while (num > 0)
- {
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- adiantamentos.ForEach((Adiantamento x) => {
- string str;
- Adiantamento adiantamento = commited.get_AdiantamentoRepository().FindById(x.get_Id());
- adiantamento.set_Pago(true);
- adiantamento.set_Pagamento(new DateTime?(networkTime));
- adiantamento = commited.get_AdiantamentoRepository().Merge(adiantamento);
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(1);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(networkTime);
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(adiantamento, jsonSerializerSetting));
- registroLog.set_EntidadeId(adiantamento.get_Id());
- registroLog.set_Tela(36);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_42 = AdiantamentoServico.u003cu003ec.u003cu003e9__4_2;
- if (u003cu003e9_42 == null)
- {
- u003cu003e9_42 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- AdiantamentoServico.u003cu003ec.u003cu003e9__4_2 = u003cu003e9_42;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_42);
- str = (pAddress != null ? pAddress.ToString() : null);
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- });
- commited.Commit();
- break;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 194, num, adiantamentos, true);
- }
- }
- });
- }
-
- public async Task<Adiantamento> Save(Adiantamento adiatamento)
- {
- int num = 3;
- base.Sucesso = true;
- Adiantamento adiantamento2 = adiatamento;
- DateTime networkTime = Funcoes.GetNetworkTime();
- Adiantamento adiantamento3 = await Task.Run<Adiantamento>(() => {
- Adiantamento adiantamento;
- string str;
- while (num > 0)
- {
- adiatamento = adiantamento2;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- TipoAcao tipoAcao = (adiatamento.get_Id() == 0 ? 0 : 1);
- adiatamento.set_Pagamento((adiatamento.get_Pago() ? new DateTime?(networkTime) : null));
- adiatamento = (adiatamento.get_Id() == 0 ? commited.get_AdiantamentoRepository().SaveOrUpdate(adiatamento) : commited.get_AdiantamentoRepository().Merge(adiatamento));
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(tipoAcao);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(networkTime);
- Adiantamento adiantamento1 = adiatamento;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(adiantamento1, jsonSerializerSetting));
- registroLog.set_EntidadeId(adiatamento.get_Id());
- registroLog.set_Tela(36);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_01 = AdiantamentoServico.u003cu003ec.u003cu003e9__0_1;
- if (u003cu003e9_01 == null)
- {
- u003cu003e9_01 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- AdiantamentoServico.u003cu003ec.u003cu003e9__0_1 = u003cu003e9_01;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_01);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- adiantamento = adiatamento;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 209, num, adiatamento, true);
- continue;
- }
- return adiantamento;
- }
- return adiantamento2;
- });
- return adiantamento3;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/AgendaServico.cs b/Gestor.Application/Servicos/Ferramentas/AgendaServico.cs deleted file mode 100644 index d52af23..0000000 --- a/Gestor.Application/Servicos/Ferramentas/AgendaServico.cs +++ /dev/null @@ -1,257 +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.Ferramentas;
-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 AgendaServico : BaseServico
- {
- public AgendaServico()
- {
- }
-
- internal async Task<ObservableCollection<AgendaEmail>> BuscarEmailsAsync(long id)
- {
- int num = 3;
- ObservableCollection<AgendaEmail> observableCollection1 = await Task.Run<ObservableCollection<AgendaEmail>>(() => {
- ObservableCollection<AgendaEmail> observableCollection;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- observableCollection = new ObservableCollection<AgendaEmail>(read.get_AgendaEmailRepository().FindByAgendaId(id));
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 108, num, id, true);
- continue;
- }
- return observableCollection;
- }
- return new ObservableCollection<AgendaEmail>();
- });
- return observableCollection1;
- }
-
- internal async Task<ObservableCollection<AgendaTelefone>> BuscarTelefonesAsync(long id)
- {
- int num = 3;
- ObservableCollection<AgendaTelefone> observableCollection1 = await Task.Run<ObservableCollection<AgendaTelefone>>(() => {
- ObservableCollection<AgendaTelefone> observableCollection;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- observableCollection = new ObservableCollection<AgendaTelefone>(read.get_AgendaTelefoneRepository().FindByAgendaId(id));
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 107, num, id, true);
- continue;
- }
- return observableCollection;
- }
- return new ObservableCollection<AgendaTelefone>();
- });
- return observableCollection1;
- }
-
- public async Task<bool> Delete(Agenda agenda)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- string str;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- commited.get_AgendaRepository().Delete(agenda.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.set_Descricao(string.Concat(new string[] { string.Format("O USUÁRIO {0} EXCLUIU, EM {1}, O CONTATO DE ", Recursos.Usuario.get_Nome(), networkTime), string.Format("ID: '{0}'", agenda.get_Id()), ", NOME: '", (string.IsNullOrWhiteSpace(agenda.get_Nome()) ? "" : agenda.get_Nome() ?? ""), "', ENDEREÇO: '", agenda.get_Endereco(), ", ", agenda.get_Numero(), ", ", (string.IsNullOrWhiteSpace(agenda.get_Complemento()) ? "-" : agenda.get_Complemento() ?? ""), ", ", agenda.get_Bairro(), ", ", agenda.get_Cidade(), "/", agenda.get_Estado(), " - ", agenda.get_Cep(), "', OBSERVAÇÃO: '", (string.IsNullOrWhiteSpace(agenda.get_Observacao()) ? "" : agenda.get_Observacao() ?? ""), "'." }));
- registroLog.set_EntidadeId(agenda.get_Id());
- registroLog.set_Tela(34);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- RegistroLog registroLog1 = registroLog;
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_11 = AgendaServico.u003cu003ec.u003cu003e9__1_1;
- if (u003cu003e9_11 == null)
- {
- u003cu003e9_11 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- AgendaServico.u003cu003ec.u003cu003e9__1_1 = u003cu003e9_11;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_11);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog1.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 216, num, agenda, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<Agenda> Save(Agenda agenda)
- {
- int num = 3;
- base.Sucesso = true;
- Agenda agenda2 = agenda;
- Agenda agenda3 = await Task.Run<Agenda>(() => {
- Agenda agenda4;
- List<AgendaTelefone> list;
- List<AgendaEmail> agendaEmails;
- string str;
- while (num > 0)
- {
- agenda = agenda2;
- try
- {
- TipoAcao tipoAcao = (agenda.get_Id() == 0 ? 0 : 1);
- ObservableCollection<AgendaTelefone> telefones = agenda.get_Telefones();
- if (telefones != null)
- {
- list = telefones.ToList<AgendaTelefone>();
- }
- else
- {
- list = null;
- }
- List<AgendaTelefone> agendaTelefones = list;
- ObservableCollection<AgendaEmail> emails = agenda.get_Emails();
- if (emails != null)
- {
- agendaEmails = emails.ToList<AgendaEmail>();
- }
- else
- {
- agendaEmails = null;
- }
- List<AgendaEmail> agendaEmails1 = agendaEmails;
- agenda.set_Telefones(null);
- agenda.set_Emails(null);
- using (UnitOfWork commited = Instancia.Commited)
- {
- if (agenda.get_Id() != (long)0)
- {
- if (agendaTelefones != null)
- {
- agendaTelefones = commited.get_AgendaTelefoneRepository().Merge(agendaTelefones, agenda);
- }
- if (agendaEmails1 != null)
- {
- agendaEmails1 = commited.get_AgendaEmailRepository().Merge(agendaEmails1, agenda);
- }
- agenda = commited.get_AgendaRepository().Merge(agenda);
- }
- else
- {
- agenda = commited.get_AgendaRepository().SaveOrUpdate(agenda);
- if (agendaTelefones != null)
- {
- agendaTelefones = commited.get_AgendaTelefoneRepository().Inserir(agendaTelefones, agenda);
- }
- if (agendaEmails1 != null)
- {
- agendaEmails1 = commited.get_AgendaEmailRepository().Inserir(agendaEmails1, agenda);
- }
- }
- agenda.set_Telefones((agendaTelefones == null ? null : new ObservableCollection<AgendaTelefone>(agendaTelefones)));
- agenda.set_Emails((agendaEmails1 == null ? null : new ObservableCollection<AgendaEmail>(agendaEmails1)));
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(tipoAcao);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(Funcoes.GetNetworkTime());
- Agenda agenda1 = agenda;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(agenda1, jsonSerializerSetting));
- registroLog.set_EntidadeId(agenda.get_Id());
- registroLog.set_Tela(34);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_01 = AgendaServico.u003cu003ec.u003cu003e9__0_1;
- if (u003cu003e9_01 == null)
- {
- u003cu003e9_01 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- AgendaServico.u003cu003ec.u003cu003e9__0_1 = u003cu003e9_01;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_01);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- agenda4 = agenda;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 215, num, agenda, true);
- continue;
- }
- return agenda4;
- }
- return agenda2;
- });
- return agenda3;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/EmailServico.cs b/Gestor.Application/Servicos/Ferramentas/EmailServico.cs deleted file mode 100644 index 2e8887d..0000000 --- a/Gestor.Application/Servicos/Ferramentas/EmailServico.cs +++ /dev/null @@ -1,127 +0,0 @@ -using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Common.Helpers;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Infrastructure.UnitOfWork.Logic;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Ferramentas;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Seguros;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Ferramentas
-{
- internal class EmailServico : BaseServico
- {
- public EmailServico()
- {
- }
-
- internal async Task<List<ClienteEmail>> BuscarEmail(string email)
- {
- int num = 3;
- List<ClienteEmail> clienteEmails1 = await Task.Run<List<ClienteEmail>>(() => {
- List<ClienteEmail> clienteEmails;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- clienteEmails = read.get_ClienteEmailRepository().FindEmailCliente(email, (Recursos.Usuario.get_IdEmpresa() == (long)1 ? (long)0 : Recursos.Usuario.get_IdEmpresa()));
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 109, num, email, true);
- continue;
- }
- return clienteEmails;
- }
- return new List<ClienteEmail>();
- });
- return clienteEmails1;
- }
-
- public async Task<bool> Delete(Credencial email)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- registroLogs.Add(base.CreateLog(email.get_Id(), email.GetValorOriginal(), 17, 2));
- commited.get_CredencialRepository().Delete(email.get_Id());
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 218, num, email, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<Credencial> Save(Credencial credencial)
- {
- int num = 3;
- base.Sucesso = true;
- Credencial credencial1 = credencial;
- Credencial credencial2 = await Task.Run<Credencial>(() => {
- Credencial credencial3;
- bool flag;
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- credencial = credencial1;
- while (num > 0)
- {
- credencial = credencial1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- flag = (credencial.get_Id() == 0 ? false : true);
- credencial.set_Senha(EncryptionHelper.Encrypt(credencial.get_Senha()));
- if (flag)
- {
- registroLogs.Add(base.CreateLog(credencial.get_Id(), credencial, 17));
- }
- credencial = (credencial.get_Id() == 0 ? commited.get_CredencialRepository().SaveOrUpdate(credencial) : commited.get_CredencialRepository().Merge(credencial));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(credencial.get_Id(), credencial.GetValorOriginal(), 17, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- credencial3 = credencial;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 217, num, credencial, true);
- continue;
- }
- return credencial3;
- }
- return credencial1;
- });
- return credencial2;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/EmpresaServico.cs b/Gestor.Application/Servicos/Ferramentas/EmpresaServico.cs deleted file mode 100644 index 4d6d354..0000000 --- a/Gestor.Application/Servicos/Ferramentas/EmpresaServico.cs +++ /dev/null @@ -1,287 +0,0 @@ -using ArquivoDigital.Infrastructure.Repository.Interface;
-using ArquivoDigital.Infrastructure.UnitOfWork.Logic;
-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.API;
-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.Ferramentas
-{
- internal class EmpresaServico : BaseServico
- {
- public EmpresaServico()
- {
- }
-
- public async void AtualizarLogoId(long id, string idLogo)
- {
- await Task.Run(() => {
- try
- {
- using (Gestor.Infrastructure.UnitOfWork.Logic.UnitOfWork commited = Instancia.Commited)
- {
- Empresa empresa = commited.get_EmpresaRepository().FindById(id);
- empresa.set_LogoId(idLogo);
- commited.get_EmpresaRepository().Merge(empresa);
- commited.Commit();
- }
- }
- catch (Exception exception)
- {
- }
- });
- }
-
- internal async Task<Empresa> BuscarEmpresaPorId(long id)
- {
- int num = 3;
- Empresa empresa1 = await Task.Run<Empresa>(() => {
- Empresa empresa;
- while (num > 0)
- {
- try
- {
- using (Gestor.Infrastructure.UnitOfWork.Logic.UnitOfWork read = Instancia.Read)
- {
- empresa = read.get_EmpresaRepository().FindById(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 114, num, id, true);
- continue;
- }
- return empresa;
- }
- return new Empresa();
- });
- return empresa1;
- }
-
- internal async Task<List<Empresa>> BuscarEmpresas()
- {
- int num = 3;
- List<Empresa> empresas1 = await Task.Run<List<Empresa>>(() => {
- List<Empresa> empresas;
- while (num > 0)
- {
- try
- {
- using (Gestor.Infrastructure.UnitOfWork.Logic.UnitOfWork read = Instancia.Read)
- {
- empresas = read.get_EmpresaRepository().Find((Recursos.Usuario.get_IdEmpresa() == (long)1 ? (long)0 : Recursos.Usuario.get_IdEmpresa()));
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 113, num, null, true);
- continue;
- }
- return empresas;
- }
- return new List<Empresa>();
- });
- return empresas1;
- }
-
- public string BuscarSenhaAdm()
- {
- string str;
- int num = 3;
- while (num > 0)
- {
- try
- {
- using (Gestor.Infrastructure.UnitOfWork.Logic.UnitOfWork read = Instancia.Read)
- {
- str = read.get_EmpresaRepository().BuscarSenhaAdm((long)1);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 115, num, null, true);
- continue;
- }
- return str;
- }
- return null;
- }
-
- public async Task<double> ConsultaEspacoBancoInGb()
- {
- double num3 = await Task.Run<double>(() => {
- double num;
- try
- {
- using (Gestor.Infrastructure.UnitOfWork.Logic.UnitOfWork read = Instancia.Read)
- {
- double num1 = read.get_EmpresaRepository().ConsultaEspacoBancoInGb();
- double num2 = 0;
- try
- {
- foreach (ControleArquivoDigital controleArquivoDigital in read.get_IndiceArquivoDigitalRepository().BuscarBancos())
- {
- if (controleArquivoDigital.get_Tabela().ToLower() == "arquivos")
- {
- continue;
- }
- try
- {
- Gestor.Application.Helpers.ArquivoDigital.SetConnection(controleArquivoDigital.get_Catalogo());
- using (ArquivoDigital.Infrastructure.UnitOfWork.Logic.UnitOfWork unitOfWork = Gestor.Application.Helpers.ArquivoDigital.Read)
- {
- num2 += unitOfWork.get_ArquivoDigitalRepository().ConsultaEspacoBancoInGb();
- }
- }
- catch
- {
- }
- }
- }
- catch
- {
- }
- num = num1 + num2;
- }
- }
- catch (Exception exception)
- {
- return 0;
- }
- return num;
- });
- return num3;
- }
-
- internal async Task<Customer> Save(Customer customer)
- {
- int num = 3;
- base.Sucesso = true;
- Customer customer1 = customer;
- Customer customer2 = await Task.Run<Customer>(() => {
- Customer customer3;
- while (num > 0)
- {
- customer = customer1;
- try
- {
- using (Gestor.Infrastructure.UnitOfWork.Logic.UnitOfWork commited = Instancia.Commited)
- {
- Empresa empresa = new Empresa();
- empresa.set_Nome(customer.get_Name());
- empresa.set_Documento(customer.get_Document());
- empresa.set_Bairro(customer.get_District());
- empresa.set_Cidade(customer.get_City());
- empresa.set_Complemento(customer.get_Adjunct());
- empresa.set_Numero(customer.get_Number());
- empresa.set_Cep(customer.get_PostCode());
- empresa.set_Estado(customer.get_State());
- empresa.set_Email(customer.get_Mail());
- empresa.set_PrimeiroPrefixo(customer.get_AreaCode());
- empresa.set_PrimeiroTelefone(customer.get_Phone());
- empresa.set_SegundoPrefixo(customer.get_SecondAreaCode());
- empresa.set_SegundoTelefone(customer.get_SecondPhone());
- empresa.set_Serial(ApplicationHelper.NumeroSerial);
- empresa.set_Site(customer.get_Site());
- commited.get_EmpresaRepository().SaveOrUpdate(empresa);
- commited.Commit();
- customer3 = customer;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 277, num, customer, true);
- continue;
- }
- return customer3;
- }
- return customer1;
- });
- return customer2;
- }
-
- public async Task<Empresa> Save(Empresa empresa)
- {
- int num = 3;
- base.Sucesso = true;
- Empresa empresa2 = empresa;
- Empresa empresa3 = await Task.Run<Empresa>(() => {
- Empresa empresa4;
- string str;
- while (num > 0)
- {
- empresa = empresa2;
- try
- {
- using (Gestor.Infrastructure.UnitOfWork.Logic.UnitOfWork commited = Instancia.Commited)
- {
- TipoAcao tipoAcao = (empresa.get_Id() == 0 ? 0 : 1);
- empresa = (empresa.get_Id() == 0 ? commited.get_EmpresaRepository().SaveOrUpdate(empresa) : commited.get_EmpresaRepository().Merge(empresa));
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- if (Recursos.Usuario.get_Id() != 0)
- {
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(tipoAcao);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(Funcoes.GetNetworkTime());
- Empresa empresa1 = empresa;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(empresa1, jsonSerializerSetting));
- registroLog.set_EntidadeId(empresa.get_Id());
- registroLog.set_Tela(18);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_31 = EmpresaServico.u003cu003ec.u003cu003e9__3_1;
- if (u003cu003e9_31 == null)
- {
- u003cu003e9_31 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- EmpresaServico.u003cu003ec.u003cu003e9__3_1 = u003cu003e9_31;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_31);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- }
- commited.Commit();
- empresa4 = empresa;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 277, num, empresa, true);
- continue;
- }
- return empresa4;
- }
- return empresa2;
- });
- return empresa3;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs b/Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs deleted file mode 100644 index 413a361..0000000 --- a/Gestor.Application/Servicos/Ferramentas/EstipulanteServico.cs +++ /dev/null @@ -1,124 +0,0 @@ -using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-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 System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Ferramentas
-{
- internal class EstipulanteServico : BaseServico
- {
- public EstipulanteServico()
- {
- }
-
- internal async Task<Estipulante> BuscarEstipulantePorId(long id)
- {
- int num = 3;
- Estipulante estipulante1 = await Task.Run<Estipulante>(() => {
- Estipulante estipulante;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- estipulante = read.get_EstipulanteRepository().FindById(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 110, num, id, true);
- continue;
- }
- return estipulante;
- }
- return new Estipulante();
- });
- return estipulante1;
- }
-
- public async Task<bool> Delete(Estipulante estipulante)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- registroLogs.Add(base.CreateLog(estipulante.get_Id(), estipulante.GetValorOriginal(), 9, 2));
- commited.get_EstipulanteRepository().Delete(estipulante.get_Id());
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 220, num, estipulante, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<Estipulante> Save(Estipulante estipulante)
- {
- int num = 3;
- base.Sucesso = true;
- Estipulante estipulante1 = estipulante;
- Estipulante estipulante2 = await Task.Run<Estipulante>(() => {
- Estipulante estipulante3;
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- estipulante = estipulante1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- estipulante.set_IdEmpresa(Recursos.Empresa.get_Id());
- flag = (estipulante.get_Id() == 0 ? false : true);
- if (flag)
- {
- registroLogs.Add(base.CreateLog(estipulante.get_Id(), estipulante, 9));
- }
- estipulante = (estipulante.get_Id() == 0 ? commited.get_EstipulanteRepository().SaveOrUpdate(estipulante) : commited.get_EstipulanteRepository().Merge(estipulante));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(estipulante.get_Id(), estipulante.GetValorOriginal(), 9, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- estipulante3 = estipulante;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 219, num, estipulante, true);
- continue;
- }
- return estipulante3;
- }
- return estipulante1;
- });
- return estipulante2;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/ImpostoServico.cs b/Gestor.Application/Servicos/Ferramentas/ImpostoServico.cs deleted file mode 100644 index ac8cd9f..0000000 --- a/Gestor.Application/Servicos/Ferramentas/ImpostoServico.cs +++ /dev/null @@ -1,171 +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.Ferramentas;
-using Gestor.Model.Domain.Generic;
-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
-{
- public class ImpostoServico : BaseServico
- {
- public ImpostoServico()
- {
- }
-
- public async Task<List<Imposto>> Buscar(bool? ativo)
- {
- int num = 3;
- List<Imposto> impostos1 = await Task.Run<List<Imposto>>(() => {
- List<Imposto> impostos;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- impostos = read.get_ImpostoRepository().DefaultSelect(ativo);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 317, num, ativo, true);
- continue;
- }
- return impostos;
- }
- return new List<Imposto>();
- });
- return impostos1;
- }
-
- public async Task<List<Imposto>> BuscarPorRamo(long id)
- {
- int num = 3;
- List<Imposto> impostos1 = await Task.Run<List<Imposto>>(() => {
- List<Imposto> impostos;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- impostos = read.get_ImpostoRepository().FindByRamo(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 317, num, id, true);
- continue;
- }
- return impostos;
- }
- return new List<Imposto>();
- });
- return impostos1;
- }
-
- public async Task<List<Imposto>> BuscarPorSeguradora(long id)
- {
- int num = 3;
- List<Imposto> impostos1 = await Task.Run<List<Imposto>>(() => {
- List<Imposto> impostos;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- impostos = read.get_ImpostoRepository().FindBySeguradora(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 317, num, id, true);
- continue;
- }
- return impostos;
- }
- return new List<Imposto>();
- });
- return impostos1;
- }
-
- public async Task<Imposto> Salvar(Imposto imposto)
- {
- int num = 3;
- Imposto imposto2 = await Task.Run<Imposto>(() => {
- Imposto imposto3;
- string str;
- while (num > 0)
- {
- this.Sucesso = true;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- TipoAcao tipoAcao = (imposto.get_Id() == 0 ? 0 : 1);
- Imposto imposto1 = (tipoAcao == null ? commited.get_ImpostoRepository().SaveOrUpdate(imposto) : commited.get_ImpostoRepository().Merge(imposto));
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(tipoAcao);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(Funcoes.GetNetworkTime());
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(imposto1, jsonSerializerSetting));
- registroLog.set_EntidadeId(imposto1.get_Id());
- registroLog.set_Tela(56);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_31 = ImpostoServico.u003cu003ec.u003cu003e9__3_1;
- if (u003cu003e9_31 == null)
- {
- u003cu003e9_31 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- ImpostoServico.u003cu003ec.u003cu003e9__3_1 = u003cu003e9_31;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_31);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- imposto3 = imposto1;
- }
- }
- catch (Exception exception1)
- {
- Exception exception = exception1;
- this.Sucesso = false;
- num = base.Registrar(exception, 318, num, imposto, false);
- continue;
- }
- return imposto3;
- }
- return imposto;
- });
- return imposto2;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/MetaSeguradoraServico.cs b/Gestor.Application/Servicos/Ferramentas/MetaSeguradoraServico.cs deleted file mode 100644 index 3cac6b8..0000000 --- a/Gestor.Application/Servicos/Ferramentas/MetaSeguradoraServico.cs +++ /dev/null @@ -1,182 +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.Relatorios;
-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 MetaSeguradoraServico : BaseServico
- {
- public MetaSeguradoraServico()
- {
- }
-
- public async Task<List<MetaSeguradora>> BuscarMetasSeguradoras(Filtros filtro)
- {
- int num = 3;
- List<MetaSeguradora> metaSeguradoras1 = await Task.Run<List<MetaSeguradora>>(() => {
- List<MetaSeguradora> metaSeguradoras;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- metaSeguradoras = read.get_MetaSeguradoraRepository().FindByMeta(filtro);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 284, num, filtro, true);
- continue;
- }
- return metaSeguradoras;
- }
- return new List<MetaSeguradora>();
- });
- return metaSeguradoras1;
- }
-
- public async Task<bool> Delete(MetaSeguradora meta)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- string str;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- commited.get_MetaSeguradoraRepository().Delete(meta.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.set_Descricao(string.Concat(new string[] { string.Format("O USUÁRIO {0} EXCLUIU, EM {1}, A META DE", Recursos.Usuario.get_Nome(), networkTime), string.Format("ID: '{0}'", meta.get_Id()), ", MÊS: '", Gestor.Common.Validation.ValidationHelper.GetDescription(meta.get_Mes()), "'", string.Format(", ANO: '{0}'", meta.get_Ano()), string.Format(", VALOR: 'R${0}'.", meta.get_Valor()) }));
- registroLog.set_EntidadeId(meta.get_Id());
- registroLog.set_Tela(31);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- RegistroLog registroLog1 = registroLog;
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_11 = MetaSeguradoraServico.u003cu003ec.u003cu003e9__1_1;
- if (u003cu003e9_11 == null)
- {
- u003cu003e9_11 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- MetaSeguradoraServico.u003cu003ec.u003cu003e9__1_1 = u003cu003e9_11;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_11);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog1.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 223, num, meta, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<MetaSeguradora> Save(MetaSeguradora metaSeguradora)
- {
- int num = 3;
- base.Sucesso = true;
- MetaSeguradora metaSeguradora2 = metaSeguradora;
- MetaSeguradora metaSeguradora3 = await Task.Run<MetaSeguradora>(() => {
- MetaSeguradora metaSeguradora4;
- string str;
- while (num > 0)
- {
- metaSeguradora = metaSeguradora2;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- TipoAcao tipoAcao = (metaSeguradora.get_Id() == 0 ? 0 : 1);
- metaSeguradora = (metaSeguradora.get_Id() == 0 ? commited.get_MetaSeguradoraRepository().SaveOrUpdate(metaSeguradora) : commited.get_MetaSeguradoraRepository().Merge(metaSeguradora));
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(tipoAcao);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(Funcoes.GetNetworkTime());
- MetaSeguradora metaSeguradora1 = metaSeguradora;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(metaSeguradora1, jsonSerializerSetting));
- registroLog.set_EntidadeId(metaSeguradora.get_Id());
- registroLog.set_Tela(31);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_01 = MetaSeguradoraServico.u003cu003ec.u003cu003e9__0_1;
- if (u003cu003e9_01 == null)
- {
- u003cu003e9_01 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- MetaSeguradoraServico.u003cu003ec.u003cu003e9__0_1 = u003cu003e9_01;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_01);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- metaSeguradora4 = metaSeguradora;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 222, num, metaSeguradora, true);
- continue;
- }
- return metaSeguradora4;
- }
- return metaSeguradora2;
- });
- return metaSeguradora3;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/MetaVendedorServico.cs b/Gestor.Application/Servicos/Ferramentas/MetaVendedorServico.cs deleted file mode 100644 index 5e30a23..0000000 --- a/Gestor.Application/Servicos/Ferramentas/MetaVendedorServico.cs +++ /dev/null @@ -1,182 +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.Relatorios;
-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 MetaVendedorServico : BaseServico
- {
- public MetaVendedorServico()
- {
- }
-
- public async Task<List<MetaVendedor>> BuscarMetasVendedores(Filtros filtro)
- {
- int num = 3;
- List<MetaVendedor> metaVendedors1 = await Task.Run<List<MetaVendedor>>(() => {
- List<MetaVendedor> metaVendedors;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- metaVendedors = read.get_MetaVendedorRepository().FindByMeta(filtro);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 285, num, filtro, true);
- continue;
- }
- return metaVendedors;
- }
- return new List<MetaVendedor>();
- });
- return metaVendedors1;
- }
-
- public async Task<bool> Delete(MetaVendedor meta)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- string str;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- commited.get_MetaVendedorRepository().Delete(meta.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.set_Descricao(string.Concat(new string[] { string.Format("O USUÁRIO {0} EXCLUIU, EM {1}, A META DE", Recursos.Usuario.get_Nome(), networkTime), string.Format("ID: '{0}'", meta.get_Id()), ", MÊS: '", Gestor.Common.Validation.ValidationHelper.GetDescription(meta.get_Mes()), "'", string.Format(", ANO: '{0}'", meta.get_Ano()), string.Format(", VALOR: 'R${0}'.", meta.get_Valor()) }));
- registroLog.set_EntidadeId(meta.get_Id());
- registroLog.set_Tela(30);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- RegistroLog registroLog1 = registroLog;
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_11 = MetaVendedorServico.u003cu003ec.u003cu003e9__1_1;
- if (u003cu003e9_11 == null)
- {
- u003cu003e9_11 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- MetaVendedorServico.u003cu003ec.u003cu003e9__1_1 = u003cu003e9_11;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_11);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog1.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 225, num, meta, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<MetaVendedor> Save(MetaVendedor metaVendedor)
- {
- int num = 3;
- base.Sucesso = true;
- MetaVendedor metaVendedor2 = metaVendedor;
- MetaVendedor metaVendedor3 = await Task.Run<MetaVendedor>(() => {
- MetaVendedor metaVendedor4;
- string str;
- while (num > 0)
- {
- metaVendedor = metaVendedor2;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- TipoAcao tipoAcao = (metaVendedor.get_Id() == 0 ? 0 : 1);
- metaVendedor = (metaVendedor.get_Id() == 0 ? commited.get_MetaVendedorRepository().SaveOrUpdate(metaVendedor) : commited.get_MetaVendedorRepository().Merge(metaVendedor));
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(tipoAcao);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(Funcoes.GetNetworkTime());
- MetaVendedor metaVendedor1 = metaVendedor;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(metaVendedor1, jsonSerializerSetting));
- registroLog.set_EntidadeId(metaVendedor.get_Id());
- registroLog.set_Tela(30);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_01 = MetaVendedorServico.u003cu003ec.u003cu003e9__0_1;
- if (u003cu003e9_01 == null)
- {
- u003cu003e9_01 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- MetaVendedorServico.u003cu003ec.u003cu003e9__0_1 = u003cu003e9_01;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_01);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- metaVendedor4 = metaVendedor;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 224, num, metaVendedor, true);
- continue;
- }
- return metaVendedor4;
- }
- return metaVendedor2;
- });
- return metaVendedor3;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/NotaFiscalServico.cs b/Gestor.Application/Servicos/Ferramentas/NotaFiscalServico.cs deleted file mode 100644 index 9ea8485..0000000 --- a/Gestor.Application/Servicos/Ferramentas/NotaFiscalServico.cs +++ /dev/null @@ -1,176 +0,0 @@ -using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Infrastructure.UnitOfWork.Logic;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Ferramentas;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Relatorios;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Ferramentas
-{
- internal class NotaFiscalServico : BaseServico
- {
- public NotaFiscalServico()
- {
- }
-
- internal async Task<List<NotaFiscal>> BuscarNotasFiscais()
- {
- int num = 3;
- List<NotaFiscal> notaFiscals1 = await Task.Run<List<NotaFiscal>>(() => {
- List<NotaFiscal> notaFiscals;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- notaFiscals = read.get_NotaFiscalRepository().FindAll();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 312, num, null, true);
- continue;
- }
- return notaFiscals;
- }
- return new List<NotaFiscal>();
- });
- return notaFiscals1;
- }
-
- public async Task<List<NotaFiscal>> BuscarNotasFiscais(Filtros filtro)
- {
- int num = 3;
- List<NotaFiscal> notaFiscals1 = await Task.Run<List<NotaFiscal>>(() => {
- List<NotaFiscal> notaFiscals;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- notaFiscals = read.get_NotaFiscalRepository().FindByDatas(filtro);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 315, num, filtro, true);
- continue;
- }
- return notaFiscals;
- }
- return new List<NotaFiscal>();
- });
- return notaFiscals1;
- }
-
- internal async Task<bool> Cadatrada(long idExtrato)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- flag = read.get_NotaFiscalRepository().FindByExtrato(idExtrato);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 315, num, idExtrato, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<bool> Delete(NotaFiscal notaFiscal)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- registroLogs.Add(base.CreateLog(notaFiscal.get_Id(), notaFiscal.GetValorOriginal(), 55, 2));
- commited.get_NotaFiscalRepository().Delete(notaFiscal.get_Id());
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 314, num, notaFiscal, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- internal async Task<NotaFiscal> Save(NotaFiscal notaFiscal)
- {
- int num = 3;
- base.Sucesso = true;
- NotaFiscal notaFiscal1 = notaFiscal;
- NotaFiscal notaFiscal2 = await Task.Run<NotaFiscal>(() => {
- NotaFiscal notaFiscal3;
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- notaFiscal = notaFiscal1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- flag = (notaFiscal.get_Id() == 0 ? false : true);
- if (flag)
- {
- registroLogs.Add(base.CreateLog(notaFiscal.get_Id(), notaFiscal, 55));
- }
- notaFiscal = (notaFiscal.get_Id() == 0 ? commited.get_NotaFiscalRepository().SaveOrUpdate(notaFiscal) : commited.get_NotaFiscalRepository().Merge(notaFiscal));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(notaFiscal.get_Id(), notaFiscal.GetValorOriginal(), 55, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- notaFiscal3 = notaFiscal;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 313, num, notaFiscal, true);
- continue;
- }
- return notaFiscal3;
- }
- return notaFiscal1;
- });
- return notaFiscal2;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/ProdutoServico.cs b/Gestor.Application/Servicos/Ferramentas/ProdutoServico.cs deleted file mode 100644 index 76fd16d..0000000 --- a/Gestor.Application/Servicos/Ferramentas/ProdutoServico.cs +++ /dev/null @@ -1,92 +0,0 @@ -using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-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 System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Ferramentas
-{
- internal class ProdutoServico : BaseServico
- {
- public ProdutoServico()
- {
- }
-
- internal async Task<Produto> BuscarProdutoPorId(long id)
- {
- int num = 3;
- Produto produto1 = await Task.Run<Produto>(() => {
- Produto produto;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- produto = read.get_ProdutoRepository().FindById(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 116, num, id, true);
- continue;
- }
- return produto;
- }
- return new Produto();
- });
- return produto1;
- }
-
- public async Task<Produto> Save(Produto produto)
- {
- int num = 3;
- base.Sucesso = true;
- Produto produto1 = produto;
- Produto produto2 = await Task.Run<Produto>(() => {
- Produto produto3;
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- produto = produto1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- flag = (produto.get_Id() == 0 ? false : true);
- if (flag)
- {
- registroLogs.Add(base.CreateLog(produto.get_Id(), produto, 10));
- }
- produto = (produto.get_Id() == 0 ? commited.get_ProdutoRepository().SaveOrUpdate(produto) : commited.get_ProdutoRepository().Merge(produto));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(produto.get_Id(), produto.GetValorOriginal(), 10, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- produto3 = produto;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 226, num, produto, true);
- continue;
- }
- return produto3;
- }
- return produto1;
- });
- return produto2;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/QualificacaoServico.cs b/Gestor.Application/Servicos/Ferramentas/QualificacaoServico.cs deleted file mode 100644 index 5d7507b..0000000 --- a/Gestor.Application/Servicos/Ferramentas/QualificacaoServico.cs +++ /dev/null @@ -1,57 +0,0 @@ -using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-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 System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Ferramentas
-{
- internal class QualificacaoServico : BaseServico
- {
- public QualificacaoServico()
- {
- }
-
- internal async Task<Qualificacao> Save(Qualificacao qualificacao)
- {
- int num = 3;
- base.Sucesso = true;
- Qualificacao qualificacao2 = qualificacao;
- Qualificacao qualificacao3 = await Task.Run<Qualificacao>(() => {
- Qualificacao qualificacao4;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- qualificacao = qualificacao2;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- registroLogs.Add(base.CreateLog(qualificacao.get_Id(), qualificacao, 48));
- Qualificacao qualificacao1 = commited.get_QualificacaoRepository().SaveOrUpdate(qualificacao);
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- qualificacao4 = qualificacao1;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 229, num, qualificacao, true);
- continue;
- }
- return qualificacao4;
- }
- return qualificacao2;
- });
- return qualificacao3;
- }
- }
-}
\ No newline at end of file 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 diff --git a/Gestor.Application/Servicos/Ferramentas/ReciboServico.cs b/Gestor.Application/Servicos/Ferramentas/ReciboServico.cs deleted file mode 100644 index ceee657..0000000 --- a/Gestor.Application/Servicos/Ferramentas/ReciboServico.cs +++ /dev/null @@ -1,123 +0,0 @@ -using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Infrastructure.UnitOfWork.Logic;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Ferramentas;
-using Gestor.Model.Domain.Generic;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Ferramentas
-{
- internal class ReciboServico : BaseServico
- {
- public ReciboServico()
- {
- }
-
- internal async Task<List<Recibo>> BuscarRecibos()
- {
- int num = 3;
- List<Recibo> recibos1 = await Task.Run<List<Recibo>>(() => {
- List<Recibo> recibos;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- recibos = read.get_ReciboRepository().BuscarRecibos();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 123, num, null, true);
- continue;
- }
- return recibos;
- }
- return new List<Recibo>();
- });
- return recibos1;
- }
-
- public async Task<bool> Delete(Recibo recibo)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- registroLogs.Add(base.CreateLog(recibo.get_Id(), recibo.GetValorOriginal(), 42, 2));
- commited.get_ReciboRepository().Delete(recibo.get_Id());
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 232, num, recibo, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<Recibo> Save(Recibo recibo)
- {
- int num = 3;
- base.Sucesso = true;
- Recibo recibo1 = recibo;
- Recibo recibo2 = await Task.Run<Recibo>(() => {
- Recibo recibo3;
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- recibo = recibo1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- flag = (recibo.get_Id() == 0 ? false : true);
- if (flag)
- {
- registroLogs.Add(base.CreateLog(recibo.get_Id(), recibo, 42));
- }
- recibo = (recibo.get_Id() == 0 ? commited.get_ReciboRepository().SaveOrUpdate(recibo) : commited.get_ReciboRepository().Merge(recibo));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(recibo.get_Id(), recibo.GetValorOriginal(), 42, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- recibo3 = recibo;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 231, num, recibo, true);
- continue;
- }
- return recibo3;
- }
- return recibo1;
- });
- return recibo2;
- }
- }
-}
\ No newline at end of file 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 diff --git a/Gestor.Application/Servicos/Ferramentas/SocioServico.cs b/Gestor.Application/Servicos/Ferramentas/SocioServico.cs deleted file mode 100644 index 9b46d97..0000000 --- a/Gestor.Application/Servicos/Ferramentas/SocioServico.cs +++ /dev/null @@ -1,97 +0,0 @@ -using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-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 System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Ferramentas
-{
- internal class SocioServico : BaseServico
- {
- public SocioServico()
- {
- }
-
- public async Task<bool> Delete(Socio socio)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- registroLogs.Add(base.CreateLog(socio.get_Id(), socio.GetValorOriginal(), 19, 2));
- commited.get_SocioRepository().Delete(socio.get_Id());
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 236, num, socio, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<Socio> Save(Socio socio)
- {
- int num = 3;
- base.Sucesso = true;
- Socio socio1 = socio;
- Socio socio2 = await Task.Run<Socio>(() => {
- Socio socio3;
- bool flag;
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- socio = socio1;
- while (num > 0)
- {
- socio = socio1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- flag = (socio.get_Id() == 0 ? false : true);
- if (flag)
- {
- registroLogs.Add(base.CreateLog(socio.get_Id(), socio, 19));
- }
- socio = (socio.get_Id() == 0 ? commited.get_SocioRepository().SaveOrUpdate(socio) : commited.get_SocioRepository().Merge(socio));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(socio.get_Id(), socio.GetValorOriginal(), 19, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- socio3 = socio;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 235, num, socio, true);
- continue;
- }
- return socio3;
- }
- return socio1;
- });
- return socio2;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/StatusProspeccaoServico.cs b/Gestor.Application/Servicos/Ferramentas/StatusProspeccaoServico.cs deleted file mode 100644 index 1af6770..0000000 --- a/Gestor.Application/Servicos/Ferramentas/StatusProspeccaoServico.cs +++ /dev/null @@ -1,93 +0,0 @@ -using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Infrastructure.UnitOfWork.Logic;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Ferramentas;
-using Gestor.Model.Domain.Generic;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Ferramentas
-{
- internal class StatusProspeccaoServico : BaseServico
- {
- public StatusProspeccaoServico()
- {
- }
-
- internal async Task<List<StatusDeProspeccao>> BuscarProspeccoes()
- {
- int num = 3;
- List<StatusDeProspeccao> statusDeProspeccaos1 = await Task.Run<List<StatusDeProspeccao>>(() => {
- List<StatusDeProspeccao> statusDeProspeccaos;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- statusDeProspeccaos = read.get_StatusProspeccaoRepository().FindAll();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 308, num, null, true);
- continue;
- }
- return statusDeProspeccaos;
- }
- return new List<StatusDeProspeccao>();
- });
- return statusDeProspeccaos1;
- }
-
- internal async Task<StatusDeProspeccao> Save(StatusDeProspeccao statusProspeccao)
- {
- int num = 3;
- base.Sucesso = true;
- StatusDeProspeccao statusDeProspeccao1 = statusProspeccao;
- StatusDeProspeccao statusDeProspeccao2 = await Task.Run<StatusDeProspeccao>(() => {
- StatusDeProspeccao statusDeProspeccao;
- bool flag;
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- statusProspeccao = statusDeProspeccao1;
- while (num > 0)
- {
- statusProspeccao = statusDeProspeccao1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- flag = (statusProspeccao.get_Id() == 0 ? false : true);
- if (flag)
- {
- registroLogs.Add(base.CreateLog(statusProspeccao.get_Id(), statusProspeccao, 57));
- }
- statusProspeccao = (statusProspeccao.get_Id() == 0 ? commited.get_StatusProspeccaoRepository().SaveOrUpdate(statusProspeccao) : commited.get_StatusProspeccaoRepository().Merge(statusProspeccao));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(statusProspeccao.get_Id(), statusProspeccao.GetValorOriginal(), 57, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- statusDeProspeccao = statusProspeccao;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 307, num, statusProspeccao, true);
- continue;
- }
- return statusDeProspeccao;
- }
- return statusDeProspeccao1;
- });
- return statusDeProspeccao2;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/StatusServico.cs b/Gestor.Application/Servicos/Ferramentas/StatusServico.cs deleted file mode 100644 index 88b146c..0000000 --- a/Gestor.Application/Servicos/Ferramentas/StatusServico.cs +++ /dev/null @@ -1,124 +0,0 @@ -using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-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 System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Ferramentas
-{
- internal class StatusServico : BaseServico
- {
- public StatusServico()
- {
- }
-
- internal async Task<Status> BuscarStatusPorId(long id)
- {
- int num = 3;
- Status statu1 = await Task.Run<Status>(() => {
- Status statu;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- statu = read.get_StatusRepository().FindById(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 119, num, id, true);
- continue;
- }
- return statu;
- }
- return new Status();
- });
- return statu1;
- }
-
- public async Task<bool> Delete(Status status)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- registroLogs.Add(base.CreateLog(status.get_Id(), status.GetValorOriginal(), 11, 2));
- commited.get_StatusRepository().Delete(status.get_Id());
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 221, num, status, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<Status> Save(Status status)
- {
- int num = 3;
- base.Sucesso = true;
- Status statu1 = status;
- Status statu2 = await Task.Run<Status>(() => {
- Status statu;
- bool flag;
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- status = statu1;
- while (num > 0)
- {
- status = statu1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- flag = (status.get_Id() == 0 ? false : true);
- if (flag)
- {
- registroLogs.Add(base.CreateLog(status.get_Id(), status, 11));
- }
- status = (status.get_Id() == 0 ? commited.get_StatusRepository().SaveOrUpdate(status) : commited.get_StatusRepository().Merge(status));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(status.get_Id(), status.GetValorOriginal(), 11, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- statu = status;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 227, num, status, true);
- continue;
- }
- return statu;
- }
- return statu1;
- });
- return statu2;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/TipoTarefaServico.cs b/Gestor.Application/Servicos/Ferramentas/TipoTarefaServico.cs deleted file mode 100644 index fa7c297..0000000 --- a/Gestor.Application/Servicos/Ferramentas/TipoTarefaServico.cs +++ /dev/null @@ -1,93 +0,0 @@ -using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Infrastructure.Repository.Interface;
-using Gestor.Infrastructure.UnitOfWork.Generic;
-using Gestor.Infrastructure.UnitOfWork.Logic;
-using Gestor.Model.Domain.Common;
-using Gestor.Model.Domain.Ferramentas;
-using Gestor.Model.Domain.Generic;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Ferramentas
-{
- internal class TipoTarefaServico : BaseServico
- {
- public TipoTarefaServico()
- {
- }
-
- internal async Task<List<TipoDeTarefa>> BuscarTarefas()
- {
- int num = 3;
- List<TipoDeTarefa> tipoDeTarefas1 = await Task.Run<List<TipoDeTarefa>>(() => {
- List<TipoDeTarefa> tipoDeTarefas;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- tipoDeTarefas = read.get_TipoTarefaRepository().FindAll();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 308, num, null, true);
- continue;
- }
- return tipoDeTarefas;
- }
- return new List<TipoDeTarefa>();
- });
- return tipoDeTarefas1;
- }
-
- internal async Task<TipoDeTarefa> Save(TipoDeTarefa tipoTarefa)
- {
- int num = 3;
- base.Sucesso = true;
- TipoDeTarefa tipoDeTarefa1 = tipoTarefa;
- TipoDeTarefa tipoDeTarefa2 = await Task.Run<TipoDeTarefa>(() => {
- TipoDeTarefa tipoDeTarefa;
- bool flag;
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- tipoTarefa = tipoDeTarefa1;
- while (num > 0)
- {
- tipoTarefa = tipoDeTarefa1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- flag = (tipoTarefa.get_Id() == 0 ? false : true);
- if (flag)
- {
- registroLogs.Add(base.CreateLog(tipoTarefa.get_Id(), tipoTarefa, 52));
- }
- tipoTarefa = (tipoTarefa.get_Id() == 0 ? commited.get_TipoTarefaRepository().SaveOrUpdate(tipoTarefa) : commited.get_TipoTarefaRepository().Merge(tipoTarefa));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(tipoTarefa.get_Id(), tipoTarefa.GetValorOriginal(), 52, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- tipoDeTarefa = tipoTarefa;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 306, num, tipoTarefa, true);
- continue;
- }
- return tipoDeTarefa;
- }
- return tipoDeTarefa1;
- });
- return tipoDeTarefa2;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/TipoVendedorServico.cs b/Gestor.Application/Servicos/Ferramentas/TipoVendedorServico.cs deleted file mode 100644 index 0757820..0000000 --- a/Gestor.Application/Servicos/Ferramentas/TipoVendedorServico.cs +++ /dev/null @@ -1,131 +0,0 @@ -using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-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 System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Ferramentas
-{
- internal class TipoVendedorServico : BaseServico
- {
- public TipoVendedorServico()
- {
- }
-
- public async Task<bool> Delete(TipoVendedor tipoVendedor)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- registroLogs.Add(base.CreateLog(tipoVendedor.get_Id(), tipoVendedor.GetValorOriginal(), 14, 2));
- commited.get_TipoVendedorRepository().Delete(tipoVendedor.get_Id());
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 238, num, tipoVendedor, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<long> FindLastId()
- {
- int num1 = 3;
- long num2 = await Task.Run<long>(() => {
- long num;
- while (num1 > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- num = read.get_TipoVendedorRepository().FindLastId();
- }
- }
- catch (Exception exception)
- {
- num1 = base.Registrar(exception, 17, num1, null, true);
- continue;
- }
- return num;
- }
- return (long)0;
- });
- return num2;
- }
-
- internal async Task<TipoVendedor> Save(TipoVendedor tipoVendedor)
- {
- int num = 3;
- base.Sucesso = true;
- TipoVendedor tipoVendedor2 = tipoVendedor;
- TipoVendedor tipoVendedor3 = await Task.Run<TipoVendedor>(async () => {
- TipoVendedor tipoVendedor4;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- tipoVendedor = tipoVendedor2;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- TipoAcao tipoAcao = (tipoVendedor.get_Id() == 0 ? 0 : 1);
- if (tipoVendedor.get_Id() == 0)
- {
- TipoVendedor tipoVendedor1 = tipoVendedor;
- tipoVendedor1.set_Id(await this.FindLastId() + (long)1);
- tipoVendedor1 = null;
- }
- TipoAcao tipoAcao1 = tipoAcao;
- if (tipoAcao1 == null)
- {
- registroLogs.Add(base.CreateLog(tipoVendedor.get_Id(), tipoVendedor.GetValorOriginal(), 14, 0));
- }
- else if (tipoAcao1 == 1)
- {
- registroLogs.Add(base.CreateLog(tipoVendedor.get_Id(), tipoVendedor, 14));
- }
- tipoVendedor = (tipoAcao == null ? commited.get_TipoVendedorRepository().SaveOrUpdate(tipoVendedor) : commited.get_TipoVendedorRepository().Merge(tipoVendedor));
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- tipoVendedor4 = tipoVendedor;
- return tipoVendedor4;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 237, num, tipoVendedor, true);
- }
- registroLogs = null;
- }
- tipoVendedor4 = tipoVendedor2;
- return tipoVendedor4;
- });
- return tipoVendedor3;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/UsuarioServico.cs b/Gestor.Application/Servicos/Ferramentas/UsuarioServico.cs deleted file mode 100644 index 5b04623..0000000 --- a/Gestor.Application/Servicos/Ferramentas/UsuarioServico.cs +++ /dev/null @@ -1,303 +0,0 @@ -using Gestor.Application.Helpers;
-using Gestor.Application.Servicos.Generic;
-using Gestor.Common.Security;
-using Gestor.Common.Validation;
-using Gestor.Infrastructure.Mappers;
-using Gestor.Infrastructure.Repository.Interface;
-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 System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Threading.Tasks;
-
-namespace Gestor.Application.Servicos.Ferramentas
-{
- internal class UsuarioServico : BaseServico
- {
- public UsuarioServico()
- {
- }
-
- public async Task AddCentralSegurado(long id, bool update = true)
- {
- await Task.Run(() => {
- using (UnitOfWork commited = Instancia.Commited)
- {
- commited.get_ClienteRepository().AddCentralSegurado(id, update);
- }
- });
- }
-
- public async Task<Usuario> BuscarLogin(string login)
- {
- int num = 3;
- Usuario usuario2 = await Task.Run<Usuario>(() => {
- Usuario usuario;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- Empresa empresa = read.get_EmpresaRepository().FindBySerial(ApplicationHelper.NumeroSerial);
- AuthSso result = base.VerificaUsuarioSso(login, empresa.get_Documento()).Result;
- if (result == null || result.get_Code() == 401)
- {
- usuario = new Usuario();
- }
- else
- {
- Usuario usuario1 = read.get_UsuarioRepository().FindUsuario(login);
- usuario = (result.get_Code() == 404 ? usuario1 : CustomMap.FromUserSso(usuario1, result.get_Data().get_User()));
- }
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 134, num, login, true);
- continue;
- }
- return usuario;
- }
- return new Usuario();
- });
- return usuario2;
- }
-
- public async Task<List<PermissaoAggilizador>> BuscarPermissaoAggilizador()
- {
- List<PermissaoAggilizador> permissaoAggilizadors2 = await Task.Run<List<PermissaoAggilizador>>(() => {
- List<PermissaoAggilizador> permissaoAggilizadors;
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- permissaoAggilizadors = read.get_UsuarioRepository().PermissaoAggilizador();
- }
- }
- catch (Exception exception)
- {
- List<PermissaoAggilizador> permissaoAggilizadors1 = new List<PermissaoAggilizador>();
- PermissaoAggilizador permissaoAggilizador = new PermissaoAggilizador();
- permissaoAggilizador.set_Id((long)1);
- permissaoAggilizador.set_Descricao("ADMINISTRADOR");
- permissaoAggilizadors1.Add(permissaoAggilizador);
- PermissaoAggilizador permissaoAggilizador1 = new PermissaoAggilizador();
- permissaoAggilizador1.set_Id((long)2);
- permissaoAggilizador1.set_Descricao("NORMAL");
- permissaoAggilizadors1.Add(permissaoAggilizador1);
- PermissaoAggilizador permissaoAggilizador2 = new PermissaoAggilizador();
- permissaoAggilizador2.set_Id((long)3);
- permissaoAggilizador2.set_Descricao("LIMITADO");
- permissaoAggilizadors1.Add(permissaoAggilizador2);
- permissaoAggilizadors = permissaoAggilizadors1;
- }
- return permissaoAggilizadors;
- });
- return permissaoAggilizadors2;
- }
-
- internal async Task<Usuario> BuscarUsuarioPorId(long id)
- {
- int num = 3;
- Usuario usuario1 = await Task.Run<Usuario>(() => {
- Usuario usuario;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- usuario = read.get_UsuarioRepository().FindById(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 130, num, id, true);
- continue;
- }
- return usuario;
- }
- return new Usuario();
- });
- return usuario1;
- }
-
- public async Task<Usuario> BuscaUsuarioInicial(string usuario, string senha)
- {
- Usuario usuario2 = await Task.Run<Usuario>(() => {
- Usuario usuario3;
- using (UnitOfWork read = Instancia.Read)
- {
- Empresa empresa = read.get_EmpresaRepository().FindBySerial(ApplicationHelper.NumeroSerial);
- string str = (new Token()).AggerEncrypt(senha);
- AuthSso result = base.BuscaUsuarioSso(usuario, str, empresa.get_Documento()).Result;
- if (result.get_Code() != 401)
- {
- Usuario usuario1 = read.get_UsuarioRepository().FindUsuario(usuario);
- usuario3 = (result.get_Code() != 404 || usuario1 != null ? (result.get_Data() != null || usuario1 == null ? (usuario1 != null || result.get_Data() == null ? usuario1 : CustomMap.ToUsuario(result.get_Data().get_User(), empresa.get_Id())) : usuario1) : new Usuario());
- }
- else
- {
- usuario3 = null;
- }
- }
- return usuario3;
- });
- return usuario2;
- }
-
- public async Task<bool> Delete(Usuario usuario)
- {
- int num = 3;
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- while (num > 0)
- {
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- registroLogs.Add(base.CreateLog(usuario.get_Id(), usuario.GetValorOriginal(), 16, 2));
- commited.get_UsuarioRepository().Delete(usuario.get_Id());
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- usuario.set_TokenSso(Recursos.Usuario.get_TokenSso());
- base.DeleteUsuarioSso(usuario, Recursos.Empresa.get_Documento()).Wait();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 240, num, usuario, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<Usuario> Save(Usuario usuario)
- {
- int num = 3;
- base.Sucesso = true;
- Usuario usuario5 = usuario;
- Usuario usuario6 = await Task.Run<Usuario>(() => {
- Usuario usuario7;
- long? nullable;
- string tokenSso;
- string documento;
- long? nullable1;
- bool flag;
- List<RegistroLog> registroLogs = new List<RegistroLog>();
- while (num > 0)
- {
- usuario = usuario5;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- Usuario usuario1 = Recursos.Usuario;
- if (usuario1 != null)
- {
- tokenSso = usuario1.get_TokenSso();
- }
- else
- {
- tokenSso = null;
- }
- string token = tokenSso;
- Empresa empresa = Recursos.Empresa;
- if (empresa != null)
- {
- documento = empresa.get_Documento();
- }
- else
- {
- documento = null;
- }
- string str = documento;
- if (ValidationHelper.IsNullOrEmpty(token))
- {
- Empresa empresa1 = commited.get_EmpresaRepository().FindBySerial(ApplicationHelper.NumeroSerial);
- string senha = usuario.get_Senha();
- if (ValidationHelper.IsNotNullOrEmpty(usuario.get_SenhaAnterior()))
- {
- if ((new Token()).AggerDecrypt(usuario.get_SenhaAnterior()).ToUpper().Contains("AGGER@"))
- {
- Usuario result = this.BuscarLogin(usuario.get_Login()).Result;
- usuario.set_SenhaAnterior(result.get_Senha());
- }
- senha = usuario.get_SenhaAnterior();
- }
- AuthSso authSso = base.BuscaUsuarioSso(usuario.get_Login(), senha, empresa1.get_Documento()).Result;
- if (authSso == null || authSso.get_Code() == 401)
- {
- this.Sucesso = false;
- usuario7 = usuario5;
- return usuario7;
- }
- else
- {
- token = authSso.get_Data().get_Token();
- str = empresa1.get_Documento();
- }
- }
- Usuario usuario2 = usuario;
- if (!usuario.get_PermissaoAggilizador().HasValue)
- {
- Usuario usuario3 = usuario;
- long? nullable2 = new long?((long)2);
- nullable = nullable2;
- usuario3.set_PermissaoAggilizador(nullable2);
- nullable1 = nullable;
- }
- else
- {
- Usuario usuario4 = usuario;
- long? permissaoAggilizador = usuario.get_PermissaoAggilizador();
- nullable = permissaoAggilizador;
- usuario4.set_PermissaoAggilizador(permissaoAggilizador);
- nullable1 = nullable;
- }
- usuario2.set_PermissaoAggilizador(nullable1);
- flag = (usuario.get_Id() == 0 ? false : true);
- if (flag)
- {
- registroLogs.Add(base.CreateLog(usuario.get_Id(), usuario, 16));
- }
- usuario = (usuario.get_Id() == 0 ? commited.get_UsuarioRepository().SaveOrUpdate(usuario) : commited.get_UsuarioRepository().Merge(usuario));
- if (!flag)
- {
- registroLogs.Add(base.CreateLog(usuario.get_Id(), usuario.GetValorOriginal(), 16, 0));
- }
- base.SaveLog(registroLogs, commited);
- commited.Commit();
- usuario.set_TokenSso(token);
- base.AddOrUpdateUsuarioSso(usuario, str, usuario.get_SsoId()).Wait();
- usuario7 = usuario;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 239, num, usuario, true);
- continue;
- }
- return usuario7;
- }
- return usuario5;
- });
- return usuario6;
- }
- }
-}
\ No newline at end of file diff --git a/Gestor.Application/Servicos/Ferramentas/VendedorServico.cs b/Gestor.Application/Servicos/Ferramentas/VendedorServico.cs deleted file mode 100644 index 9c81d34..0000000 --- a/Gestor.Application/Servicos/Ferramentas/VendedorServico.cs +++ /dev/null @@ -1,851 +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.Ferramentas;
-using Gestor.Model.Domain.Generic;
-using Gestor.Model.Domain.Relatorios;
-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
-{
- public class VendedorServico : BaseServico
- {
- public VendedorServico()
- {
- }
-
- public async Task<Vendedor> BuscarCorretora()
- {
- Vendedor vendedor1 = await Task.Run<Vendedor>(() => {
- Vendedor vendedor;
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- vendedor = read.get_VendedorRepository().FindCorretora();
- }
- }
- catch (Exception exception)
- {
- vendedor = null;
- }
- return vendedor;
- });
- return vendedor1;
- }
-
- public async Task<List<VendedorParcela>> BuscaRepasse(long id)
- {
- int num = 3;
- List<VendedorParcela> vendedorParcelas1 = await Task.Run<List<VendedorParcela>>(() => {
- List<VendedorParcela> list;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<VendedorParcela> vendedorParcelas = read.get_VendedorParcelaRepository().FindByDocumentId(id);
- Func<VendedorParcela, long> u003cu003e9_31 = VendedorServico.u003cu003ec.u003cu003e9__3_1;
- if (u003cu003e9_31 == null)
- {
- u003cu003e9_31 = (VendedorParcela x) => x.get_TipoVendedor().get_Id();
- VendedorServico.u003cu003ec.u003cu003e9__3_1 = u003cu003e9_31;
- }
- list = vendedorParcelas.OrderBy<VendedorParcela, long>(u003cu003e9_31).ToList<VendedorParcela>();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 136, num, id, true);
- continue;
- }
- return list;
- }
- return new List<VendedorParcela>();
- });
- return vendedorParcelas1;
- }
-
- public async Task<List<VendedorParcela>> BuscaRepasseParcela(long id)
- {
- int num = 3;
- List<VendedorParcela> vendedorParcelas1 = await Task.Run<List<VendedorParcela>>(() => {
- List<VendedorParcela> list;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<VendedorParcela> vendedorParcelas = read.get_VendedorParcelaRepository().FindByParcela(id);
- Func<VendedorParcela, long?> u003cu003e9_41 = VendedorServico.u003cu003ec.u003cu003e9__4_1;
- if (u003cu003e9_41 == null)
- {
- u003cu003e9_41 = (VendedorParcela x) => {
- TipoVendedor tipoVendedor = x.get_TipoVendedor();
- if (tipoVendedor != null)
- {
- return new long?(tipoVendedor.get_Id());
- }
- return null;
- };
- VendedorServico.u003cu003ec.u003cu003e9__4_1 = u003cu003e9_41;
- }
- list = vendedorParcelas.OrderBy<VendedorParcela, long?>(u003cu003e9_41).ToList<VendedorParcela>();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 137, num, id, true);
- continue;
- }
- return list;
- }
- return new List<VendedorParcela>();
- });
- return vendedorParcelas1;
- }
-
- public async Task<List<Repasse>> BuscaRepasses()
- {
- int num = 3;
- List<Repasse> repasses1 = await Task.Run<List<Repasse>>(() => {
- List<Repasse> repasses;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- repasses = read.get_RepasseRepository().DefaultSelect((long)0);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 142, num, null, true);
- continue;
- }
- return repasses;
- }
- return new List<Repasse>();
- });
- return repasses1;
- }
-
- public async Task<ObservableCollection<Repasse>> BuscaRepassesPorIdVendedor(long id)
- {
- int num = 3;
- ObservableCollection<Repasse> observableCollection1 = await Task.Run<ObservableCollection<Repasse>>(() => {
- ObservableCollection<Repasse> observableCollection;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- observableCollection = new ObservableCollection<Repasse>(read.get_RepasseRepository().FindByIdVendedor(id));
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 143, num, id, true);
- continue;
- }
- return observableCollection;
- }
- return new ObservableCollection<Repasse>();
- });
- return observableCollection1;
- }
-
- public async Task<List<ManutencaoPagamentos>> BuscarPagos(Filtros filtro)
- {
- int num = 3;
- List<ManutencaoPagamentos> manutencaoPagamentos = await Task.Run<List<ManutencaoPagamentos>>(() => {
- List<ManutencaoPagamentos> list;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- list = read.get_VendedorParcelaRepository().FindByDate(filtro).ToList<ManutencaoPagamentos>();
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 80, num, null, true);
- continue;
- }
- return list;
- }
- return new List<ManutencaoPagamentos>();
- });
- return manutencaoPagamentos;
- }
-
- internal async Task<ObservableCollection<VendedorTelefone>> BuscarTelefonesAsync(long id)
- {
- int num = 3;
- ObservableCollection<VendedorTelefone> observableCollection1 = await Task.Run<ObservableCollection<VendedorTelefone>>(() => {
- ObservableCollection<VendedorTelefone> observableCollection;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<VendedorTelefone> vendedorTelefones = read.get_VendedorTelefoneRepository().FindByVendedorId(id);
- Func<VendedorTelefone, string> u003cu003e9_51 = VendedorServico.u003cu003ec.u003cu003e9__5_1;
- if (u003cu003e9_51 == null)
- {
- u003cu003e9_51 = (VendedorTelefone x) => x.get_Nome();
- VendedorServico.u003cu003ec.u003cu003e9__5_1 = u003cu003e9_51;
- }
- observableCollection = new ObservableCollection<VendedorTelefone>(vendedorTelefones.OrderBy<VendedorTelefone, string>(u003cu003e9_51));
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 138, num, id, true);
- continue;
- }
- return observableCollection;
- }
- return new ObservableCollection<VendedorTelefone>();
- });
- return observableCollection1;
- }
-
- internal async Task<List<Vendedor>> BuscarVendedoresAtivosAsync()
- {
- int num = 3;
- List<Vendedor> vendedors2 = await Task.Run<List<Vendedor>>(() => {
- List<Vendedor> vendedors;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- List<Vendedor> vendedors1 = read.get_VendedorRepository().Find(true, (Recursos.Usuario.get_IdEmpresa() == (long)1 ? (long)0 : Recursos.Usuario.get_IdEmpresa()));
- Func<Vendedor, string> u003cu003e9_01 = VendedorServico.u003cu003ec.u003cu003e9__0_1;
- if (u003cu003e9_01 == null)
- {
- u003cu003e9_01 = (Vendedor x) => x.get_Nome();
- VendedorServico.u003cu003ec.u003cu003e9__0_1 = u003cu003e9_01;
- }
- vendedors = new List<Vendedor>(vendedors1.OrderBy<Vendedor, string>(u003cu003e9_01));
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 135, num, null, true);
- continue;
- }
- return vendedors;
- }
- return new List<Vendedor>();
- });
- return vendedors2;
- }
-
- public async Task<List<VendedorParcela>> BuscarVendedorParcela(long id)
- {
- int num = 3;
- List<VendedorParcela> vendedorParcelas1 = await Task.Run<List<VendedorParcela>>(() => {
- List<VendedorParcela> vendedorParcelas;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- vendedorParcelas = read.get_RepasseRepository().FindByIdRepasse(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 143, num, id, true);
- continue;
- }
- return vendedorParcelas;
- }
- return new List<VendedorParcela>();
- });
- return vendedorParcelas1;
- }
-
- public async Task<VendedorParcela> BuscarVendedorParcelaCompleto(long id)
- {
- int num = 3;
- VendedorParcela vendedorParcela1 = await Task.Run<VendedorParcela>(() => {
- VendedorParcela vendedorParcela;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- vendedorParcela = read.get_VendedorParcelaRepository().FindById(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 81, num, null, true);
- continue;
- }
- return vendedorParcela;
- }
- return new VendedorParcela();
- });
- return vendedorParcela1;
- }
-
- internal async Task<Vendedor> BuscarVendedorPorId(long id)
- {
- int num = 3;
- Vendedor vendedor1 = await Task.Run<Vendedor>(() => {
- Vendedor vendedor;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- vendedor = read.get_VendedorRepository().FindById(id);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 139, num, id, true);
- continue;
- }
- return vendedor;
- }
- return new Vendedor();
- });
- return vendedor1;
- }
-
- public async Task<List<Vendedor>> BuscarVinculosCliente(long idCliente)
- {
- int num = 3;
- List<Vendedor> vendedors1 = await Task.Run<List<Vendedor>>(() => {
- List<Vendedor> vendedors;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork read = Instancia.Read)
- {
- if (Recursos.Usuario.get_IdEmpresa() != (long)1)
- {
- Recursos.Usuario.get_IdEmpresa();
- }
- vendedors = read.get_VendedorParcelaRepository().FindVinculoByIdCliente(idCliente);
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 143, num, null, true);
- continue;
- }
- return vendedors;
- }
- return null;
- });
- return vendedors1;
- }
-
- public async Task<bool> Delete(VinculoRepasse vinculo)
- {
- int num = 3;
- base.Sucesso = true;
- DateTime networkTime = Funcoes.GetNetworkTime();
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- string str;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- commited.get_RepasseRepository().DeleteVinculo(vinculo.get_Id());
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(2);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(networkTime);
- VinculoRepasse vinculoRepasse = vinculo;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(vinculoRepasse, jsonSerializerSetting));
- registroLog.set_EntidadeId(vinculo.get_Id());
- registroLog.set_Tela(53);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_101 = VendedorServico.u003cu003ec.u003cu003e9__10_1;
- if (u003cu003e9_101 == null)
- {
- u003cu003e9_101 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- VendedorServico.u003cu003ec.u003cu003e9__10_1 = u003cu003e9_101;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_101);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 311, num, vinculo, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<bool> Delete(Vendedor vendedor)
- {
- int num = 3;
- DateTime networkTime = Funcoes.GetNetworkTime();
- bool flag1 = await Task.Run<bool>(() => {
- bool flag;
- string str;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- commited.get_VendedorRepository().Delete(vendedor.get_Id());
- 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[] strArrays = new string[] { string.Format("O USUÁRIO {0} EXCLUIU, EM {1}, O VENDEDOR DE ", Recursos.Usuario.get_Nome(), networkTime), string.Format("ID: '{0}'", vendedor.get_Id()), ", NOME: '", null, null, null, null, null, null, null, null };
- strArrays[3] = (string.IsNullOrWhiteSpace(vendedor.get_Nome()) ? "" : vendedor.get_Nome() ?? "");
- strArrays[4] = "', DOCUMENTO: '";
- strArrays[5] = (string.IsNullOrWhiteSpace(vendedor.get_Documento()) ? "" : vendedor.get_Documento() ?? "");
- strArrays[6] = "', BANCO: '";
- strArrays[7] = (vendedor.get_Banco() == null ? "" : vendedor.get_Banco().get_Nome() ?? "");
- strArrays[8] = "', CONTA: '";
- strArrays[9] = (string.IsNullOrWhiteSpace(vendedor.get_Conta()) ? "" : vendedor.get_Conta() ?? "");
- strArrays[10] = "'.";
- registroLog1.set_Descricao(string.Concat(strArrays));
- registroLog.set_EntidadeId(vendedor.get_Id());
- registroLog.set_Tela(15);
- 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_131 = VendedorServico.u003cu003ec.u003cu003e9__13_1;
- if (u003cu003e9_131 == null)
- {
- u003cu003e9_131 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- VendedorServico.u003cu003ec.u003cu003e9__13_1 = u003cu003e9_131;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_131);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog2.set_Ip(str);
- RegistroLog registroLog3 = registroLog;
- if (vendedor.get_Telefones() != null && vendedor.get_Telefones().Count != 0)
- {
- foreach (VendedorTelefone telefone in vendedor.get_Telefones())
- {
- RegistroLog registroLog4 = registroLog3;
- string descricao = registroLog4.get_Descricao();
- object[] objArray = new object[] { vendedor.get_Telefones().IndexOf(telefone), null, null, null };
- objArray[1] = (!telefone.get_Tipo().HasValue ? "-" : Gestor.Common.Validation.ValidationHelper.GetDescription(telefone.get_Tipo()));
- objArray[2] = (string.IsNullOrWhiteSpace(telefone.get_Prefixo()) ? "" : telefone.get_Prefixo() ?? "");
- objArray[3] = (string.IsNullOrWhiteSpace(telefone.get_Numero()) ? "" : telefone.get_Numero() ?? "");
- registroLog4.set_Descricao(string.Concat(descricao, string.Format(", TELEFONE {0}: {1} ({2}) {3}", objArray)));
- }
- }
- RegistroLog registroLog5 = registroLog3;
- registroLog5.set_Descricao(string.Concat(registroLog5.get_Descricao(), "."));
- base.SaveLog(registroLog3, commited);
- commited.Commit();
- flag = true;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 242, num, vendedor, true);
- continue;
- }
- return flag;
- }
- return false;
- });
- return flag1;
- }
-
- public async Task<Vendedor> Save(Vendedor vendedor, Repasse repasse)
- {
- int num = 3;
- base.Sucesso = true;
- Vendedor vendedor1 = vendedor;
- Vendedor vendedor2 = await Task.Run<Vendedor>(() => {
- Vendedor vendedor3;
- while (num > 0)
- {
- vendedor = vendedor1;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- vendedor.set_IdEmpresa((vendedor.get_IdEmpresa() == 0 ? Recursos.Empresa.get_Id() : vendedor.get_IdEmpresa()));
- vendedor = commited.get_VendedorRepository().SaveOrUpdate(vendedor);
- repasse.set_Vendedor(vendedor);
- repasse = commited.get_RepasseRepository().SaveOrUpdate(repasse);
- commited.Commit();
- vendedor3 = vendedor;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 241, num, new { vendedor = vendedor, repasse = repasse }, true);
- continue;
- }
- return vendedor3;
- }
- return vendedor1;
- });
- return vendedor2;
- }
-
- public async Task<VinculoRepasse> Save(VinculoRepasse vinculo)
- {
- int num = 3;
- base.Sucesso = true;
- DateTime networkTime = Funcoes.GetNetworkTime();
- VinculoRepasse vinculoRepasse2 = await Task.Run<VinculoRepasse>(() => {
- VinculoRepasse vinculoRepasse;
- string str;
- while (num > 0)
- {
- VinculoRepasse vinculoRepasse1 = vinculo;
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- TipoAcao tipoAcao = (vinculoRepasse1.get_Id() == 0 ? 0 : 1);
- vinculoRepasse1 = (tipoAcao == null ? commited.get_RepasseRepository().SaveOrUpdate(vinculoRepasse1) : commited.get_RepasseRepository().Merge(vinculoRepasse1));
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(tipoAcao);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(networkTime);
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(vinculoRepasse1, jsonSerializerSetting));
- registroLog.set_EntidadeId(vinculoRepasse1.get_Id());
- registroLog.set_Tela(53);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_91 = VendedorServico.u003cu003ec.u003cu003e9__9_1;
- if (u003cu003e9_91 == null)
- {
- u003cu003e9_91 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- VendedorServico.u003cu003ec.u003cu003e9__9_1 = u003cu003e9_91;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_91);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- vinculoRepasse = vinculoRepasse1;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 311, num, vinculo, true);
- continue;
- }
- return vinculoRepasse;
- }
- return vinculo;
- });
- return vinculoRepasse2;
- }
-
- public async Task<Vendedor> Save(Vendedor vendedor, List<Repasse> repasses)
- {
- int num = 3;
- base.Sucesso = true;
- DateTime networkTime = Funcoes.GetNetworkTime();
- Vendedor vendedor2 = vendedor;
- Vendedor vendedor3 = await Task.Run<Vendedor>(() => {
- Vendedor vendedor4;
- string str;
- string str1;
- while (num > 0)
- {
- vendedor = vendedor2;
- try
- {
- List<VendedorTelefone> telefones = vendedor.get_Telefones();
- using (UnitOfWork commited = Instancia.Commited)
- {
- List<Repasse> repasses1 = repasses;
- Func<Repasse, bool> u003cu003e9_111 = VendedorServico.u003cu003ec.u003cu003e9__11_1;
- if (u003cu003e9_111 == null)
- {
- u003cu003e9_111 = (Repasse r) => {
- Ramo ramo = r.get_Ramo();
- if (ramo == null)
- {
- return false;
- }
- return ramo.get_Id() == (long)0;
- };
- VendedorServico.u003cu003ec.u003cu003e9__11_1 = u003cu003e9_111;
- }
- foreach (Repasse repasse in repasses1.Where<Repasse>(u003cu003e9_111))
- {
- repasse.set_Ramo(null);
- }
- bool id = vendedor.get_Id() == (long)0;
- vendedor.set_IdEmpresa((vendedor.get_IdEmpresa() == 0 ? Recursos.Empresa.get_Id() : vendedor.get_IdEmpresa()));
- TipoAcao tipoAcao = (vendedor.get_Id() == 0 ? 0 : 1);
- if (!id)
- {
- vendedor = commited.get_VendedorRepository().Merge(vendedor);
- if (telefones != null)
- {
- telefones = commited.get_VendedorTelefoneRepository().Merge(telefones, vendedor);
- }
- if (repasses != null && repasses.Count > 0)
- {
- foreach (Repasse repass in repasses)
- {
- if (repass.get_Id() != 0)
- {
- commited.get_RepasseRepository().Merge(repass);
- }
- else
- {
- commited.get_RepasseRepository().SaveOrUpdate(repass);
- }
- }
- }
- }
- else
- {
- vendedor = commited.get_VendedorRepository().SaveOrUpdate(vendedor);
- if (telefones != null)
- {
- telefones = commited.get_VendedorTelefoneRepository().Inserir(telefones, vendedor);
- }
- if (repasses != null && repasses.Count > 0)
- {
- foreach (Repasse repass1 in repasses)
- {
- repass1.set_Vendedor(vendedor);
- commited.get_RepasseRepository().SaveOrUpdate(repass1);
- }
- }
- }
- vendedor.set_Telefones(telefones);
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- if (Recursos.Usuario.get_Id() != 0)
- {
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(tipoAcao);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(networkTime);
- Vendedor vendedor1 = vendedor;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(vendedor1, jsonSerializerSetting));
- registroLog.set_EntidadeId(vendedor.get_Id());
- registroLog.set_Tela(15);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_112 = VendedorServico.u003cu003ec.u003cu003e9__11_2;
- if (u003cu003e9_112 == null)
- {
- u003cu003e9_112 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- VendedorServico.u003cu003ec.u003cu003e9__11_2 = u003cu003e9_112;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_112);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- foreach (Repasse repasse1 in repasses)
- {
- RegistroLog registroLog1 = new RegistroLog();
- registroLog1.set_Acao(tipoAcao);
- registroLog1.set_Usuario(Recursos.Usuario);
- registroLog1.set_DataHora(networkTime);
- JsonSerializerSettings jsonSerializerSetting1 = new JsonSerializerSettings();
- jsonSerializerSetting1.set_ReferenceLoopHandling(1);
- registroLog1.set_Descricao(JsonConvert.SerializeObject(repasse1, jsonSerializerSetting1));
- registroLog1.set_EntidadeId(repasse1.get_Id());
- registroLog1.set_Tela(54);
- registroLog1.set_Versao(LoginViewModel.VersaoAtual);
- registroLog1.set_NomeMaquina(Environment.MachineName);
- registroLog1.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] pAddressArray = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_113 = VendedorServico.u003cu003ec.u003cu003e9__11_3;
- if (u003cu003e9_113 == null)
- {
- u003cu003e9_113 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- VendedorServico.u003cu003ec.u003cu003e9__11_3 = u003cu003e9_113;
- }
- IPAddress pAddress1 = ((IEnumerable<IPAddress>)pAddressArray).FirstOrDefault<IPAddress>(u003cu003e9_113);
- if (pAddress1 != null)
- {
- str1 = pAddress1.ToString();
- }
- else
- {
- str1 = null;
- }
- registroLog1.set_Ip(str1);
- base.SaveLog(registroLog1, commited);
- }
- }
- commited.Commit();
- vendedor4 = vendedor;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 241, num, new { vendedor = vendedor, repasses = repasses }, true);
- continue;
- }
- return vendedor4;
- }
- return vendedor2;
- });
- return vendedor3;
- }
-
- public async Task<Repasse> Save(Repasse repasse)
- {
- int num = 3;
- base.Sucesso = true;
- DateTime networkTime = Funcoes.GetNetworkTime();
- Repasse repasse2 = repasse;
- Repasse repasse3 = await Task.Run<Repasse>(() => {
- Repasse repasse4;
- string str;
- while (num > 0)
- {
- try
- {
- using (UnitOfWork commited = Instancia.Commited)
- {
- repasse2 = commited.get_RepasseRepository().Merge(repasse2);
- IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName());
- RegistroLog registroLog = new RegistroLog();
- registroLog.set_Acao(1);
- registroLog.set_Usuario(Recursos.Usuario);
- registroLog.set_DataHora(networkTime);
- Repasse repasse1 = repasse;
- JsonSerializerSettings jsonSerializerSetting = new JsonSerializerSettings();
- jsonSerializerSetting.set_ReferenceLoopHandling(1);
- registroLog.set_Descricao(JsonConvert.SerializeObject(repasse1, jsonSerializerSetting));
- registroLog.set_EntidadeId(repasse.get_Id());
- registroLog.set_Tela(54);
- registroLog.set_Versao(LoginViewModel.VersaoAtual);
- registroLog.set_NomeMaquina(Environment.MachineName);
- registroLog.set_UsuarioMaquina(Environment.UserName);
- IPAddress[] addressList = hostEntry.AddressList;
- Func<IPAddress, bool> u003cu003e9_121 = VendedorServico.u003cu003ec.u003cu003e9__12_1;
- if (u003cu003e9_121 == null)
- {
- u003cu003e9_121 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork;
- VendedorServico.u003cu003ec.u003cu003e9__12_1 = u003cu003e9_121;
- }
- IPAddress pAddress = ((IEnumerable<IPAddress>)addressList).FirstOrDefault<IPAddress>(u003cu003e9_121);
- if (pAddress != null)
- {
- str = pAddress.ToString();
- }
- else
- {
- str = null;
- }
- registroLog.set_Ip(str);
- base.SaveLog(registroLog, commited);
- commited.Commit();
- repasse4 = repasse2;
- }
- }
- catch (Exception exception)
- {
- num = base.Registrar(exception, 241, num, new { repasse = repasse }, true);
- continue;
- }
- return repasse4;
- }
- return repasse;
- });
- return repasse3;
- }
- }
-}
\ No newline at end of file |