Exemplo n.º 1
0
        public SCAttendCollection LoadData()
        {
            int current = 0;
            SCAttendCollection objSCAttends = new SCAttendCollection();

            foreach (List <string> each in _packings)
            {
                current++;

                if (_progress.Cancellation)
                {
                    break;
                }

                _progress.ReportProgress(string.Format("下載修課相關資料({0}%)", Math.Round(((float)current / (float)_packings.Count) * 100, 0)), 0);
                XmlElement xmlSCAttends = QueryCourse.GetSCAttendBrief(each.ToArray()).GetContent().BaseElement;

                foreach (XmlElement attend in xmlSCAttends.SelectNodes("Student"))
                {
                    SCAttend scattend = new SCAttend(attend);
                    objSCAttends.Add(scattend.Identity, scattend);
                }
            }

            return(objSCAttends);
        }
Exemplo n.º 2
0
 private static void CreateSCAttendSCETakeReference(SCAttendCollection scattends, SCETakeCollection scetakes)
 {
     foreach (SCETake each in scetakes.Values)
     {
         if (scattends.ContainsKey(each.SCAttendId))
         {
             SCAttend scattend = scattends[each.SCAttendId];
             scattend.SCETakes.Add(each);
         }
         else
         {
             Console.WriteLine("SCETake Error:" + each.Identity);
         }
     }
 }
Exemplo n.º 3
0
        public void LoadCalculationData(IProgressUI progressUI)
        {
            _progress_ui = progressUI;
            _courses     = new CourseCollection();

            List <string> courseIds = new List <string>();

            foreach (CourseRecord each in JHSchool.Course.Instance.SelectedList)
            {
                courseIds.Add(each.ID);
            }

            CurrentStep = 1;
            ReportProgress("下載課程相關資料...", 0);
            CourseCollection courses = Course.GetCourses(courseIds.ToArray());

            if (_progress_ui.Cancellation)
            {
                return;
            }

            CurrentStep++;
            ReportProgress("下載評量相關資料...", 0);
            ExamTemplateCollection templates = ExamTemplate.GetExamTemplates();

            if (_progress_ui.Cancellation)
            {
                return;
            }

            TEIncludeCollection teincludes = TEInclude.GetTEIncludes();

            if (_progress_ui.Cancellation)
            {
                return;
            }

            CurrentStep++;
            SCAttendCollection scattends = SCAttend.GetSCAttends(_progress_ui, courseIds.ToArray());

            if (_progress_ui.Cancellation)
            {
                return;
            }

            CurrentStep++;
            SCETakeCollection scetakes = SCETake.GetSCETakes(_progress_ui, courseIds.ToArray());

            if (_progress_ui.Cancellation)
            {
                return;
            }

            //建立 ExamTemplate 的 TEInclude。
            CreateTemplateExamReference(templates, teincludes);

            //建立 Course 的 ExamTemplate。
            CreateCourseTemplateReference(courses, templates);

            //建立 Course 的 SCAttend。
            CreateCourseStudentTwoWayReference(courses, scattends);

            //建立 SCAttend  的 SCETake。
            CreateSCAttendSCETakeReference(scattends, scetakes);

            _courses = courses;
        }