public CourseListViewItem(CourseRecord course, AEIncludeRecord aei, List <SCETakeRecord> sceList) { _is_finish = true; TeacherRecord teacher = course.GetFirstTeacher(); _total = SCAttend.GetCourseStudentCount(course.ID); Calculate(sceList); if (aei.UseScore) { _is_finish &= (_scoreCount == _total); } if (aei.UseEffort) { _is_finish &= (_effortCount == _total); } if (aei.UseText) { _is_finish &= (_textCount == _total); } this.Text = course.Name; this.SubItems.Add((teacher != null) ? teacher.Name : ""); this.SubItems.Add(aei.UseScore ? ScoreField : "").ForeColor = (_scoreCount == _total) ? Color.Black : Color.Red; this.SubItems.Add(aei.UseEffort ? EffortField : "").ForeColor = (_effortCount == _total) ? Color.Black : Color.Red; this.SubItems.Add(aei.UseText ? TextField : "").ForeColor = (_textCount == _total) ? Color.Black : Color.Red; }
internal AEIncludeRecordEditor(AEIncludeRecord record) { AEInclude = record; ID = record.ID; RefAssessmentSetupID = record.RefAssessmentSetupID; RefExamID = record.RefExamID; Name = record.Name; UseText = record.UseText; UseScore = record.UseScore; UseEffort = record.UseEffort; Weight = record.Weight; StartTime = record.StartTime; EndTime = record.EndTime; }
/// <summary> /// 選擇試別時觸發。 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cboExamList_SelectedIndexChanged(object sender, EventArgs e) { if (cboExamList.SelectedItem == null) { return; } ExamComboBoxItem item = cboExamList.SelectedItem as ExamComboBoxItem; AEIncludeRecord aeIncludeRecord = item.AEIncludeRecord; dgv.SuspendLayout(); #region 依 AEIncludeRecord 決定哪些 Column 要顯示 chInputScore.Visible = aeIncludeRecord.UseScore; chInputEffort.Visible = aeIncludeRecord.UseEffort; chInputText.Visible = aeIncludeRecord.UseText; #endregion GetScoresAndFill(aeIncludeRecord); dgv.ResumeLayout(); }
public static AEIncludeRecordEditor GetEditor(this AEIncludeRecord record) { return(new AEIncludeRecordEditor(record)); }
//private string _weight; public ExamComboBoxItem(AEIncludeRecord record) { _aeIncludeRecord = record; //_weight = record.Weight; _examRecord = record.Exam; }
/// <summary> /// 取得成績並填入DataGridView /// </summary> private void GetScoresAndFill(AEIncludeRecord aeIncludeRecord) { _dirtyCellList.Clear(); lblSave.Visible = false; #region 清空所有評量欄位及SCETakeRecord foreach (DataGridViewRow row in dgv.Rows) { row.Cells[chInputScore.Index].Value = row.Cells[chInputEffort.Index].Value = row.Cells[chInputText.Index].Value = null; (row.Tag as SCAttendTag).SCETake = null; } #endregion #region 取得成績並填入 foreach (var record in QuerySCETake.GetSCETakeRecords(_course.ID, aeIncludeRecord.RefExamID)) { if (_studentRowDict.ContainsKey(record.RefStudentID)) { DataGridViewRow row = _studentRowDict[record.RefStudentID]; row.Cells[chInputScore.Index].Value = record.Score; row.Cells[chInputEffort.Index].Value = record.Effort; row.Cells[chInputText.Index].Value = record.Text; row.Cells[chInputScore.Index].Tag = record.Score; row.Cells[chInputEffort.Index].Tag = record.Effort; row.Cells[chInputText.Index].Tag = record.Text; if (record.Score < 60) { row.Cells[chInputScore.Index].Style.ForeColor = Color.Red; } if (record.Score > 100 || record.Score < 0) { row.Cells[chInputScore.Index].Style.ForeColor = Color.Green; } else { row.Cells[chInputScore.Index].Style.ForeColor = Color.Black; } SCAttendTag tag = row.Tag as SCAttendTag; tag.SCETake = record; } else { #region 除錯用,別刪掉 //StudentRecord student = Student.Instance.Items[record.RefStudentID]; //if (student == null) // MsgBox.Show("系統編號「" + record.RefStudentID + "」的學生不存在…"); //else //{ // string className = (student.Class != null) ? student.Class.Name + " " : ""; // string seatNo = string.IsNullOrEmpty(className) ? "" : (string.IsNullOrEmpty(student.SeatNo) ? "" : student.SeatNo + " "); // string studentNumber = string.IsNullOrEmpty(student.StudentNumber) ? "" : " (" + student.StudentNumber + ")"; // MsgBox.Show(className + seatNo + student.Name + studentNumber, "這個學生有問題喔…"); //} #endregion } } #endregion }