コード例 #1
0
ファイル: Student.cs プロジェクト: ischoolinc/SHEvaluation
        private void ProcessScoreList(int semesters, List <string> printEntries)
        {
            //統計有成績的學期
            if (semesters <= 0)
            {
                semesters = int.MaxValue;
            }
            List <int> semesterlist = new List <int>();

            foreach (SemesterSubjectScoreInfo info in _student.SemesterSubjectScoreList)
            {
                if (info.Detail.GetAttribute("不需評分") == "是")
                {
                    continue;
                }
                if (!semesterlist.Contains((info.GradeYear - 1) * 2 + info.Semester))
                {
                    semesterlist.Add((info.GradeYear - 1) * 2 + info.Semester);
                }
            }

            foreach (SemesterEntryScoreInfo info in _student.SemesterEntryScoreList)
            {
                if (!semesterlist.Contains((info.GradeYear - 1) * 2 + info.Semester))
                {
                    semesterlist.Add((info.GradeYear - 1) * 2 + info.Semester);
                }
            }
            semesterlist.Sort();

            foreach (SemesterSubjectScoreInfo info in _student.SemesterSubjectScoreList)
            {
                if (info.Detail.GetAttribute("不需評分") == "是")
                {
                    continue;
                }
                //超過統計學期當沒看到
                if (semesterlist.Count > semesters && (info.GradeYear - 1) * 2 + info.Semester > semesterlist[semesters - 1])
                {
                    continue;
                }
                if (!_subjects.ContainsKey(info.Subject))
                {
                    SubjectInfo new_info = new SubjectInfo(info.Subject);
                    _subjects.Add(info.Subject, new_info);
                    new_info.AddSemsScore(info.GradeYear, info.Semester, SelectScore(info));
                }
                else
                {
                    _subjects[info.Subject].AddSemsScore(info.GradeYear, info.Semester, SelectScore(info));
                }
            }

            foreach (SemesterEntryScoreInfo info in _student.SemesterEntryScoreList)
            {
                //超過統計學期當沒看到
                if (semesterlist.Count > semesters && (info.GradeYear - 1) * 2 + info.Semester > semesterlist[semesters - 1])
                {
                    continue;
                }
                //不是要列印的分項當沒看到
                if (!printEntries.Contains(info.Entry))
                {
                    continue;
                }
                if (!_entries.ContainsKey(info.Entry))
                {
                    EntryInfo new_info = new EntryInfo(info.Entry);
                    _entries.Add(info.Entry, new_info);
                    new_info.AddSemsScore(info.GradeYear, info.Semester, info.Score);
                }
                else
                {
                    _entries[info.Entry].AddSemsScore(info.GradeYear, info.Semester, info.Score);
                }
            }
        }