Пример #1
0
        protected override void ReadRow(DataRow dr)
        {
            data    = dr;
            ID      = (int)dr["id"];
            Title   = (string)dr["title"];
            Created = (DateTime)dr["created_at"];

            Students.Clear();
            Exams.Clear();
            foreach (DataRow cRow in dr.GetChildRows("EducationStudents"))
            {
                Students.Add(new Student(cRow, this));
            }

            foreach (DataRow cRow in dr.GetChildRows("EducationExams"))
            {
                Exams.Add(new Exam(cRow, this));
            }
        }
Пример #2
0
        public void UpdateLists()
        {
            Educations.Clear();
            Students.Clear();
            Exams.Clear();
            Attempts.Clear();
            foreach (DataRow dr in dao.Data.Tables["Educations"].Rows)
            {
                Education e = new Education(dr);
                Educations.Add(e);

                Students.AddRange(e.Students);
                Exams.AddRange(e.Exams);
            }

            foreach (DataRow dr in dao.Data.Tables["Attempts"].Rows)
            {
                Student s = (from stud in Students where stud.ID == (int)dr["student_id"] select stud).First();
                Exam    e = (from ex in Exams where ex.ID == (int)dr["exam_id"] select ex).First();

                Attempts.Add(new Attempt(dr, e, s));
            }
        }