Exemplo n.º 1
0
        protected override void PrepareDataBackground()
        {
            JHClass.RemoveAll();
            RatingStudent.SetClassMapping(JHClass.SelectAll()); //快取班級對照資訊。
            Dictionary <string, RatingStudent> dicstuds = Students.ToDictionary();

            //將學生的成績清除,並新增一個 Token 用來放成績。
            foreach (RatingStudent each in Students)
            {
                each.Clear();
                each.Scores.Add(ThisToken, new ScoreCollection());
            }

            foreach (JHSemesterScoreRecord semsRecord in SemesterScores.Values)
            {
                RatingStudent student;

                if (!dicstuds.TryGetValue(semsRecord.RefStudentID, out student))
                {
                    continue; //找不到該學生。
                }
                ScoreCollection scores = student.Scores[ThisToken];

                foreach (K12.Data.DomainScore domainRecord in semsRecord.Domains.Values)
                {
                    if (!domainRecord.Score.HasValue)
                    {
                        continue;                               //沒有成績就不處理。
                    }
                    string domain = domainRecord.Domain.Trim();

                    if (!SelectedDomains.Contains(domain))
                    {
                        continue; //不在處理的科目清單中。
                    }
                    if (!NameMapping.ContainsKey(domain))
                    {
                        throw new ArgumentException(string.Format("領域名稱「{0}」在此畫面沒有定議。", domain));
                    }

                    if (scores.Contains(domain))
                    {
                        throw new ArgumentException(string.Format("學生「{0}」在同一學期有「{1}」領域一次以上。", student.Name, domain));
                    }

                    scores.Add(domain, domainRecord.Score.Value);
                }

                if (semsRecord.LearnDomainScore.HasValue)
                {
                    scores.Add("學習領域", semsRecord.LearnDomainScore.Value);
                }

                if (semsRecord.CourseLearnScore.HasValue)
                {
                    scores.Add("課程學習", semsRecord.CourseLearnScore.Value);
                }
            }
        }
Exemplo n.º 2
0
        protected override void PrepareDataBackground()
        {
            List <JHSCETakeRecord> scetakes = JHSCETake.SelectByCourseAndExam(Courses.Values.ToKeys(), ExamId);

            JHClass.RemoveAll();
            RatingStudent.SetClassMapping(JHClass.SelectAll()); //快取班級對照資訊。
            Dictionary <string, RatingStudent> dicstuds = Students.ToDictionary();

            //將學生的成績清除,並新增一個 Token 用來放成績。
            foreach (RatingStudent each in Students)
            {
                each.Clear();
                each.Scores.Add(ThisToken, new ScoreCollection());
            }

            foreach (JHSCETakeRecord take in scetakes) //特別注意 take.Score 是 Extensions 裡面的 Score 不是實體欄位的 Score。
            {
                if (!take.Score.HasValue)
                {
                    continue;                       //沒有成績就不處理。
                }
                JHSCAttendRecord attend;
                JHCourseRecord   course;
                RatingStudent    student;

                if (!SCAttends.TryGetValue(take.RefSCAttendID, out attend))
                {
                    continue;  //找不到該修課記錄。
                }
                if (!Courses.TryGetValue(take.RefCourseID, out course))
                {
                    continue;  //找不到該課程。
                }
                if (!dicstuds.TryGetValue(attend.RefStudentID, out student))
                {
                    continue; //找不到該學生。
                }
                ScoreCollection scores  = student.Scores[ThisToken];
                string          subject = course.Subject;

                if (!SelectedSubjects.Contains(subject))
                {
                    continue; //不在處理的科目清單中。
                }
                if (scores.Contains(subject))
                {
                    throw new ArgumentException(string.Format("學生「{0}」在同一學期修習「{1}」科目一次以上。", student.Name, subject));
                }

                scores.Add(subject, take.Score.Value);
            }
        }
Exemplo n.º 3
0
        protected override void PrepareDataBackground()
        {
            JHClass.RemoveAll();
            RatingStudent.SetClassMapping(JHClass.SelectAll()); //快取班級對照資訊。
            Dictionary <string, RatingStudent> dicstuds = Students.ToDictionary();

            //將學生的成績清除,並新增一個 Token 用來放成績。
            foreach (RatingStudent each in Students)
            {
                each.Clear();
                each.Scores.Add(ThisToken, new ScoreCollection());
            }

            foreach (JHSemesterScoreRecord semsRecord in SemesterScores.Values)
            {
                RatingStudent student;

                if (!dicstuds.TryGetValue(semsRecord.RefStudentID, out student))
                {
                    continue; //找不到該學生。
                }
                ScoreCollection scores = student.Scores[ThisToken];

                foreach (K12.Data.SubjectScore subjRecord in semsRecord.Subjects.Values)
                {
                    if (!subjRecord.Score.HasValue)
                    {
                        continue;                             //沒有成績就不處理。
                    }
                    string subject = subjRecord.Subject;

                    if (!SelectedSubjects.Contains(subject))
                    {
                        continue; //不在處理的科目清單中。
                    }
                    if (scores.Contains(subject))
                    {
                        throw new ArgumentException(string.Format("學生「{0}」在同一學期修習「{1}」科目一次以上。", student.Name, subject));
                    }

                    scores.Add(subject, subjRecord.Score.Value);
                }
            }
        }
Exemplo n.º 4
0
        protected override void PrepareDataBackground()
        {
            JHClass.RemoveAll();
            RatingStudent.SetClassMapping(JHClass.SelectAll()); //快取班級對照資訊。
            Dictionary <string, RatingStudent> dicstuds = Students.ToDictionary();

            //學期歷程查詢類別。
            SemesterHistory = new HistoryQuery(JHSemesterHistory.SelectByStudentIDs(Students.ToKeys()));

            //將學生的成績清除。
            foreach (RatingStudent each in Students)
            {
                each.Clear();
            }

            foreach (JHSemesterScoreRecord semsRecord in SemesterScores)
            {
                RatingStudent student;

                if (!dicstuds.TryGetValue(semsRecord.RefStudentID, out student))
                {
                    continue; //找不到該學生。
                }
                ScoreCollection scores = null;

                if (SemesterHistory.Contains(semsRecord.RefStudentID, semsRecord.SchoolYear, semsRecord.Semester))
                {
                    //tokne 意思是特定學期的識別字串,例如「一上」。
                    string token = SemesterHistory.GetToken(semsRecord.RefStudentID, semsRecord.SchoolYear, semsRecord.Semester);

                    //不在使用者選擇的學期中,就不處理。
                    if (!Tokens.Contains(token))
                    {
                        continue;
                    }

                    if (!student.Scores.Contains(token)) //如果學生不包含該學期的成績,就加上該學期。
                    {
                        student.Scores.Add(token, new ScoreCollection());
                    }

                    scores = student.Scores[token];
                }
                else
                {
                    continue; //沒有該學期的學期歷程就不處理。
                }
                foreach (K12.Data.SubjectScore subjRecord in semsRecord.Subjects.Values)
                {
                    if (!subjRecord.Score.HasValue)
                    {
                        continue;                             //沒有成績就不處理。
                    }
                    string subject = subjRecord.Subject;

                    if (!SelectedSubjects.Contains(subject))
                    {
                        continue; //不在處理的科目清單中。
                    }
                    if (scores.Contains(subject))
                    {
                        throw new ArgumentException(string.Format("學生「{0}」在同一學期修習「{1}」科目一次以上。", student.Name, subject));
                    }

                    scores.Add(subject, subjRecord.Score.Value);
                }
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 加入指定的成績集合。
 /// </summary>
 /// <param name="token">可能類似學期的資訊,例:一上。</param>
 public void Add(string token, ScoreCollection scores)
 {
     _multi_scores.Add(token, scores);
 }