private void SetReportType(string rptCode) { switch (rptCode) { case "100": reportType = ReportServerType.AssociateBrokerageComissionReport; break; } }
private void ShowReport(ReportServerConfigVo reportServerConfigVo, ReportServerType reportType) { try { IReportServerCredentials irsc = new CustomReportCredentials(reportServerConfigVo.UserName, reportServerConfigVo.Password, reportServerConfigVo.Domain); rptViewer.ServerReport.ReportServerCredentials = irsc; rptViewer.ProcessingMode = ProcessingMode.Remote; // ProcessingMode will be Either Remote or Local rptViewer.ServerReport.ReportServerUrl = new Uri(reportServerConfigVo.ReportServerURL); //Set the ReportServer Url switch (reportType) { case ReportServerType.AssociateBrokerageComissionReport: rptViewer.ServerReport.ReportPath = reportServerConfigVo.ReportPath; //Passing the Report Path rptViewer.ServerReport.DisplayName = "Associate Consolidate Payout " + DateTime.Now.ToShortDateString(); break; } //Creating an ArrayList for combine the Parameters which will be passed into SSRS Report ArrayList reportParam = new ArrayList(); reportParam = ReportDefaultPatam(); ReportParameter[] param = new ReportParameter[reportParam.Count]; for (int k = 0; k < reportParam.Count; k++) { param[k] = (ReportParameter)reportParam[k]; } //pass parmeters to report rptViewer.ServerReport.SetParameters(CreateReportParameter(Request.QueryString["ReportCode"])); //Set Report Parameters rptViewer.ShowParameterPrompts = false; rptViewer.ServerReport.Refresh(); } catch (Exception ex) { throw ex; } }
private ReportServerConfigVo GetReportServerVo(DataSet dsReportServerDetails, ReportServerType reportType) { DataTable dtServerConfig = dsReportServerDetails.Tables[0]; DataTable dtReportDetails = dsReportServerDetails.Tables[1]; reportServerConfigVo = new ReportServerConfigVo(); foreach (DataRow dr in dtServerConfig.Rows) { switch (dr["ServerConfigTypeCode"].ToString()) { case "RSURL": reportServerConfigVo.ReportServerURL = dr["ServerConfigTypeValue"].ToString(); break; case "RSUN": reportServerConfigVo.UserName = dr["ServerConfigTypeValue"].ToString(); break; case "RSPWD": reportServerConfigVo.Password = dr["ServerConfigTypeValue"].ToString(); break; case "RSDOM": reportServerConfigVo.Domain = dr["ServerConfigTypeValue"].ToString(); break; } } DataView dvReportDetails = new DataView(dtReportDetails, "ReportTypeCode=" + reportType.ToString("d").ToString(), "ReportTypeCode", DataViewRowState.CurrentRows); reportServerConfigVo.ReportPath = dvReportDetails.ToTable().Rows[0]["ReportPath"].ToString(); return(reportServerConfigVo); }