private void btnThanhToan_Click(object sender, EventArgs e) { if (grdHoaDon.Rows.Count == 0) { return; } try { DialogResult ok = new DialogResult(); ok = MessageBox.Show("Tính tiền cho bàn " + btnBanDaChon.Text + " ?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (ok == DialogResult.Yes) { MessageBox.Show("Tổng tiền là " + lblTongTien.Text, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); Tien(); string s = "UPDATE HoaDon SET TrangThai = '1' WHERE MaBan = '" + MaBan_Luu + "'"; KetNoiSQL.ExecuteNonQuery(s); DanhSachBan(); DanhSachHoaDon(MaBan_Luu); Tien(); } else { return; } } catch { MessageBox.Show("Bạn chưa chọn bàn thanh toán", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnLuu_Click(object sender, EventArgs e) { if (txtMatKhau_Cu.Text == "") { MessageBox.Show("Mật khẩu cũ không được trống", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); txtMatKhau_Cu.Focus(); return; } if (txtMatKhau_Moi.Text == "") { MessageBox.Show("Mật khẩu mới không được trống", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); txtMatKhau_Moi.Focus(); return; } if ((txtMatKhau_Moi.Text != txtMatKhau_NhapLai.Text)) { MessageBox.Show("Nhập lại mật khẩu không trùng khớp", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); txtMatKhau_Moi.Focus(); return; } if (txtMatKhau_Cu.Text != frmDangNhap.MatKhau_Luu) { MessageBox.Show("Mật khẩu cũ không chính xác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); txtMatKhau_Cu.Focus(); return; } string strSQL = string.Format(@"UPDATE TaiKhoan_NhanVien set MatKhau = '" + txtMatKhau_Moi.Text + "' where MaTK_NV = '" + txtMaTK_NV.Text + "'"); KetNoiSQL.ExecuteNonQuery(strSQL); MessageBox.Show("Đổi mật khẩu thành công ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); this.Close(); }