private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (Configure == null) { return; } CloneConfigure dialog = new CloneConfigure() { ParentName = Configure.Name }; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Configure conf = new Configure(); conf.Name = dialog.NewConfigureName; conf.ExamRecord = Configure.ExamRecord; conf.PrintSubjectList.AddRange(Configure.PrintSubjectList); conf.RankFilterTagList.AddRange(Configure.RankFilterTagList); conf.RankFilterTagName = Configure.RankFilterTagName; conf.RefenceExamRecord = Configure.RefenceExamRecord; conf.SchoolYear = Configure.SchoolYear; conf.Semester = Configure.Semester; conf.SubjectLimit = Configure.SubjectLimit; conf.ScoreCurDate = Configure.ScoreCurDate; conf.TagRank1SubjectList.AddRange(Configure.TagRank1SubjectList); conf.TagRank1TagList.AddRange(Configure.TagRank1TagList); conf.TagRank1TagName = Configure.TagRank1TagName; conf.TagRank2SubjectList.AddRange(Configure.TagRank2SubjectList); conf.TagRank2TagList.AddRange(Configure.TagRank2TagList); conf.TagRank2TagName = Configure.TagRank2TagName; conf.Template = Configure.Template; conf.Encode(); conf.AvgRd = Configure.AvgRd; conf.Save(); _Configures.Add(conf); cboConfigure.Items.Insert(cboConfigure.Items.Count - 1, conf); cboConfigure.SelectedIndex = cboConfigure.Items.Count - 2; } }
private void linkLabel3_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (Configure == null) return; CloneConfigure dialog = new CloneConfigure() { ParentName = Configure.Name }; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Configure conf = new Configure(); conf.Name = dialog.NewConfigureName; conf.ExamRecord = Configure.ExamRecord; conf.PrintSubjectList.AddRange(Configure.PrintSubjectList); conf.RankFilterTagList.AddRange(Configure.RankFilterTagList); conf.RankFilterTagName = Configure.RankFilterTagName; conf.RefenceExamRecord = Configure.RefenceExamRecord; conf.SchoolYear = Configure.SchoolYear; conf.Semester = Configure.Semester; conf.SubjectLimit = Configure.SubjectLimit; conf.TagRank1SubjectList.AddRange(Configure.TagRank1SubjectList); conf.TagRank1TagList.AddRange(Configure.TagRank1TagList); conf.TagRank1TagName = Configure.TagRank1TagName; conf.TagRank2SubjectList.AddRange(Configure.TagRank2SubjectList); conf.TagRank2TagList.AddRange(Configure.TagRank2TagList); conf.TagRank2TagName = Configure.TagRank2TagName; conf.Template = Configure.Template; conf.Encode(); conf.Save(); _Configures.Add(conf); cboConfigure.Items.Insert(cboConfigure.Items.Count - 1, conf); cboConfigure.SelectedIndex = cboConfigure.Items.Count - 2; } }
private void cboConfigure_SelectedIndexChanged(object sender, EventArgs e) { if (cboConfigure.SelectedIndex == cboConfigure.Items.Count - 1) { //新增 btnSaveConfig.Enabled = btnPrint.Enabled = false; NewConfigure dialog = new NewConfigure(); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Configure = new Configure(); Configure.Name = dialog.ConfigName; Configure.Template = dialog.Template; Configure.SubjectLimit = dialog.SubjectLimit; Configure.ScoreCurDate = dialog.ScoreCurDate; Configure.DisciplineDetailLimit = dialog.DisciplineDetailLimit; Configure.ServiceLearningDetailLimit = dialog.ServiceLearningDetailLimit; Configure.SchoolYear = _DefalutSchoolYear; Configure.Semester = _DefaultSemester; if (cboExam.Items.Count > 0) { Configure.ExamRecord = (ExamRecord)cboExam.Items[0]; } _Configures.Add(Configure); cboConfigure.Items.Insert(cboConfigure.SelectedIndex, Configure); cboConfigure.SelectedIndex = cboConfigure.SelectedIndex - 1; Configure.Encode(); Configure.Save(); } else { cboConfigure.SelectedIndex = -1; } } else { if (cboConfigure.SelectedIndex >= 0) { btnSaveConfig.Enabled = btnPrint.Enabled = true; Configure = _Configures[cboConfigure.SelectedIndex]; if (Configure.Template == null) { Configure.Decode(); } if (!cboSchoolYear.Items.Contains(Configure.SchoolYear)) { cboSchoolYear.Items.Add(Configure.SchoolYear); } cboSchoolYear.Text = Configure.SchoolYear; cboSemester.Text = Configure.Semester; if (Configure.ExamRecord != null) { foreach (var item in cboExam.Items) { if (((ExamRecord)item).ID == Configure.ExamRecord.ID) { cboExam.SelectedIndex = cboExam.Items.IndexOf(item); break; } } } cboRefExam.SelectedIndex = -1; if (Configure.RefenceExamRecord != null) { foreach (var item in cboRefExam.Items) { if (((ExamRecord)item).ID == Configure.RefenceExamRecord.ID) { cboRefExam.SelectedIndex = cboRefExam.Items.IndexOf(item); break; } } } cboRankRilter.Text = Configure.RankFilterTagName; foreach (ListViewItem item in listViewEx1.Items) { item.Checked = Configure.PrintSubjectList.Contains(item.Text); } cboTagRank1.Text = Configure.TagRank1TagName; foreach (ListViewItem item in listViewEx2.Items) { item.Checked = Configure.TagRank1SubjectList.Contains(item.Text); } cboTagRank2.Text = Configure.TagRank2TagName; foreach (ListViewItem item in listViewEx3.Items) { item.Checked = Configure.TagRank2SubjectList.Contains(item.Text); } // 開始與結束日期 DateTime dtb, dte; if (DateTime.TryParse(Configure.BeginDate, out dtb)) { dtBegin.Value = dtb; } else { dtBegin.Value = DateTime.Now; } if (DateTime.TryParse(Configure.EndDate, out dte)) { dtEnd.Value = dte; } else { dtEnd.Value = DateTime.Now; } if (Configure.ScoreCurDate != null) { dtCurDate.Value = Configure.ScoreCurDate; } else { dtCurDate.Value = DateTime.Now; } if (Configure.AvgRd.HasValue) { iptRd.Value = Configure.AvgRd.Value; } else { iptRd.Value = 2; } // 判斷是否產生勾選學生清單 bool bo1; if (bool.TryParse(Configure.isExportStudentList, out bo1)) { ChkExportStudList.Checked = bo1; } else { ChkExportStudList.Checked = false; } } else { Configure = null; cboSchoolYear.SelectedIndex = -1; cboSemester.SelectedIndex = -1; cboExam.SelectedIndex = -1; cboRefExam.SelectedIndex = -1; cboRankRilter.SelectedIndex = -1; cboTagRank1.SelectedIndex = -1; cboTagRank2.SelectedIndex = -1; foreach (ListViewItem item in listViewEx1.Items) { item.Checked = false; } foreach (ListViewItem item in listViewEx2.Items) { item.Checked = false; } foreach (ListViewItem item in listViewEx3.Items) { item.Checked = false; } // 開始與結束日期沒有預設值時給當天 dtCurDate.Value = dtBegin.Value = dtEnd.Value = DateTime.Now; if (Configure != null) { // 產生學生清單 ChkExportStudList.Checked = false; Configure.isExportStudentList = ChkExportStudList.Checked.ToString(); } } } }
private void cboConfigure_SelectedIndexChanged(object sender, EventArgs e) { if (cboConfigure.SelectedIndex == cboConfigure.Items.Count - 1) { //新增 btnSaveConfig.Enabled = btnPrint.Enabled = false; NewConfigure dialog = new NewConfigure(); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Configure = new Configure(); Configure.Name = dialog.ConfigName; Configure.Template = dialog.Template; Configure.SubjectLimit = dialog.SubjectLimit; Configure.SchoolYear = _DefalutSchoolYear; Configure.Semester = _DefaultSemester; if (cboExam.Items.Count > 0) Configure.ExamRecord = (ExamRecord)cboExam.Items[0]; _Configures.Add(Configure); cboConfigure.Items.Insert(cboConfigure.SelectedIndex, Configure); cboConfigure.SelectedIndex = cboConfigure.SelectedIndex - 1; Configure.Encode(); Configure.Save(); } else { cboConfigure.SelectedIndex = -1; } } else { if (cboConfigure.SelectedIndex >= 0) { btnSaveConfig.Enabled = btnPrint.Enabled = true; Configure = _Configures[cboConfigure.SelectedIndex]; if (Configure.Template == null) Configure.Decode(); if (!cboSchoolYear.Items.Contains(Configure.SchoolYear)) cboSchoolYear.Items.Add(Configure.SchoolYear); cboSchoolYear.Text = Configure.SchoolYear; cboSemester.Text = Configure.Semester; if (Configure.ExamRecord != null) { foreach (var item in cboExam.Items) { if (((ExamRecord)item).ID == Configure.ExamRecord.ID) { cboExam.SelectedIndex = cboExam.Items.IndexOf(item); break; } } } cboRefExam.SelectedIndex = -1; if (Configure.RefenceExamRecord != null) { foreach (var item in cboRefExam.Items) { if (((ExamRecord)item).ID == Configure.RefenceExamRecord.ID) { cboRefExam.SelectedIndex = cboRefExam.Items.IndexOf(item); break; } } } cboRankRilter.Text = Configure.RankFilterTagName; foreach (ListViewItem item in listViewEx1.Items) { item.Checked = Configure.PrintSubjectList.Contains(item.Text); } cboTagRank1.Text = Configure.TagRank1TagName; foreach (ListViewItem item in listViewEx2.Items) { item.Checked = Configure.TagRank1SubjectList.Contains(item.Text); } cboTagRank2.Text = Configure.TagRank2TagName; foreach (ListViewItem item in listViewEx3.Items) { item.Checked = Configure.TagRank2SubjectList.Contains(item.Text); } } else { Configure = null; cboSchoolYear.SelectedIndex = -1; cboSemester.SelectedIndex = -1; cboExam.SelectedIndex = -1; cboRefExam.SelectedIndex = -1; cboRankRilter.SelectedIndex = -1; cboTagRank1.SelectedIndex = -1; cboTagRank2.SelectedIndex = -1; foreach (ListViewItem item in listViewEx1.Items) { item.Checked = false; } foreach (ListViewItem item in listViewEx2.Items) { item.Checked = false; } foreach (ListViewItem item in listViewEx3.Items) { item.Checked = false; } } } }