Пример #1
0
        /// <summary>
        /// Get the differences between the original and updated courses.
        /// </summary>
        /// <param name="originalCourses">The original courses before changes were made to them.</param>
        /// <param name="newCourses">The updated courses which have had changes made during the session.</param>
        /// <returns>The differences between the original and new courses.</returns>
        private List <CourseDifference> GetDifferences(List <Course> originalCourses, List <Course> newCourses)
        {
            List <CourseDifference> differences = new List <CourseDifference>();

            for (int i = 0; i < originalCourses.Count; i++)
            {
                for (int j = 0; j < newCourses.Count; j++)
                {
                    if (originalCourses[i].ClassID_AsInt == newCourses[j].ClassID_AsInt)
                    {
                        var difference = new CourseDifference();

                        // Checks if the needsRoom variable has been changed from true to false
                        bool v = (originalCourses[i].NeedsRoom == true && newCourses[j].NeedsRoom == false);
                        if (v)
                        {
                            setDifferences(originalCourses[i], newCourses[j], "No Assignment Needed", differences, difference);
                        }

                        // Otherwise check if another change has been made
                        if (originalCourses[i] != newCourses[j])
                        {
                            setDifferences(originalCourses[i], newCourses[j], "Modified", differences, difference);
                        }
                    }

                    // TODO: Finish Implementing differences
                }
            }

            return(differences);
        }
        private List <CourseDifference> GetDifferences(List <Course> originalCourses, List <Course> newCourses)
        {
            List <CourseDifference> differences = new List <CourseDifference>();

            for (int i = 0; i < originalCourses.Count; i++)
            {
                for (int j = 0; j < newCourses.Count; j++)
                {
                    if (originalCourses[i].ClassID_AsInt == newCourses[j].ClassID_AsInt)
                    {
                        if (!CoursesAreSame(originalCourses[i], newCourses[j]))
                        {
                            var difference = new CourseDifference();

                            difference.DifferenceType = "Modified";
                            difference.OriginalCourse = originalCourses[i];
                            difference.NewestCourse   = newCourses[j];
                            differences.Add(difference);
                        }
                    }

                    // TODO: Finish Implementing differences
                }
            }

            return(differences);
        }
Пример #3
0
 /// <summary>
 /// Method to set the differences using the info from getDifferences.
 /// Mainly to make future additions to the changes page easier
 /// </summary>
 /// <param name="i">The original course.</param>
 /// <param name="j">The update course</param>
 /// <param name="type">The type of difference between the two courses</param>
 /// <param name="diff">The list of differences</param>
 /// <param name="difference">The difference to be added to the list of differences</param>
 /// <returns>The list of differences</returns>
 private List <CourseDifference> setDifferences(Course i, Course j, string type, List <CourseDifference> diff, CourseDifference difference)
 {
     difference.DifferenceType = type;
     difference.OriginalCourse = i;
     difference.NewestCourse   = j;
     diff.Add(difference);
     return(diff);
 }