public static decimal?GetScore(KH.JHSCETakeRecord sce, KH.JHAEIncludeRecord ae, string source) { decimal?Score = null; //if (source == "定期") //{ if (ae.UseScore) { Score = sce.Score; } //} //else if (source == "定期加平時") //{ // if (ae.UseScore && ae.UseAssignmentScore) // { // if (sce.Score.HasValue && sce.AssignmentScore.HasValue) // Score = (sce.Score.Value + sce.AssignmentScore.Value) / 2m; // else if (sce.Score.HasValue) Score = sce.Score; // else if (sce.AssignmentScore.HasValue) Score = sce.AssignmentScore; // } // else if (ae.UseScore) // Score = sce.Score; // else if (ae.UseAssignmentScore) // Score = sce.AssignmentScore; //} return(Score); }
/// <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; KH.JHAEIncludeRecord aeIncludeRecord = item.AEIncludeRecord; dgv.SuspendLayout(); #region 依 AEIncludeRecord 決定哪些 Column 要顯示 chInputScore.Visible = aeIncludeRecord.UseScore; chInputEffort.Visible = aeIncludeRecord.UseEffort; chInputText.Visible = aeIncludeRecord.UseText; #endregion GetScoresAndFill(aeIncludeRecord); LoadDvScoreColor(); dgv.ResumeLayout(); SetLoadDataToLog(); }
public CourseListViewItem(JHSchool.CourseRecord course, KH.JHAEIncludeRecord aei, List <KH.JHSCETakeRecord> sceList) { _is_finish = true; TeacherRecord teacher = course.GetFirstTeacher(); //_total = course.GetAttends().Count; _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; }
public void CalculateScore(KH.JHAEIncludeRecord ae) { if (ae.UseScore) { Score = _score; } //if (type == ScoreType.定期) //{ // if (ae.UseScore) Score = _score; //} //else if (type == ScoreType.定期加平時) //{ // if (ae.UseScore && ae.UseAssignmentScore) // { // if (_score.HasValue && _assignment_score.HasValue) // Score = (_score.Value + _assignment_score.Value) / 2m; // else if (_score.HasValue) Score = _score; // else if (_assignment_score.HasValue) Score = _assignment_score; // } // else if (ae.UseScore) // Score = _score; // else if (ae.UseAssignmentScore) // Score = _assignment_score; //} }
/// <summary> /// 取得成績並填入DataGridView /// </summary> private void GetScoresAndFill(KH.JHAEIncludeRecord 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)) List <KH.JHSCETakeRecord> list = JHSchool.Data.JHSCETake.SelectByCourseAndExam(_course.ID, aeIncludeRecord.RefExamID).AsKHJHSCETakeRecords(); foreach (var record in list) { 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 }
//private string _weight; public ExamComboBoxItem(KH.JHAEIncludeRecord record) { _aeIncludeRecord = record; //_weight = record.Weight; _examRecord = record.Exam; }