private void btnResetPass_Click(object sender, EventArgs e) { ForgotPassword forgetpass = new ForgotPassword(); UserResetPassword.CreateSecurityTable("create"); this.Hide(); forgetpass.Show(); }
private void btnSubmit_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(txQuest1.Text)) { throw new Exception("Question 1 is empty"); } if (string.IsNullOrEmpty(txtAnswer1.Text)) { throw new Exception("Answer for question 1 is empty"); } if (string.IsNullOrEmpty(txtQuest2.Text)) { throw new Exception("Question 2 is empty"); } if (string.IsNullOrEmpty(txtAnswer2.Text)) { throw new Exception("Answer for question 2 is empty"); } UserResetPassword.CreateSecurityTable(); var Questionchecked = UserResetPassword.CheckSecurityQuestions(); if (Questionchecked == 0) { //inset these questions UserResetPassword.SetSecurityQuestions(txQuest1.Text, txtAnswer1.Text, txtQuest2.Text, txtAnswer2.Text); MessageBox.Show("Question Set Successfully", "Security Questions", MessageBoxButtons.OK, MessageBoxIcon.Information); Clear(); } else { //update the questions UserResetPassword.UpdateSecurityQuestions(txQuest1.Text, txtAnswer1.Text, txtQuest2.Text, txtAnswer2.Text); MessageBox.Show("Question Updated Successfully", "Security Questions", MessageBoxButtons.OK, MessageBoxIcon.Information); Clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Set Question Error", MessageBoxButtons.OK, MessageBoxIcon.Information); } }