Beispiel #1
0
        /// <summary>
        /// 將資料變成只有學年度學期,年級統一為0。
        /// </summary>
        /// <param name="semesters"></param>
        /// <returns></returns>
        public static SemesterDataCollection ToSemesterOnly(this SemesterDataCollection semesters)
        {
            SemesterDataCollection result = new SemesterDataCollection();

            foreach (SemesterData sd in semesters)
            {
                result.Add(new SemesterData(0, sd.SchoolYear, sd.Semester));
            }

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// 取得按年級學期排序、去除重讀學期後指定的學期資訊,例:1,2,3,4,取得1,2年級的資訊,例:1,2,3,4,5,取得1,2年級與3上的資訊。
        /// </summary>
        /// <param name="semester"></param>
        /// <returns></returns>
        public SemesterDataCollection GetSemesters(List <int> semesters)
        {
            SemesterDataCollection origin = GetGradeYearSemester();
            SemesterDataCollection result = new SemesterDataCollection();

            foreach (SemesterData semester in origin)
            {
                if (semester.GradeYear == 1 && semester.Semester == 1)
                {
                    if (semesters.Contains(1))
                    {
                        result.Add(semester);
                    }
                }
                else if (semester.GradeYear == 1 && semester.Semester == 2)
                {
                    if (semesters.Contains(2))
                    {
                        result.Add(semester);
                    }
                }
                else if (semester.GradeYear == 2 && semester.Semester == 1)
                {
                    if (semesters.Contains(3))
                    {
                        result.Add(semester);
                    }
                }
                else if (semester.GradeYear == 2 && semester.Semester == 2)
                {
                    if (semesters.Contains(4))
                    {
                        result.Add(semester);
                    }
                }
                else if (semester.GradeYear == 3 && semester.Semester == 1)
                {
                    if (semesters.Contains(5))
                    {
                        result.Add(semester);
                    }
                }
                else if (semester.GradeYear == 3 && semester.Semester == 2)
                {
                    if (semesters.Contains(6))
                    {
                        result.Add(semester);
                    }
                }
                else if (semester.GradeYear == 7 && semester.Semester == 1)
                {
                    if (semesters.Contains(1))
                    {
                        result.Add(semester);
                    }
                }
                else if (semester.GradeYear == 7 && semester.Semester == 2)
                {
                    if (semesters.Contains(2))
                    {
                        result.Add(semester);
                    }
                }
                else if (semester.GradeYear == 8 && semester.Semester == 1)
                {
                    if (semesters.Contains(3))
                    {
                        result.Add(semester);
                    }
                }
                else if (semester.GradeYear == 8 && semester.Semester == 2)
                {
                    if (semesters.Contains(4))
                    {
                        result.Add(semester);
                    }
                }
                else if (semester.GradeYear == 9 && semester.Semester == 1)
                {
                    if (semesters.Contains(5))
                    {
                        result.Add(semester);
                    }
                }
                else if (semester.GradeYear == 9 && semester.Semester == 2)
                {
                    if (semesters.Contains(6))
                    {
                        result.Add(semester);
                    }
                }
            }

            return(result);
        }