示例#1
0
        internal void Add(HC.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.RefAssessmentSetupID = course.RefAssessmentSetupID;

            subjectRow.SetPeriodCredit(course.Period, course.Credit);
            subjectRow.Score           = sce.Score;
            subjectRow.AssignmentScore = sce.AssignmentScore;
            subjectRow.Text            = sce.Text;
            subjectRow.Display         = true;
        }
示例#2
0
        /// <summary>
        /// 處理領域顯示
        /// </summary>
        /// <param name="indexCell"></param>
        /// <param name="domain"></param>
        private void WriteDomainRowOnly(Cell indexCell, DomainRow domain)
        {
            try
            {
                // 判斷領域名稱是否需要顯示
                bool DisplayDomain1 = CheckDisplayDomain(domain);

                if (DisplayDomain1)
                {
                    // 當領域為空白時需要另外處理
                    if (string.IsNullOrEmpty(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 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 (PrintAssScore)
                                {
                                    temp1 = temp1.NextSibling as Cell;
                                    if (row.AssignmentScore.HasValue)
                                    {
                                        Write(temp1, "" + _calculator.ParseSubjectScore(row.AssignmentScore.Value));
                                    }
                                    else
                                    {
                                        Write(temp1, "");
                                    }
                                }
                                // 定期學習評量總成績
                                if (PrintTotalScore)
                                {
                                    temp1 = temp1.NextSibling as Cell;
                                    if (row.FinalScore.HasValue)
                                    {
                                        Write(temp1, "" + _calculator.ParseSubjectScore(row.FinalScore.Value));
                                    }
                                    else
                                    {
                                        Write(temp1, "");
                                    }
                                }

                                // 文字評語
                                if (PrintText)
                                {
                                    temp1 = temp1.NextSibling as Cell;
                                    Write(temp1, "" + row.Text);
                                }

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

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

                                // 算領域平時評量加權平均
                                if (row.AssignmentScore.HasValue)
                                {
                                    DomainSumAssignmentScore += row.AssignmentScore.Value * row.Credit;
                                    DomainSumCreditAss       += row.Credit;
                                }

                                // 算領域學習總分加權平均
                                if (row.FinalScore.HasValue)
                                {
                                    DomainSumFinalScore  += row.FinalScore.Value * row.Credit;
                                    DomainSumFinalCredit += row.Credit;
                                }
                                if (subjectCell == null)
                                {
                                    break;
                                }
                            }
                        }
                        WordHelper.MergeVerticalCell(indexCell, count);
                        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 (PrintAssScore)
                        {
                            temp = temp.NextSibling as Cell;
                            Write(temp, (domain.AssignmentScore.HasValue ? "" + _calculator.ParseDomainScore(domain.AssignmentScore.Value) : ""));
                        }

                        // 定期學習評量總成績
                        if (PrintTotalScore)
                        {
                            temp = temp.NextSibling as Cell;
                            Write(temp, (domain.FinalScore.HasValue ? "" + _calculator.ParseDomainScore(domain.FinalScore.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;
                            }
                        }

                        // 算領域平時評量加權平均
                        if (domain.AssignmentScore.HasValue)
                        {
                            decimal crd;
                            if (decimal.TryParse(GetPCDisplay(domain.PeriodCredit), out crd))
                            {
                                DomainSumAssignmentScore += (domain.AssignmentScore.Value * crd);
                                DomainSumCreditAss       += crd;
                            }
                        }

                        // 算領域學習總成績加權平均
                        if (domain.FinalScore.HasValue)
                        {
                            decimal crd;
                            if (decimal.TryParse(GetPCDisplay(domain.PeriodCredit), out crd))
                            {
                                DomainSumFinalScore  += (domain.FinalScore.Value * crd);
                                DomainSumFinalCredit += crd;
                            }
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
示例#3
0
        private int WriteDomainRow(Cell indexCell, DomainRow domain)
        {
            try
            {
                // 判斷領域名稱是否需要顯示
                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 (PrintAssScore)
                        {
                            temp = temp.NextSibling as Cell;
                            if (row.AssignmentScore.HasValue)
                            {
                                Write(temp, "" + _calculator.ParseSubjectScore(row.AssignmentScore.Value));
                            }
                            else
                            {
                                Write(temp, "");
                            }
                        }

                        // 定期學習評量總成績
                        if (PrintTotalScore)
                        {
                            temp = temp.NextSibling as Cell;
                            if (row.FinalScore.HasValue)
                            {
                                Write(temp, "" + _calculator.ParseSubjectScore(row.FinalScore.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 (row.AssignmentScore.HasValue)
                        {
                            SubjSumAssignmentScore += (row.AssignmentScore.Value * row.Credit);
                            SubjSumCreditAss       += row.Credit;
                        }
                        // 學習總成績加權平均
                        if (row.FinalScore.HasValue)
                        {
                            SubjSumFinalScore  += (row.FinalScore.Value * row.Credit);
                            SubjSumFinalCredit += row.Credit;
                        }
                        if (subjectCell == null)
                        {
                            break;
                        }
                    }
                }
                return(count);
            }
            catch (Exception)
            {
                throw;
            }
        }