public frmAddRule(PaperRule rule) { InitializeComponent(); Init(rule.Course); nupdCount.Value = rule.Count; nupdPLevel.Value = rule.PLevel; nupdScore.Value = rule.Score; cboChapterList.SelectedIndex = dtChapter.Rows.IndexOf(dtChapter.Select("UnitName=\'" + rule.ChapterName + "\'").First()); cboPType.SelectedIndex = dtPType.Rows.IndexOf(dtPType.Select("PType=\'" + rule.PTypeName + "\'").First()); }
private void btnOK_Click(object sender, EventArgs e) { NewRule = new PaperRule(); NewRule.Chapter = Convert.ToInt32(cboChapterList.SelectedValue); NewRule.Course = CourseId; NewRule.PType = (ProblemType)(Convert.ToInt32(cboPType.SelectedValue)); NewRule.PLevel = (int)nupdPLevel.Value; NewRule.Score = (int)nupdScore.Value; NewRule.Count = (int)nupdCount.Value; NewRule.ChapterName = dtChapter.Rows[cboChapterList.SelectedIndex][0].ToString(); NewRule.PTypeName = dtPType.Rows[cboPType.SelectedIndex][0].ToString(); this.Close(); }
private void btnCancel_Click(object sender, EventArgs e) { NewRule = null; this.Close(); }