示例#1
0
 void InsertCourseToListOfTeacherCourses(Course i_courseToAdd)
 {
     m_ListOfCoursesThatTheTeacherIsTeach.Add(i_courseToAdd);
 }
示例#2
0
 private bool isCourseInTheArray(Course i_course, Course[] i_courseArray, int i_startPosition)
 {
     bool returnAnswer = false;
     while (i_startPosition < i_courseArray.Length && returnAnswer == false)
     {
         if (i_courseArray[i_startPosition] != null)
         {
             if (i_course.ID == i_courseArray[i_startPosition].ID)
             {
                 returnAnswer = true;
             }
             i_startPosition++;
         }
         else
         {
             break;
         }
     }
     return returnAnswer;
 }
示例#3
0
 void DeleteCourseToListOfTeacherCourses(Course i_courseToDelete)
 {
     m_ListOfCoursesThatTheTeacherIsTeach.Remove(i_courseToDelete);
 }
示例#4
0
 private Course getRandomCourse(List<Course> i_ListOfCourses, Course[] i_courseArray, int i_startPosition)
 {
     int index = 0;
     bool isInTheArray = true;
     while (isInTheArray)
     {
         index = rnd.Next(i_ListOfCourses.Count);
         isInTheArray = isCourseInTheArray(i_ListOfCourses[index], i_courseArray, i_startPosition);
     }
     return i_ListOfCourses[index];
 }
示例#5
0
 //randomly selection - corect it
 //private void insertEleventCourseToArray(Course[] courseArray, int i_NumberOfElevtiveCourses)
 //{
 //    int currentPossition = 0;
 //    if (i_NumberOfElevtiveCourses < m_ListOfElectiveCoursesThatTheStudentCanTakeByPreference.Count)
 //    {
 //        for (; currentPossition < i_NumberOfElevtiveCourses; currentPossition++)
 //        {
 //            //ToDo
 //            //to add a function that checks if the course is in the array and, the courses will add rundomly
 //            courseArray[currentPossition] = m_ListOfElectiveCoursesThatTheStudentCanTakeByPreference[currentPossition];
 //        }
 //    }
 //    else if (i_NumberOfElevtiveCourses >= m_ListOfElectiveCoursesThatTheStudentCanTakeByPreference.Count)
 //    {
 //        for (; currentPossition < m_ListOfCoursesTheStudentNeedsToBeRegisteredToThisSemester.Count; currentPossition++)
 //        {
 //            courseArray[currentPossition] = m_ListOfCoursesTheStudentNeedsToBeRegisteredToThisSemester[currentPossition];
 //        }
 //    }
 //}
 private void insertRequiredCourseToArray(Course[] courseArray, int i_NumberOfRequiredCourses)
 {
     //int coursesTahtAddedToArray = 0;
     if (i_NumberOfRequiredCourses < m_ListOfCoursesTheStudentNeedsToBeRegisteredToThisSemester.Count)
     {
     }
 }
示例#6
0
 internal int[] modifyNumbersOfCoursesToArray(Course[] m_ArrayOfCourses)
 {
     int[] returnArr = new int[m_ArrayOfCourses.Length];
     int count = 0;
     while (count < m_ArrayOfCourses.Length)
     {
         returnArr[count] = m_ArrayOfCourses[count].ID;
         count++;
     }
     return returnArr;
 }
示例#7
0
        public void updateStudentCoursLists(int i_StudentId)
        {
            MySqlConnection conn = null;
            MySqlDataReader rdr = null;
            Course CourseToAdd;
            try
            {
                conn = new MySqlConnection(k_CS);
                conn.Open();

                string quoteByString = "SELECT * FROM sql217024.studentsgrades where StudentID = '" + i_StudentId + "'";

                MySqlCommand cmd = new MySqlCommand(quoteByString, conn);
                rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    CourseToAdd = new Course(rdr.GetInt32(2), rdr.GetInt32(3));
                    if (rdr.GetInt32(3) >= 60)
                    {
                        m_ListOfCoursesTheStudentPass.Add(CourseToAdd);
                    }
                    else
                    {
                        m_ListOfCoursesTheStudentFailed.Add(CourseToAdd);
                    }
                }

            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Error: {0}", ex.ToString());

            }
            finally
            {
                if (rdr != null)
                {
                    rdr.Close();
                }

                if (conn != null)
                {
                    conn.Close();
                }

            }
        }
示例#8
0
        public void updateCourseListThatTheStudentHaveToTake(int i_StudentSemeste)
        {
            MySqlConnection conn = null;
            MySqlDataReader rdr = null;
            Course CourseToAdd;
            try
            {
                conn = new MySqlConnection(k_CS);
                conn.Open();

                string quoteByString = "SELECT * FROM sql217024.coursesplan where Semester = '" + i_StudentSemeste + "'";

                MySqlCommand cmd = new MySqlCommand(quoteByString, conn);
                rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    CourseToAdd = new Course(rdr.GetInt32(0), -1);
                    m_ListOfCoursesTheStudentNeedsToBeRegisteredToThisSemester.Add(CourseToAdd);
                }

            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Error: {0}", ex.ToString());

            }
            finally
            {
                if (rdr != null)
                {
                    rdr.Close();
                }

                if (conn != null)
                {
                    conn.Close();
                }

            }
            if (m_ListOfCoursesTheStudentFailed.Count != 0)
            {
                foreach (Course failedCourse in m_ListOfCoursesTheStudentFailed)
                {
                    m_ListOfCoursesTheStudentNeedsToBeRegisteredToThisSemester.Add(failedCourse);
                }
            }
            updateCourseScore();
        }
示例#9
0
        public Course[] modifyArrayOfCourses(int i_NumberOfRequiredCourses)
        {
            int min1, min2, count;
            Course[] returnArr;
            min1 = Math.Min(i_NumberOfRequiredCourses, m_ListOfCoursesTheStudentNeedsToBeRegisteredToThisSemester.Count);
            min2 = m_ListOfElectiveCoursesThatTheStudentCanTakeByPreference.Count;
            count = 0;
            returnArr = new Course[min1 + min2];
            orderRequiredCourseListByScore();
            while (count < min1)
            {
                returnArr[count] = m_ListOfCoursesTheStudentNeedsToBeRegisteredToThisSemester[count];
                count ++;
            }

            while ((count - min1) < min2)
            {
                returnArr[count] = getRandomCourse(m_ListOfElectiveCoursesThatTheStudentCanTakeByPreference, returnArr, min1);
                count++;
            }
            return returnArr;
        }
示例#10
0
        public void getListOfElectiveCourses()
        {
            MySqlConnection conn = null;
            MySqlDataReader rdr = null;
            Course CourseToAdd;
            int numberOfPreference = 0;
            try
            {
                conn = new MySqlConnection(k_CS);
                conn.Open();
                while (m_ListOfCourseTypeCodesWitchTheStudentPreferred.Count > numberOfPreference)
                {
                    string quoteByString = "SELECT * FROM sql217024.coursesclass where coursesClassType = '" + m_ListOfCourseTypeCodesWitchTheStudentPreferred[numberOfPreference] + "'";
                    MySqlCommand cmd = new MySqlCommand(quoteByString, conn);
                    rdr = cmd.ExecuteReader();
                    while (rdr.Read())
                    {
                        CourseToAdd = new Course(rdr.GetInt32(0), -1);
                        m_ListOfElectiveCoursesThatTheStudentCanTakeByPreference.Add(CourseToAdd);
                    }
                    numberOfPreference++;
                    if (rdr != null)
                    {
                        rdr.Close();
                    }
                }

            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Error: {0}", ex.ToString());

            }
            finally
            {
                if (rdr != null)
                {
                    rdr.Close();
                }

                if (conn != null)
                {
                    conn.Close();
                }

            }
        }