예제 #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 (!row.Subjects.ContainsKey(course.Subject))
            {
                row.AddSubject(course.Subject);
            }

            SubjectRow subjectRow = row.Subjects[course.Subject];

            subjectRow.SetPeriodCredit(course.Period, course.Credit);
            subjectRow.Score   = sce.Score;
            subjectRow.Effort  = sce.Effort;
            subjectRow.Text    = sce.Text;
            subjectRow.Display = true;
        }
예제 #2
0
        internal void AddAssignment(JHSCAttendRecord assignment)
        {
            if (!_courseDict.ContainsKey(assignment.RefCourseID))
            {
                return;
            }
            JHCourseRecord course = _courseDict[assignment.RefCourseID];

            if (!Domains.ContainsKey(course.Domain))
            {
                return;
            }

            DomainRow row = Domains[course.Domain];

            if (!row.Subjects.ContainsKey(course.Subject))
            {
                return;
            }

            SubjectRow subjectRow = row.Subjects[course.Subject];

            subjectRow.AssignmentScore = assignment.OrdinarilyScore;
        }
예제 #3
0
        // 這段在處理只有列印領域
        private void WriteDomainRowOnly(Cell indexCell, DomainRow domain)
        {
            // 判斷領域名稱是否需要顯示
            bool DisplayDomain1 = CheckDisplayDomain(domain);

            if (DisplayDomain1)
            {
                // 當領域是空白另外處理
                if (string.IsNullOrEmpty(domain.DomainName))
                {
                    int  co          = 0;
                    Cell subjectCell = WordHelper.GetMoveRightCell(indexCell, 1);
                    foreach (var subjectName in domain.Subjects.Keys)
                    {
                        // 判斷是否需要顯示科目
                        bool DisplaySubject = true;

                        if (_SubjCourseDict.ContainsKey(subjectName))
                        {
                            if (_config.HasExam(_SubjCourseDict[subjectName]) == false)
                            {
                                DisplaySubject = false;
                            }
                        }

                        if (DisplaySubject == false)
                        {
                            continue;
                        }


                        SubjectRow row = domain.Subjects[subjectName];


                        if (row.Display)
                        {
                            Cell temp1 = subjectCell;
                            Write(temp1, row.SubjectName);
                            temp1 = temp1.NextSibling as Cell;
                            Write(temp1, GetPCDisplay(row.PeriodCredit));
                            if (PrintScore)
                            {
                                temp1 = temp1.NextSibling as Cell;
                                // 依照成績計算規則設定
                                if (row.Score.HasValue)
                                {
                                    Write(temp1, "" + _calculator.ParseSubjectScore(row.Score.Value));
                                }
                                else
                                {
                                    Write(temp1, "");
                                }
                            }

                            if (PrintEffort)
                            {
                                temp1 = temp1.NextSibling as Cell;
                                string effortText1 = string.Empty;
                                if (row.Effort.HasValue)
                                {
                                    effortText1 = _effortMapper.GetTextByCode(row.Effort.Value);
                                }
                                Write(temp1, effortText1);
                            }
                            if (PrintAssignment)
                            {
                                temp1 = temp1.NextSibling as Cell;
                                // 依照成績計算規則設定
                                if (row.AssignmentScore.HasValue)
                                {
                                    Write(temp1, "" + _calculator.ParseSubjectScore(row.AssignmentScore.Value));
                                }
                                else
                                {
                                    Write(temp1, "");
                                }
                            }

                            if (PrintText)
                            {
                                temp1 = temp1.NextSibling as Cell;
                                Write(temp1, "" + row.Text);
                            }
                            co++;

                            // 算領域加權平均
                            if (row.Score.HasValue)
                            {
                                DomainSumScore  += row.Score.Value * row.Credit;
                                DomainSumCredit += row.Credit;
                            }


                            subjectCell = WordHelper.GetMoveDownCell(subjectCell, 1);
                            if (subjectCell == null)
                            {
                                break;
                            }
                        }
                    }
                    WordHelper.MergeVerticalCell(indexCell, co);
                    Write(indexCell, "彈性課程");
                }
                else
                {
                    WordHelper.MergeHorizontalCell(indexCell, 2);
                    Write(indexCell, domain.DomainName);

                    Cell temp = indexCell.NextSibling as Cell;
                    temp = temp.NextSibling as Cell;
                    Write(temp, GetPCDisplay(domain.PeriodCredit));

                    if (PrintScore)
                    {
                        temp = temp.NextSibling as Cell;
                        Write(temp, (domain.Score.HasValue ? "" + _calculator.ParseDomainScore(domain.Score.Value) : ""));
                    }

                    if (PrintEffort)
                    {
                        temp = temp.NextSibling as Cell;
                        string effortText = string.Empty;
                        if (domain.Score.HasValue)
                        {
                            effortText = _effortMapper.GetTextByScore(domain.Score.Value);
                        }
                        Write(temp, effortText);
                    }

                    if (PrintAssignment)
                    {
                        temp = temp.NextSibling as Cell;
                        Write(temp, (domain.AssignmentScore.HasValue ? "" + _calculator.ParseDomainScore(domain.AssignmentScore.Value) : ""));
                    }
                    if (PrintText)
                    {
                        temp = temp.NextSibling as Cell;
                        Write(temp, "" + domain.Text);
                    }

                    // 算領域加權平均
                    if (domain.Score.HasValue)
                    {
                        decimal crd;
                        if (decimal.TryParse(GetPCDisplay(domain.PeriodCredit), out crd))
                        {
                            DomainSumScore  += (domain.Score.Value * crd);
                            DomainSumCredit += crd;
                        }
                    }
                }
            }
        }
예제 #4
0
        private int WriteDomainRow(Cell indexCell, DomainRow domain)
        {
            // 判斷領域名稱是否需要顯示
            bool DisplayDomain = CheckDisplayDomain(domain);

            if (DisplayDomain)
            {
                Write(indexCell, string.IsNullOrEmpty(domain.DomainName) ? "彈性課程" : domain.DomainName);
            }

            Cell subjectCell = WordHelper.GetMoveRightCell(indexCell, 1);
            int  count       = 0;

            foreach (var subjectName in domain.Subjects.Keys)
            {
                // 判斷是否需要顯示科目
                bool DisplaySubject = true;

                if (_SubjCourseDict.ContainsKey(subjectName))
                {
                    if (_config.HasExam(_SubjCourseDict[subjectName]) == false)
                    {
                        DisplaySubject = false;
                    }
                }

                if (DisplaySubject == false)
                {
                    continue;
                }

                SubjectRow row = domain.Subjects[subjectName];

                if (row.Display)
                {
                    Cell temp = subjectCell;
                    Write(temp, row.SubjectName);
                    temp = temp.NextSibling as Cell;
                    Write(temp, GetPCDisplay(row.PeriodCredit));

                    if (PrintScore)
                    {
                        temp = temp.NextSibling as Cell;
                        // 依照成績計算規則
                        if (row.Score.HasValue)
                        {
                            Write(temp, "" + _calculator.ParseSubjectScore(row.Score.Value));
                        }
                        else
                        {
                            Write(temp, "");
                        }
                    }
                    if (PrintEffort)
                    {
                        temp = temp.NextSibling as Cell;
                        string effortText = string.Empty;
                        if (row.Effort.HasValue)
                        {
                            effortText = _effortMapper.GetTextByCode(row.Effort.Value);
                        }
                        Write(temp, effortText);
                    }

                    if (PrintAssignment)
                    {
                        temp = temp.NextSibling as Cell;
                        if (row.AssignmentScore.HasValue)
                        {
                            Write(temp, "" + _calculator.ParseSubjectScore(row.AssignmentScore.Value));
                        }
                        else
                        {
                            Write(temp, "");
                        }
                    }

                    if (PrintText)
                    {
                        temp = temp.NextSibling as Cell;
                        Write(temp, "" + row.Text);
                    }

                    subjectCell = WordHelper.GetMoveDownCell(subjectCell, 1);
                    count++;

                    if (row.Score.HasValue)
                    {
                        SubjSumScore  += (row.Score.Value * row.Credit);
                        SubjSumCredit += row.Credit;
                    }

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