Exemple #1
0
        private void ProcessDailyLifeRecommend()
        {
            _builder.MoveToMergeField("綜合評語");
            _cell = _builder.CurrentParagraph.ParentNode as Cell;

            TextScoreItemRow itemRow = new TextScoreItemRow("");

            foreach (AutoSummaryRecord asRecord in _list)
            {
                if (asRecord.MoralScore == null)
                {
                    continue;
                }
                JHMoralScoreRecord record   = asRecord.MoralScore;
                SemesterData       semester = new SemesterData("" + record.SchoolYear, "" + record.Semester);

                XmlElement textscore = record.TextScore;
                if (textscore != null)
                {
                    XmlElement item = (XmlElement)textscore.SelectSingleNode("DailyLifeRecommend");
                    if (item != null)
                    {
                        itemRow.Add(semester, item.GetAttribute("Description"));
                    }
                }
            }

            WriteTextScoreItemRow(_cell, itemRow);
        }
Exemple #2
0
        private void RebuildSemesterMap()
        {
            Dictionary <int, SemesterData> indexes = new Dictionary <int, SemesterData>();

            foreach (SemesterData sems in _semsMapping.Keys)
            {
                if (!indexes.ContainsKey(_semsMapping[sems]))
                {
                    indexes.Add(_semsMapping[sems], sems);
                }
                else
                {
                    SemesterData orig = indexes[_semsMapping[sems]];
                    if (int.Parse(sems.SchoolYear) > int.Parse(orig.SchoolYear))
                    {
                        indexes[_semsMapping[sems]] = sems;
                    }
                }
            }

            _semsMapping.Clear();
            _schoolYearMapping.Clear();
            foreach (int index in indexes.Keys)
            {
                SemesterData sems = indexes[index];
                _semsMapping.Add(sems, index);
                _schoolYearMapping.Add(index, sems.SchoolYear);
            }
        }
Exemple #3
0
        private void ProcessDiscipline()
        {
            Dictionary <string, DisciplineItemRow> items = new Dictionary <string, DisciplineItemRow>();

            foreach (string name in _sortOrder)
            {
                items.Add(name, new DisciplineItemRow(name));
            }

            foreach (var record in _list)
            {
                SemesterData semester = new SemesterData("" + record.SchoolYear, "" + record.Semester);

                items["大功"].Add(semester, record.MeritA);
                items["小功"].Add(semester, record.MeritB);
                items["嘉獎"].Add(semester, record.MeritC);
                items["大過"].Add(semester, record.DemeritA);
                items["小過"].Add(semester, record.DemeritB);
                items["警告"].Add(semester, record.DemeritC);
            }

            Cell cell     = _cell;
            Cell itemCell = _cell;

            foreach (string name in _sortOrder)
            {
                WriteDisciplineItemRow(itemCell, items[name]);
                itemCell = WordHelper.GetMoveDownCell(itemCell, 1);
                if (itemCell == null)
                {
                    break;
                }
            }
        }
Exemple #4
0
 public bool Add(SemesterData semester, K12.Data.DomainScore domain)
 {
     if (!_scores.ContainsKey(semester))
     {
         _scores.Add(semester, new ScoreData("" + domain.Period, "" + domain.Credit, "" + domain.Score));
         return(true);
     }
     return(false);
 }
Exemple #5
0
        private void ProcessAttendance()
        {
            Dictionary <string, AttendanceItemRow> items = new Dictionary <string, AttendanceItemRow>();

            foreach (AutoSummaryRecord record in _list)
            {
                SemesterData semester = new SemesterData("" + record.SchoolYear, "" + record.Semester);

                foreach (AbsenceCountRecord absence in record.AbsenceCounts)
                {
                    if (!items.ContainsKey(absence.PeriodType + ":" + absence.Name))
                    {
                        items.Add(absence.PeriodType + ":" + absence.Name, new AttendanceItemRow(absence.PeriodType, absence.Name));
                    }
                    items[absence.PeriodType + ":" + absence.Name].Add(semester, absence.Count);
                }
            }

            Row   row      = _cell.ParentRow;
            Table table    = row.ParentTable;
            int   rowIndex = table.IndexOf(row);

            if (_types.Count <= 0)
            {
                row.Remove();
                return;
            }

            int typeCount = 0;

            foreach (string type in _types.Keys)
            {
                int nameCount = 0;
                foreach (string name in _types[type])
                {
                    nameCount++;
                    typeCount++;
                    table.Rows.Insert(++rowIndex, row.Clone(true));
                    Row tempRow = table.Rows[rowIndex];
                    Write(tempRow.Cells[2], name);
                    if (items.ContainsKey(type + ":" + name))
                    {
                        WriteAttendanceItemRow(tempRow.Cells[3], items[type + ":" + name]);
                    }
                }
                Cell nameCell = table.Rows[rowIndex - nameCount + 1].Cells[1];
                WordHelper.MergeVerticalCell(nameCell, nameCount);
                Write(nameCell, type);
            }
            Cell typeCell = table.Rows[rowIndex - typeCount + 1].Cells[0];

            WordHelper.MergeVerticalCell(typeCell, typeCount);
            Write(typeCell, "缺曠資料");

            row.Remove();
        }
Exemple #6
0
        public bool Add(SemesterData semester, int count)
        {
            if (!_items.ContainsKey(semester))
            {
                _items.Add(semester, 0);
            }
            _items[semester] += count;

            return(true);
        }
Exemple #7
0
        public bool Add(SemesterData semester, string text)
        {
            if (!_items.ContainsKey(semester))
            {
                _items.Add(semester, string.Empty);
            }
            _items[semester] = text;

            return(true);
        }
Exemple #8
0
 public bool Add(SemesterData semester, K12.Data.SubjectScore subject)
 {
     if (!_subjectScores.ContainsKey(subject.Subject))
     {
         _subjectScores.Add(subject.Subject, new Dictionary <SemesterData, ScoreData>());
     }
     if (!_subjectScores[subject.Subject].ContainsKey(semester))
     {
         _subjectScores[subject.Subject].Add(semester, new ScoreData("" + subject.Period, "" + subject.Credit, "" + subject.Score));
         return(true);
     }
     return(false);
 }
Exemple #9
0
 public override bool Equals(object obj)
 {
     if (obj is SemesterData)
     {
         SemesterData other = obj as SemesterData;
         if (this.SchoolYear == other.SchoolYear && this.Semester == other.Semester)
         {
             return(true);
         }
         return(false);
     }
     return(false);
 }
Exemple #10
0
        private void ProcessDailyBehavior()
        {
            _builder.MoveToMergeField("日常行為");
            _cell = _builder.CurrentParagraph.ParentNode as Cell;

            Dictionary <string, TextScoreItemRow> items = new Dictionary <string, TextScoreItemRow>();

            foreach (AutoSummaryRecord asRecord in _list)
            {
                if (asRecord.MoralScore == null)
                {
                    continue;
                }
                JHMoralScoreRecord record   = asRecord.MoralScore;
                SemesterData       semester = new SemesterData("" + record.SchoolYear, "" + record.Semester);

                XmlElement textscore = record.TextScore;
                if (textscore != null)
                {
                    foreach (string name in _sortOrder)
                    {
                        XmlElement item = (XmlElement)textscore.SelectSingleNode("DailyBehavior/Item[@Name='" + name + "']");
                        if (item != null)
                        {
                            if (!items.ContainsKey(name))
                            {
                                items.Add(name, new TextScoreItemRow(name));
                            }
                            items[name].Add(semester, item.GetAttribute("Degree"));
                        }
                    }
                }
            }

            Cell itemCell = _cell;

            foreach (string name in _sortOrder)
            {
                if (items.ContainsKey(name))
                {
                    WriteTextScoreItemRow(itemCell, items[name]);
                }
                itemCell = WordHelper.GetMoveDownCell(itemCell, 1);
                if (itemCell == null)
                {
                    break;
                }
            }
        }
Exemple #11
0
        private void Add(K12.Data.SemesterHistoryItem item)
        {
            SemesterData semester = new SemesterData("" + item.SchoolYear, "" + item.Semester);

            if (!_semsMapping.ContainsKey(semester))
            {
                int gradeYear = item.GradeYear;
                if (gradeYear > 6)
                {
                    gradeYear -= 6;
                }

                int index = (gradeYear - 1) * 2 + item.Semester;
                _semsMapping.Add(semester, index - 1);
            }
        }