}//end constructor

        public List <CourseOffering> getOfferingsByGoalIdAndSemester(String theGoalId, String semester)
        {
            CoreGoal theGoal = null;

            foreach (CoreGoal cg in Goals)
            {
                if (cg.Id.Equals(theGoalId))
                {
                    theGoal = cg; break;
                }
            }
            if (theGoal == null)
            {
                throw new Exception("Didn't find the goal");
            }
            //search list of courses, then for each course, search offerings
            List <CourseOffering> courseOfferingsThatMeetGoal = new List <CourseOffering>();

            foreach (CourseOffering c in Offerings)
            {
                if (c.Semester.Equals(semester) &&
                    theGoal.Courses.Contains(c.TheCourse))
                {
                    courseOfferingsThatMeetGoal.Add(c);
                }
            }//end for
            return(courseOfferingsThatMeetGoal);
        }
Exemple #2
0
        public List <Course> getCoursesByGoalIds(String userGoalId1, String userGoalId2)
        {
            List <CoreGoal> byGoalIDsOnly = repo.Goals;
            List <Course>   byGoals       = repo.Courses;

            List <Course> courseThatMeet2GoalID = new List <Course>();



            CoreGoal theGoal4 = null;
            CoreGoal theGoal5 = null;

            foreach (CoreGoal f in byGoalIDsOnly)
            {
                if (f.Id.Equals(userGoalId1))
                {
                    theGoal4 = f;// deafult


                    break;
                }
            }
            if (theGoal4 == null)
            {
                throw new Exception("Goal not found");
            }


            foreach (CoreGoal g in byGoalIDsOnly)
            {
                if (g.Id.Equals(userGoalId2))
                {
                    theGoal5 = g;


                    break;
                }
            }
            if (theGoal5 == null)
            {
                throw new Exception("Goal not found");
            }


            foreach (Course z in byGoals)
            {
                if (theGoal4.Courses.Contains(z) &&
                    theGoal5.Courses.Contains(z))

                {
                    courseThatMeet2GoalID.Add(z);
                }
            }

            return(courseThatMeet2GoalID);
        }
Exemple #3
0
        public List <CourseOffering> getOfferingsByGoalIdAndSemester(String theGoalId, String semester)
        {
            List <CoreGoal> theGoals = repo.Goals;

            List <CourseOffering> theOfferings = repo.Offerings;



            CoreGoal theGoal = null;

            foreach (CoreGoal cg in theGoals)
            {
                if (cg.Id.Equals(theGoalId))
                {
                    theGoal = cg; break;
                }
            }

            if (theGoal == null)
            {
                throw new Exception("Didn't find the goal");
            }


            List <CourseOffering> courseOfferingsThatMeetGoal = new List <CourseOffering>();



            foreach (CourseOffering c in theOfferings)
            {
                if (c.Semester.Equals(semester)

                    && theGoal.Courses.Contains(c.TheCourse))

                {
                    courseOfferingsThatMeetGoal.Add(c);
                }
            }

            return(courseOfferingsThatMeetGoal);
        }
Exemple #4
0
        public List <Course> getCoursesByGoalId(String userGoalId)
        {
            List <CoreGoal> byGoalIDOnly = repo.Goals;
            List <Course>   byGoal       = repo.Courses;

            List <Course> corseThatMeetGoalID = new List <Course>();



            CoreGoal theGoal3 = null;

            foreach (CoreGoal f in byGoalIDOnly)
            {
                if (f.Id.Equals(userGoalId))
                {
                    theGoal3 = f;


                    break;
                }
            }
            if (theGoal3 == null)
            {
                throw new Exception("There are no matches for this goal");
            }

            foreach (Course f in byGoal)
            {
                if (theGoal3.Courses.Contains(f))
                {
                    corseThatMeetGoalID.Add(f);
                }
            }

            return(corseThatMeetGoalID);
        }
        //Add more data as needed
        public CourseRepository()
        {
            Courses   = new List <Course>();
            Goals     = new List <CoreGoal>();
            Offerings = new List <CourseOffering>();

            Course c1 = new Course()
            {
                Name        = "ARTD 201",
                Title       = "graphic design",
                Credits     = 3.0,
                Description = "graphic design descr"
            };
            Course c2 = new Course()
            {
                Name        = "ARTS 101",
                Title       = "art studio",
                Credits     = 3.0,
                Description = "studio descr"
            };
            Course c3 = new Course()
            {
                Name        = "STAT 201",
                Title       = "stats",
                Credits     = 4.0,
                Description = "stats descr"
            };
            Course c4 = new Course()
            {
                Name        = "ENGL 302",
                Title       = "Math as a Communication language",
                Credits     = 4.0,
                Description = "communication descr"
            };

            Courses.Add(c1);
            Courses.Add(c2);
            Courses.Add(c3);
            Courses.Add(c4);



            CourseOffering co1 = new CourseOffering()
            {
                TheCourse = c1,
                Section   = "D1",
                Semester  = "Spring 2021"
            };
            CourseOffering co2 = new CourseOffering()
            {
                TheCourse = c3,
                Section   = "01",
                Semester  = "Spring 2021"
            };
            CourseOffering co3 = new CourseOffering()
            {
                TheCourse = c2,
                Section   = "01",
                Semester  = "Spring 2022"
            };

            Offerings.Add(co1);
            Offerings.Add(co2);
            Offerings.Add(co3);



            CoreGoal cg1 = new CoreGoal()
            {
                Id          = "CG1",
                Name        = "Artistic Expression",
                Description = "Desc for artistic expression",
                Courses     = new List <Course>()
                {
                    c1, c2
                }
            };
            CoreGoal cg2 = new CoreGoal()
            {
                Id          = "CG2",
                Name        = "Quantitative Literacy",
                Description = "Desc for quantitative literacy",
                Courses     = new List <Course>()
                {
                    c2, c3
                }
            };
            CoreGoal cg3 = new CoreGoal()
            {
                Id          = "CG3",
                Name        = "Effective Communication",
                Description = "Desc for communication",
                Courses     = new List <Course>()
                {
                    c4, c3
                }
            };

            Goals.Add(cg1);
            Goals.Add(cg2);
            Goals.Add(cg3);
        }//end constructor