コード例 #1
0
 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();
     }
 }
コード例 #2
0
        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();
        }
コード例 #3
0
        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;
        }
コード例 #5
0
 protected virtual void ClearNavigationProperties()
 {
     Course.Clear();
     Group.Clear();
 }
コード例 #6
0
        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();
            }
        }