Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void ProcessRequest(HttpContext context)
- {
- string report = null;
- int managerId = -1;
- int planId = -1;
- GetParametersFromSession(context.Session, out report, out managerId, out planId);
- if (report == null || managerId == -1 || planId == -1)
- {
- return;
- }
- CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;
- List<ReportParameter> parameters = new List<ReportParameter>();
- parameters.Add(new ReportParameter("Prefix", report));
- parameters.Add(new ReportParameter("ManagerId", managerId.ToString()));
- parameters.Add(new ReportParameter("ActionPlanId", planId.ToString()));
- string language = Thread.CurrentThread.CurrentCulture.Name;
- language = String.Format("{0}_{1}", language.Substring(0, 2), language.Substring(3, 2).ToLower());
- parameters.Add(new ReportParameter("Lang", language));
- ReportViewer rv = new ReportViewer();
- rv.ProcessingMode = ProcessingMode.Remote;
- rv.ServerReport.ReportServerUrl = new Uri(ConfigurationManager.AppSettings["ReportServer"]);
- if (ConfigurationManager.AppSettings["DbYear"] == "2007")
- {
- rv.ServerReport.ReportPath = "/ActionPlanning/Plan";
- }
- else
- {
- rv.ServerReport.ReportPath = String.Format("/ActionPlanning{0}/Plan", ConfigurationManager.AppSettings["DbYear"]);
- }
- rv.ServerReport.SetParameters(parameters);
- string mimeType = null;
- string encoding = null;
- string extension = null;
- string[] streamIds = null;
- Warning[] warnings = null;
- byte[] output = rv.ServerReport.Render("pdf", null, out mimeType, out encoding, out extension, out streamIds, out warnings);
- context.Response.ContentType = mimeType;
- context.Response.BinaryWrite(output);
- }
Add Comment
Please, Sign In to add comment