/// <summary> /// Load thong tin chung cua hoc sinh bao gom ca diem len listview DSHS /// </summary> void LoadDSHS_DSHS() { List <ThongTinChungHS_DiemTB> listThongTinChungHocSinh = hocSinhbll.GetDanhSachHocSinh_ThongTinChung_Diem(cbNH_DSHS.Text); lvdshs.Items.Clear(); int soThuTu = 1; HocKyBLL hockybll = new HocKyBLL(); List <HocKy> listhocky = hockybll.GetListHocKy(); foreach (ThongTinChungHS_DiemTB hocsinh in listThongTinChungHocSinh) { int indexHocKy = 0; for (int i = 0; i < listhocky.Count; i++) { if (listhocky[i].MaHocKy == hocsinh.maHocKy) { indexHocKy = i + 4; } } bool kiemTraTonTai = false; if (lvdshs.Items.Count > 0) { foreach (ListViewItem lvitem in lvdshs.Items) { if (lvitem.SubItems[1].Text == hocsinh.maHocSinh) { kiemTraTonTai = true; lvitem.SubItems[indexHocKy].Text = hocsinh.diemTB; break; } } } if (!kiemTraTonTai) { ListViewItem lvi = new ListViewItem(soThuTu + ""); lvi.SubItems.Add(hocsinh.maHocSinh); lvi.SubItems.Add(hocsinh.TenHocSinh); lvi.SubItems.Add(hocsinh.Lop); lvi.SubItems.Add("-"); // diem tb hoc ki 1 lvi.SubItems.Add("-"); // dim trung binh hk 2 lvi.SubItems.Add("-"); // dim trung binh hk 3 lvi.SubItems.Add("-"); // dim trung binh hk 4 lvi.SubItems[indexHocKy].Text = hocsinh.diemTB; lvdshs.Items.Add(lvi); soThuTu++; } } }
/// <summary> /// Load hoc ky len combobox man hinh xep lop /// </summary> void LoadHocKy_XL() { HocKyBLL hocKybll = new HocKyBLL(); List <HocKy> listHocKy = hocKybll.GetListHocKy(); List <string> listmaHocKy = new List <string>(); foreach (HocKy hocky in listHocKy) { listmaHocKy.Add(hocky.MaHocKy); } cbHocKy_XL.DataSource = listmaHocKy; }
void LoadDSHocKy() { List <HocKy> listHocKy = hockybll.GetListHocKy(); List <string> nameHocKy = new List <string>(); // nameHocKy.Add("Chọn tất cả."); foreach (HocKy hocKy in listHocKy) { nameHocKy.Add(hocKy.MaHocKy); } cbDSHocKy.DataSource = nameHocKy; }
void LoadHocKy_BangDiemMonHoc() { HocKyBLL hockybll = new HocKyBLL(); List <HocKy> listHK = hockybll.GetListHocKy(); List <string> nameHocKy = new List <string>(); //nameHocKy.Add("Chọn tất cả."); foreach (HocKy hocKy in listHK) { nameHocKy.Add(hocKy.MaHocKy); } cbDSHocKy.DataSource = nameHocKy; }
/// <summary> /// Load hoc ky len combobox man hinh chuyen lop /// </summary> void LoadHK_CL() { HocKyBLL hocKybll = new HocKyBLL(); List <HocKy> listHocKy = hocKybll.GetListHocKy(); List <string> listmaHKCu = new List <string>(); List <string> listmaHKMoi = new List <string>(); foreach (HocKy hocky in listHocKy) { listmaHKCu.Add(hocky.MaHocKy); listmaHKMoi.Add(hocky.MaHocKy); } cbHK_ChuyenLopCu.DataSource = listmaHKCu; cbHocKy_ChuyenLopMoi.DataSource = listmaHKMoi; }
/// <summary> /// Load header cac column len listview, vi day la danh sach hoc ki dong /// </summary> void LoadColumnHocKyLenListView() { HocKyBLL hockybll = new HocKyBLL(); List <HocKy> listHocKy = hockybll.GetListHocKy(); foreach (HocKy hocky in listHocKy) { ColumnHeader header = new ColumnHeader() { Name = hocky.MaHocKy, Text = "Điểm TB " + hocky.MaHocKy, Width = 110 }; lvdshs.Columns.Add(header); } ColumnHeader colltemp1 = new ColumnHeader() { Name = "temp1", Text = "", Width = 0 }; lvdshs.Columns.Add(colltemp1); ColumnHeader colltemp2 = new ColumnHeader() { Name = "temp2", Text = "", Width = 0 }; lvdshs.Columns.Add(colltemp2); ColumnHeader colltemp3 = new ColumnHeader() { Name = "temp3", Text = "", Width = 0 }; lvdshs.Columns.Add(colltemp3); ColumnHeader colltemp4 = new ColumnHeader() { Name = "temp4", Text = "", Width = 0 }; lvdshs.Columns.Add(colltemp4); }
/// <summary> /// Load danh sach hoc ky len combobox theo tabpage /// </summary> void LoadDanhSachHocKy(int index) { HocKyBLL hockybll = new HocKyBLL(); List <HocKy> DanhSachHocKy = hockybll.GetListHocKy(); List <string> DanhSachMaHocKy = new List <string>(); foreach (HocKy hocky in DanhSachHocKy) { DanhSachMaHocKy.Add(hocky.MaHocKy); } if (index == 1) { cbHocKy_BCHK.DataSource = DanhSachMaHocKy; } else { cbHocKy_BCMH.DataSource = DanhSachMaHocKy; } }
/// <summary> /// Load thong tin chung cua hoc sinh bao gom ca diem len listview DSHS /// </summary> void LoadDSHS_DSHS() { DShocsinhBLL hocSinhbll = new DShocsinhBLL(); List <ThongTinChungHS_DiemTB> listThongTinChungHocSinh; if (cbTieuChiTimKiem.SelectedIndex == 0) { listThongTinChungHocSinh = hocSinhbll.GetDanhSachHocSinh_ThongTinChung_TimKiemTheoTen(tbTuKhoaTimKiem.Text); } else if (cbTieuChiTimKiem.SelectedIndex == 2) { try { string[] listdiem = tbTuKhoaTimKiem.Text.Split(' '); float canTren = float.Parse(listdiem[1]); float canDuoi = float.Parse(listdiem[0]); listThongTinChungHocSinh = hocSinhbll.GetDanhSachHocSinh_ThongTinChung_TimKiemTheoDiemTB(canDuoi, canTren); } catch { MessageBox.Show("Không đúng định dạng tìm kiếm", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else // if (cbTieuChiTimKiem.SelectedIndex == 1) { listThongTinChungHocSinh = hocSinhbll.GetDanhSachHocSinh_ThongTinChung_TimKiemTheoLop(tbTuKhoaTimKiem.Text); } lvdshs.Items.Clear(); int soThuTu = 1; HocKyBLL hockybll = new HocKyBLL(); List <HocKy> listhocky = hockybll.GetListHocKy(); foreach (ThongTinChungHS_DiemTB hocsinh in listThongTinChungHocSinh) { int indexHocKy = 0; for (int i = 0; i < listhocky.Count; i++) { if (listhocky[i].MaHocKy == hocsinh.maHocKy) { indexHocKy = i + 4; } } bool kiemTraTonTai = false; if (lvdshs.Items.Count > 0) { foreach (ListViewItem lvitem in lvdshs.Items) { if (lvitem.SubItems[1].Text == hocsinh.maHocSinh) { kiemTraTonTai = true; lvitem.SubItems[indexHocKy].Text = hocsinh.diemTB; break; } } } if (!kiemTraTonTai) { ListViewItem lvi = new ListViewItem(soThuTu + ""); lvi.SubItems.Add(hocsinh.maHocSinh); lvi.SubItems.Add(hocsinh.TenHocSinh); lvi.SubItems.Add(hocsinh.Lop); lvi.SubItems.Add("-"); // diem tb hoc ki 1 lvi.SubItems.Add("-"); // dim trung binh hk 2 lvi.SubItems.Add("-"); // dim trung binh hk 3 lvi.SubItems.Add("-"); // dim trung binh hk 4 lvi.SubItems[indexHocKy].Text = hocsinh.diemTB; lvdshs.Items.Add(lvi); soThuTu++; } } }