public IActionResult SearchAjax(string data) { try { if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) { return(AccessDeniedKendoGridJson()); } PaymentTransferSearch search = new PaymentTransferSearch { orden = 0, BancoEmisorId = 0, BancoReceptorId = 0, referencia = string.Empty }; var transferList = _transferService.SearchTransfer(search); return(Json(new DataSourceResult { Data = transferList, Total = transferList.TotalCount })); } catch (Exception ex) { throw new NopException(ex.Message, ex); } }
public IActionResult Configure() { try { if (!_permissionService.Authorize(StandardPermissionProvider.ManagePaymentMethods)) { return(AccessDeniedView()); } var allBank = _bankService.GetBankAlls(); var listaBancos = new List <SelectListItem>(); listaBancos.Add(new SelectListItem { Text = "SELECCIONE", Value = 0.ToString() }); foreach (var bank in allBank) { listaBancos.Add(new SelectListItem { Text = bank.Name, Value = bank.Id.ToString() }); } var allBankReceiver = _bankService.GetBankReceiver(); var listaBancosReceiver = new List <SelectListItem>(); listaBancosReceiver.Add(new SelectListItem { Text = "SELECCIONE", Value = 0.ToString() }); foreach (var bank in allBankReceiver) { listaBancosReceiver.Add(new SelectListItem { Text = bank.Name, Value = bank.Id.ToString() }); } var model = new PaymentTransferSearch(); model.BancoEmisor = listaBancos; model.BancoReceptor = listaBancosReceiver; return(View("~/Plugins/Payments.Transfer/Views/Configure.cshtml", model)); } catch (Exception ex) { throw new NopException(ex.Message, ex); } }
public IPagedList <PaymentTransfer> SearchTransfer(PaymentTransferSearch transfer, int pageIndex = 0, int pageSize = int.MaxValue) { try { var key = string.Format(TRANSFER_SEARCH_KEY, transfer, pageIndex, pageSize); if (transfer == null) { throw new ArgumentNullException(nameof(transfer)); } var transfers = _transferRepository.Table; if (transfer.orden > 0) { transfers = transfers.Where(o => o.OrderId == transfer.orden); } if (transfer.BancoEmisorId > 0) { transfers = transfers.Where(o => o.IssuingBankId == transfer.BancoEmisorId); } if (!string.IsNullOrWhiteSpace(transfer.referencia)) { transfers = transfers.Where(o => o.ReferenceNumber.Contains(transfer.referencia)); } if (transfer.BancoReceptorId > 0) { transfers = transfers.Where(o => o.ReceiverBankId == transfer.BancoReceptorId); } return(_cacheManager.Get(key, () => { var listTransfer = from tr in transfers orderby tr.OrderId descending select tr; return new PagedList <PaymentTransfer>(listTransfer, pageIndex, pageSize); })); } catch (Exception ex) { throw new NopException("Error al insertar la transferencia: " + ex.Message, ex); } }
public IActionResult Search(PaymentTransferSearch search, DataSourceRequest command) { try { if (!_permissionService.Authorize(StandardPermissionProvider.ManageShippingSettings)) { return(AccessDeniedKendoGridJson()); } var transferList = _transferService.SearchTransfer(search, pageIndex: command.Page - 1, pageSize: command.PageSize); return(Json(new DataSourceResult { Data = transferList, Total = transferList.TotalCount })); } catch (Exception ex) { throw new NopException(ex.Message, ex); } }