Example #1
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            if (ControlValidation.Isblank(txtUsername.Text.Trim()) == true || ControlValidation.IsReserveWord(txtUsername.Text.Trim().ToLower()))
            {
                lblError.Text    = "Please enter Username !";
                txtUsername.Text = "";
                txtUsername.Focus();
            }
            else if (ControlValidation.Isblank(txtAnswer1.Text.Trim()) == true || ControlValidation.IsReserveWord(txtAnswer1.Text.Trim().ToLower()))
            {
                lblError.Text   = "Enter Answar for Question1 !";
                txtAnswer1.Text = "";
                txtAnswer1.Focus();
            }
            else if (ControlValidation.Isblank(txtAnswer2.Text.Trim()) == true || ControlValidation.IsReserveWord(txtAnswer2.Text.Trim().ToLower()))
            {
                lblError.Text   = "Enter Answar for Question2 !";
                txtAnswer2.Text = "";
                txtAnswer2.Focus();
            }

            else
            {
                var result = CheckAnswer();
                if (result.Result)
                {
                    if ((MessageBox.Show("Are you Sure to Reset the Password ???", "Password Reset", MessageBoxButtons.YesNo) == DialogResult.Yes))
                    {
                        NewPassword newpasswordform = new NewPassword();
                        newpasswordform.userName = txtUsername.Text.Trim();
                        newpasswordform.userID   = Convert.ToInt32(txthiddenUserID.Text.Trim());
                        newpasswordform.Show();
                        this.Hide();
                    }
                    else
                    {
                        ForgotPassword forgotPasswordform = new ForgotPassword();
                        forgotPasswordform.Show();
                    }
                }
                else
                {
                    lblError.Text = result.Message;
                }
            }
        }