private bool NavHandlerWiki(string args)
    {
        Guid PageID = Guid.Parse(args.Split(':')[1]);

        throw new PXRedirectToUrlException(PXUrl.ToAbsoluteUrl(HttpUtility.UrlPathEncode(string.Format("~/Wiki/ShowWiki.aspx?PageID={0}", PageID)))
                                           , null);
    }
 protected void Page_Init(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         PXContext.Session.PageInfo[PXUrl.ToAbsoluteUrl(Request.Path)] = null;
     }
 }
Esempio n. 3
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 virtual string BuildUrl(string query, int?page)
    {
        var url = PXUrl.ToAbsoluteUrl(Request.AppRelativeCurrentExecutionFilePath) + "?query=" + HttpUtility.UrlEncode(query) + "&st=" + this.searchType + "&am=" + this.activeModule;

        if (page != null)
        {
            url = url + "&Page=" + page.Value;
        }

        return(url);
    }
    private bool NavHandler(string args)
    {
        Guid noteID = Guid.Parse(args.Split(':')[1]);

        try
        {
            PXEntitySearch search = new PXEntitySearch();
            search.Redirect(noteID);
        }
        catch (PXRedirectRequiredException ex)
        {
            string url = PX.Web.UI.PXDataSource.getMainForm(ex.Graph.GetType());
            if (url != null)
            {
                ex.Graph.Unload();
                PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = ex.Graph.GetType();
                throw new PXRedirectRequiredException(url, ex.Graph, "Redirect0:" + this.ResolveUrl/**/ (url));
            }
        }
        return(false);
    }

    private bool NavHandlerFiles(string args)
    {
        try
        {
            String FileName = args.Split(':')[1];
            WikiFileMaintenance      graph = PXGraph.CreateInstance <WikiFileMaintenance>();
            UploadFileWithIDSelector cur   =
                PXSelect <UploadFileWithIDSelector,
                          Where <UploadFileWithIDSelector.name,
                                 Equal <Required <UploadFileWithIDSelector.name> > > > .Select(graph, HttpUtility.UrlDecode(FileName));

            if (cur != null)
            {
                graph.Files.Current = cur;
            }
            PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.Same);
        }
        catch (PXRedirectRequiredException ex)
        {
            string url = PX.Web.UI.PXDataSource.getMainForm(ex.Graph.GetType());
            if (url != null)
            {
                ex.Graph.Unload();
                PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = ex.Graph.GetType();
                throw new PXRedirectRequiredException(url, ex.Graph, "Redirect0:" + this.ResolveUrl/**/ (url));
            }
        }
        return(false);
    }
Esempio n. 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!PXAccess.FeatureInstalled <FeaturesSet.payrollModule>())
        {
            return;
        }

        PREarningTypeMaint graph = PXGraph.CreateInstance <PREarningTypeMaint>();
        string             url   = PXDataSource.getMainForm(graph.GetType());

        if (url == null)
        {
            return;
        }

        graph.Unload();
        PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = graph.GetType();
        Response.Redirect(this.ResolveUrl(url));
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        var graph = PXGraph.CreateInstance <FileHandler>();

        try
        {
            BoxFolderCache relatedFolder = graph.FoldersByFolderID.Select(Request.QueryString["itemID"]);
            new EntityHelper(graph).NavigateToRow(relatedFolder.RefNoteID, PXRedirectHelper.WindowMode.Same);
        }
        catch (PXRedirectRequiredException ex)
        {
            string url = PXDataSource.getMainForm(ex.Graph.GetType());
            if (url != null)
            {
                ex.Graph.Unload();
                PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = ex.Graph.GetType();
                Response.Redirect(this.ResolveUrl(url));
            }
        }
    }
    protected virtual void Page_LoadComplete(object sender, EventArgs e)
    {
        string noteID = Request.Params["navigate"];

        if (!string.IsNullOrEmpty(noteID))
        {
            try
            {
                PXEntitySearch search = new PXEntitySearch();
                search.Redirect(Guid.Parse(noteID));
            }
            catch (PXRedirectRequiredException ex)
            {
                string url = PX.Web.UI.PXDataSource.getMainForm(ex.Graph.GetType());
                if (url != null)
                {
                    ex.Graph.Unload();
                    PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = ex.Graph.GetType();
                    Response.Redirect(this.ResolveUrl/**/ (url));
                    //throw new PXRedirectRequiredException(url, ex.Graph, "Redirect0:" + this.ResolveUrl/**/(url));
                }
            }
        }

        string fileName = Request.Params["file"];

        if (!string.IsNullOrEmpty(fileName))
        {
            try
            {
                WikiFileMaintenance      graph = PXGraph.CreateInstance <WikiFileMaintenance>();
                UploadFileWithIDSelector cur   =
                    PXSelect <UploadFileWithIDSelector,
                              Where <UploadFileWithIDSelector.name,
                                     Equal <Required <UploadFileWithIDSelector.name> > > > .Select(graph, HttpUtility.UrlDecode(fileName));

                if (cur != null)
                {
                    graph.Files.Current = cur;
                }
                PXRedirectHelper.TryRedirect(graph, PXRedirectHelper.WindowMode.Same);
            }
            catch (PXRedirectRequiredException ex)
            {
                string url = PX.Web.UI.PXDataSource.getMainForm(ex.Graph.GetType());
                if (url != null)
                {
                    ex.Graph.Unload();
                    PXContext.Session.RedirectGraphType[PXUrl.ToAbsoluteUrl(url)] = ex.Graph.GetType();
                    Response.Redirect(this.ResolveUrl/**/ (url));
                    //throw new PXRedirectRequiredException(url, ex.Graph, "Redirect0:" + this.ResolveUrl/**/(url));
                }
            }
        }
        //if (Page.IsPostBack && !Page.IsCallback)
        //	AcceptInput();

        //int page = 0;
        //int.TryParse(Request.Params["page"], out page);
        string query = TrimLongString(txtSearch.Text);

        switch (searchType)
        {
        case SearchService.SearchLookupType.ActiveModule:
        case SearchService.SearchLookupType.AllEntities:
            if (PerformSearchEntity(query, pageIndex))
            {
                divMessage.Visible = false;
            }
            break;

        case SearchService.SearchLookupType.ActiveWiki:
        case SearchService.SearchLookupType.AllHelp:
            if (PerformSearchArticle(query, pageIndex))
            {
                divMessage.Visible = false;
            }
            break;

        case SearchService.SearchLookupType.Files:
            if (PerformSearchFile(query, pageIndex))
            {
                divMessage.Visible = false;
            }
            break;
        }
    }
    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);
                    }
                }
            }
        }
    }