public void LoadBangDauSach() { dgvDSSach.DataSource = null; dgvDSSach.DataSource = DauSach_BUS.LoadDauSach(); var vtSeXoa = new List <int>(); if (cuaFrmPhieuMuon.Rows.Count > 1) { for (var i = 0; i < dgvDSSach.Rows.Count - 1; i++) { for (var j = 0; j < cuaFrmPhieuMuon.Rows.Count - 1; j++) { var meMaDauSach = dgvDSSach.Rows[i].Cells["MaDauSach"].Value.ToString(); var meMaSach = dgvDSSach.Rows[i].Cells["STT"].Value.ToString(); var youMaDauSach = cuaFrmPhieuMuon.Rows[j].Cells["MaDauSach"].Value.ToString(); var youMaSach = cuaFrmPhieuMuon.Rows[j].Cells["MaSach"].Value.ToString(); if (youMaDauSach == meMaDauSach && youMaSach == meMaSach) { vtSeXoa.Add(i); break; } } } } foreach (var i in vtSeXoa.ToArray().Reverse()) { dgvDSSach.Rows.RemoveAt(i); } }
public void LoadDauSach() { dgvDSDauSach.DataSource = DauSach_BUS.LoadDauSach(); }