Example #1
0
 public AssignmentDetailStudentDTO(Assignment assignment, Student student, Tutor tutor) : base(assignment, tutor)
 {
     if (assignment != null && student != null)
     {
         Tasks = new HashSet <TaskListDTO>();
         HashSet <int> taskNumbers = new HashSet <int>();
         foreach (GroupMembership membership in student.GroupMemberships)
         {
             if (assignment.Equals(membership.Group.Lesson.Assignment))
             {
                 Lesson          = new LessonListDTO(membership.Group.Lesson, null);
                 GroupMembership = new GroupMembershipDTO(membership);
                 foreach (Evaluation evaluation in membership.Group.Evaluations)
                 {
                     taskNumbers.Add(evaluation.Task.Number);
                     Tasks.Add(new TaskDetailDTO(evaluation.Task, evaluation));
                 }
                 break;
             }
         }
         if (assignment.Tasks != null)
         {
             foreach (Task task in assignment.Tasks)
             {
                 if (!taskNumbers.Contains(task.Number))
                 {
                     Tasks.Add(new TaskListDTO(task));
                 }
             }
         }
         Result = new AssignmentResult(student, assignment, false);
     }
 }
        public GroupDetailTeacherDTO(Group group) : base(group)
        {
            Tasks = new HashSet <TaskDetailDTO>();
            HashSet <int> taskNumbers = new HashSet <int>();

            if (group != null)
            {
                if (group.Lesson != null)
                {
                    Lesson = new LessonListDTO(group.Lesson, null);
                }
                if (group.Lesson.Assignment != null)
                {
                    Assignment = new AssignmentListDTO(group.Lesson.Assignment);
                }
                if (group.Lesson.Assignment.Course != null)
                {
                    Course = new CourseListDTO(group.Lesson.Assignment.Course);
                }
                foreach (Evaluation evaluation in group.Evaluations)
                {
                    taskNumbers.Add(evaluation.Task.Number);
                    Tasks.Add(new TaskDetailDTO(evaluation.Task, evaluation));
                }
                foreach (Task task in group.Lesson.Assignment.Tasks)
                {
                    if (!taskNumbers.Contains(task.Number))
                    {
                        Tasks.Add(new TaskDetailDTO(task, null));
                    }
                }
            }
        }
Example #3
0
 public LessonDetailDTO(Lesson lesson) : base(lesson, null)
 {
     if (lesson != null)
     {
         if (lesson.Assignment != null)
         {
             Assignment = new AssignmentListDTO(lesson.Assignment);
         }
         if (lesson.Assignment.Course != null)
         {
             Course = new CourseListDTO(lesson.Assignment.Course);
         }
         Groups = new HashSet <GroupListDTO>();
         foreach (Group group in lesson.Groups)
         {
             Groups.Add(new GroupListDTO(group));
         }
         if (lesson.DerivedFrom != null)
         {
             DerivedFrom = new LessonListDTO(lesson.DerivedFrom, null);
         }
     }
 }