77 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			77 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			C#
		
	
	
	
using BLL;
 | 
						|
using System;
 | 
						|
using System.Collections.Generic;
 | 
						|
using System.Data;
 | 
						|
using System.Linq;
 | 
						|
using System.Web;
 | 
						|
using System.Web.UI;
 | 
						|
using System.Web.UI.WebControls;
 | 
						|
 | 
						|
namespace FineUIPro.Web.HJGL.TrustManage
 | 
						|
{
 | 
						|
    public partial class Fastreport : PageBase
 | 
						|
    {
 | 
						|
        public string ReportPath
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                return (string)ViewState["ReportPath"];
 | 
						|
            }
 | 
						|
            set
 | 
						|
            {
 | 
						|
                ViewState["ReportPath"] = value;
 | 
						|
            }
 | 
						|
 | 
						|
 | 
						|
        }
 | 
						|
        public List<DataTable> dataTables
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                return (List<DataTable>)Session["ReportDataTables"];
 | 
						|
            }
 | 
						|
        }
 | 
						|
        public Dictionary<string, string> ParameterValues
 | 
						|
        {
 | 
						|
            get
 | 
						|
            {
 | 
						|
                return (Dictionary<string, string>)Session["ReportParameterValues"];
 | 
						|
            }
 | 
						|
        }
 | 
						|
        protected void Page_Load(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            ReportPath = Request.Params["ReportPath"];
 | 
						|
            WebReport1.StartReport += WebReport1_StartReport;
 | 
						|
            if (dataTables!=null&&dataTables.Count > 0)
 | 
						|
            {
 | 
						|
                for (int i = 0; i < dataTables.Count; i++)
 | 
						|
                {
 | 
						|
                    WebReport1.RegisterData(dataTables[i], dataTables[i].TableName);
 | 
						|
                }
 | 
						|
 | 
						|
            }
 | 
						|
            WebReport1.Report.Load(ReportPath);
 | 
						|
            if (WebReport1.Report.Dictionary.Connections.Count > 0)
 | 
						|
            {
 | 
						|
                WebReport1.Report.Dictionary.Connections[0].ConnectionString = Funs.ConnString;
 | 
						|
                WebReport1.Report.Save(ReportPath);
 | 
						|
            }
 | 
						|
            WebReport1.ReportFile = ReportPath;
 | 
						|
            WebReport1.Prepare();
 | 
						|
 | 
						|
        }
 | 
						|
 | 
						|
        private void WebReport1_StartReport(object sender, EventArgs e)
 | 
						|
        {
 | 
						|
            if (ParameterValues.Count > 0)
 | 
						|
            {
 | 
						|
                foreach (KeyValuePair<string, string> kvp in ParameterValues)
 | 
						|
                {
 | 
						|
                    WebReport1.Report.SetParameterValue(kvp.Key, kvp.Value);
 | 
						|
                }
 | 
						|
 | 
						|
                // WebReport1.Report.SetParameterValue("CH_TrustID", Session["CH_TrustID"].ToString());               
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
} |