diff options
Diffstat (limited to 'Gestor.Application/Servicos/Ferramentas/AdiantamentoServico.cs')
| -rw-r--r-- | Gestor.Application/Servicos/Ferramentas/AdiantamentoServico.cs | 281 |
1 files changed, 0 insertions, 281 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 |