Exemplo n.º 1
0
        /// <summary>
        /// Group By 科目清單,儲存於 Subjects  變數中。
        /// (限制在已選擇的學生有修的才算)。
        /// </summary>
        /// <param name="semsScores"></param>
        //private void GroupBySubjects(List<JHSemesterScoreRecord> semsScores)
        private void GroupBySubjects(List <InternalExamScoreRecord> examScores)
        {
            SubjectDomainMap = new Dictionary <string, string>();
            Dictionary <string, string> groupBySubject = new Dictionary <string, string>();

            //Group By 可選擇的科目清單。
            Dictionary <string, ReportStudent> dicSelectedStudents = JHStudent.SelectByClassIDs(
                SelectedClasses.ToKeys()).ToReportStudent().ToDictionary();

            // TODO: 這裡
            //foreach (JHSemesterScoreRecord eachScore in semsScores)
            foreach (InternalExamScoreRecord eachScore in examScores)
            {
                //如果成績不屬於已選擇的學生之中,就跳到下一筆。
                if (!dicSelectedStudents.ContainsKey(eachScore.RefStudentID))
                {
                    continue;
                }

                foreach (SubjectScore each in eachScore.Subjects.Values)
                {
                    if (!groupBySubject.ContainsKey(each.Subject))
                    {
                        groupBySubject.Add(each.Subject, null);
                        SubjectDomainMap.Add(each.Subject, each.Domain);
                    }
                }
            }

            //所有可選擇的科目。
            Subjects = new List <string>(groupBySubject.Keys);
            Subjects.Sort(new Comparison <string>(SubjectSorter.Sort));
        }
Exemplo n.º 2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            _options.SchoolYear = iptSchoolYear.Value;
            _options.Semester   = iptSemester.Value;
            List <JHStudentRecord> students = new List <JHStudentRecord>();

            if (_PrintSource == PrintSource.學生)
            {
                students = JHStudent.SelectByIDs(K12.Presentation.NLDPanels.Student.SelectedSource);
            }
            else  // 一般或輟學
            {
                students = (from data in JHStudent.SelectByClassIDs(K12.Presentation.NLDPanels.Class.SelectedSource) where data.Status == K12.Data.StudentRecord.StudentStatus.一般 || data.Status == K12.Data.StudentRecord.StudentStatus.輟學 select data).ToList();
            }

            //排序學生
            students.Sort(SortStudentByClassSeatNo);
            _options.Students = students;
            ReportController controller = new ReportController();

            controller.Generate(_options);
        }