Esempio n. 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);
            }
        }
Esempio n. 2
0
        protected override object OnBackgroundWorkerWorking()
        {
            try
            {
                List <AttendInfo> attends = new List <AttendInfo>();
                DSResponse        rsp     = QueryCourse.GetSCAttend(RunningID);
                _current_response = rsp.GetContent();

                foreach (XmlElement each in rsp.GetContent().GetElements("Student"))
                {
                    attends.Add(new AttendInfo(each));
                }

                return(attends);
            }
            catch (Exception ex)
            {
                return(ex);
            }
        }
Esempio n. 3
0
        private void bkw_DoWork(object sender, DoWorkEventArgs e)
        {
            string[] list = (string[])e.Argument;

            DSResponse rsp = QueryCourse.GetSCAttend(list);

            foreach (XmlElement each in rsp.GetContent().GetElements("Student"))
            {
                string attendID  = each.GetAttribute("ID");
                string studentID = each.SelectSingleNode("RefStudentID").InnerText;
                string courseID  = each.SelectSingleNode("RefCourseID").InnerText;

                AttInfo attInfo = new AttInfo(attendID, courseID, studentID);
                if (!_StudentAttenCourses.ContainsKey(studentID))
                {
                    _StudentAttenCourses.Add(studentID, new List <AttInfo>());
                }
                _StudentAttenCourses[studentID].Add(attInfo);

                _AttendInfoList.Add(attInfo);
            }
        }