private void btnResetPassword_Click(object sender, EventArgs e) { if (dtgvAccount.CurrentRow.Index == dtgvAccount.Rows.Count - 1) { return; } clsTaiKhoanDangNhap cls = new clsTaiKhoanDangNhap(); cls.ID_TaiKhoanDangNhap = int.Parse(dtgvAccount.Rows[dtgvAccount.CurrentRow.Index].Cells[0].Value.ToString()); cls.SelectOne(); cls.MatKhau = GlobalMethods.MD5Hash("1"); cls.Update(); MessageBox.Show("Reset mật khẩu thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadAccount(); }
private void btnDeleteAccount_Click(object sender, EventArgs e) { if (dtgvAccount.CurrentRow.Index == dtgvAccount.Rows.Count - 1) { return; } clsTaiKhoanDangNhap cls = new clsTaiKhoanDangNhap(); cls.ID_TaiKhoanDangNhap = int.Parse(dtgvAccount.Rows[dtgvAccount.CurrentRow.Index].Cells[0].Value.ToString()); cls.SelectOne(); cls.TonTai = false; cls.Update(); MessageBox.Show("Xóa thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadAccount(); }
private void btnEditAccount_Click(object sender, EventArgs e) { if (dtgvAccount.CurrentRow.Index == dtgvAccount.Rows.Count - 1) { return; } if (!IsValid()) { return; } clsTaiKhoanDangNhap cls = new clsTaiKhoanDangNhap(); cls.ID_TaiKhoanDangNhap = int.Parse(dtgvAccount.Rows[dtgvAccount.CurrentRow.Index].Cells[0].Value.ToString()); cls.SelectOne(); cls.TenDangNhap = txtUserName.Text.Trim(); cls.TenDayDu = txtTenDayDu.Text.Trim(); cls.TonTai = true; cls.Update(); MessageBox.Show("Cập nhật thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadAccount(); }