private void check_CheckedChanged(object sender, EventArgs e) { if (check.Checked == true && txtTimMaDT.Text == "" && txtTimTenDT.Text == "") { listDeTai.Items.Clear(); string displaysinhvien = ""; List <DeTai> lstdt = DeTaiController.danhsachDTKhongCoSinhVien(); foreach (DeTai detai in lstdt) { displaysinhvien = ""; foreach (SinhVien u in detai.SinhViens) { displaysinhvien = displaysinhvien + u + ", "; } ListViewItem dt = new ListViewItem(detai.MaDT); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.TenDT)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.MoTaDT)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.NgayBatDau.ToString())); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.NgayKetThuc.ToString())); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.TienDoDT.ToString())); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, displaysinhvien)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.MaGV)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, GiaoVienController.getExistGV(detai.MaGV).HoTen)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.NhanXet)); this.listDeTai.Items.Add(dt); } } if (check.Checked == false && txtTimMaDT.Text == "" && txtTimTenDT.Text == "") { listDeTai.Items.Clear(); string displaysinhvien = ""; List <DeTai> lstdt = DeTaiController.danhsachDT(); foreach (DeTai detai in lstdt) { displaysinhvien = ""; foreach (SinhVien u in detai.SinhViens) { displaysinhvien = displaysinhvien + u + ", "; } ListViewItem dt = new ListViewItem(detai.MaDT); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.TenDT)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.MoTaDT)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.NgayBatDau.ToString())); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.NgayKetThuc.ToString())); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.TienDoDT.ToString())); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, displaysinhvien)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.MaGV)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, GiaoVienController.getExistGV(detai.MaGV).HoTen)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.NhanXet)); this.listDeTai.Items.Add(dt); } } if (check.Checked == true && (txtTimMaDT.Text != "" || txtTimTenDT.Text != "")) { listDeTai.Items.Clear(); string displaysinhvien = ""; List <DeTai> lstdt = DeTaiController.TimKiemDeTaiKhiCoCheck(txtTimMaDT.Text, txtTimTenDT.Text); foreach (DeTai detai in lstdt) { displaysinhvien = ""; foreach (SinhVien u in detai.SinhViens) { displaysinhvien = displaysinhvien + u + ", "; } ListViewItem dt = new ListViewItem(detai.MaDT); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.TenDT)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.MoTaDT)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.NgayBatDau.ToString())); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.NgayKetThuc.ToString())); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.TienDoDT.ToString())); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, displaysinhvien)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.MaGV)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, GiaoVienController.getExistGV(detai.MaGV).HoTen)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.NhanXet)); this.listDeTai.Items.Add(dt); } } if (check.Checked == false && (txtTimMaDT.Text != "" || txtTimTenDT.Text != "")) { listDeTai.Items.Clear(); string displaysinhvien = ""; List <DeTai> lstdt = DeTaiController.TimKiemDeTaiKhiKhongCheck(txtTimMaDT.Text, txtTimTenDT.Text); foreach (DeTai detai in lstdt) { displaysinhvien = ""; foreach (SinhVien u in detai.SinhViens) { displaysinhvien = displaysinhvien + u + ", "; } ListViewItem dt = new ListViewItem(detai.MaDT); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.TenDT)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.MoTaDT)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.NgayBatDau.ToString())); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.NgayKetThuc.ToString())); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.TienDoDT.ToString())); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, displaysinhvien)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.MaGV)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, GiaoVienController.getExistGV(detai.MaGV).HoTen)); dt.SubItems.Add(new ListViewItem.ListViewSubItem(dt, detai.NhanXet)); this.listDeTai.Items.Add(dt); } } }