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 changeCourseCmbExecuted()
        {
            CoursePairs.Clear();

            using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress)))
            {
                Course[] courses = service.ReadCoursesFromSemester(SelectedSemester.Id);
                foreach (var course in courses)
                {
                    CoursePairs.Add(new ComboBoxCoursePair()
                    {
                        CourseObject = course,
                        CourseString = PrettyFormatter.dayFormatter(Convert.ToInt32(course.Day_of_week)) + ' '
                                       + course.Starting_time + ' '
                                       + PrettyFormatter.parityFormatter(course.Week_parity)
                    });
                }
            }
        }
        public void changeCourseCmbExecuted()
        {
            CoursePairs.Clear();

            using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress)))
            {
                Course[] courses = service.ReadCoursesFromSemester(SelectedSemester.Id);
                foreach (var course in courses)
                {
                    CoursePairs.Add(new ComboBoxCoursePair()
                    {
                        CourseObject = course,
                        CourseString = PrettyFormatter.dayFormatter(Convert.ToInt32(course.Day_of_week)) + ' '
                                            + course.Starting_time + ' '
                                            + PrettyFormatter.parityFormatter(course.Week_parity)

                    });
                }
            }
        }
        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);
            }
        }