private void fillTotalScore(StudentScoreInfo studScore, DataRow row) { TotaltScoreInfo totalScore = studScore.TotaltScoreInfo; if (totalScore == null) { return; } row["班級名次"] = totalScore.ClassRank; row["科組名次"] = String.IsNullOrEmpty(totalScore.TeamRank) ? totalScore.DeptRank : totalScore.TeamRank; row["年級名次"] = totalScore.GradeRank; row["班級人數"] = totalScore.ClassMatrixCount; row["科組人數"] = String.IsNullOrEmpty(totalScore.TeamMatrixCount) ? totalScore.DeptMatrixCount : totalScore.TeamMatrixCount; row["年級人數"] = totalScore.GradeMatrixCount; row["附註"] = ""; row["S04_Ytdbgoc_Mid_Teachsay"] = ""; }
/// <summary> /// 載入 加權平均 之 排名相關資訊 (rank_matrix) /// </summary> private void LoadWeightedScore() { string sql = @" WITH rank_matrix_sp_semester AS ( SELECT * FROM rank_matrix WHERE is_alive =true AND item_type = '定期評量/總計成績' AND item_name = '加權平均' AND (rank_type ='班排名' OR rank_type ='類別1排名' OR rank_type = '科排名' OR rank_type='年排名') AND ref_exam_id = {3} AND school_year ='{1}' AND semester ='{2}' )SELECT rank_matrix_sp_semester.school_year , rank_matrix_sp_semester.semester , rank_matrix_sp_semester.avg , rank_matrix_sp_semester.matrix_count , rank_type , rank_name , item_name , item_type , rank_detail.* FROM rank_matrix_sp_semester INNER JOIN ( SELECT * FROM rank_detail WHERE ref_student_id IN ( {0} )) AS rank_detail ON rank_detail.ref_matrix_id =rank_matrix_sp_semester .id "; sql = String.Format(sql, String.Join(",", this.studentIDs), this.SchoolYear, this.Semester, this.ExamID); DataTable dt = tool._Q.Select(sql); foreach (DataRow dr in dt.Rows) { string studentID = "" + dr["ref_student_id"]; string rankType = "" + dr["rank_type"]; if (this._DicStudentScoreInfo[studentID].TotaltScoreInfo == null) { this._DicStudentScoreInfo[studentID].TotaltScoreInfo = new TotaltScoreInfo(); } TotaltScoreInfo totalScoreInfo = this._DicStudentScoreInfo[studentID].TotaltScoreInfo; //放排名 & 母群人數 if (rankType == "年排名") { totalScoreInfo.GradeRank = "" + dr["rank"]; totalScoreInfo.GradeMatrixCount = "" + dr["matrix_count"]; } else if (rankType == "科排名") { totalScoreInfo.DeptRank = "" + dr["rank"]; totalScoreInfo.DeptMatrixCount = "" + dr["matrix_count"]; } else if (rankType == "類別1排名") { totalScoreInfo.TeamRank = "" + dr["rank"]; totalScoreInfo.TeamMatrixCount = "" + dr["matrix_count"]; } else if (rankType == "班排名") { totalScoreInfo.ClassRank = "" + dr["rank"]; totalScoreInfo.ClassMatrixCount = "" + dr["matrix_count"]; } } }