void LoadDSHSLenListview() { List <HocSinh> listHS = new List <HocSinh>(); string malop = cbMaLop.Text; string [] listma = malop.Split('('); malop = listma[0]; listHS = hocsinhbll.GetDSHocSinh(cbDSNH.Text, cbDSHocKy.Text, malop); //MessageBox.Show(malop); int STT = 1; lvDSHS.Items.Clear(); foreach (HocSinh hs in listHS) { ListViewItem lvi = new ListViewItem(STT + ""); lvi.SubItems.Add(hs.MaHocSinh); lvi.SubItems.Add(hs.HoVaTen); lvi.SubItems.Add(hs.GioiTinh); STT++; lvDSHS.Items.Add(lvi); } }
/// <summary> /// int listview =1 la lisstview lop cu. 2 la lop moi 3 la listView xepLop-dshoc sinh trong lop duoc chuyen den /// </summary> /// <param name="listView"></param> /// <param name="maNamHoc"></param> /// <param name="maHocKy"></param> /// <param name="maLop"></param> void LoadDanhSachHocSinh(int listView, string maNamHoc, string maHocKy, string maLop) { List <HocSinh> listDSHocSinhCoDK; if (listView != 3) { string[] splitMaLop = maLop.Split('('); maLop = splitMaLop[1]; splitMaLop = maLop.Split(')'); maLop = splitMaLop[0]; } listDSHocSinhCoDK = hocSinhbll.GetDSHocSinh(maNamHoc, maHocKy, maLop); int STT = 1; if (listView == 1) { lvDSHSCu_CL.Items.Clear(); foreach (HocSinh hocsinh in listDSHocSinhCoDK) { ListViewItem lvi = new ListViewItem(STT.ToString()); lvi.SubItems.Add(hocsinh.MaHocSinh); lvi.SubItems.Add(hocsinh.HoVaTen); lvDSHSCu_CL.Items.Add(lvi); STT++; } } if (listView == 2) { lvDSHSMoi_CL.Items.Clear(); foreach (HocSinh hocsinh in listDSHocSinhCoDK) { ListViewItem lvi = new ListViewItem(STT.ToString()); lvi.SubItems.Add(hocsinh.MaHocSinh); lvi.SubItems.Add(hocsinh.HoVaTen); lvDSHSMoi_CL.Items.Add(lvi); STT++; } } else { lvDSHS_MHXL.Items.Clear(); foreach (HocSinh hocsinh in listDSHocSinhCoDK) { ListViewItem lvi = new ListViewItem(STT.ToString()); lvi.SubItems.Add(hocsinh.MaHocSinh); lvi.SubItems.Add(hocsinh.HoVaTen); lvDSHS_MHXL.Items.Add(lvi); STT++; } } }