示例#1
0
    private void CheckStillVisible()
    {
        // This function duplicates the check done in Page_Load, after a membership has been removed.
        // If the displayed person is no longer visible, then the viewer is redirected to Member Search.

        Person displayedPerson = Person.FromIdentity(Convert.ToInt32("" + Request["id"]));

        Person    viewingPerson = Person.FromIdentity(Int32.Parse(HttpContext.Current.User.Identity.Name));
        Authority authority     = viewingPerson.GetAuthority();

        if (!authority.CanSeePerson(displayedPerson))
        {
            Page.ClientScript.RegisterStartupScript(typeof(Page), "RedirectMessage",
                                                    "alert ('After your removal of this membership, this person no longer has any visible memberships. This person is no longer visible. Therefore, you are being redirected to the Member Search page.'); document.location.href='Search.aspx';",
                                                    true);
        }
    }