예제 #1
0
        /// <summary>
        /// build courses list for curriculum
        /// </summary>
        /// <param name="coursesString"></param>
        /// <returns></returns>
        private List <Course> builder(string coursesString)
        {
            List <Course> result = new List <Course>();

            // for each crs name in splitted string
            foreach (string crsName in coursesString.Split(','))
            {
                if (crsName == "")
                {
                    continue;
                }
                // create new crs
                Course crs = new Course();
                // get course from db
                crs = SqlWorker.GetCoures(crsName.Trim());
                // fill lectures
                crs.LectEventsList = SqlWorker.GetLects(crs);
                // fill Practice and Lab of the curse
                crs.PractEventsList = SqlWorker.GetPracts(crs);
                crs.LabsEventsList  = SqlWorker.GetLabs(crs);

                result.Add(crs);
            }

            return(result);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        private void BuildCurriculum()
        {
            // if curriculum is empty or not init, stop
            if (currentStudent.Curriculum == null || currentStudent.Curriculum.Courses.Count == 0)
            {
                return;
            }

            // handle course adition
            foreach (Course crs in currentStudent.Curriculum.Courses)
            {
                bool preReq = true;
                // for each course
                // check if there are pre courses
                // IF GLOBAL USER IS A SECRETARY, SHE CAN DO WHAT SHE WANTS
                if (crs.PreReq != "")
                // if there are
                {
                    // check for each if the student passed them
                    foreach (string preCrsName in crs.PreReq.Split(','))
                    {
                        if (preCrsName == "")
                        {
                            continue;
                        }
                        // if they dont,
                        if (!currentStudent.PassedCourses.Contains(preCrsName))
                        {
                            // try to find it in curriculum
                            Course preCrs = currentStudent.Curriculum.Courses.Find(f_crs => f_crs.Name == preCrsName);
                            if (preCrs == null)
                            {
                                // not in curriculum
                                // init them and add them to the must do list
                                preCrs = SqlWorker.GetCoures(preCrsName);
                                // fill lectures
                                preCrs.LectEventsList = SqlWorker.GetLects(preCrs);
                                // fill Practice and Lab of the curse
                                preCrs.PractEventsList = SqlWorker.GetPracts(preCrs);
                                preCrs.LabsEventsList  = SqlWorker.GetLabs(preCrs);
                            }
                            // do NOT add the original crs to the list
                            preReq = false;
                            // add it to the must do list if it's not there already
                            if (!SearchCourseInComboBoxs(preCrs))
                            {
                                if (preCrs.Must)
                                {
                                    this.must_do_courses_list.Items.Add(preCrs);
                                }
                                else
                                {
                                    this.can_do_courses_list.Items.Add(preCrs);
                                }
                            }
                        }
                    }
                }
                // if there are no pre courses or the student passed them all
                if (Globals._session.Type == "Secretary" || (preReq && !currentStudent.PassedCourses.Contains(crs.Name)))
                {
                    // add the crs based on must field
                    if (!SearchCourseInComboBoxs(crs))
                    {
                        if (crs.Must)
                        {
                            this.must_do_courses_list.Items.Add(crs);
                        }
                        else
                        {
                            this.can_do_courses_list.Items.Add(crs);
                        }
                    }
                }
            }
        }