Exemplo n.º 1
0
        public static SuccessObjective getSuccessObjective(DataRow data, int weight, SuccessObjectiveClassifier classifier)
        {
            string ID          = data["ObjID"].ToString();
            string name        = data["ObjName"].ToString();
            string description = data["Description"].ToString();
            string link        = data["Link"].ToString();
            string type        = data["Type"].ToString().ToLower();

            if (type.Contains("course"))
            {
                if (type.Contains("goalarea"))
                {
                    return(new Course(ID, name, description, link, weight, classifier, ID, CourseType.GoalArea));
                }
                else if (type.Contains("programcore"))
                {
                    return(new Course(ID, name, description, link, weight, classifier, ID, CourseType.ProgramCore));
                }
                else //Elective
                {
                    return(new Course(ID, name, description, link, weight, classifier, ID, CourseType.Elective));
                }
            }
            else if (type.Contains("activity"))
            {
                return(new SuccessActivity(ID, name, description, link, weight, classifier));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
 public Course(string ID, string name, string description, string externalLink, int weight,
               SuccessObjectiveClassifier classifier, string courseID, CourseType type)
     : base(ID, name, description, externalLink, weight, classifier)
 {
     CourseID = courseID;
     Type     = type;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Adds a success objective classifier to the success map.
 /// </summary>
 public void addSuccessObjectiveClassifier(SuccessObjectiveClassifier classifier)
 {
     if (classifier != null)
     {
         objectiveClassifiers.Add(classifier);
     }
 }
Exemplo n.º 4
0
 public SuccessObjective(string ID, string name, string description, string externalLink, int weight,
                         SuccessObjectiveClassifier classifier)
 {
     this.ID      = ID;
     Name         = name;
     Description  = description;
     ExternalLink = externalLink;
     Weight       = weight;
     Classifier   = classifier;
 }
Exemplo n.º 5
0
 public SuccessActivity(string ID, string name, string description, string externalLink, int weight,
                        SuccessObjectiveClassifier classifier)
     : base(ID, name, description, externalLink, weight, classifier)
 {
 }
Exemplo n.º 6
0
        //Populates the given success map with the required data.
        private static void populateSuccessMap(ref SuccessMap successMap)
        {
            DatabaseSelect dbSelect = new DatabaseSelect();

            DataTable objectiveMappingsTable = dbSelect.SelectSuccessObjMapSuccessMap(successMap.ID);

            //The success map has success objectives
            if (objectiveMappingsTable != null && objectiveMappingsTable.Rows.Count > 0)
            {
                Dictionary <int, SuccessCategory>            categories  = new Dictionary <int, SuccessCategory>();
                Dictionary <int, SuccessObjectiveClassifier> classifiers = new Dictionary <int, SuccessObjectiveClassifier>();
                Dictionary <int, Semester>   semesters   = new Dictionary <int, Semester>();
                Dictionary <int, SchoolYear> schoolYears = new Dictionary <int, SchoolYear>();

                foreach (DataRow mappingData in objectiveMappingsTable.Rows)
                {
                    string objectiveID = mappingData["ObjID"].ToString();
                    int    semesterID  = (int)mappingData["SemesterID"];
                    int    categoryID  = (int)mappingData["CategoryID"];
                    int    weight      = (int)mappingData["Weight"];

                    //Classifier optional
                    int classifierID;
                    try
                    {
                        classifierID = (int)mappingData["ClassificationID"];

                        //Get success objective classifier if it doesn't already exist
                        if (!classifiers.ContainsKey(classifierID))
                        {
                            DataTable classifierTable = dbSelect.SelectClassifier(classifierID);
                            if (classifierTable != null && classifierTable.Rows.Count > 0) //Classifier exists
                            {
                                classifiers.Add(classifierID, getSuccessObjectiveClassifier(classifierTable.Rows[0]));
                            }
                        }
                    }
                    catch
                    {
                        classifierID = default;
                        Console.WriteLine("Classifier ID not provided for objective: " + objectiveID);
                    }

                    SuccessObjective successObjective = null;

                    //Get success objective
                    DataTable objectiveTable = dbSelect.SelectObjective(objectiveID);
                    if (objectiveTable != null && objectiveTable.Rows.Count > 0) //Objective exists
                    {
                        //Check if objective has a classifier
                        SuccessObjectiveClassifier classifier = classifierID != default ? classifiers[classifierID] : null;
                        successObjective = getSuccessObjective(objectiveTable.Rows[0], weight, classifier);
                    }
                    else
                    {
                        Console.WriteLine("Could not retrieve success objective with ID: " + objectiveID);
                    }

                    //Get success category if it doesn't already exist
                    if (!categories.ContainsKey(categoryID))
                    {
                        DataTable categoryTable = dbSelect.SelectCategory(categoryID);
                        if (categoryTable != null && categoryTable.Rows.Count > 0) //Category exists
                        {
                            categories.Add(categoryID, getSuccessCategory(categoryTable.Rows[0]));
                        }
                        else
                        {
                            Console.WriteLine("Could not retrieve success category with ID: " + categoryID);
                        }
                    }

                    //Get semester if it doesn't already exist
                    if (!semesters.ContainsKey(semesterID))
                    {
                        DataTable semesterTable = dbSelect.SelectSemester(semesterID);
                        if (semesterTable != null && semesterTable.Rows.Count > 0) //Semester exists
                        {
                            int year;
                            semesters.Add(semesterID, getSemester(semesterTable.Rows[0], out year));

                            //Get year if it doesn't already exist
                            if (!schoolYears.ContainsKey(year))
                            {
                                DataTable yearTable = dbSelect.SelectYear(year);
                                if (yearTable != null && yearTable.Rows.Count > 0) //Year exists
                                {
                                    schoolYears.Add(year, getSchoolYear(yearTable.Rows[0]));
                                }
                                else
                                {
                                    Console.WriteLine("Could not retrieve school year with ID: " + year);
                                }
                            }

                            //Add semester to year
                            Semester   semester   = semesters[semesterID];
                            SchoolYear schoolYear = schoolYears[year];
                            semester.SchoolYear = schoolYear;

                            //Associate semester with school year
                            string lowerCaseName = semester.Name.ToLower();
                            if (lowerCaseName.Contains("fall"))
                            {
                                schoolYear.Fall = semester;
                            }
                            else if (lowerCaseName.Contains("spring"))
                            {
                                schoolYear.Spring = semester;
                            }
                            else if (lowerCaseName.Contains("summer"))
                            {
                                schoolYear.Summer = semester;
                            }
                        }
                    }

                    SuccessCategory category          = categories[categoryID];
                    Semester        objectiveSemester = semesters[semesterID];

                    //Add success objective to the success map if all the required data is present
                    if (successObjective != null && category != null && objectiveSemester != null)
                    {
                        successMap.addSuccessObjective(category, objectiveSemester, successObjective);
                    }
                    else
                    {
                        Console.WriteLine("Could not add success objective to success map, missing required data.");
                    }
                }

                //Add classifiers to success map
                successMap.addSuccessObjectiveClassifiers(classifiers.Values);
            }
        }