private void getInstructors()
 {
     InstructorsForDataGrid.Clear();
     using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress)))
     {
         Instructor[] instructors = service.ReadInstructors();
         foreach (var instructor in instructors)
         {
             InstructorsForDataGrid.Add(instructor);
         }
     }
 }
        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);
            }
        }
 private void getInstructors()
 {
     InstructorsForDataGrid.Clear();
     using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress)))
     {
         Instructor[] instructors = service.ReadInstructors();
         foreach (var instructor in instructors)
         {
             InstructorsForDataGrid.Add(instructor);
         }
     }
 }
        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);
            }
        }