private void fAddFile_Load(object sender, EventArgs e) { DataTable dt = conn.GetDataTable("select * from tKieu"); cbKieu.DataSource = dt; cbKieu.ValueMember = "ID"; cbKieu.DisplayMember = "TenKieu"; if (!Them)//Sửa nhóm câu hỏi { NhomCauHoiDao _dao = new NhomCauHoiDao(); int idNhomCauHoi = 0; idNhomCauHoi = _fMain.LayMaNhomCauHoi(); DataTable _dTable = _dao.LayDSNhomCauHoiTheoID(idNhomCauHoi); foreach (DataRow row in _dTable.Rows) { txtTenFile.Text = row["TenFile"].ToString(); //tenFile = row["TenFile"].ToString(); cbKieu.SelectedValue = row["IDKieu"]; lbDuongDan.Text = row["DuongDan"].ToString(); txtTenFile.Text = lbDuongDan.Text.Substring(lbDuongDan.Text.LastIndexOf("\\") + 1); nudDiem.Value = Convert.ToDecimal(row["Diem"]); cbLoaiKho.SelectedText = Convert.ToString(row["LoaiKho"]); nudSoCau.Value = Convert.ToInt32(row["SoCauMacDinh"]); } } else//Thêm nhóm câu hỏi { cbKieu.SelectedIndex = 0; cbLoaiKho.SelectedIndex = 0; nudSoCau.Value = 1; } }
private void fInfoTest_Load(object sender, EventArgs e) { ConnectData conn = new ConnectData(); DataTable dt = conn.GetDataTable("select * from tKieu"); cbHinhThucThi.DataSource = dt; cbHinhThucThi.ValueMember = "ID"; cbHinhThucThi.DisplayMember = "TenKieu"; // cbGiaiThich.SelectedIndex = 0; cbHinhThucThi.SelectedIndex = 0; cbKieuDeThi.SelectedIndex = 0; cbTenCau.SelectedIndex = 0; cbTepMau.SelectedIndex = 0; cbTieuDeNhom.SelectedIndex = 0; }
private void fEditItemListViewFile_Load(object sender, EventArgs e) { DataTable dt = conn.GetDataTable("select * from tKieu"); cbKieu.DataSource = dt; cbKieu.ValueMember = "ID"; cbKieu.DisplayMember = "TenKieu"; cbKieu.SelectedIndex = 0; if (!Them) { NhomCauHoiDto dto = new NhomCauHoiDto(); dto = _fMain.LayNhomCauHoiTuListView(); txtTenFile.Text = dto.TenFile; //Tên file nudSoCau.Value = Convert.ToDecimal(dto.SoCauMacDinh); //Số câu đc chọn nudDiem.Value = dto.Diem; //Điểm cbLoaiKho.Text = dto.LoaiKho.ToString(); //Loại khó lbDuongDan.Text = dto.DuongDan; cbKieu.SelectedValue = dto.IdKieu; } }