public FileResult ExportInventoryListToExcel(InventoryListModel model) { var queryInfo = new InventoryListQueryInfo(); queryInfo.SupplierID = base.CurrentUser.SupplierID; queryInfo.ProductName = model.ProductName.SafeTrim(); queryInfo.Spu = model.Spu.SafeTrim(); queryInfo.Sku = model.Sku.SafeTrim(); queryInfo.BarCode = model.BarCode.SafeTrim(); queryInfo.SkuStatus = model.SkuStatus; queryInfo.IsLowStockAlarm = model.IsLowStockAlarm; var fileName = "Inventory" + DateTime.Now.ToString("yyyyMMdd") + ".xlsx"; try { var dateTable = bll.GetSkuInventoryListData(queryInfo, LanguageEnum.TraditionalChinese); var dtExporter = new DataTableExporter(EnumExcelType.XLSX); dtExporter.AddTable <InventoryListExportModel>(dateTable, "SKU庫存"); return(XlsxFile(dtExporter.Export(), fileName)); } catch (Exception ex) { LogHelper.Error(ex); } return(XlsxFile(new byte[0], fileName)); }
public FileResult ExportInventoryListToExcel(InventoryListViewModel Model) { var fileName = "Inventory" + DateTime.Now.ToString("yyyyMMdd") + ".xlsx"; try { var dateTable = productBll.GetProductInventoryListData(Model, LanguageEnum.TraditionalChinese); var dtExporter = new DataTableExporter(EnumExcelType.XLSX); dtExporter.AddTable <InventoryListExportModel>(dateTable, "SKU庫存"); return(XlsxFile(dtExporter.Export(), fileName)); } catch (Exception ext) { LogHelper.Error(ext); } return(XlsxFile(new byte[0], fileName)); }