1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- using System;
- using Stimulsoft.Report;
- namespace PMS.WebUI.WebForms
- {
- public partial class WebReportView : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- StiConfig.Services.Add(new Stimulsoft.Report.Dictionary.StiOracleODPAdapterService()); //注册oracleOpd
- base.OnInit(e);
- GetReport();
- }
- protected void StiWebViewer1_ReportDesign(object sender, Stimulsoft.Report.Web.StiReportDesignEventArgs e)
- {
- }
- //售后渠道统计
- private void GetReport()
- {
- StiReport report = new StiReport();
- report.RequestParameters = true;
- var reportName = Request.QueryString["reportName"];
-
- if (!string.IsNullOrEmpty(reportName))
- {
- reportName += ".mrt";
- report.Load(base.Server.MapPath("/Reports/" + reportName + ""));
- //if (report.Dictionary.Databases.Count > 0)
- //{//修改数据源
- //((StiSqlDatabase)report.Dictionary.Databases[0]).ConnectionString = "Data Source=192.168.0.106/orcl;Persist Security Info=True;User ID=zlchs;Password=zlchs2013"; //重新定义数据库连接
- //}
- //参数值
- //report.Dictionary.Variables["xmid"].Value = "c321e858-c4b9-4492-972c-ea1d81a39ef3";
- var list = report.Dictionary.Variables.Items;
- foreach(var item in list)
- {
- switch (item.Name)
- {
- case "xmid": report.Dictionary.Variables["xmid"].Value = Request.QueryString["xmid"]; break;
- case "qdid": report.Dictionary.Variables["qdid"].Value = Request.QueryString["channelid"]; break;
- case "stime": report.Dictionary.Variables["stime"].Value = Request.QueryString["stime"]; break;
- case "etime": report.Dictionary.Variables["etime"].Value = Request.QueryString["etime"]; break;
- case "person": report.Dictionary.Variables["person"].Value = Request.QueryString["person"]; break;
- case "jjbb": report.Dictionary.Variables["jjbb"].Value = Request.QueryString["jjbb"]; break;
- case "dd": report.Dictionary.Variables["dd"].Value = Request.QueryString["dd"]; break;
- }
- //if(item.Name=="xmid")
- //{
- // report.Dictionary.Variables["xmid"].Value = Request.QueryString["xmid"]; /*"c321e858-c4b9-4492-972c-ea1d81a39ef3";*/
- //}
- }
- report.ReportName = "统计报表";
- report.Compile();
- report.Render(false);
- StiWebViewer1.Report = report;
- StiWebViewer1.DataBind();
- }
- }
- }
- }
|