예제 #1
0
    protected void viewer_ReportCreated(object sender, EventArgs e)
    {
        object passed = PXContext.Session.PageInfo[VirtualPathUtility.ToAbsolute(this.Page.Request.Path)];
        PXReportsRedirectList reports = passed as PXReportsRedirectList;

        sessionReportParams.Add(reports == null ? passed : reports[0].Value);

        PXSiteMapProvider provider = SiteMap.Provider as PXSiteMapProvider;

        if (provider != null && reports != null)
        {
            if (reports.SeparateWindows)
            {
                if (reports.Count > 1)
                {
                    KeyValuePair <String, Object> pair;
                    do
                    {
                        reports.RemoveAt(0);
                        pair = reports.First();
                    } while (reports.Count > 1 && String.IsNullOrEmpty(pair.Key));

                    string reportID = pair.Key;
                    if (String.IsNullOrEmpty(reportID))
                    {
                        return;
                    }
                    string url = PXBaseDataSource.getScreenUrl(reportID);
                    if (!String.IsNullOrEmpty(url))
                    {
                        url = PXUrl.ToAbsoluteUrl(url);

                        NextReport           = new KeyValuePair <String, Object>(url, reports);
                        viewer.NextReportUrl = url;
                    }
                }
            }
            else
            {
                foreach (KeyValuePair <string, object> t in reports)
                {
                    string reportID = t.Key;
                    if (string.IsNullOrEmpty(reportID))
                    {
                        continue;
                    }
                    PXSiteMapNode reportNode = provider.FindSiteMapNodeByScreenID(reportID);
                    string        reportName;
                    if (reportNode != null && !string.IsNullOrEmpty(reportName = PXUrl.GetParameter(reportNode.Url, "ID")))
                    {
                        Report report = new Report();
                        report.ReportName = reportName;
                        viewer.Report.SiblingReports.Add(report);
                        sessionReportParams.Add(t.Value);
                    }
                }
            }
        }
    }
    protected void viewer_ReportCreated(object sender, EventArgs e)
    {
        object passed = PXContext.Session.PageInfo[VirtualPathUtility.ToAbsolute(this.Page.Request.Path)];

        if (passed == null)
        {
            object passedByRawUrl = PXContext.Session.PageInfo[VirtualPathUtility.ToAbsolute(this.Page.Request.RawUrl)];
            var    pars           = passedByRawUrl as Dictionary <string, string>;
            if (pars != null)
            {
                string autoexport;
                if (pars.TryGetValue(ReportLauncherHelper._AUTO_EXPORT_PDF, out autoexport) &&
                    autoexport == "true")
                {
                    viewer.AutoExportPDF = true;
                    pars.Remove(ReportLauncherHelper._AUTO_EXPORT_PDF);
                }
                passed = new Dictionary <string, string>(pars);
            }
            else
            {
                passed = passedByRawUrl;
            }
        }
        PXReportsRedirectList reports = passed as PXReportsRedirectList;

        sessionReportParams.Add(reports == null ? passed : reports[0].Value);

        PXSiteMapProvider provider = SiteMap.Provider as PXSiteMapProvider;

        if (provider != null && reports != null)
        {
            if (reports.SeparateWindows)
            {
                if (reports.Count > 1)
                {
                    KeyValuePair <String, Object> pair;
                    do
                    {
                        reports.RemoveAt(0);
                        pair = reports.First();
                    } while (reports.Count > 1 && String.IsNullOrEmpty(pair.Key));

                    string reportID = pair.Key;
                    if (String.IsNullOrEmpty(reportID))
                    {
                        return;
                    }
                    string url = PXBaseDataSource.getScreenUrl(reportID);
                    if (!String.IsNullOrEmpty(url))
                    {
                        url = PXUrl.ToAbsoluteUrl(url) + "&preserveSession=true";

                        NextReport           = new KeyValuePair <String, Object>(url, reports);
                        viewer.NextReportUrl = url;
                    }
                }
            }
            else
            {
                foreach (KeyValuePair <string, object> t in reports)
                {
                    string reportID = t.Key;
                    if (string.IsNullOrEmpty(reportID))
                    {
                        continue;
                    }
                    PXSiteMapNode reportNode = provider.FindSiteMapNodeByScreenID(reportID);
                    string        reportName;
                    if (reportNode != null && !string.IsNullOrEmpty(reportName = PXUrl.GetParameter(reportNode.Url, "ID")))
                    {
                        Report report = new Report();
                        report.ReportName = reportName;
                        viewer.Report.SiblingReports.Add(report);
                        sessionReportParams.Add(t.Value);
                    }
                }
            }
        }
    }