public virtual IActionResult ExportExcelAll(ConsignmentOrderSearchModel searchModel) { if (!permissionService.Authorize(StandardPermissionProvider.ManageConsignmentOrders)) { return(AccessDeniedView()); } var list = consignmentOrderService.GetAll( shipmentMethod: searchModel.SearchShipmentMethod, startPoint: searchModel.SearchStartPoint, terminal: searchModel.SearchTerminal, consignor: searchModel.SearchConsignor, consignee: searchModel.SearchConsignee, tripId: searchModel.TripId, noRelatedTrip: searchModel.SearchNoRelatedTrip, serialNum: searchModel.SearchSerialNum, consignmentTimeFrom: searchModel.SearchConsignmentTimeFrom, consignmentTimeTo: searchModel.SearchConsignmentTimeTo, orderStatuses: (searchModel.SearchOrderStatuses?.Contains(0) ?? false) ? null : searchModel.SearchOrderStatuses, paymentStatuses: (searchModel.SearchPaymentStatuses?.Contains(0) ?? false) ? null : searchModel.SearchPaymentStatuses); try { var bytes = exportManager.ExportConsignmentOrdersToXlsx(list); return(File(bytes, MimeTypes.TextXlsx, $"{localizationService.GetResource("Admin.Logistics.ConsignmentOrder")}.xlsx")); } catch (Exception ex) { ErrorNotification(ex); return(RedirectToAction("List")); } }
public virtual ConsignmentOrderListModel PrepareListModel(ConsignmentOrderSearchModel searchModel) { if (null == searchModel) { throw new ArgumentNullException(nameof(searchModel)); } var list = consignmentOrderService.GetAll( pageIndex: searchModel.Page - 1, pageSize: searchModel.PageSize, shipmentMethod: searchModel.SearchShipmentMethod, startPoint: searchModel.SearchStartPoint, terminal: searchModel.SearchTerminal, consignor: searchModel.SearchConsignor, consignee: searchModel.SearchConsignee, tripId: searchModel.TripId, noRelatedTrip: searchModel.SearchNoRelatedTrip, serialNum: searchModel.SearchSerialNum, consignmentTimeFrom: searchModel.SearchConsignmentTimeFrom, consignmentTimeTo: searchModel.SearchConsignmentTimeTo, orderStatuses: (searchModel.SearchOrderStatuses?.Contains(0) ?? false) ? null : searchModel.SearchOrderStatuses, paymentStatuses: (searchModel.SearchPaymentStatuses?.Contains(0) ?? false) ? null : searchModel.SearchPaymentStatuses); var model = new ConsignmentOrderListModel { Data = list.Select(x => { var modelItem = x.ToModel <ConsignmentOrderModel>(); PrepareModel(ref modelItem); return(modelItem); }), Total = list.TotalCount }; return(model); }