private void btnKhoiPhucPhieuNhap_Click(object sender, EventArgs e) { List <CTPhieuNhapDTO> lsCTPhieuNhap = new List <CTPhieuNhapDTO>(); foreach (DataGridViewRow row in dgvCTPhieuNhap.Rows) { CTPhieuNhapDTO ctPhieuNhap = new CTPhieuNhapDTO(); ctPhieuNhap.MaNguyenLieu = Convert.ToInt32(row.Cells["colCTPN_MaNguyenLieu"].Value); ctPhieuNhap.SoLuong = Convert.ToInt32(row.Cells["colCTPN_SoLuong"].Value); lsCTPhieuNhap.Add(ctPhieuNhap); } if (PhieuNhapBUS.KhoiPhucPhieuNhap(Convert.ToInt32(dgvPhieuNhap.SelectedRows[0].Cells["colPN_MaPhieuNhap"].Value), lsCTPhieuNhap)) { MessageBox.Show("Khôi phục thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LSPN_LoadDanhSachPhieuNhapDaXoa(); dgvCTPhieuNhap.DataSource = null; dgvPhieuNhap.ClearSelection(); btnKhoiPhucPhieuNhap.Enabled = false; } else { MessageBox.Show("Khôi phục thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }