private void btn_close_Click(object sender, EventArgs e) { this.Hide(); var frm_login = new frm_login(); frm_login.ShowDialog(); this.Close(); }
private void btnlogout_Click(object sender, EventArgs e) { var result = MessageBox.Show("Are you sure you wan't to logout?", "Confirm", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { this.Hide(); var frm_login = new frm_login(); frm_login.ShowDialog(); this.Close(); } }
private void btn_logout_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Are you sure you want to logout?", "Logout", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { clearAccount(); this.Hide(); var frm_login = new frm_login(); frm_login.ShowDialog(); this.Close(); } }
private void btn_save_Click(object sender, EventArgs e) { if (txt_old_password.Text.Trim() == "") { MessageBox.Show("Old Password is empty.", "Validation"); txt_old_password.Focus(); } else if (txt_new_password.Text.Trim() == "") { MessageBox.Show("New Password is empty.", "Validation"); txt_new_password.Focus(); } else if (txt_v_new_password.Text.Trim() == "") { MessageBox.Show("Verify Password is empty.", "Validation"); txt_v_new_password.Focus(); } else if (Cryptography.Encrypt(txt_old_password.Text.Trim()) != Cryptography.Encrypt(Global.Account_Password)) { MessageBox.Show("Incorrect old password.", "Error"); txt_old_password.Focus(); } else if (txt_old_password.Text.Trim() == txt_new_password.Text.Trim()) { MessageBox.Show("Old password and new password is equal.", "Validation"); txt_old_password.Focus(); txt_new_password.Clear(); txt_v_new_password.Clear(); } else if (txt_new_password.Text.Trim() != txt_v_new_password.Text.Trim()) { MessageBox.Show("New paassword is not equal to validate password.", "Validation"); txt_new_password.Clear(); txt_v_new_password.Clear(); txt_new_password.Focus(); } else { DialogResult dialogResult = MessageBox.Show("Are you sure you want to save new password?", "New Password", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { try { using (MySqlConnection conn = new MySqlConnection(Global.MyConn)) { conn.Open(); string password = Cryptography.Encrypt(txt_new_password.Text.Trim()); string query = "UPDATE tbl_user Set password = '******' where id='" + Global.AccountID + "'"; MySqlCommand command = new MySqlCommand(query, conn); command.ExecuteReader(); conn.Close(); MessageBox.Show("Save Successfully"); SetAccount(); this.Hide(); if (Global.FromLogin) { var frm_login = new frm_login(); frm_login.ShowDialog(); } this.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }