private void btn_login_Click(object sender, EventArgs e) { Credential_DB cDB = new Credential_DB(); cDB.Name = txt_name.Text; cDB.UserName = txt_username.Text; cDB.Password = txt_password.Text; if (rbtn_owner.Checked) { cDB.UserType = "Owner"; } else if (rbtn_staff.Checked) { cDB.UserType = "Staff"; } if (cDB.Authenticate(cDB)) { Home hform = new Home(); hform.lbl_GetIDhere.Text = txt_username.Text; hform.lbl_GetUsertype.Text = cDB.UserType; txt_password.Text = ""; hform.Show(); MessageBox.Show("Login Successfully"); } else { MessageBox.Show("Login Failed"); } }
private void btn_ChangePassword_Click(object sender, EventArgs e) { Credential_DB cDB = new Credential_DB(); cDB.UserName = label1.Text; cDB.UserType = label2.Text; cDB.Password = txt_OldPassword.Text; if (cDB.Authenticate(cDB)) { if (txt_NewPassword.Text == txt_Confirmpassword.Text) { cDB.Password = txt_NewPassword.Text; cDB.changemypassword(cDB); MessageBox.Show("Password Changed Successfully"); } else { MessageBox.Show("Password doesnot match"); } } else { MessageBox.Show("old password is incorrect"); } }