Exemplo n.º 1
0
        private void dataGridViewSach_Sach_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row = dataGridViewSach_Sach.CurrentRow;

            if (!string.IsNullOrEmpty(row.Cells[0].Value.ToString()) && !string.IsNullOrEmpty(row.Cells[1].Value.ToString()))
            {
                textBoxMaSach_Sach.Text        = row.Cells[0].Value.ToString();
                textBoxMaDauSach_Sach.Text     = row.Cells[1].Value.ToString();
                textBoxTenSach_Sach.Text       = row.Cells[2].Value.ToString();
                checkBoxTinhTrang_Sach.Checked = (bool)row.Cells[3].Value;
                sach_MaSach = Convert.ToInt32(row.Cells[0].Value);

                dataGridViewDauSach_Sach.DataSource            = dauSachBUS.DauSach_Sach(Convert.ToInt32(row.Cells[1].Value));
                dataGridViewDauSach_Sach.Columns[0].HeaderText = "Mã Đầu Sách";
                dataGridViewDauSach_Sach.Columns[1].HeaderText = "Tên Đầu Sách";
                dataGridViewDauSach_Sach.Columns[2].HeaderText = "Mã Kệ Sách";
                dataGridViewDauSach_Sach.Columns[3].HeaderText = "Số Lượng Hiện Tại";
                dataGridViewDauSach_Sach.Columns[4].HeaderText = "Tổng Số";
            }
        }