//private static string getReportLocation(string reportName, string locationType) //{ // if (locationType == "Service") return WebConfigurationManager.AppSettings["ReportingService"]; // switch (reportName) // { // case "IEP": // case "IEPReport": // return "SES_Reports/IEP/Production"; // case "SSF": // case "SSForm": // return "SES_Reports/SSForm/Production"; // default: // return "TC_Report/Production"; // } //} private static ReportingWebService.ParameterValue[] GetReportingServiceParameters(List <ReportParameter> _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; } return(rptParameters); }
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]); } }