public void changeCourseExecuted()
        {
            StudentsForDatagrid.Clear();

            if (SelectedCourse == null)
            {
                return;
            }

            // load datagrid with students
            using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress)))
            {
                Student[] students = service.ReadStudentsFromCourse(SelectedCourse.Id);

                foreach (var student in students)
                {
                    StudentsForDatagrid.Add(student);
                }
            }

            // load target course combobox
            TargetCoursePairs.Clear();
            foreach (var coursePair in CoursePairs)
            {
                if (((Course)coursePair.CourseObject).Id != SelectedCourse.Id)
                {
                    TargetCoursePairs.Add(coursePair);
                }
            }
        }
        public void assignExecuted()
        {
            using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress)))
            {
                List <Course>                 courses              = service.ReadCoursesFromSemester(SelectedSemester.Id).ToList();
                List <Instructor>             instructors          = service.ReadInstructors().ToList();
                List <Instructor> .Enumerator instructorEnumerator = instructors.GetEnumerator();
                List <Group>            groups         = new List <Group>();
                List <Room>             rooms          = service.ReadRooms().ToList();
                List <Room> .Enumerator roomEnumerator = rooms.GetEnumerator();

                try
                {
                    groupIndex = 0;
                    foreach (var course in courses)
                    {
                        List <Student> students = service.ReadStudentsFromCourse(course.Id).ToList();

                        // no group for empty courses --> continue with the other courses
                        if (students.Count() == 0)
                        {
                            continue;
                        }

                        // create new group
                        groups.Add(newGroup(ref roomEnumerator, ref instructorEnumerator, course));

                        foreach (var student in students)
                        {
                            Group group = groups.Last();

                            // if we reached the maximum computer count, add new group
                            if (group.Student.Count() == group.Room.Computer_count)
                            {
                                groups.Add(newGroup(ref roomEnumerator, ref instructorEnumerator, course));
                                group = groups.Last();
                            }

                            // set the students group and add the student to the collection
                            group.Student.Add(student);
                        }
                    }
                } catch (Exception e) {
                    throw e;
                }

                // UI
                AssignmentViewModel assignmentViewModel = new AssignmentViewModel(groups);
            }
        }
        public void changeCourseExecuted()
        {
            StudentsForDatagrid.Clear();

            if (SelectedCourse == null) return;

            // load datagrid with students
            using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress)))
            {
                Student[] students = service.ReadStudentsFromCourse(SelectedCourse.Id);

                foreach (var student in students)
                {
                    StudentsForDatagrid.Add(student);
                }
            }

            // load target course combobox
            TargetCoursePairs.Clear();
            foreach (var coursePair in CoursePairs)
            {
                if (((Course)coursePair.CourseObject).Id != SelectedCourse.Id)
                {
                    TargetCoursePairs.Add(coursePair);
                }
            }
        }
        public void assignExecuted()
        {
            using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress)))
            {
                List<Course> courses = service.ReadCoursesFromSemester(SelectedSemester.Id).ToList();
                List<Instructor> instructors = service.ReadInstructors().ToList();
                List<Instructor>.Enumerator instructorEnumerator = instructors.GetEnumerator();
                List<Group> groups = new List<Group>();
                List<Room> rooms = service.ReadRooms().ToList();
                List<Room>.Enumerator roomEnumerator = rooms.GetEnumerator();

                try
                {
                    groupIndex = 0;
                    foreach (var course in courses)
                    {
                        List<Student> students = service.ReadStudentsFromCourse(course.Id).ToList();

                        // no group for empty courses --> continue with the other courses
                        if (students.Count() == 0) continue;

                        // create new group
                        groups.Add(newGroup(ref roomEnumerator, ref instructorEnumerator, course));

                        foreach (var student in students)
                        {
                            Group group = groups.Last();

                            // if we reached the maximum computer count, add new group
                            if (group.Student.Count() == group.Room.Computer_count)
                            {
                                groups.Add(newGroup(ref roomEnumerator, ref instructorEnumerator, course));
                                group = groups.Last();
                            }

                            // set the students group and add the student to the collection
                            group.Student.Add(student);
                        }
                    }

                } catch (Exception e) {
                    throw e;
                }

                // UI
                AssignmentViewModel assignmentViewModel = new AssignmentViewModel(groups);
            }
        }