コード例 #1
0
    protected void btnCreateUser_Click(object sender, EventArgs e)
    {
        TextBox password = (TextBox)ctrlPD.FindControl("txtPassword");

        //Create Person with User.
        newPerson = ctrlPD.GetPersonDetails();
        newUser   = MembershipManager.CreateUser(newPerson.Id, password.Text);
        newUser.PasswordChangeRequired = true;
        newUser.Person = newPerson;
        PersonManager.CreatePerson(newUser, newPerson);

        //Attach regions to person if any.
        UpsertRegions(newUser.Person);

        //Attach sites to the person if any.
        UpsertSites(newUser.Person);

        //attach groups to the person if any.
        AddGroups(newUser.Person);

        //create feedback
        string   usernameLink = "<a href=../Directory/PersonDetails.aspx?id=" + newUser.Person.Id + ">" + newUser.Name + "</a>";
        Feedback feedBack     = new Feedback(BusiBlocksConstants.Blocks.Documents.BlockName, "User", Feedback.Actions.Created, usernameLink);

        Session["feedback"] = feedBack;

        Navigation.Admin_SearchUsers().Redirect(this);
    }