Exemple #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string message          = Request.Params["message"];
        string exceptionID      = Request.Params["exceptionID"];
        string errorcode        = Request.Params["errorcode"];
        string typeID           = Request.Params["typeID"];
        bool   showLogoutButton = (!string.IsNullOrEmpty(Request.Params["showLogoutButton"]) && Request.Params["showLogoutButton"].Trim().ToLower() == "true");

        this.Title = ErrorMessages.GetLocal(ErrorMessages.ErrorHasOccurred);

        ((HyperLink)this.frmBottom.FindControl("lnkTrace")).Text = ErrorMessages.GetLocal(ErrorMessages.ShowTrace);

        if (typeID != null)
        {
            SetUserFriendlyInfoWarning(errorcode, exceptionID);
        }
        else if (exceptionID != null && PXContext.Session.Exception[exceptionID] != null)
        {
            PXException exception = (PXException)PXContext.Session.Exception[exceptionID];
            PXSetupNotEnteredException setPropException = exception as PXSetupNotEnteredException;

            if (setPropException != null)
            {
                string url = GetNextUrl(ref setPropException);
                if (url != null)
                {
                    url = PXPageCache.FixPageUrl(ControlHelper.FixHideScriptUrl(url, null));
                }
                SetUserFriendlyInfo(url, setPropException.NavigateTo, setPropException.ExceptionNumber.ToString(), setPropException.MessageNoPrefix);
            }
            else
            {
                SetDefaultExceptionInfo(exception.ExceptionNumber.ToString(), exception.MessageNoPrefix);
            }
        }
        else if (!String.IsNullOrEmpty(message))
        {
            SetDefaultExceptionInfo(null, message);
        }
        else
        {
            SetDefaultVisibility();
        }

        if (this.User.IsAnonymous())
        {
            ((HyperLink)this.frmBottom.FindControl("lnkTrace")).Visible = false;
        }

        ((Button)this.frmBottom.FindControl("btnLogout")).Visible =
            User != null &&
            User.Identity != null &&
            User.Identity.IsAuthenticated &&
            User.Identity.Name != "anonymous" &&
            showLogoutButton;

        this.Server.ClearError();
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string message     = Request.Params["message"];
        string exceptionID = Request.Params["exceptionID"];
        string errorcode   = Request.Params["errorcode"];
        string typeID      = Request.Params["typeID"];

        ((HyperLink)this.frmBottom.FindControl("lnkTrace")).Text = ErrorMessages.GetLocal(ErrorMessages.ShowTrace);

        if (typeID != null)
        {
            SetUserFriendlyInfoWarning(errorcode, System.Web.HttpUtility.HtmlEncode(exceptionID));
        }
        else if (exceptionID != null && PXContext.Session.Exception[exceptionID] != null)
        {
            PXException exception = (PXException)PXContext.Session.Exception[exceptionID];
            PXSetupNotEnteredException setPropException = exception as PXSetupNotEnteredException;

            if (setPropException != null)
            {
                string url = GetNextUrl(ref setPropException);
                if (url != null)
                {
                    url = PXPageCache.FixPageUrl(ControlHelper.FixHideScriptUrl(url, null));
                }
                SetUserFriendlyInfo(url, setPropException.NavigateTo, setPropException.ExceptionNumber.ToString(), setPropException.MessageNoPrefix);
            }
            else
            {
                SetDefaultExceptionInfo(exception.ExceptionNumber.ToString(), exception.MessageNoPrefix);
            }
        }
        else if (!String.IsNullOrEmpty(message))
        {
            SetDefaultExceptionInfo(null, message);
        }
        else
        {
            SetDefaultVisibility();
        }

        if (this.User == null || this.User.Identity == null || !this.User.Identity.IsAuthenticated || this.User.Identity.Name == "anonymous")
        {
            ((HyperLink)this.frmBottom.FindControl("lnkTrace")).Visible = false;
        }

        this.Server.ClearError();
    }
Exemple #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
        {
            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);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string exceptionID = Request.Params["exceptionID"];
        string errorcode   = Request.Params["errorcode"];
        string typeID      = Request.Params["typeID"];

        if (typeID != null)
        {
            SetUserFriendlyInfoWarning(errorcode, exceptionID);
        }
        else
        {
            if (exceptionID != null && PXContext.Session.Exception[exceptionID] != null)
            {
                PXException exception = (PXException)PXContext.Session.Exception[exceptionID];
                PXSetupNotEnteredException setPropException = exception as PXSetupNotEnteredException;

                if (setPropException != null)
                {
                    string url = GetNextUrl(ref setPropException);
                    if (url != null)
                    {
                        url = PXPageCache.FixPageUrl(ControlHelper.FixHideScriptUrl(url, null));
                    }
                    SetUserFriendlyInfo(url, setPropException.NavigateTo, setPropException.ExceptionNumber.ToString(), setPropException.MessageNoPrefix);
                }
                else
                {
                    SetDefaultExceptionInfo(exception.ExceptionNumber.ToString(), exception.MessageNoPrefix);
                }
            }
            else
            {
                SetDefaultVisibility();
            }
        }
        this.Server.ClearError();
    }
    //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 virtual void _(Events.RowSelected <ARInvoice> e)
        {
            var ex = new PXSetupNotEnteredException("Setup is not entered");

            throw ex;
        }
Exemple #7
0
        public IEnumerable action3(PXAdapter adapter)
        {
            var exception = new PXSetupNotEnteredException <Users>(null);

            throw exception;
        }
Exemple #8
0
        public void RowSelected(PXCache sender, PXRowSelectedEventArgs e)
        {
            var ex = new PXSetupNotEnteredException("Setup is not entered", typeof(SOInvoice));

            throw ex;
        }