void LoadData() { try { dtBangDiem = new DataTable(); dtBangDiem.Clear(); DataSet ds = dbBD.LayBangDiem(); dtBangDiem = ds.Tables[0]; gcBangDiem.DataSource = dtBangDiem; dtMonHoc = new DataTable(); dtMonHoc.Clear(); DataSet dsMH = dbMH.LayMonHoc(); dtMonHoc = dsMH.Tables[0]; lookUpMaMH.Properties.DataSource = dtMonHoc; lookUpMaMH.Properties.DisplayMember = "MaMH"; lookUpMaMH.Properties.ValueMember = "MaMH"; dtSinhVien = new DataTable(); dtSinhVien.Clear(); DataSet dsSV = dbSV.LaySinhVien(); dtSinhVien = dsSV.Tables[0]; lookUpMaSV.Properties.DataSource = dtSinhVien; lookUpMaSV.Properties.DisplayMember = "MaSV"; lookUpMaSV.Properties.ValueMember = "MaSV"; this.lookUpMaSV.ResetText(); this.txtTenSV.ResetText(); this.txtMaLop.ResetText(); this.lookUpMaMH.ResetText(); this.txtDiemL1.ResetText(); this.txtDiemL2.ResetText(); this.txtDiemQT.ResetText(); this.txtDiemKT.ResetText(); this.txtDiemTK.ResetText(); this.spinHocKy.ResetText(); this.txtKhoaHoc.ResetText(); this.chkKetQua.Reset(); this.btnLuu.Enabled = false; this.btnHuy.Enabled = false; this.layoutControl1.Enabled = false; this.btnThem.Enabled = true; this.btnSua.Enabled = true; this.btnXoa.Enabled = true; this.btnSuaDiem.Enabled = true; this.btnTroVe.Enabled = true; gvBangDiem_RowCellClick(null, null); } catch (SqlException) { XtraMessageBox.Show("Không lấy được nội dung trong table BangDiem. Lỗi rồi!!!"); } }
public void LoadData() { try { dtMonHoc = new DataTable(); dtMonHoc.Clear(); DataSet ds = dbMonHoc.LayMonHoc(); dtMonHoc = ds.Tables[0]; dgvMonHoc.DataSource = dtMonHoc; dgvMonHoc.AutoResizeColumns(); this.txtMaMon.ResetText(); this.txtTenMon.ResetText(); this.txtSoTinChi.ResetText(); this.btnLuu.Enabled = false; this.btnHuyBo.Enabled = false; this.grbTTCT.Enabled = false; this.btnThem.Enabled = true; this.btnSua.Enabled = true; this.btnXoa.Enabled = true; this.btnLuu.BackgroundImage = image_save_off; this.btnHuyBo.BackgroundImage = image_cancel_off; this.btnThem.BackgroundImage = image_add; this.btnSua.BackgroundImage = image_update; this.btnXoa.BackgroundImage = image_delete; this.lblLuu.ForeColor = Color.Gray; this.lblHuyBo.ForeColor = Color.Gray; this.lblThem.ForeColor = Color.SteelBlue; this.lblSua.ForeColor = Color.SteelBlue; this.lblXoa.ForeColor = Color.SteelBlue; dgvMonHoc_CellClick(null, null); } catch (SqlException) { MessageBox.Show("Không lấy được nội dung trong table MON. Lỗi rồi!!!"); } }
void LoadData() { try { dtMonHoc = new DataTable(); dtMonHoc.Clear(); DataSet ds = dbMH.LayMonHoc(); dtMonHoc = ds.Tables[0]; gcMonHoc.DataSource = dtMonHoc; dtGiangVien = new DataTable(); dtGiangVien.Clear(); DataSet dsGV = dbGV.LayGiangVien(); dtGiangVien = dsGV.Tables[0]; lookUpMaGV.Properties.DataSource = dtGiangVien; lookUpMaGV.Properties.DisplayMember = "MaGV"; lookUpMaGV.Properties.ValueMember = "MaGV"; this.txtMaMH.ResetText(); this.txtTenMH.ResetText(); this.spinSoTC.ResetText(); this.lookUpMaGV.ResetText(); this.btnLuu.Enabled = false; this.btnHuy.Enabled = false; this.layoutControl1.Enabled = false; this.btnThem.Enabled = true; this.btnSua.Enabled = true; this.btnXoa.Enabled = true; this.btnTroVe.Enabled = true; gvMonHoc_RowCellClick(null, null); } catch (SqlException) { XtraMessageBox.Show("Không lấy được nội dung trong table THANHPHO. Lỗi rồi!!!"); } }