From 674ca83ba9243a9e95a7568c797668dab6aee26a Mon Sep 17 00:00:00 2001 From: Lucas Faria Mendes Date: Mon, 30 Mar 2026 10:35:25 -0300 Subject: feat: upload files --- Gestor.Application/Servicos/ParcelaServico.cs | 1006 +++++++++++++++++++++++++ 1 file changed, 1006 insertions(+) create mode 100644 Gestor.Application/Servicos/ParcelaServico.cs (limited to 'Gestor.Application/Servicos/ParcelaServico.cs') diff --git a/Gestor.Application/Servicos/ParcelaServico.cs b/Gestor.Application/Servicos/ParcelaServico.cs new file mode 100644 index 0000000..fcb987e --- /dev/null +++ b/Gestor.Application/Servicos/ParcelaServico.cs @@ -0,0 +1,1006 @@ +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.Configuracoes; +using Gestor.Model.Domain.Generic; +using Gestor.Model.Domain.Relatorios; +using Gestor.Model.Domain.Relatorios.PrevisaoPagamentoComissao; +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 +{ + internal class ParcelaServico : BaseServico + { + public ParcelaServico() + { + } + + public async Task BuscarApolice(long id) + { + int num = 3; + Documento documento1 = await Task.Run(() => { + Documento documento; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + documento = read.get_ParcelaRepository().BuscarApolice(id); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 3, num, id, true); + continue; + } + return documento; + } + return new Documento(); + }); + return documento1; + } + + public async Task> BuscarFatura(string numero) + { + int num = 3; + List documentos1 = await Task.Run>(() => { + List documentos; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + documentos = read.get_ParcelaRepository().FindNumFatura(numero); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 322, num, numero, true); + continue; + } + return documentos; + } + return new List(); + }); + return documentos1; + } + + public async Task> BuscarFaturas(Filtros filtro, bool buscaAssinaturas = false, bool painelBi = false) + { + int num = 3; + List documentos1 = await Task.Run>(async () => { + List documentos; + while (true) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + documentos = await read.get_ParcelaRepository().BuscaDocumentosPorVigencia(filtro, buscaAssinaturas, painelBi); + return documentos; + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 76, num, filtro, true); + } + if (num <= 0) + { + break; + } + } + documentos = new List(); + return documentos; + }); + return documentos1; + } + + public async Task BuscarLogAntigo(long id) + { + int num = 3; + string str1 = await Task.Run(() => { + string str; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + str = read.get_ParcelaRepository().BuscarLogAntigo(id, Gestor.Application.Helpers.Connection.GetConnectionString()); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 319, num, id, true); + continue; + } + return str; + } + return null; + }); + return str1; + } + + public async Task> BuscarPagamentoVendedor(Filtros filtro, bool reciboPagamento, bool segundaViaReciboPagamento) + { + int num = 3; + List vendedorParcelas1 = await Task.Run>(() => { + List vendedorParcelas; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + IParcelaRepository parcelaRepository = read.get_ParcelaRepository(); + Filtros filtro1 = filtro; + bool flag = reciboPagamento; + bool flag1 = segundaViaReciboPagamento; + List configuracoes = Recursos.Configuracoes; + Func u003cu003e9_201 = ParcelaServico.u003cu003ec.u003cu003e9__20_1; + if (u003cu003e9_201 == null) + { + u003cu003e9_201 = (ConfiguracaoSistema x) => x.get_Configuracao() == 34; + ParcelaServico.u003cu003ec.u003cu003e9__20_1 = u003cu003e9_201; + } + vendedorParcelas = parcelaRepository.FindByPagamento(filtro1, flag, flag1, configuracoes.Any(u003cu003e9_201)); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 80, num, filtro, true); + continue; + } + return vendedorParcelas; + } + return new List(); + }); + return vendedorParcelas1; + } + + public async Task BuscarParcela(long id) + { + int num = 3; + Parcela parcela1 = await Task.Run(() => { + Parcela parcela; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + parcela = read.get_ParcelaRepository().FindById(id); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 74, num, id, true); + continue; + } + return parcela; + } + return new Parcela(); + }); + return parcela1; + } + + internal async Task> BuscarParcelas(long id) + { + int num = 3; + List parcelas1 = await Task.Run>(() => { + List list; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + List parcelas = read.get_ParcelaRepository().FindByDocumentId(id); + Func u003cu003e9_31 = ParcelaServico.u003cu003ec.u003cu003e9__3_1; + if (u003cu003e9_31 == null) + { + u003cu003e9_31 = (Parcela x) => x.get_NumeroParcela(); + ParcelaServico.u003cu003ec.u003cu003e9__3_1 = u003cu003e9_31; + } + list = parcelas.OrderBy(u003cu003e9_31).ToList(); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 73, num, id, true); + continue; + } + return list; + } + return new List(); + }); + return parcelas1; + } + + internal async Task> BuscarParcelas(string ids, List documentos) + { + int num = 3; + List documentos1 = await Task.Run>(() => { + List documentos2; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + documentos2 = read.get_ParcelaRepository().FindByDocumentIds(ids, documentos); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 75, num, null, true); + continue; + } + return documentos2; + } + return new List(); + }); + return documentos1; + } + + public async Task> BuscarParcelas(Filtros filtro, bool somenteAtivos = false) + { + int num = 3; + List parcelas1 = await Task.Run>(() => { + List parcelas; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + parcelas = read.get_ParcelaRepository().FindByPendente(filtro, false, somenteAtivos); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 79, num, filtro, true); + continue; + } + return parcelas; + } + return new List(); + }); + return parcelas1; + } + + internal async Task> BuscarParcelasAsync(long id) + { + int num = 3; + ObservableCollection observableCollection1 = await Task.Run>(() => { + ObservableCollection observableCollection; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + List parcelas = read.get_ParcelaRepository().FindByDocumentId(id); + Func u003cu003e9_01 = ParcelaServico.u003cu003ec.u003cu003e9__0_1; + if (u003cu003e9_01 == null) + { + u003cu003e9_01 = (Parcela x) => x.get_NumeroParcela(); + ParcelaServico.u003cu003ec.u003cu003e9__0_1 = u003cu003e9_01; + } + observableCollection = new ObservableCollection(parcelas.OrderBy(u003cu003e9_01)); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 73, num, id, true); + continue; + } + return observableCollection; + } + return new ObservableCollection(); + }); + return observableCollection1; + } + + public async Task> BuscarParcelasPendentes(Filtros filtro, bool somenteAtivos = false) + { + int num = 3; + List parcelas1 = await Task.Run>(() => { + List parcelas; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + parcelas = read.get_ParcelaRepository().FindByPendente(filtro, true, somenteAtivos); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 78, num, filtro, true); + continue; + } + return parcelas; + } + return new List(); + }); + return parcelas1; + } + + internal async Task> BuscarParcelasPorDocumento(Documento documento) + { + int num = 3; + ObservableCollection observableCollection1 = await Task.Run>(() => { + ObservableCollection observableCollection; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + List parcelas = read.get_ParcelaRepository().FindByDocumento(documento); + Func u003cu003e9_11 = ParcelaServico.u003cu003ec.u003cu003e9__1_1; + if (u003cu003e9_11 == null) + { + u003cu003e9_11 = (Parcela x) => x.get_NumeroParcela(); + ParcelaServico.u003cu003ec.u003cu003e9__1_1 = u003cu003e9_11; + } + observableCollection = new ObservableCollection(parcelas.OrderBy(u003cu003e9_11)); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 73, num, documento.get_Id(), true); + continue; + } + return observableCollection; + } + return new ObservableCollection(); + }); + return observableCollection1; + } + + public async Task> BuscarParcelasRecebimento(Filtros filtro) + { + int num = 3; + List parcelas1 = await Task.Run>(async () => { + List parcelas; + while (true) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + parcelas = await read.get_ParcelaRepository().FindByRecebimento(filtro); + return parcelas; + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 77, num, filtro, true); + } + if (num <= 0) + { + break; + } + } + parcelas = new List(); + return parcelas; + }); + return parcelas1; + } + + public async Task> BuscarPrevisaoPagamentoComissao(Filtros filtro) + { + int num = 3; + List previsaoPagamentos1 = await Task.Run>(() => { + List previsaoPagamentos; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + previsaoPagamentos = read.get_ParcelaRepository().PrevisaoPagamentoComissao(filtro); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 316, num, filtro, true); + continue; + } + return previsaoPagamentos; + } + return new List(); + }); + return previsaoPagamentos1; + } + + internal async Task> BuscarTodasParcelas(List ids) + { + int num = 3; + List parcelas1 = await Task.Run>(() => { + List parcelas; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + parcelas = read.get_ParcelaRepository().FindByDocumentId(ids); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 73, num, ids, true); + continue; + } + return parcelas; + } + return new List(); + }); + return parcelas1; + } + + internal async Task> BuscarVendedores(long id) + { + int num = 3; + List vendedors = await Task.Run>(() => { + List list; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + List vendedorParcelas = read.get_VendedorParcelaRepository().FindByDocumentId(id); + Func u003cu003e9_51 = ParcelaServico.u003cu003ec.u003cu003e9__5_1; + if (u003cu003e9_51 == null) + { + u003cu003e9_51 = (VendedorParcela x) => x.get_Vendedor().get_Id(); + ParcelaServico.u003cu003ec.u003cu003e9__5_1 = u003cu003e9_51; + } + IEnumerable> groupings = vendedorParcelas.GroupBy(u003cu003e9_51); + Func, Vendedor> u003cu003e9_52 = ParcelaServico.u003cu003ec.u003cu003e9__5_2; + if (u003cu003e9_52 == null) + { + u003cu003e9_52 = (IGrouping x) => x.First().get_Vendedor(); + ParcelaServico.u003cu003ec.u003cu003e9__5_2 = u003cu003e9_52; + } + list = groupings.Select, Vendedor>(u003cu003e9_52).ToList(); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 140, num, null, true); + continue; + } + return list; + } + return new List(); + }); + return vendedors; + } + + public async Task Delete(Parcela parcela, List todas) + { + int num = 3; + Funcoes.GetNetworkTime(); + bool flag1 = await Task.Run(() => { + bool flag; + while (num > 0) + { + try + { + using (UnitOfWork commited = Instancia.Commited) + { + commited.get_ParcelaRepository().Delete(parcela.get_Id()); + List registroLogs = new List() + { + base.CreateLog(parcela.get_Id(), parcela.GetValorOriginal(), 5, 2) + }; + base.SaveLog(registroLogs, commited); + commited.Commit(); + flag = true; + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 190, num, parcela, true); + continue; + } + return flag; + } + return false; + }); + return flag1; + } + + public async Task DeletePagamentoRange(List repasses) + { + int num = 3; + bool flag1 = await Task.Run(() => { + bool flag; + while (num > 0) + { + try + { + using (UnitOfWork commited = Instancia.Commited) + { + commited.get_VendedorParcelaRepository().DeleteRange(repasses); + commited.Commit(); + flag = true; + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 21, num, repasses, false); + continue; + } + return flag; + } + return false; + }); + return flag1; + } + + public async Task> FaturaPendente(Filtros filtro) + { + int num = 3; + List documentos1 = await Task.Run>(async () => { + List documentos; + while (true) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + documentos = await read.get_ParcelaRepository().FaturaPendente(filtro); + return documentos; + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 83, num, filtro, true); + } + if (num <= 0) + { + break; + } + } + documentos = new List(); + return documentos; + }); + return documentos1; + } + + public async Task GerarPagamento(List pagamentos) + { + int num = 3; + DateTime networkTime = Funcoes.GetNetworkTime(); + bool flag1 = await Task.Run(() => { + bool flag; + while (num > 0) + { + try + { + using (UnitOfWork commited = Instancia.Commited) + { + IVendedorParcelaRepository vendedorParcelaRepository = commited.get_VendedorParcelaRepository(); + List vendedorParcelas = pagamentos; + Func u003cu003e9_221 = ParcelaServico.u003cu003ec.u003cu003e9__22_1; + if (u003cu003e9_221 == null) + { + u003cu003e9_221 = (VendedorParcela x) => x.get_Id(); + ParcelaServico.u003cu003ec.u003cu003e9__22_1 = u003cu003e9_221; + } + if (vendedorParcelaRepository.GerarPagamento(vendedorParcelas.Select(u003cu003e9_221).ToList(), networkTime)) + { + commited.Commit(); + flag = true; + } + else + { + flag = false; + } + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 193, num, pagamentos, true); + continue; + } + return flag; + } + return false; + }); + return flag1; + } + + public async Task SalvarObservacoes(long id, string observacao) + { + int num = 3; + base.Sucesso = true; + Funcoes.GetNetworkTime(); + string str1 = await Task.Run(() => { + string str; + while (num > 0) + { + List registroLogs = new List(); + try + { + using (UnitOfWork commited = Instancia.Commited) + { + Parcela parcela = commited.get_ParcelaRepository().FindById(id); + parcela.Initialize(); + parcela.set_Observacao(observacao); + registroLogs.Add(base.CreateLog(parcela.get_Id(), parcela, 5)); + commited.get_ParcelaRepository().Merge(parcela); + base.SaveLog(registroLogs, commited); + commited.Commit(); + } + str = observacao; + } + catch (Exception exception) + { + num = base.Registrar(exception, 24, num, new { id = id, observacao = observacao }, true); + continue; + } + return str; + } + return ""; + }); + return str1; + } + + public async Task Save(Parcela parcela, List todas, List repasses = null, bool abrirTela = true) + { + Func func1 = null; + int num = 3; + base.Sucesso = true; + Parcela parcela2 = parcela; + List vendedorParcelas = repasses; + Funcoes.GetNetworkTime(); + ObservableCollection observableCollection1 = await this.BuscarParcelasAsync(parcela.get_Documento().get_Id()); + ObservableCollection observableCollection2 = observableCollection1; + Parcela parcela3 = await Task.Run(async () => { + Parcela parcela4; + while (num > 0) + { + try + { + ObservableCollection observableCollection = observableCollection2; + Func u003cu003e9_1 = func1; + if (u003cu003e9_1 == null) + { + Func id = (Parcela x) => x.get_Id() == parcela.get_Id(); + Func func = id; + func1 = id; + u003cu003e9_1 = func; + } + Parcela parcela1 = observableCollection.FirstOrDefault(u003cu003e9_1); + List registroLogs = new List(); + using (UnitOfWork commited = Instancia.Commited) + { + bool flag = parcela.get_Id() == (long)0; + parcela.set_IdEmpresa(parcela.get_Documento().get_Controle().get_IdEmpresa()); + parcela = (flag ? commited.get_ParcelaRepository().SaveOrUpdate(parcela) : commited.get_ParcelaRepository().Merge(parcela)); + if (repasses != null) + { + foreach (VendedorParcela repass in repasses) + { + repass.set_Documento(parcela.get_Documento()); + repass.set_Parcela(parcela); + if (repass.get_Id() != 0) + { + commited.get_VendedorParcelaRepository().Merge(repass); + } + else + { + commited.get_VendedorParcelaRepository().SaveOrUpdate(repass); + } + } + parcela.set_Vendedores(new ObservableCollection(repasses)); + } + if (!flag) + { + registroLogs.Add(base.CreateLog(parcela.get_Id(), parcela.Compare(parcela1.GetValorOriginal()), 5, 1)); + } + else + { + registroLogs.Add(base.CreateLog(parcela.get_Id(), parcela.GetValorOriginal(), 5, 0)); + } + base.SaveLog(registroLogs, commited); + commited.Commit(); + parcela4 = parcela; + return parcela4; + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 24, num, parcela2, abrirTela); + } + } + parcela2.set_Vendedores((vendedorParcelas != null ? new ObservableCollection(vendedorParcelas) : null)); + parcela4 = parcela2; + return parcela4; + }); + return parcela3; + } + + public async Task Save(VendedorParcela pagamento) + { + int num = 3; + base.Sucesso = true; + Funcoes.GetNetworkTime(); + VendedorParcela vendedorParcela2 = await Task.Run(() => { + VendedorParcela vendedorParcela; + while (num > 0) + { + VendedorParcela vendedorParcela1 = pagamento; + try + { + List registroLogs = new List(); + using (UnitOfWork commited = Instancia.Commited) + { + vendedorParcela1 = (vendedorParcela1.get_Id() == 0 ? commited.get_VendedorParcelaRepository().SaveOrUpdate(vendedorParcela1) : commited.get_VendedorParcelaRepository().Merge(vendedorParcela1)); + if (pagamento.get_Id() != 0) + { + registroLogs.Add(base.CreateLog(vendedorParcela1.get_Id(), vendedorParcela1.Compare(vendedorParcela1.GetValorOriginal()), 37, 1)); + } + else + { + registroLogs.Add(base.CreateLog(vendedorParcela1.get_Id(), vendedorParcela1.GetValorOriginal(), 37, 0)); + } + base.SaveLog(registroLogs, commited); + commited.Commit(); + vendedorParcela = vendedorParcela1; + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 189, num, pagamento, true); + continue; + } + return vendedorParcela; + } + return pagamento; + }); + return vendedorParcela2; + } + + public async Task> SaveRange(List parcela) + { + int num = 3; + base.Sucesso = true; + List parcelas2 = await Task.Run>(() => { + List parcelas; + while (num > 0) + { + List parcelas1 = parcela; + try + { + using (UnitOfWork commited = Instancia.Commited) + { + foreach (Parcela parcela1 in parcelas1) + { + if (parcela1.get_Id() != 0) + { + commited.get_ParcelaRepository().Merge(parcela1); + } + else + { + parcela1.set_IdEmpresa(parcela1.get_Documento().get_Controle().get_IdEmpresa()); + commited.get_ParcelaRepository().SaveOrUpdate(parcela1); + } + } + commited.Commit(); + parcelas = parcelas1; + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 24, num, parcela, true); + continue; + } + return parcelas; + } + return parcela; + }); + return parcelas2; + } + + public async Task SaveRange(List repasses) + { + int num = 3; + List vendedorParcelas1 = repasses; + Funcoes.GetNetworkTime(); + bool flag1 = await Task.Run(() => { + bool flag; + while (num > 0) + { + repasses = vendedorParcelas1; + try + { + List registroLogs = new List(); + using (UnitOfWork commited = Instancia.Commited) + { + List vendedorParcelas = repasses; + if (vendedorParcelas != null) + { + vendedorParcelas.ForEach((VendedorParcela x) => { + x.get_Id(); + x = (x.get_Id() == 0 ? commited.get_VendedorParcelaRepository().SaveOrUpdate(x) : commited.get_VendedorParcelaRepository().Merge(x)); + if (x.get_Id() == 0) + { + registroLogs.Add(base.CreateLog(x.get_Id(), x.GetValorOriginal(), 37, 0)); + return; + } + registroLogs.Add(base.CreateLog(x.get_Id(), x.Compare(x.GetValorOriginal()), 37, 1)); + }); + } + else + { + } + base.SaveLog(registroLogs, commited); + commited.Commit(); + flag = true; + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 189, num, repasses, false); + continue; + } + return flag; + } + return false; + }); + return flag1; + } + + public async Task TemPagamento(long id) + { + int num = 3; + bool flag1 = await Task.Run(() => { + bool flag; + while (num > 0) + { + try + { + using (UnitOfWork read = Instancia.Read) + { + flag = read.get_VendedorParcelaRepository().TemPagamentoParcela(id); + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 82, num, id, true); + continue; + } + return flag; + } + return false; + }); + return flag1; + } + + public async Task UpdateDetalhes(List detalhes) + { + int num = 3; + DateTime networkTime = Funcoes.GetNetworkTime(); + bool flag3 = await Task.Run(() => { + bool flag; + while (num > 0) + { + try + { + using (UnitOfWork commited = Instancia.Commited) + { + List configuracoes = Recursos.Configuracoes; + Func u003cu003e9_141 = ParcelaServico.u003cu003ec.u003cu003e9__14_1; + if (u003cu003e9_141 == null) + { + u003cu003e9_141 = (ConfiguracaoSistema x) => x.get_Configuracao() == 51; + ParcelaServico.u003cu003ec.u003cu003e9__14_1 = u003cu003e9_141; + } + bool flag1 = configuracoes.Any(u003cu003e9_141); + bool flag2 = commited.get_ParcelaRepository().Update(detalhes, flag1); + IPHostEntry hostEntry = Dns.GetHostEntry(Dns.GetHostName()); + detalhes.ForEach((DetalheExtrato x) => { + string str; + 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(x, jsonSerializerSetting)); + registroLog.set_EntidadeId(x.get_Id()); + registroLog.set_Tela(23); + registroLog.set_Versao(LoginViewModel.VersaoAtual); + registroLog.set_NomeMaquina(Environment.MachineName); + registroLog.set_UsuarioMaquina(Environment.UserName); + IPAddress[] addressList = hostEntry.AddressList; + Func u003cu003e9_143 = ParcelaServico.u003cu003ec.u003cu003e9__14_3; + if (u003cu003e9_143 == null) + { + u003cu003e9_143 = (IPAddress ip) => ip.AddressFamily == AddressFamily.InterNetwork; + ParcelaServico.u003cu003ec.u003cu003e9__14_3 = u003cu003e9_143; + } + IPAddress pAddress = ((IEnumerable)addressList).FirstOrDefault(u003cu003e9_143); + str = (pAddress != null ? pAddress.ToString() : null); + registroLog.set_Ip(str); + base.SaveLog(registroLog, commited); + }); + commited.Commit(); + flag = flag2; + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 192, num, detalhes, true); + continue; + } + return flag; + } + return false; + }); + return flag3; + } + + public async Task> UpdateRange(List parcelas) + { + base.Sucesso = true; + int num = 3; + List parcelas1 = parcelas; + Funcoes.GetNetworkTime(); + List parcelas2 = await Task.Run>(() => { + List parcelas3; + while (num > 0) + { + parcelas = parcelas1; + try + { + List registroLogs = new List(); + using (UnitOfWork commited = Instancia.Commited) + { + parcelas = commited.get_ParcelaRepository().UpdateRange(parcelas); + parcelas.ForEach((Parcela x) => { + registroLogs.Add(base.CreateLog(x.get_Id(), x.Compare(x.GetValorOriginal()), 5, 1)); + base.SaveLog(registroLogs, commited); + }); + commited.Commit(); + parcelas3 = parcelas; + } + } + catch (Exception exception) + { + num = base.Registrar(exception, 24, num, parcelas, false); + continue; + } + return parcelas3; + } + return parcelas1; + }); + return parcelas2; + } + } +} \ No newline at end of file -- cgit v1.2.3