Ejemplo n.º 1
0
        public static Byte[] GetReportR2(string _reportName, string reportFormat, List <ReportParameter> _reportParameter)

        {
            //  Byte[] result;
            try
            {
                ReportingWebService.ReportExecutionService RS = new ReportingWebService.ReportExecutionService();
                //  CredentialCache cache = new CredentialCache();
                string accessUser        = WebConfigurationManager.AppSettings["WebServiceUser"];   // WebConfig.ReportUser();
                string accessRWSPW       = WebConfigurationManager.AppSettings["WebServiceWP"];     //  WebConfig.ReportPW();
                string accessDomain      = WebConfigurationManager.AppSettings["NetWorkDomain"];    //  WebConfig.DomainName();
                string reportingServices = WebConfigurationManager.AppSettings["ReportingService"]; // WebConfig.ReportServices();
                                                                                                    // string currentDB = DBConnectionHelper.CurrentDB();
                string report = WebConfigurationManager.AppSettings["ReportPathWS"] + _reportName;  //  WebConfig.ReportPathWS()  + "/" + _reportName;
                string format = reportFormat;                                                       // getReportContentType(reportFormat); //WebConfigValue.ReportFormat();

                RS.Url         = reportingServices;
                RS.Credentials = new System.Net.NetworkCredential(accessUser, accessRWSPW, accessDomain);


                string historyID = null;
                string devInfo   = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";

                string encoding = "";
                string mimeType = "";
                ReportingWebService.Warning[] warnings = new ReportingWebService.Warning[0];
                string[] streamIDs = null;


                ReportingWebService.ServerInfoHeader sh = new ReportingWebService.ServerInfoHeader(); //'ServerInfoHeader
                RS.ServerInfoHeaderValue = sh;                                                        //'ServerInfoHeaderValue = sh
                                                                                                      // ReportingWebService.Warning warning = new ReportingWebService.Warning();

                // MyCommon.MyParameterRS[] _reportParameter = GetReportParameters(_reportName, parameters);
                // List<NVListItem> _reportParameter = GetReportParameters(_reportName, parameters);

                var rptParameters = GetReportingServiceParameters(_reportParameter);

                ReportingWebService.ExecutionInfo   execInfo   = new ReportingWebService.ExecutionInfo();
                ReportingWebService.ExecutionHeader execHeader = new ReportingWebService.ExecutionHeader();


                execInfo = RS.LoadReport(report, historyID);

                RS.SetExecutionParameters(rptParameters, "en-us");

                string extension = "";
                string SessionId = RS.ExecutionHeaderValue.ExecutionID;
                //   Console.WriteLine("SessionID: {0}", RS.ExecutionHeaderValue.ExecutionID);

                return(RS.Render(format, devInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs));

                //    return result;
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                return(new Byte[0]);
            }
        }
Ejemplo n.º 2
0
        private static Byte[] getPDFReport(ReportBase reportPara, List <ReportParameter> _reportParameter)

        {
            //  Byte[] result;
            try
            {
                ReportingWebService.ReportExecutionService RS = new ReportingWebService.ReportExecutionService();
                //  CredentialCache cache = new CredentialCache();
                string accessUser   = WebConfigurationManager.AppSettings["WebServiceUser"]; // WebConfig.ReportUser();
                string accessRWSPW  = WebConfigurationManager.AppSettings["WebServiceWP"];   //  WebConfig.ReportPW();
                string accessDomain = WebConfigurationManager.AppSettings["NetWorkDomain"];  //  WebConfig.DomainName();
                                                                                             //  string reportingServices = WebConfigurationManager.AppSettings["ReportingService"];// WebConfig.ReportServices();
                                                                                             //  string reportPath = WebConfigurationManager.AppSettings["ReportPathWS"];//  WebConfig.ReportPathWS()  + "/" + _reportName;
                string format = reportPara.ReportFormat;

                RS.Url         = reportPara.ReportService;
                RS.Credentials = new System.Net.NetworkCredential(accessUser, accessRWSPW, accessDomain);

                string report = reportPara.ReportPath + reportPara.ReportName;


                string historyID = null;
                string devInfo   = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";

                string encoding = "";
                string mimeType = "";
                ReportingWebService.Warning[] warnings = new ReportingWebService.Warning[0];
                string[] streamIDs = null;


                ReportingWebService.ServerInfoHeader sh = new ReportingWebService.ServerInfoHeader();
                RS.ServerInfoHeaderValue = sh;

                var rptParameters = GetReportingServiceParameters(_reportParameter);

                ReportingWebService.ExecutionInfo   execInfo   = new ReportingWebService.ExecutionInfo();
                ReportingWebService.ExecutionHeader execHeader = new ReportingWebService.ExecutionHeader();

                execInfo = RS.LoadReport(report, historyID);

                RS.SetExecutionParameters(rptParameters, "en-us");

                string extension = "";
                string SessionId = RS.ExecutionHeaderValue.ExecutionID;

                return(RS.Render(format, devInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs));
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                return(new Byte[0]);
            }
        }
Ejemplo n.º 3
0
        public static Byte[] GetReportR2(string _reportName, MyADO.MyParameterRS[] _reportParameter)

        {
            Byte[] result;
            try
            {
                ReportingWebService.ReportExecutionService RS = new ReportingWebService.ReportExecutionService();
                //  CredentialCache cache = new CredentialCache();
                string accessUser        = WebConfig.ReportUser();
                string accessRWSPW       = WebConfig.ReportPW();
                string accessDomain      = WebConfig.DomainName();
                string reportingServices = WebConfig.ReportServices();
                string currentDB         = DBConnection.CurrentDB;
                string report            = WebConfig.ReportPathWS() + currentDB + "/" + _reportName;
                string format            = WebConfig.ReportFormat();

                RS.Url         = reportingServices;
                RS.Credentials = new System.Net.NetworkCredential(accessUser, accessRWSPW, accessDomain);


                string historyID = null;
                string devInfo   = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";

                string encoding = "";
                string mimeType = "";
                ReportingWebService.Warning[] warnings = new ReportingWebService.Warning[0];
                string[] streamIDs = null;


                ReportingWebService.ServerInfoHeader sh = new ReportingWebService.ServerInfoHeader(); //'ServerInfoHeader
                RS.ServerInfoHeaderValue = sh;                                                        //'ServerInfoHeaderValue = sh
                                                                                                      // ReportingWebService.Warning warning = new ReportingWebService.Warning();

                int pLeng = _reportParameter.Length;
                ReportingWebService.ParameterValue[] rptParameters = new ReportingWebService.ParameterValue[pLeng];


                int i = 0;
                foreach (MyADO.MyParameterRS para in _reportParameter)
                {
                    rptParameters[i]       = new ReportingWebService.ParameterValue();
                    rptParameters[i].Name  = para.pName;
                    rptParameters[i].Value = para.pValue.ToString();
                    i += 1;
                }



                // ReDim rptParameters(cnt - 1)


                ReportingWebService.ExecutionInfo   execInfo   = new ReportingWebService.ExecutionInfo();
                ReportingWebService.ExecutionHeader execHeader = new ReportingWebService.ExecutionHeader();


                execInfo = RS.LoadReport(report, historyID);

                RS.SetExecutionParameters(rptParameters, "en-us");

                string extension = "";
                string SessionId = RS.ExecutionHeaderValue.ExecutionID;
                //   Console.WriteLine("SessionID: {0}", RS.ExecutionHeaderValue.ExecutionID);

                result = RS.Render(format, devInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs);

                return(result);
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                return(new Byte[0]);
            }
        }
Ejemplo n.º 4
0
        public static Byte[] GetReportR3(string reportingServices, string reportPath, string reportName, string reportFormat, List <ReportParameter> _reportParameter)

        {
            //  Byte[] result;
            try
            {
                ReportingWebService.ReportExecutionService RS = new ReportingWebService.ReportExecutionService();
                //  CredentialCache cache = new CredentialCache();
                string accessUser   = WebConfigurationManager.AppSettings["WebServiceUser"]; // WebConfig.ReportUser();
                string accessRWSPW  = WebConfigurationManager.AppSettings["WebServiceWP"];   //  WebConfig.ReportPW();
                string accessDomain = WebConfigurationManager.AppSettings["NetWorkDomain"];  //  WebConfig.DomainName();
                                                                                             //  string reportingServices = WebConfigurationManager.AppSettings["ReportingService"];// WebConfig.ReportServices();
                                                                                             //  string reportPath = WebConfigurationManager.AppSettings["ReportPathWS"];//  WebConfig.ReportPathWS()  + "/" + _reportName;
                string format = reportFormat;                                                // getReportContentType(reportFormat); //WebConfigValue.ReportFormat();

                RS.Url         = reportingServices;
                RS.Credentials = new System.Net.NetworkCredential(accessUser, accessRWSPW, accessDomain);

                string report = reportPath + reportName;


                string historyID = null;
                string devInfo   = "<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";

                string encoding = "";
                string mimeType = "";
                ReportingWebService.Warning[] warnings = new ReportingWebService.Warning[0];
                string[] streamIDs = null;


                ReportingWebService.ServerInfoHeader sh = new ReportingWebService.ServerInfoHeader();
                RS.ServerInfoHeaderValue = sh;

                var rptParameters = GetReportingServiceParameters(_reportParameter);

                //int pLeng = _reportParameter.Count;

                //ReportingWebService.ParameterValue[] rptParameters = new ReportingWebService.ParameterValue[pLeng];

                //int i = 0;
                //foreach (var item in _reportParameter)
                //{
                //    rptParameters[i] = new ReportingWebService.ParameterValue()
                //    {
                //        Name = item.ParaName,
                //        Value = item.ParaValue.ToString()
                //    };
                //    i += 1;
                //}

                ReportingWebService.ExecutionInfo   execInfo   = new ReportingWebService.ExecutionInfo();
                ReportingWebService.ExecutionHeader execHeader = new ReportingWebService.ExecutionHeader();

                execInfo = RS.LoadReport(report, historyID);

                RS.SetExecutionParameters(rptParameters, "en-us");

                string extension = "";
                string SessionId = RS.ExecutionHeaderValue.ExecutionID;
                return(RS.Render(format, devInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs));
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                return(new Byte[0]);
            }
        }