Exemplo n.º 1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Establishment es  = (Establishment)Session["establishment"];
        string        np  = tbxnewPass.Text;
        string        np2 = tbxnewPassRepeat.Text;

        if (es.Password != tbxCurrentPsw.Text)
        {
            lblCP.Visible = true;
            return;
        }
        else
        {
            lblCP.Visible = false;
            if (np == np2)
            {
                es.Password = np;
                int num = EstablishmentDB.updateEstPassowrd(es);
                if (num != 1)
                {
                    lblOutput.Text = "Cannot Change Password!";
                }
                else
                {
                    lblOutput.Text = "Password Updated!";
                    //auto refresh the page
                    string MyAccountUrl = "EMyAccount.aspx";
                    Page.Header.Controls.Add(new LiteralControl(string.Format(@" <META http-equiv='REFRESH' content=2;url={0}> ", MyAccountUrl)));
                }
            }
            else
            {
                lblOutput.Text        = "New password and repeat password is not matching!";
                tbxnewPassRepeat.Text = "";
                tbxnewPass.Text       = "";
            }
        }
    }