コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ReportViewer1.ProcessingMode = ProcessingMode.Remote;

                var serviceName = Request.QueryString["service"];
                var reportName  = Request.QueryString["report"];

                var application = ((MvcApplication)HttpContext.Current.ApplicationInstance);
                IReportingService reportingService = (IReportingService)application.Kernel.GetService(typeof(IReportingService));
                if (!reportingService.CanAccess(serviceName))
                {
                    Response.Clear();
                    Response.Write("<h2>No access.</h2>");
                    return;
                }


                ReportViewer1.ServerReport.ReportServerUrl = new Uri(GetReportingServiceUrl());
                ReportViewer1.ServerReport.ReportPath      = reportingService.GetReportPath(serviceName, reportName);

                //ReportParameter[] param = new ReportParameter[1];
                //param[0] = new ReportParameter("CustomerID", txtparam.Text);
                //ReportViewer1.ServerReport.SetParameters(param);

                ReportViewer1.ServerReport.Refresh();
            }
        }
コード例 #2
0
 public JsonResult Index(int moduleId)
 {
     if (_reportingService.CanAccess(moduleId))
     {
         return(Json(new { service = _reportingService.GetService(moduleId), reports = _reportingService.GetReports(moduleId) }, JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(new string[0], JsonRequestBehavior.AllowGet));
     }
 }