private void capNhat() { if (flag == true) { LopBUS adapterLop = new LopBUS(); Lop[] Danh_Sach_Lop = adapterLop.getAllClass_BUS(); int chi_soHK = combHocKi.SelectedIndex; int chi_soMH = combMonHoc.SelectedIndex; if (chi_soHK >= 0 && chi_soMH >= 0) { HocKi[] HK = (HocKi[])combHocKi.Tag; HocKi KQHK = HK[chi_soHK]; MonHoc[] MonHoc = (MonHoc[])combMonHoc.Tag; MonHoc KQMH = MonHoc[chi_soMH]; monHoc = KQMH.TenMonHoc; hocKi = KQHK.TenHocKi; DataTable dt = new DataTable(); dt.Columns.Add("Stt"); dt.Columns.Add("tenLop"); dt.Columns.Add("siSo"); dt.Columns.Add("soLuongDat"); dt.Columns.Add("tiLe"); int stt = 0; int i = 0; noiDungBaoCao = new BaoCaoTongKetMon[Danh_Sach_Lop.Length]; foreach (Lop lop in Danh_Sach_Lop) { BaoCaoTongKetMon temp = new BaoCaoTongKetMon(); DataRow dr = dt.NewRow(); dt.Rows.Add(dr); temp.Stt = stt; dr["Stt"] = stt++; dr["tenLop"] = lop.TenLop; dr["siSo"] = lop.SiSo; int soLuongDat = adapterLop.soLuongDat(KQMH.MaMonHoc, KQHK.MaHocKi, lop.MaLop); dr["soLuongDat"] = soLuongDat; dr["tiLe"] = (float)soLuongDat / lop.SiSo * 100 + "%"; temp.TenLop = lop.TenLop; temp.SiSo = lop.SiSo; temp.SoLuongDat = soLuongDat; temp.TiLe = (float)soLuongDat / lop.SiSo * 100 + "%"; noiDungBaoCao[i] = temp; i++; } dgvBaoCao.DataSource = dt; } } }
private void frmThayDoiBangDiem_Load(object sender, EventArgs e) { LopBUS adaterLop = new LopBUS(); HocKiBUS adapterHK = new HocKiBUS(); MonHocBUS adapterMH = new MonHocBUS(); if (flag == false) { combMonHoc.DataSource = adapterMH.getAllMH_BUS(); combMonHoc.DisplayMember = "tenMonHoc"; combMonHoc.Tag = adapterMH.getAllMH_BUS(); combHK.DataSource = adapterHK.getAllHK_BUS(); combHK.DisplayMember = "tenHocKi"; combHK.Tag = adapterHK.getAllHK_BUS(); combLop.DataSource = adaterLop.getAllClass_BUS(); combLop.DisplayMember = "tenLop"; combLop.Tag = adaterLop.getAllClass_BUS(); flag = true; } XL_Chon(); }