private void btn_Logout_ItemClick(object sender, ItemClickEventArgs e) { if (XtraMessageBox.Show("Bạn có chắc muốn đăng xuất không?" , "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { SqlRequestFunction.Logout(Program.mlogin); if (Program.conn.State == ConnectionState.Open) { Program.conn.Close(); } this.Dispose(); } catch (SqlException) { MessageBox.Show("Không thể đăng xuất. Vui lòng thử lại." , "Lỗi đăng xuất." , MessageBoxButtons.OK , MessageBoxIcon.Error); return; } } }
private void btn_DeleteAccount_ItemClick(object sender, ItemClickEventArgs e) { if (XtraMessageBox.Show("Bạn có chắc muốn xóa tài khoản không?" , "Confirmation", MessageBoxButtons.YesNo) == DialogResult.Yes) { try { ChangeCurrentLogToKillSession(); SqlRequestFunction.Logout(Program.mlogin); if (SqlRequestFunction.DeleteAccount(Program.mlogin, Program.username)) { if (Program.conn.State == ConnectionState.Open) { Program.conn.Close(); } MessageBox.Show("Xóa tài khoản thành công.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); } this.Dispose(); } catch (SqlException) { MessageBox.Show("Không thể đăng xuất. Vui lòng thử lại." , "Lỗi đăng xuất." , MessageBoxButtons.OK , MessageBoxIcon.Error); return; } } }