internal void Read() { Courses = ReadCourse(); AEIncludes = ReadAEInclude(); Attends = ReadCurrentSemesterAttend(); List <JHSCETakeRecord> SCETakes = ReadSCETake(); // 取得新竹評量樣版設定 Util.ScorePercentageHSDict.Clear(); Util.ScorePercentageHSDict = Util.GetScorePercentageHS(); //清除原有的資料。 foreach (StudentScore each in Students.Values) { each.AttendScore.Clear(); } Reporter.Feedback("計算成績...", 0); int t1 = Environment.TickCount; foreach (JHSCAttendRecord Attend in Attends.Values) { if (!Students.ContainsKey(Attend.RefStudentID)) { continue; } StudentScore Student = Students[Attend.RefStudentID]; if (!Courses.ContainsKey(Attend.RefCourseID)) { continue; } JHCourseRecord Course = Courses[Attend.RefCourseID]; bool toSems = (Course.CalculationFlag == "1") ? true : false; string subjName = Course.Subject.Trim(); // 如果科目名稱空白就不處理,因為無法計算到科目成績 if (string.IsNullOrWhiteSpace(subjName)) { continue; } //傳入學年度,判斷103以前的學年度5:5而以後6:4比例計算 if (!Student.AttendScore.Contains(subjName)) { Student.AttendScore.Add(subjName, new AttendScore(Attend, Course.Credit, Course.Period, toSems, Course.Domain, Course.SchoolYear)); } } try { foreach (JHSCETakeRecord take in SCETakes) { if (!Attends.ContainsKey(take.RefSCAttendID)) { continue; } JHSCAttendRecord Attend = Attends[take.RefSCAttendID]; if (!Students.ContainsKey(Attend.RefStudentID)) { continue; } StudentScore Student = Students[Attend.RefStudentID]; if (!Courses.ContainsKey(Attend.RefCourseID)) { continue; } JHCourseRecord Course = Courses[Attend.RefCourseID]; if (!AEIncludes.ContainsKey(Course.RefAssessmentSetupID)) { continue; } Dictionary <string, AEIncludeData> Include = AEIncludes[Course.RefAssessmentSetupID]; //沒有該次考試就不處理。 if (!Include.ContainsKey(take.RefExamID)) { continue; } string subjName = Course.Subject.Trim(); // 如果科目名稱空白就不處理,因為無法計算到科目成績 if (string.IsNullOrWhiteSpace(subjName)) { continue; } try { Student.AttendScore[subjName].Subscores.Add(take.RefExamID, new TakeScore(take, Include[take.RefExamID])); } catch (Exception ex) { Console.Write(ex.Message); } } } catch (Exception ex) { Console.Write(ex.Message); } Reporter.Feedback("時間:" + (Environment.TickCount - t1), 0); }
internal void Read() { Courses = ReadCourse(); AEIncludes = ReadAEInclude(); Attends = ReadCurrentSemesterAttend(); List <JHSCETakeRecord> SCETakes = ReadSCETake(); //清除原有的資料。 foreach (StudentScore each in Students.Values) { each.AttendScore.Clear(); } Reporter.Feedback("計算成績...", 0); int t1 = Environment.TickCount; foreach (JHSCAttendRecord Attend in Attends.Values) { if (!Students.ContainsKey(Attend.RefStudentID)) { continue; } StudentScore Student = Students[Attend.RefStudentID]; if (!Courses.ContainsKey(Attend.RefCourseID)) { continue; } JHCourseRecord Course = Courses[Attend.RefCourseID]; bool toSems = (Course.CalculationFlag == "1") ? true : false; string subjName = Course.Subject.Trim(); if (!Student.AttendScore.Contains(subjName)) { Student.AttendScore.Add(subjName, new AttendScore(Attend, Course.Credit, Course.Period, toSems, Course.Domain)); } } foreach (JHSCETakeRecord take in SCETakes) { if (!Attends.ContainsKey(take.RefSCAttendID)) { continue; } JHSCAttendRecord Attend = Attends[take.RefSCAttendID]; if (!Students.ContainsKey(Attend.RefStudentID)) { continue; } StudentScore Student = Students[Attend.RefStudentID]; if (!Courses.ContainsKey(Attend.RefCourseID)) { continue; } JHCourseRecord Course = Courses[Attend.RefCourseID]; if (!AEIncludes.ContainsKey(Course.RefAssessmentSetupID)) { continue; } Dictionary <string, AEIncludeData> Include = AEIncludes[Course.RefAssessmentSetupID]; //沒有該次考試就不處理。 if (!Include.ContainsKey(take.RefExamID)) { continue; } string subjName = Course.Subject.Trim(); Student.AttendScore[subjName].Subscores.Add(take.RefExamID, new TakeScore(take, Include[take.RefExamID])); } Reporter.Feedback("時間:" + (Environment.TickCount - t1), 0); }