private void FillScore() { _builder.MoveToMergeField("成績"); _font = _builder.Font; Cell indexCell = _builder.CurrentParagraph.ParentNode as Cell; //排序 List <string> domains = new List <string>(_manager.Domains.Keys); domains.Sort(JHSchool.Evaluation.Subject.CompareDomainOrdinal); foreach (var domainName in domains) { DomainRow domain = _manager.Domains[domainName]; bool display = false; if (_config.PrintDomains.ContainsKey(domain.DomainName)) { display = _config.PrintDomains[domain.DomainName]; } else { display = domain.Display; } if (display) { Cell temp = indexCell; indexCell = WordHelper.GetMoveDownCell(indexCell, 1); WriteDomainRowOnly(temp, domain); WordHelper.MergeHorizontalCell(temp, 2); if (indexCell == null) { break; } } else { if (domain.Subjects.Count > 0) { int count = WriteDomainRow(indexCell, domain); Cell temp = indexCell; indexCell = WordHelper.GetMoveDownCell(indexCell, count); WordHelper.MergeVerticalCell(temp, count); if (indexCell == null) { break; } } } } }
private void WriteDomainRowOnly(Cell indexCell, DomainRow domain) { WordHelper.Write(indexCell, _font, domain.DomainName); Cell temp = indexCell.NextSibling as Cell; temp = temp.NextSibling as Cell; WordHelper.Write(temp, _font, domain.PeriodCredit); foreach (var examID in domain.ExamIDs) { decimal?score = domain.GetScore(examID); decimal?assignmentScore = domain.GetAssignmentScore(examID); decimal?finalScore = domain.GetFinalScore(examID); temp = WordHelper.GetMoveRightCell(indexCell, _columnMapping[examID]); WordHelper.Write(temp, _font, (score.HasValue ? "" + _calculator.ParseDomainScore(score.Value) : "")); WordHelper.Write(temp.NextSibling as Cell, _font, (assignmentScore.HasValue ? "" + _calculator.ParseDomainScore(assignmentScore.Value) : "")); WordHelper.Write(temp.NextSibling.NextSibling as Cell, _font, (finalScore.HasValue ? "" + _calculator.ParseDomainScore(finalScore.Value) : "")); } }
internal void SetSubjects(List <string> list) { List <JHCourseRecord> courseList = new List <JHCourseRecord>(); foreach (string courseID in list) { if (!_courseDict.ContainsKey(courseID)) { continue; } courseList.Add(_courseDict[courseID]); } courseList.Sort(delegate(JHCourseRecord x, JHCourseRecord y) { return(JHSchool.Evaluation.Subject.CompareSubjectOrdinal(x.Subject, y.Subject)); }); foreach (JHCourseRecord course in courseList) { string domain = course.Domain; string subject = course.Subject; if (!Domains.ContainsKey(domain)) { Domains.Add(domain, new DomainRow(domain)); } DomainRow domainRow = Domains[domain]; if (!domainRow.Subjects.ContainsKey(subject)) { domainRow.AddSubject(subject); } domainRow.Subjects[subject].SetPeriodCredit(course.Period, course.Credit); //domainRow.Subjects[subject].Display = true; } }
internal void Add(HC.JHSCETakeRecord sce) { if (!_courseDict.ContainsKey(sce.RefCourseID)) { return; //如果評量成績的課程不存在,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.AssignmentScore); //if (_config.DomainSubjectSetup == DomainSubjectSetup.Subject) // subjectRow.Display = true; }
private int WriteDomainRow(Cell indexCell, DomainRow domain) { WordHelper.Write(indexCell, _font, string.IsNullOrEmpty(domain.DomainName) ? "彈性課程" : domain.DomainName); 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]; 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, "" + data.AssignmentScore); WordHelper.Write(temp.NextSibling.NextSibling as Cell, _font, "" + row.GetFinalScore(examID)); } subjectCell = WordHelper.GetMoveDownCell(subjectCell, 1); if (subjectCell == null) { break; } count++; //} } return(count); }
internal void Add(HC.JHSCETakeRecord sce) { if (!_courseDict.ContainsKey(sce.RefCourseID)) { return; //如果評量成績的課程不存在,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.AssignmentScore); //Report._NoneExamT if (course.AssessmentSetup == null) { Report._NoneExamT = true; } K12.Data.AssessmentSetupRecord assessmentSetupRecord = course.AssessmentSetup; XmlElement extension = assessmentSetupRecord.Extension; int examPercentage = 0; if (!string.IsNullOrEmpty(extension["ScorePercentage"].InnerText)) { examPercentage = Convert.ToInt32(extension["ScorePercentage"].InnerText.Trim(' ', '\n')); } int assignmentPercentage = 100 - examPercentage; subjectRow.examPercentage = examPercentage; subjectRow.assignmentPercentage = assignmentPercentage; //try //{ // K12.Data.AssessmentSetupRecord assessmentSetupRecord = course.AssessmentSetup; // XmlElement extension = assessmentSetupRecord.Extension; // int examPercentage = 0; // if (!string.IsNullOrEmpty(extension["ScorePercentage"].InnerText)) // { // examPercentage = Convert.ToInt32(extension["ScorePercentage"].InnerText.Trim(' ', '\n')); // } // int assignmentPercentage = 100 - examPercentage; // subjectRow.examPercentage = examPercentage; // subjectRow.assignmentPercentage = assignmentPercentage; //} //catch (Exception ex) //{ // if (course.AssessmentSetup == null) // { // MsgBox.Show ( _courseDict[sce.RefCourseID].Name + "未設定評分樣板"); // } else // { // MsgBox.Show(ex.Message); // } //} //if (_config.DomainSubjectSetup == DomainSubjectSetup.Subject) // subjectRow.Display = true; }