Beispiel #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);
                    }
                }
            }
        }
    }
Beispiel #2
0
    //Gets url to navigate for entering required data
    private string GetNextUrl(ref PXSetupNotEnteredException exception)
    {
        Type    graphType           = null;
        PXGraph gettingCache        = new PXGraph();
        bool    createInstanceError = true;

        //Get graph that user must use at first
        while (createInstanceError)
        {
            createInstanceError = false;
            PXPrimaryGraphBaseAttribute attr = PXPrimaryGraphAttribute.FindPrimaryGraph(gettingCache.Caches[exception.DAC], out graphType);

            if (graphType != null)
            {
                try
                {
                    PXGraph tmpGraph = PXGraph.CreateInstance(graphType) as PXGraph;
                }
                catch (PXSetupNotEnteredException ctrException)
                {
                    createInstanceError = true;
                    exception           = ctrException;
                }
            }
        }

        try
        {
            string link = graphType == null ? null : PXBaseDataSource.getMainForm(graphType);
            if (exception.KeyParams != null)
            {
                char pref = '?';
                foreach (var keyparam in exception.KeyParams)
                {
                    link += String.Format(pref + "{0}={1}", keyparam.Key.Name.ToString(), keyparam.Value.ToString());
                    pref  = '&';
                }
            }
            return(link);
        }
        //we cang get url if we don't have rights to the screen
        catch
        {
            return(null);
        }
    }
Beispiel #3
0
    //Gets url to navigate for entering required data
    private string GetNextUrl(ref PXSetupNotEnteredException exception)
    {
        Type    graphType           = null;
        PXGraph gettingCache        = new PXGraph();
        bool    createInstanceError = true;

        //Get graph that user must use at first
        while (createInstanceError)
        {
            createInstanceError = false;
            PXPrimaryGraphBaseAttribute attr = PXPrimaryGraphAttribute.FindPrimaryGraph(gettingCache.Caches[exception.DAC], out graphType);

            if (graphType != null)
            {
                try
                {
                    PXGraph tmpGraph = PXGraph.CreateInstance(graphType) as PXGraph;
                }
                catch (PXSetupNotEnteredException ctrException)
                {
                    createInstanceError = true;
                    exception           = ctrException;
                }
            }
        }

        try
        {
            return(graphType == null ? null : PXBaseDataSource.getMainForm(graphType));
        }
        //we cang get url if we don't have rights to the screen
        catch
        {
            return(null);
        }
    }
    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);
                    }
                }
            }
        }
    }