private void classcombo_SelectedIndexChanged(object sender, EventArgs e) { if (classcombo.SelectedItem != null) { if (Lop.Checked == true) { dshsgrid.Rows.Clear(); HSB.Loadhsl(classcombo.SelectedItem.ToString()); foreach (var s in HocSinhDTO.lisths) { string gt = ""; if (s.Gioitinh == true) { gt = "Nam"; } else { gt = "Nữ"; } DataGridViewRow row = new DataGridViewRow(); DataGridViewCell cell = new DataGridViewTextBoxCell(); cell.Value = s.Name; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = s.Clas; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = gt; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = s.Ngsinh; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = s.Diachi; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = s.Email; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = s.HK11; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = s.HK21; row.Cells.Add(cell); dshsgrid.Rows.Add(row); } } } }
private void classcombo_SelectedIndexChanged(object sender, EventArgs e) { if (classcombo.SelectedItem != null) { if (Lop.Checked == true) { dshsgrid.Rows.Clear(); HSB.Loadhsl(classcombo.SelectedItem.ToString()); foreach (var s in HocSinhDTO.lisths) { string gt = ""; if (s.Gioitinh == true) { gt = "Nam"; } else { gt = "Nữ"; } DataGridViewRow row = new DataGridViewRow(); DataGridViewCell cell = new DataGridViewTextBoxCell(); cell.Value = s.Name; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = s.Clas; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = gt; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = s.Ngsinh; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = s.Diachi; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = s.Email; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = s.HK11; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = s.HK21; row.Cells.Add(cell); dshsgrid.Rows.Add(row); } subjectoffclassGrid.Rows.Clear(); string tt1 = classcombo.SelectedItem.ToString(); HSB.loadBCM(); var qq = from s in CTMonHoc.ctmh join c in clasDTO.lop on s.MaLop1 equals c.MaL1 join d in CTMonHoc.mh on s.MaMon1 equals d.MaMon1 join f in HocKi.HK on s.MaHK1 equals f.MaHK1 select new { s.MaHK1, s.MaMon1, f.TenHK1, c.TenL1, d.TenMon1 }; foreach (var kq in qq.ToList()) { if (kq.TenL1 == tt1) { DataGridViewRow row = new DataGridViewRow(); DataGridViewCell cell = new DataGridViewTextBoxCell(); cell.Value = kq.TenMon1; row.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = kq.TenHK1; row.Cells.Add(cell); string x = kq.MaHK1.ToString(); char[] ar = x.ToCharArray(); string nam = ar[1].ToString() + ar[2].ToString() + ar[3].ToString() + ar[4].ToString(); cell = new DataGridViewTextBoxCell(); cell.Value = nam; row.Cells.Add(cell); subjectoffclassGrid.Rows.Add(row); } } } } }