Beispiel #1
0
        public SmartSchoolDataProvider(string courseid)
        {
            _courseid = courseid;
            DSResponse  dsrsp  = QueryCourse.GetCourseExam(courseid);
            DSXmlHelper helper = dsrsp.GetContent();
            Dictionary <string, string> examList = new Dictionary <string, string>();

            // 塞 Header
            _columnHeader = new ColumnHeader();
            _columnHeader.Columns.Add(new ColumnSetting("-1", "班級", 60));
            _columnHeader.Columns.Add(new ColumnSetting("-1", "座號", 40, new DecimalComparer()));
            _columnHeader.Columns.Add(new ColumnSetting("-1", "姓名", 70));
            _columnHeader.Columns.Add(new ColumnSetting("-1", "學號", 70));

            foreach (XmlNode node in helper.GetElements("Course"))
            {
                string examName = node.SelectSingleNode("ExamName").InnerText;
                string examid   = node.SelectSingleNode("RefExamID").InnerText;

                _columnHeader.Columns.Add(new ColumnSetting(examid, examName, 80, new DecimalComparer()));
                examList.Add(examid, examName);
            }
            _columnHeader.Columns.Add(new ColumnSetting("-1", "課程成績", 100, new DecimalComparer()));


            // 取回本課程所有學生的考試成績
            DSResponse scoreResp    = QueryCourse.GetSECTake(courseid);
            XmlElement scoreElement = scoreResp.GetContent().GetElement(".");


            // 塞 Row
            _rowCollection = new RowCollection();
            dsrsp          = QueryCourse.GetSCAttend(courseid);
            helper         = dsrsp.GetContent();

            foreach (XmlNode node in helper.GetElements("Student"))
            {
                RowEntity row = new RowEntity(node.Attributes["ID"].Value);
                row.AddCell("班級", new StudentCell(node.SelectSingleNode("ClassName").InnerText));
                row.AddCell("座號", new StudentCell(node.SelectSingleNode("SeatNumber").InnerText));
                row.AddCell("姓名", new StudentCell(node.SelectSingleNode("Name").InnerText));
                row.AddCell("學號", new StudentCell(node.SelectSingleNode("StudentNumber").InnerText));
                foreach (string examid in examList.Keys)
                {
                    ScoreInfo score = GetScore(scoreElement, examid, node.Attributes["ID"].Value);
                    row.AddCell(examList[examid], new ExamCell(score));
                }
                row.AddCell("課程成績", new ScoreExamCell(new ScoreInfo(node.Attributes["ID"].Value, node.SelectSingleNode("Score").InnerText)));
                _rowCollection.Add(node.Attributes["ID"].Value, row);
            }
        }
Beispiel #2
0
 public void Add(string studentid, RowEntity entity)
 {
     _rowIndex.Add(studentid);
     _rows.Add(entity);
 }