示例#1
0
    protected void approveAll_Click(object sender, EventArgs e)
    {
        StringBuilder usernames = new StringBuilder();

        for (int i = 0; i < GridViewMemberUser.Rows.Count; i++)
        {
            GridViewRow row    = GridViewMemberUser.Rows[i];
            CheckBox    select = (CheckBox)row.FindControl("chkSelect");
            usernames.Append(select.ToolTip + ",");
        }
        SnitzMembershipProvider smp = (SnitzMembershipProvider)Membership.Providers["SnitzMembershipProvider"];

        string[] arrUsers = usernames.ToString().TrimEnd(',').Split(',');
        foreach (string user in arrUsers)
        {
            if (smp != null)
            {
                if (SnitzMembershipProvider.ActivateUser(user))
                {
                    //smp.UnlockUser(user);
                    Roles.AddUserToRole(user, "Member");
                    EmailConfirmation(user);
                }
            }
        }
        GridViewMemberUser.DataBind();
    }
示例#2
0
    protected void delSel_Click(object sender, EventArgs e)
    {
        StringBuilder str = new StringBuilder();

        for (int i = 0; i < GridViewMemberUser.Rows.Count; i++)
        {
            GridViewRow row    = GridViewMemberUser.Rows[i];
            CheckBox    select = (CheckBox)row.FindControl("chkSelect");
            if (select.Checked)
            {
                str.Append(select.ToolTip + ",");
            }
        }

        SnitzProfileProvider pro = (SnitzProfileProvider)ProfileManager.Providers["TableProfileProvider"];
        string usernameList      = str.ToString().TrimEnd(',');

        if (pro != null)
        {
            pro.DeleteProfiles(usernameList.Split(','));
        }

        foreach (string user in usernameList.Split(','))
        {
            var mp = new SnitzMembershipProvider();
            mp.DeleteUser(user, true);
            //Membership.DeleteUser(user,true);
        }
        GridViewMemberUser.DataBind();
    }
示例#3
0
    protected void ButtonNewUser_Click(object sender, EventArgs e)
    {
        //if (TextBoxUserName.Text.Length > 0 && TextBoxPassword.Text.Length > 0)
        //{
        ObjectDataSourceMembershipUser.InsertParameters["UserName"].DefaultValue         = TextBoxUserName.Text;;
        ObjectDataSourceMembershipUser.InsertParameters["password"].DefaultValue         = TextBoxPassword.Text;
        ObjectDataSourceMembershipUser.InsertParameters["passwordQuestion"].DefaultValue = TextBoxPasswordQuestion.Text;
        ObjectDataSourceMembershipUser.InsertParameters["passwordAnswer"].DefaultValue   = TextBoxPasswordAnswer.Text;
        ObjectDataSourceMembershipUser.InsertParameters["email"].DefaultValue            = TextBoxEmail.Text;
        ObjectDataSourceMembershipUser.InsertParameters["isApproved"].DefaultValue       = CheckboxApproval.Checked == true ? "true" : "false";

        ObjectDataSourceMembershipUser.Insert();
        GridViewMemberUser.DataBind();
        TextBoxUserName.Text         = "";
        TextBoxPassword.Text         = "";
        TextBoxEmail.Text            = "";
        TextBoxPasswordAnswer.Text   = "";
        TextBoxPasswordQuestion.Text = "";
        CheckboxApproval.Checked     = false;
        //}
    }
示例#4
0
 protected void DetailsView1_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
 {
     GridViewMemberUser.DataBind();
 }