示例#1
0
    //update facilitator account info
    protected void UpdateBtn_Click(object sender, EventArgs e)
    {
        CustomPrincipal cp = HttpContext.Current.User as CustomPrincipal;
        CSS             requestDirector = new CSS();

        //get facilitator info
        Facilitator activeFac = new Facilitator();

        activeFac.FacilitatorID = Convert.ToInt32(cp.Identity.Name);
        activeFac = requestDirector.GetFacilitator(activeFac.FacilitatorID);

        //check if facilitator changed email
        if (Emailtxt.Text != activeFac.Email)
        {
            //if new email, check if email already in use
            if (requestDirector.GetFacilitatorByEmail(Emailtxt.Text).Email == default(string))
            {
                activeFac.Email        = Emailtxt.Text;
                activeFac.FirstName    = FNametxt.Text;
                activeFac.LastName     = LNametxt.Text;
                activeFac.Title        = Titletxt.Text;
                activeFac.Organization = Orgtxt.Text;
                activeFac.Location     = Loctxt.Text;

                if (requestDirector.UpdateFacilitator(activeFac))
                {
                    Msglbl.Text = "Account Information Updated";
                }
                else
                {
                    Msglbl.Text = "Account Information Update Failed";
                }
            }
            else
            {
                Msglbl.Text = "That email is used by another account";
            }
        }
        else
        {
            activeFac.Email        = Emailtxt.Text;
            activeFac.FirstName    = FNametxt.Text;
            activeFac.LastName     = LNametxt.Text;
            activeFac.Title        = Titletxt.Text;
            activeFac.Organization = Orgtxt.Text;
            activeFac.Location     = Loctxt.Text;

            if (requestDirector.UpdateFacilitator(activeFac))
            {
                Msglbl.Text = "Account Information Updated";
            }
            else
            {
                Msglbl.Text = "Account Information Update Failed";
            }
        }
    }
示例#2
0
    //update facilitator password
    protected void UpdatePasswordBtn_Click(object sender, EventArgs e)
    {
        CustomPrincipal cp = HttpContext.Current.User as CustomPrincipal;
        CSS             requestDirector = new CSS();

        //get facilitator info
        Facilitator activeFac = new Facilitator();

        activeFac.FacilitatorID = Convert.ToInt32(cp.Identity.Name);
        activeFac = requestDirector.GetFacilitator(activeFac.FacilitatorID);

        //if valid password, update facilitator account with new hash
        if (activeFac.Password == requestDirector.CreatePasswordHash(oldPasswordtxt.Text, activeFac.Salt))
        {
            activeFac.Password = requestDirector.CreatePasswordHash(Passwordtxt.Text, activeFac.Salt);

            if (requestDirector.UpdateFacilitator(activeFac))
            {
                Pswdlbl.Text = "Account Password Updated";
            }
            else
            {
                Pswdlbl.Text = "Account Password Update Failed";
            }
        }
    }