private void Dgvban_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex != -1)
     {
         DataGridViewRow row = dgvban.Rows[e.RowIndex];
         txtmaban.Text  = row.Cells["maban"].Value.ToString();
         txttenban.Text = row.Cells["tenban"].Value.ToString();
         cbbkhuvuc.Text = row.Cells["khuvuc"].Value.ToString();
         string matrangthai = row.Cells["matrangthai"].Value.ToString();
         if (matrangthai == "elimi")
         {
             txbtentrangthai.Text = "Dừng hoạt động";
             OptimizedPerformance.disableButton(new Button[] { btnxoa, btnsua });
         }
         else
         {
             OptimizedPerformance.enableButton(new Button[] { btnxoa, btnsua });
             txbtentrangthai.Text = "Hoạt động bình thường";
         }
         if (row.Cells["ngayxoaban"] != null)
         {
             txbngayxoa.Text = row.Cells["ngayxoaban"].Value.ToString();
         }
     }
 }
 private void Dgvnhanvien_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex != -1 && e.RowIndex < dgvnhanvien.RowCount - 1)
     {
         DataGridViewRow row = dgvnhanvien.Rows[e.RowIndex];
         textBox3.Text       = row.Cells["manv"].Value.ToString();
         txbngayvaolam.Text  = row.Cells["ngayvaolamnv"].Value.ToString();
         cbbmacv.Text        = row.Cells["macv"].Value.ToString();
         cbbmabp.Text        = row.Cells["mabp"].Value.ToString();
         txttennv.Text       = row.Cells["tennv"].Value.ToString();
         txtemail.Text       = row.Cells["emailnv"].Value.ToString();
         txtdiachi.Text      = row.Cells["diachinv"].Value.ToString();
         txtsotk.Text        = row.Cells["sotaikhoan"].Value.ToString();
         txttendangnhap.Text = row.Cells["tendangnhapnv"].Value.ToString();
         txtmatkhau.Text     = row.Cells["matkhaunv"].Value.ToString();
         txtsodt.Text        = row.Cells["dienthoainv"].Value.ToString();
         dgvnhanvien.Tag     = row.Cells["manv"].Value.ToString();
         string matrangthai = row.Cells["matrangthainv"].Value.ToString();
         if (matrangthai == "elimi")
         {
             txbghichunhanvien.Text = "Nhân viên đã rời khỏi\n\tVào ngày: " + row.Cells["ngaynghiviec"].Value.ToString();
             OptimizedPerformance.disableButton(new Button[] { btnsuanhanvien, btnxoanhanvien });
         }
         else
         {
             OptimizedPerformance.enableButton(new Button[] { btnsuanhanvien, btnxoanhanvien });
             txbghichunhanvien.Text = "Bình thường";
         }
     }
 }
 private void DgvKhachhang_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex != -1 && e.RowIndex < dgvKhachhang.RowCount - 1)
     {
         DataGridViewRow row = dgvKhachhang.Rows[e.RowIndex];
         txbmakh.Text         = row.Cells["makh"].Value.ToString();
         txbloaikh.Text       = dgvKhachhang.Rows[e.RowIndex].Tag.ToString();
         txbtenkh.Text        = row.Cells["tenkh"].Value.ToString();
         txbdienthoaikh.Text  = row.Cells["dienthoaikh"].Value.ToString();
         txbdiachikh.Text     = row.Cells["diachikh"].Value.ToString();
         dpngaysinhkh.Value   = DateTime.Parse(row.Cells["ngaysinhkh"].Value.ToString());
         txbemailkh.Text      = row.Cells["emailkh"].Value.ToString();
         txbdiemkh.Text       = row.Cells["diemkh"].Value.ToString();
         txbtiendatieukh.Text = row.Cells["tiendatieukh"].Value.ToString();
         dgvKhachhang.Tag     = row.Cells["makh"].Value.ToString();
         string matrangthai = row.Cells["matrangthaikh"].Value.ToString();
         if (matrangthai == "elimi")
         {
             txbghichukh.Text = "Đã xóa TK vào ngày " + row.Cells["ngayhuytk"].Value.ToString();
             OptimizedPerformance.disableButton(new Button[] { btnSuakh, btnXoakh });
         }
         else
         {
             OptimizedPerformance.enableButton(new Button[] { btnSuakh, btnXoakh });
             txbghichukh.Text = "Hoạt động bình thường";
         }
         if (row.Cells["ngayhuytk"] != null)
         {
             txbngayxoa.Text = row.Cells["ngayhuytk"].Value.ToString();
         }
     }
 }
        private void Dgvmonan_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1 && e.RowIndex < dgvmonan.Rows.Count - 1)
            {
                imgboxxemtruoc.Image = null;
                DataGridViewRow row = dgvmonan.Rows[e.RowIndex];
                txtmamon.Text  = row.Cells["mamon"].Value.ToString();
                txttenmon.Text = row.Cells["tenmon"].Value.ToString();
                txtgiaban.Text = row.Cells["giaban"].Value.ToString();
                rtbmota.Text   = row.Cells["mota"].Value.ToString();
                cbbdvt.Text    = row.Cells["dvt"].Value.ToString();
                if ((Byte[])(row.Cells["hinhanh"].Value) != null && ((Byte[])(row.Cells["hinhanh"].Value)).Length > 0)
                {
                    Byte[] data = new Byte[0];
                    data            = (Byte[])(row.Cells["hinhanh"].Value);
                    dataImageToZoom = (Byte[])(row.Cells["hinhanh"].Value);
                    MemoryStream mem = new MemoryStream(data);
                    imgboxxemtruoc.Image = Image.FromStream(mem);
                }

                string trangthaimonan = row.Cells["matrangthaimonan"].Value.ToString();
                if (trangthaimonan == "elimi")
                {
                    txbtrangthaimonan.Text = "Đã dừng phục vụ";
                    OptimizedPerformance.disableButton(new Button[] { btnsuamon, btnxoamon });
                }
                else
                {
                    OptimizedPerformance.enableButton(new Button[] { btnsuamon, btnxoamon });
                    txbtrangthaimonan.Text = "Vẫn còn phục vụ";
                }
                if (row.Cells["ngayxoamon"] != null)
                {
                    txbngayxoamonan.Text = row.Cells["ngayxoamon"].Value.ToString();
                }
            }
        }