Ejemplo n.º 1
0
        private void dgvThucDon_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvThucDon.Rows.Count > 1)
            {
                if (dgvThucDon.CurrentRow.Index < dgvThucDon.Rows.Count - 1)
                {
                    TD = busTD.curTD(dgvThucDon.CurrentRow.Cells[0].FormattedValue.ToString());

                    lbTenMon.Text     = TD.TenTD;
                    btThem.Enabled    = true;
                    btAdd1.Enabled    = true;
                    btRemove1.Enabled = true;
                    dgvHDCT.Enabled   = true;
                }
            }
        }
Ejemplo n.º 2
0
        private void DgvThucDon_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (DgvThucDon.Rows.Count > 1)
            {
                if (DgvThucDon.CurrentRow.Index < DgvThucDon.Rows.Count - 1)
                {
                    btOpenDialog.Enabled = true;
                    btLuu.Enabled        = false;
                    btXoa.Enabled        = true;
                    btCapNhat.Enabled    = true;
                    btBoQua.Enabled      = true;
                    txtTenMon.Enabled    = true;
                    txtDonGia.Enabled    = true;
                    txtNhom.Enabled      = true;
                    txtMoTa.Enabled      = true;
                    txtTenMon.Focus();

                    DTO_ThucDon td = busThucDon.curTD(DgvThucDon.CurrentRow.Cells["TenTD"].Value.ToString());
                    txtTenMon.Text = td.TenTD;
                    txtDonGia.Text = td.GiaBan.ToString();
                    txtNhom.Text   = td.Nhom;
                    txtMoTa.Text   = td.MoTa;

                    MemoryStream mem = new MemoryStream(busThucDon.getHinhTD(td.MaTD));
                    ptbThucDon.BackgroundImage       = Image.FromStream(mem);
                    ptbThucDon.BackgroundImageLayout = ImageLayout.Stretch;

                    if (td.TrangThai == 1)
                    {
                        btEnable.Enabled = false;
                    }
                    else
                    {
                        btEnable.Enabled = true;
                    }
                }
            }
        }