public DataTable GetProductionLineReport(ProductionLineReportSearch search) { var productionLineList = ""; if (search.productionLineList != null) { search.productionLineList.ForEach(item => { productionLineList += "," + item; }); productionLineList = productionLineList.TrimStart(','); } DataTable dt = new DataTable(); EnsureConnectionOpen(); using (var command = CreateCommand("Proc_ProductionLineReport", CommandType.StoredProcedure, new SqlParameter("startDate", search.startDate), new SqlParameter("endDate", search.endDate), new SqlParameter("productionLineList", productionLineList), new SqlParameter("currentUserID", search.currentUserID))) { using (var da = new SqlDataAdapter(command)) { da.Fill(dt); } } return(dt); }
public ActionResult GetReport(ProductionLineReportSearch search) { search.currentUserID = Common.CommonHelper.CurrentUser; DataTable dt = _reportAppService.GetProductionLineReport(search); string JSONresult = JsonConvert.SerializeObject(dt); return(Json(new { data = JSONresult }, JsonRequestBehavior.AllowGet)); }
public FileResult GetExcelForReport(ProductionLineReportSearch search) { search.currentUserID = Common.CommonHelper.CurrentUser; DataTable dt = _reportAppService.GetProductionLineReport(search); string sheetName = "产线项目统计报表"; var book = Common.CommonHelper.CreateHSSFromDataTable(sheetName, dt, new List <int>() { 0 }, true); MemoryStream ms = new MemoryStream(); book.Write(ms); ms.Seek(0, SeekOrigin.Begin); return(File(ms, "application/vnd.ms-excel", sheetName + ".xls")); }