Exemplo n.º 1
0
        public static ReportExecution20051.ParameterValue[] ConvertPeriodicReportParameters(Hashtable parameters)
        {
            ReportExecution20051.ParameterValue[] reportParameters = null;

            reportParameters = new ReportExecution20051.ParameterValue[parameters.Count];
            // set the report parameters
            if (parameters.Count > 0)
            {
                int i = 0;
                foreach (DictionaryEntry parameter in parameters)
                {
                    try
                    {
                        reportParameters[i]      = new ReportExecution20051.ParameterValue();
                        reportParameters[i].Name = parameter.Key.ToString();
                        if (parameter.Value is DateTime)
                        {
                            //yyyy'-'MM'-'dd'T'HH':'mm':'ss (SortableDateTimePattern)
                            reportParameters[i].Value = ((DateTime)parameter.Value).ToString("s");
                        }
                        else
                        {
                            reportParameters[i].Value = parameter.Value.ToString();
                        }
                    }
                    catch (Exception Ex)
                    {
                    }
                    i++;
                }
            }

            return(reportParameters);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get report parameter's values
        /// </summary>
        /// <remarks>
        /// This method is called in the ReportViewer control
        /// </remarks>
        /// <param name="parameters"></param>
        /// <returns></returns>
        public static ReportExecution20051.ParameterValue[] ConvertReportParameters(Bdw.SqlServer.Reporting.ReportExecution20051.ParameterValue[] parameters)
        {
            ReportExecution20051.ParameterValue[] reportParameters = null;

            reportParameters = new ReportExecution20051.ParameterValue[40];
            reportParameters = parameters;

            return(reportParameters);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Renders the report via SOAP
        /// </summary>
        /// <returns></returns>
        private byte[] GetReportContent(out string mimeType)
        {
            //ReportingService2005 rs;
            ReportExecutionService rsExec;

            byte[] content;
            //In argements
            string deviceInfo;

            ReportExecution20051.ParameterValue[] parameterValues;

            //Out arguments
            string encoding;

            ReportExecution20051.Warning[] warnings = null;
            //ReportExecutionService2005.ParameterValue[] parametersUsed = null;
            string[] streamIDs = null;
            string   extension = null;

            //In argements

            //ReportExecutionService2005.ReportParameter[] _parameters = null;
            //string _report = null;
            string _historyID = null;

            //bool _forRendering = false;
            //ReportExecutionService2005.ParameterValue[] _values = null;
            //ReportExecutionService2005.DataSourceCredentials[] _credentials = null;



            //1. Get input arguments
            // Set html device information
            //deviceInfo = "";
            deviceInfo = "<DeviceInfo><Encoding>UTF-8</Encoding></DeviceInfo>";
            //Get report parameters
            parameterValues = this.ReportParameters;


            //2. Get reporting web service
            //rs = Util.GetReportingService(this.SessionID);
            rsExec = Util.GetReportExecutionService(this.SessionID);

            //3. Call render web service
//			content = rs.Render(this.Settings.ReportFolder + this.ReportPath, this.Format, null, deviceInfo, parameterValues, null, null,
//				out encoding, out mimeType, out parametersUsed, out warnings,out streamIDs);



            // Get if any parameters needed.
            //_parameters = rs.GetReportParameters(this.Settings.ReportFolder + this.ReportPath, _historyID, _forRendering, _values, _credentials);

            // Load the selected report.
            ReportExecution20051.ExecutionInfo ei = rsExec.LoadReport(this.Settings.ReportFolder + this.ReportPath, _historyID);
            rsExec.ExecutionHeaderValue.ExecutionID = this.SessionID;

            // Prepare report parameter.
            // Set the parameters for the report needed.
            ReportExecution20051.ParameterValue[] parameters =
                new ReportExecution20051.ParameterValue[1];


            rsExec.SetExecutionParameters(this.ReportParameters, "en-us");
            rsExec.Timeout = System.Threading.Timeout.Infinite;
            content        = rsExec.Render(this.Format, deviceInfo, out extension, out mimeType, out encoding, out warnings, out streamIDs);

            // Create a file stream and write the report to it
            //            using (FileStream stream = File.OpenWrite(fileName))
            //{
            //                stream.Write(results, 0, results.Length);
            //}



            //4. Session Validation
            if (this.Settings.SessionValidation)
            {
                if (rsExec.ExecutionHeaderValue.ExecutionID != this.SessionID)
                {
                    throw new ApplicationException("Session timeout");
                }
            }



            return(content);
        }