//trỏ từng dòng trong gridview private void gvDSLHP_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (gvDSLHP.FocusedRowHandle >= 0) { tbMaLHP.Text = gvDSLHP.GetFocusedRowCellValue(colMaLHP).ToString(); cboKhoa.Text = ChuanHoa(gvDSLHP.GetFocusedRowCellValue(colTenKhoa).ToString().ToLower()); cboGiaoVien.Text = ChuanHoa(gvDSLHP.GetFocusedRowCellValue(colTenGV).ToString().ToLower()); cboMonHoc.Text = ChuanHoa(gvDSLHP.GetFocusedRowCellValue(colTenMH).ToString().ToLower()); cboKyHoc.Text = gvDSLHP.GetFocusedRowCellValue(colKyHoc).ToString(); if (gvDSLHP.GetFocusedRowCellValue(colNgayThi).ToString() != "") { dtpNgayThi.Value = DateTime.Parse(gvDSLHP.GetFocusedRowCellValue(colNgayThi).ToString()); } //DataTable dtb = LopHocPhan_BUS.timeLHP(Convert.ToInt32(tbMaLHP.Text)); //if (dtb.Rows[0][0].ToString()!="") // dtpNgayBatDau.Value = DateTime.Parse(dtb.Rows[0][0].ToString()); //if (dtb.Rows[0][1].ToString() != "") // dtpNgayKetThuc.Value = DateTime.Parse(dtb.Rows[0][1].ToString()); if (gvDSLHP.GetFocusedRowCellValue(colNgayBatDau).ToString() != "") { dtpNgayBatDau.Value = DateTime.Parse(gvDSLHP.GetFocusedRowCellValue(colNgayBatDau).ToString()); } if (gvDSLHP.GetFocusedRowCellValue(colNgayKetThuc).ToString() != "") { dtpNgayKetThuc.Value = DateTime.Parse(gvDSLHP.GetFocusedRowCellValue(colNgayKetThuc).ToString()); } LHPbindingSource.DataSource = LopHocPhan_BUS.LHP(tbMaLHP.Text); gcLHP.DataSource = LHPbindingSource; } }
private void btnCapNhat_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //load lại DSLHP LoadDSLHP(); //load lại danh sách sinh viên trong LHP if (gvDSLHP.FocusedRowHandle >= 0) { LHPbindingSource.DataSource = LopHocPhan_BUS.LHP(gvDSLHP.GetFocusedRowCellValue(colMaLHP).ToString()); gcLHP.DataSource = LHPbindingSource; } }
private void btnXuatExcel_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { //BindingSource LHPbindingSource = new BindingSource(); //LHPbindingSource.DataSource = LopHocPhan_BUS.LHP(tbMaLHP.Text); //DataTable dt = (DataTable)LHPbindingSource.DataSource; DataTable dt = LopHocPhan_BUS.LHP(tbMaLHP.Text); dt.TableName = "allstudents"; Report report = new Report(); report.report_LHP("", dt, tbMaLHP.Text, tbMaLHP.Text, cboMonHoc.Text, cboGiaoVien.Text, dtpNgayThi.Value.Year.ToString()); }
private void btnHuyDiem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { LHPbindingSource.DataSource = LopHocPhan_BUS.LHP(gvDSLHP.GetFocusedRowCellValue(colMaLHP).ToString()); gcLHP.DataSource = LHPbindingSource; }