示例#1
0
        public ActionResult ScoreCardReport(int id, int weekid)
        {
            var league = _db.Leagues.Find(id);

            if (league == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
            }
            var reportViewer = new ReportViewer()
            {
                ProcessingMode     = ProcessingMode.Local,
                Width              = Unit.Pixel(800),
                Height             = Unit.Pixel(1000),
                ShowExportControls = true
            };

            ViewBag.WeekId = weekid;

            var matches = _db.GetMatchAll(weekid).ToList();

            reportViewer.LocalReport.DataSources.Add(new ReportDataSource("Match", matches));

            reportViewer.LocalReport.ReportPath = Server.MapPath("/ReportFiles/ScoreCard.rdlc");
            ViewBag.TeamSize = league.TeamSize;
            var p1 = new ReportParameter("teamsize", league.TeamSize.ToString());
            var p2 = new ReportParameter("Description", league.LeagueName);

            reportViewer.LocalReport.SetParameters(new ReportParameter[] { p1, p2 });
            ViewBag.ReportViewer = reportViewer;
            ViewBag.Id           = id;
            return(View());
        }