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 loadAssignmentExecuted() { using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress))) { Group[] groups = service.ReadGroupsFromSemester(SelectedSemester.Id); AssignmentViewModel assignmentViewModel = new AssignmentViewModel(groups.ToList()); } }
public void moveStudentExecuted() { using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress))) { service.MoveStudent(SelectedStudent.Id, SelectedTargetCourse.Id); // refresh datagrid changeCourseExecuted(); } }
public void deleteStudentExecuted() { using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress))) { service.DeleteStudents(new int[] { SelectedStudent.Id }); //MessageBox.Show("Rekord törölve."); // refresh datagrid changeCourseExecuted(); } }
public void saveInstructorExecuted() { using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress))) { service.CreateInstructor(new Instructor[] { _instructor }); _instructor.AcceptChanges(); } MessageBox.Show("Rekord beszúrva."); insertInstructorWindow.Close(); }
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 closeExecuted() { using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress))) { if (_groups.Count > 0) { service.DeleteGroups(_groups[0].Semester.Id); service.CreateGroup(_groups.ToArray()); } } _assignmentWindow.Close(); }
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 modifyInstructorExecuted() { ModifyableInstructor.clone(_instructor); using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress))) { service.UpdateInstructors(new Instructor[] { ModifyableInstructor }); _instructor.AcceptChanges(); } MessageBox.Show("Rekord módosítva."); insertInstructorWindow.Close(); }
public void modifyExecuted() { ModifyableStudent.clone(_student); using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress))) { service.UpdateStudents(new Student[] { ModifyableStudent }); _student.AcceptChanges(); } MessageBox.Show("Rekord módosítva."); insertStudentWindow.Close(); }
public MainWindowViewModel() { SemesterPairs = new List<ComboBoxSemesterPair>(); using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress))) { Semester[] semesters = service.ReadSemesters(); foreach (var semester in semesters) { SemesterPairs.Add(new ComboBoxSemesterPair() { SemesterObject = semester, SemesterString = semester.Name }); } } CoursePairs = new ObservableCollection<ComboBoxCoursePair>(); TargetCoursePairs = new ObservableCollection<ComboBoxCoursePair>(); StudentsForDatagrid = new ObservableCollection<Student>(); }
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 MainWindowViewModel() { SemesterPairs = new List <ComboBoxSemesterPair>(); using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress))) { Semester[] semesters = service.ReadSemesters(); foreach (var semester in semesters) { SemesterPairs.Add(new ComboBoxSemesterPair() { SemesterObject = semester, SemesterString = semester.Name }); } } CoursePairs = new ObservableCollection <ComboBoxCoursePair>(); TargetCoursePairs = new ObservableCollection <ComboBoxCoursePair>(); StudentsForDatagrid = new ObservableCollection <Student>(); }
public void importFromExcelExecuted() { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = ""; dlg.DefaultExt = ".xlsx"; dlg.Filter = "Excel-fájl | *.xls; *.xlsx"; bool?result = dlg.ShowDialog(); if (result == false) { return; } string filename = dlg.FileName; using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress))) { Semester semester = service.ReadSemesters().First(); IEnumerable <Student> students = ExcelTools.ImportFromExcel(filename, semester); service.CreateStudents(students.ToArray()); } }
public void saveExecuted() { using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress))) { service.CreateStudents(new Student[] { _student }); _student.AcceptChanges(); } MessageBox.Show("Rekord beszúrva."); insertStudentWindow.Close(); }
public void deleteInstructorExecuted() { using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress))) { service.DeleteInstructors(new int[] { SelectedInstructor.Id }); //MessageBox.Show("Rekord törölve."); // refresh datagrid getInstructors(); } }
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 importFromExcelExecuted() { Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog(); dlg.FileName = ""; dlg.DefaultExt = ".xlsx"; dlg.Filter = "Excel-fájl | *.xls; *.xlsx"; bool? result = dlg.ShowDialog(); if (result == false) { return; } string filename = dlg.FileName; using (var service = new ClassAdministrationServiceClient(new BasicHttpBinding(), new EndpointAddress(BUTEClassAdministrationClient.Properties.Resources.endpointAddress))) { Semester semester = service.ReadSemesters().First(); IEnumerable<Student> students = ExcelTools.ImportFromExcel(filename, semester); service.CreateStudents(students.ToArray()); } }