public ActionResult Sort(FormCollection fc) { DynamicQuery <Pig> smodel = new DynamicQuery <Pig>(); smodel.UpdateModel(Request.Form); var dataSource = new FarmRepository().GetEntities <Pig>(smodel.whereExp); ReportModel report = new ReportModel(); report.dataSource = dataSource; report.reportName = Request["sortby"] + ".rdlc"; report.displayName = "成活率排名"; Session["report"] = report; return(JavaScript(JSHelper.ShowSuccess("正在生成报表…"))); }
public ActionResult Production(DateTime orgDate, DateTime endDate) { IEnumerable <ProductionReportResult> dataSource; using (var dc = new FarmDataContext(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString)) { int userID = Account.userID; dataSource = dc.ProductionReport(userID, orgDate, endDate).ToList(); } ReportModel report = new ReportModel(); report.dataSource = dataSource.AsQueryable(); report.reportName = "Production.rdlc"; report.displayName = "生产报表"; report.Parameters.Add(new Microsoft.Reporting.WebForms.ReportParameter("orgDate", orgDate.ToShortDateString())); report.Parameters.Add(new Microsoft.Reporting.WebForms.ReportParameter("endDate", endDate.ToShortDateString())); Session["report"] = report; return(JavaScript(JSHelper.ShowSuccess("正在生成报表…"))); }