public void UpdateCourses(Course[] courses) { using (ClassAdministrationEntityContext context = new ClassAdministrationEntityContext(BUTEClassAdministrationService.Properties.Resources.connectionString)) { foreach (var course in courses) { context.CourseSet.ApplyChanges(course); } context.SaveChanges(); } }
public StudentViewModel(Semester selectedSemester, Course selectedCourse) { modify = false; _student = new Student(); Name = ""; Neptun = ""; Semester = selectedSemester; Course = selectedCourse; insertStudentWindow = new InsertStudentWindow(); insertStudentWindow.DataContext = this; insertStudentWindow.ShowDialog(); }
public StudentViewModel(Student selectedStudent, Semester selectedSemester, Course selectedCourse) { modify = true; ModifyableStudent = selectedStudent; _student = new Student(); _student.clone(selectedStudent); Semester = selectedSemester; Course = selectedCourse; insertStudentWindow = new InsertStudentWindow(); insertStudentWindow.DataContext = this; insertStudentWindow.ShowDialog(); }
private Group newGroup(ref List<Room>.Enumerator roomEnumerator, ref List<Instructor>.Enumerator instructorEnumerator, Course course) { Group group = new Group(); groupIndex++; group.Index = groupIndex; group.Course = course; group.Semester = SelectedSemester; if (!roomEnumerator.MoveNext()) { throw new BUTEClassAdministrationException("Nincs elég terem a beosztáshoz"); } group.Room = roomEnumerator.Current; if (!instructorEnumerator.MoveNext()) { throw new BUTEClassAdministrationException("Nincs elég gyakorlatvezető a beosztáshoz"); } group.Instructor = instructorEnumerator.Current; return group; }
protected virtual void ClearNavigationProperties() { Course.Clear(); Group.Clear(); }
private void FixupCourse(Course previousValue) { if (IsDeserializing) { return; } if (previousValue != null && previousValue.Group.Contains(this)) { previousValue.Group.Remove(this); } if (Course != null) { if (!Course.Group.Contains(this)) { Course.Group.Add(this); } } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("Course") && (ChangeTracker.OriginalValues["Course"] == Course)) { ChangeTracker.OriginalValues.Remove("Course"); } else { ChangeTracker.RecordOriginalValue("Course", previousValue); } if (Course != null && !Course.ChangeTracker.ChangeTrackingEnabled) { Course.StartTracking(); } FixupCourseKeys(); } }