Example #1
0
        internal void Add(KH.JHSCETakeRecord sce)
        {
            if (!_courseDict.ContainsKey(sce.RefCourseID))
            {
                return;
            }
            JHCourseRecord course = _courseDict[sce.RefCourseID];

            if (!Domains.ContainsKey(course.Domain))
            {
                Domains.Add(course.Domain, new DomainRow(course.Domain));
            }

            DomainRow row = Domains[course.Domain];

            if (_config.DomainSubjectSetup == DomainSubjectSetup.Subject)
            {
                row.Display = false;
            }
            else
            {
                row.Display = true;
            }
            row.AddExamID(sce.RefExamID);

            if (!row.Subjects.ContainsKey(course.Subject))
            {
                row.Subjects.Add(course.Subject, new SubjectRow(course.Subject));
            }
            SubjectRow subjectRow = row.Subjects[course.Subject];

            subjectRow.SetPeriodCredit(course.Period, course.Credit);
            subjectRow.AddScore(sce.RefExamID, sce.Score, sce.Effort);
            if (_config.DomainSubjectSetup == DomainSubjectSetup.Subject)
            {
                subjectRow.Display = true;
            }
        }
Example #2
0
        private int WriteDomainRow(Cell indexCell, DomainRow domain)
        {
            WordHelper.Write(indexCell, _font, string.IsNullOrEmpty(domain.DomainName) ? "彈性課程" : domain.DomainName);
            int  col         = 0;
            Cell subjectCell = WordHelper.GetMoveRightCell(indexCell, 1);
            int  count       = 0;

            foreach (var subjectName in domain.Subjects.Keys)
            {
                SubjectRow row = domain.Subjects[subjectName];
                if (row.Display)
                {
                    Cell temp = subjectCell;
                    WordHelper.Write(temp, _font, row.SubjectName);
                    temp = temp.NextSibling as Cell;
                    WordHelper.Write(temp, _font, row.PeriodCredit);

                    foreach (string examID in row.Scores.Keys)
                    {
                        ScoreData data       = row.Scores[examID];
                        string    effortText = string.Empty;
                        if (data.Effort.HasValue)
                        {
                            effortText = _effortMapper.GetTextByInt(data.Effort.Value);
                        }

                        temp = WordHelper.GetMoveRightCell(subjectCell, _columnMapping[examID] - 1);
                        WordHelper.Write(temp, _font, (data.Score.HasValue ? "" + _calculator.ParseSubjectScore(data.Score.Value) : ""));
                        WordHelper.Write(temp.NextSibling as Cell, _font, effortText);
                    }

                    if (_AttendDict.ContainsKey(subjectName))
                    {
                        temp = WordHelper.GetMoveRightCell(subjectCell, _columnMapping["平時評量"] - 1);

                        // 平時
                        if (_AttendDict[subjectName].OrdinarilyScore.HasValue)
                        {
                            WordHelper.Write(temp, _font, _calculator.ParseSubjectScore(_AttendDict[subjectName].OrdinarilyScore.Value).ToString());
                        }
                        else
                        {
                            WordHelper.Write(temp, _font, "");
                        }

                        if (_AttendDict[subjectName].OrdinarilyEffort.HasValue)
                        {
                            WordHelper.Write(temp.NextSibling as Cell, _font, _effortMapper.GetTextByInt(_AttendDict[subjectName].OrdinarilyEffort.Value));
                        }
                        else
                        {
                            WordHelper.Write(temp.NextSibling as Cell, _font, "");
                        }


                        //temp = WordHelper.GetMoveRightCell(indexCell, _columnMapping["課程總成績"]);

                        //// 課程總成績
                        //if (_AttendDict[subjectName].Score.HasValue)
                        //    WordHelper.Write(temp, _font, _calculator.ParseSubjectScore(_AttendDict[subjectName].Score.Value).ToString());
                        //else
                        //    WordHelper.Write(temp, _font, "");

                        //if (_AttendDict[subjectName].Effort.HasValue)
                        //    WordHelper.Write(temp.NextSibling as Cell, _font, _effortMapper.GetTextByInt(_AttendDict[subjectName].Effort.Value));
                        //else
                        //    WordHelper.Write(temp.NextSibling as Cell, _font, "");
                    }

                    subjectCell = WordHelper.GetMoveDownCell(subjectCell, 1);

                    if (subjectCell == null)
                    {
                        break;
                    }
                    count++;
                }
            }
            return(count);
        }