using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using ri.util; using GZTW.AyaNova.BLL; using DevExpress.XtraReports; using DevExpress.XtraReports.UI; namespace ri { public partial class ReportView : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { //********************************************** //AYANOVA RI !!!!! //************************************************ //TEST service bank report // Report r = Report.GetItem(new Guid("c48c0ba4-7569-496c-b190-7c0521d521b5")); //TEST //object DataSource = ClientList.GetListForSingleItem(new Guid("9038112d-d650-4c7f-b90c-5459f8706263")); //Get the report id Report r = Report.GetItem(new Guid(Request.QueryString["rpt"])); this.Title = r.Name; string sourceKey = Request.QueryString["src"]; string ayf = Request.QueryString["ayf"]; this.ayfLinkTop.HRef = ayf; this.ayfLinkBottom.HRef = ayf; //get the datasource object DataSource = Cache[sourceKey]; //clear it out of the cache //NO! do not clear out of cache, is required to be there for any //report toolbar functionality like exporting a report or saving one or printing one //TEST TEST TEST //#if DEBUG // util.ay.clearCacheData(sourceKey); //#endif ReportDataSet source = null; if (DataSource == null) { //user should never see this exception due to page timeout that will return them back throw new System.TimeoutException("REPORT DATA SET HAS EXPIRED"); } else { if (DataSource is ReportDataSet) source = (ReportDataSet)DataSource; else { ReportDataSetAdapter rdsa = new ReportDataSetAdapter(); source = new ReportDataSet(); rdsa.Fill(source, DataSource); } } //Add localized text and display name to reportdataset source.LocaleTextTable = ay.LocaleTextTable; //RI: the following seems wierd but it's done this way in WBI, not sure what it's for but it works in WBI. //possibly this is designer related stuff source.DisplayName = "WorkorderServiceDetailed"; //instantiate an xreport object //set it's datasource DevExpress.XtraReports.UI.XtraReport x = new XtraReport(); //Case 232 x.LoadLayout(r.GetReportContent()); //case 1468 x.ScriptReferences = AyaBizUtils.GetBizObjectLibraryDllPaths(); ; //Case 232 change block: if (source.Tables.Count == 1) { //It's a summary report so just bind to the report as normal x.DataSource = source; } else { //It's a detailed report made of subreports so remove the datasource //from the main report and set it on the detailereport band x.DataSource = null; DetailReportBand detailReport = x.Bands[BandKind.DetailReport] as DetailReportBand; if (detailReport != null) { detailReport.DataSource = source; } } //case 3646 removed //if (AyaBizUtils.Trial) //{ // WatermarkReport(x, true); //} //pass it to the viewer component this.ReportViewer1.Report = x; } //********************************************** //AYANOVA RI !!!!! //************************************************ static internal void WatermarkReport(XtraReport rpt, bool Insert) { if (Insert) { rpt.Watermark.Text = "TRIAL SAMPLE"; rpt.Watermark.Font = new System.Drawing.Font("Tahoma", 72, System.Drawing.FontStyle.Bold); //Case 232 rpt.Watermark.TextTransparency = 128; rpt.Watermark.ShowBehind = false; } else { rpt.Watermark.Text = ""; } } //********************************************** //AYANOVA RI !!!!! //************************************************ //eoc } }