/// <summary> /// 窗体加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmHomeWork_Load(object sender, EventArgs e) { try { CommonUtil.BindComboBox(cboJobState, "Id", "Name", CommonUtil.listJobState); CommonUtil.BindComboBox(cboSubject, "CourseID", "CourseName", CommonUtil.listSubject); if (CommonUtil.listJobState.Count > 0) { cboJobState.SelectedValue = 1; } if (CommonUtil.listSubject.Count == 2) { cboSubject.SelectedIndex = 1; } else { cboSubject.SelectedIndex = 0; } } catch (Exception ex) { LogHelper.WriteLog(typeof(frmHomeWork), ex); CommonUtil.WriteLog(ex); } }
private void frmResource_Load(object sender, EventArgs e) { try { CommonUtil.BindComboBox(cboResourceType, "ID", "Name", CommonUtil.listResourceType); CommonUtil.BindComboBox(cboResourceModel, "Id", "Name", CommonUtil.listResourceModel); CommonUtil.BindComboBox(cboSubject, "CourseID", "CourseName", CommonUtil.listSubject); if (CommonUtil.listSubject.Count == 2) { cboSubject.SelectedIndex = 1; } else { cboSubject.SelectedIndex = 0; } publicClass.BindDataGridViewColumn(dgvResult.Columns["ResourceModel"] as DataGridViewComboBoxColumn, "Id", "Name", CommonUtil.listResourceModel); cboResourceModel.SelectedValueChanged += cboResourceModel_SelectedValueChanged; cboSubject.SelectedValueChanged += cboSubject_SelectedValueChanged; } catch (Exception ex) { LogHelper.WriteLog(typeof(frmHomeWork), ex); CommonUtil.WriteLog(ex); } }
/// <summary> /// 加载题库列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmDownTopicDB_Load(object sender, EventArgs e) { CommonUtil.BindComboBox(cboSubject, "CourseID", "CourseName", CommonUtil.listSubject); if (CommonUtil.listSubject.Count == 2) { cboSubject.SelectedIndex = 1; } else { cboSubject.SelectedIndex = 0; } cboSubject.SelectedValueChanged += cboSubject_SelectedValueChanged; }
private void cboSubject_SelectedValueChanged(object sender, EventArgs e) { try { string courseId = cboSubject.SelectedValue.ToString(); List <M_MyJob> listMyJob = CommonUtil.listMyJob.Where(l => l.CourseID == courseId).ToList(); listMyJob.Insert(0, new M_MyJob() { HWID = "0", HWName = "---请选择---" }); CommonUtil.BindComboBox(cboJob, "HWID", "HWName", listMyJob); } catch (Exception ex) { PublicClass.ShowErrorMessageOk(ex.Message); LogHelper.WriteLog(typeof(frmHomeWork), ex.Message); } }
private void frmBrowse_Load(object sender, EventArgs e) { try { CommonUtil.BindComboBox(cboSubject, "CourseID", "CourseName", CommonUtil.listSubject); if (CommonUtil.listSubject.Count == 2) { cboSubject.SelectedIndex = 1; } else { cboSubject.SelectedIndex = 0; } cboSubject.SelectedValueChanged += cboSubject_SelectedValueChanged; cboSubject_SelectedValueChanged(this, e); } catch (Exception ex) { LogHelper.WriteLog(typeof(frmHomeWork), ex.Message); } }
private void frmStatisticalAnalysis_Load(object sender, EventArgs e) { try { SetChartVisible(true); CommonUtil.BindComboBox(cboSubject, "CourseID", "CourseName", CommonUtil.listSubject); if (CommonUtil.listSubject.Count == 2) { cboSubject.SelectedIndex = 1; } else { cboSubject.SelectedIndex = 0; } cboSubject.SelectedValueChanged += cboSubject_SelectedValueChanged; cboSubject_SelectedValueChanged(this, e); } catch (Exception ex) { LogHelper.WriteLog(typeof(frmHomeWork), ex); CommonUtil.WriteLog(ex); } }