public static List <CourseProgrammePart> readCourseProgrammePart(Programme programme)
        {
            List <CourseProgrammePart> courseProgrammePartList = new List <CourseProgrammePart>();
            String readCSECoursesStatement = "SELECT * FROM CourseProgrammePart WHERE PROGRAMMEID = '" + programme.id + "'";

            try
            {
                dbConnection.Open();
                sqlCommand = new SQLiteCommand(readCSECoursesStatement, dbConnection);
                dataReader = sqlCommand.ExecuteReader();

                while (dataReader.Read())
                {
                    CourseProgrammePart courseProgrammePart = new CourseProgrammePart(dataReader["COURSEID"].ToString(), dataReader["PART"].ToString(), dataReader["PROGRAMMEID"].ToString());
                    courseProgrammePartList.Add(courseProgrammePart);
                }
                dbConnection.Close();
            }
            catch (Exception e)
            {
                Logger.Error("DatabaseConnection::readCourseProgrammePart() " + e.Message);
            }

            return(courseProgrammePartList);
        }
        public static List <Course> readCoursesUsingProgrammePart(Programme programme, String part)
        {
            List <Course> courses = new List <Course>();
            String        readCoursesStatement = "SELECT COURSEID FROM CourseProgrammePart WHERE PROGRAMMEID = '" + programme.id + "' AND PART = '" + part + "'";

            try
            {
                dbConnection.Open();
                sqlCommand = new SQLiteCommand(readCoursesStatement, dbConnection);
                dataReader = sqlCommand.ExecuteReader();

                while (dataReader.Read())
                {
                    String cseCourseId   = dataReader["COURSEID"].ToString();
                    String readCSECourse = "SELECT * FROM Course WHERE ID = '" + cseCourseId + "'";

                    SQLiteCommand    sqlCommandTemp = new SQLiteCommand(readCSECourse, dbConnection);
                    SQLiteDataReader dataReaderTemp = sqlCommandTemp.ExecuteReader();

                    while (dataReaderTemp.Read())
                    {
                        Course cseCourse = new Course(dataReaderTemp["ID"].ToString(),
                                                      (int)dataReaderTemp["YR"],
                                                      (int)dataReaderTemp["SEM"],
                                                      dataReaderTemp["NAME"].ToString(),
                                                      dataReaderTemp["DESC"].ToString(),
                                                      (int)dataReaderTemp["POINTS"],
                                                      dataReaderTemp["ACADEMICORG"].ToString(),
                                                      dataReaderTemp["ACADEMICGROUP"].ToString(),
                                                      dataReaderTemp["COURSECOMP"].ToString(),
                                                      dataReaderTemp["GRADINGBASIS"].ToString(),
                                                      dataReaderTemp["TYPOFFERED"].ToString(),
                                                      dataReaderTemp["REMARKS"].ToString(),
                                                      dataReaderTemp["CAREERID"].ToString());

                        Logger.Info("[DatabaseConnection::readCoursesUsingProgrammePart()] PreRequisite Course Information:");
                        Logger.Info("[DatabaseConnection::readCoursesUsingProgrammePart()]" + "\nID: " + cseCourse.id + "\nNAME: " + cseCourse.name + "\nDESC: " + cseCourse.description);
                        courses.Add(cseCourse);
                    }
                }
                dbConnection.Close();
            }
            catch (Exception e)
            {
                Logger.Error("DatabaseConnection::readCoursesUsingProgrammePart() " + e.Message);
            }

            return(courses);
        }
        public static void readProgrammes(List <Programme> programmes)
        {
            String readProgrammeStatement = "SELECT * FROM Programme";

            try
            {
                programmes.Clear();
                dbConnection.Open();
                sqlCommand = new SQLiteCommand(readProgrammeStatement, dbConnection);
                dataReader = sqlCommand.ExecuteReader();

                while (dataReader.Read())
                {
                    Programme programme = new Programme(dataReader["ID"].ToString(), dataReader["NAME"].ToString(), dataReader["DESC"].ToString(), dataReader["COURSEID"].ToString());
                    programmes.Add(programme);
                    Logger.Info("ID: " + programme.id + " NAME: " + programme.name + " DESC: " + programme.description + " COURSEID: " + programme.courseId);
                }
                dbConnection.Close();
            }
            catch (Exception e)
            {
                Logger.Error("DatabaseConnection::readProgrammes() " + e.Message);
            }
        }
        /// <summary>
        /// Handles the programme selection.
        /// </summary>
        private void programmeTreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            TreeViewItem tvi = (TreeViewItem)e.NewValue;

            if (tvi != null)
            {
                tvi.IsExpanded = !tvi.IsExpanded;

                StackPanel itemHeader = (StackPanel)((TreeViewItem)((TreeView)sender).SelectedItem).Header;

                var programmeLabel = itemHeader.Children.OfType<Label>().FirstOrDefault();

                foreach (var programme in programmes)
                {
                    if (programme.name == programmeLabel.Content.ToString())
                    {
                        programmePageTBRight.Text = DatabaseConnection.readProgrammeName(programme.id) + " (" + programme.id + ")" + "\n\n"
                            + DatabaseConnection.readProgrammeDescription(programme.id);

                        selectedProgramme = programme;
                        break;
                    }
                }
            }
        }
        public static void readProgrammes(List<Programme> programmes)
        {
            String readProgrammeStatement = "SELECT * FROM Programme";

            try
            {
                programmes.Clear();
                dbConnection.Open();
                sqlCommand = new SQLiteCommand(readProgrammeStatement, dbConnection);
                dataReader = sqlCommand.ExecuteReader();

                while (dataReader.Read())
                {
                    Programme programme = new Programme(dataReader["ID"].ToString(), dataReader["NAME"].ToString(), dataReader["DESC"].ToString(), dataReader["COURSEID"].ToString());
                    programmes.Add(programme);
                    Logger.Info("ID: " + programme.id + " NAME: " + programme.name + " DESC: " + programme.description + " COURSEID: " + programme.courseId);
                }
                dbConnection.Close();
            }
            catch (Exception e)
            {
                Logger.Error("DatabaseConnection::readProgrammes() " + e.Message);
            }
        }
        public static List<Course> readCoursesUsingProgrammePart(Programme programme, String part)
        {
            List<Course> courses = new List<Course>();
            String readCoursesStatement = "SELECT COURSEID FROM CourseProgrammePart WHERE PROGRAMMEID = '" + programme.id + "' AND PART = '" + part + "'";

            try
            {
                dbConnection.Open();
                sqlCommand = new SQLiteCommand(readCoursesStatement, dbConnection);
                dataReader = sqlCommand.ExecuteReader();

                while (dataReader.Read())
                {
                    String cseCourseId = dataReader["COURSEID"].ToString();
                    String readCSECourse = "SELECT * FROM Course WHERE ID = '" + cseCourseId + "'";

                    SQLiteCommand sqlCommandTemp = new SQLiteCommand(readCSECourse, dbConnection);
                    SQLiteDataReader dataReaderTemp = sqlCommandTemp.ExecuteReader();

                    while (dataReaderTemp.Read())
                    {
                        Course cseCourse = new Course(dataReaderTemp["ID"].ToString(),
                                (int)dataReaderTemp["YR"],
                                (int)dataReaderTemp["SEM"],
                                dataReaderTemp["NAME"].ToString(),
                                dataReaderTemp["DESC"].ToString(),
                                (int)dataReaderTemp["POINTS"],
                                dataReaderTemp["ACADEMICORG"].ToString(),
                                dataReaderTemp["ACADEMICGROUP"].ToString(),
                                dataReaderTemp["COURSECOMP"].ToString(),
                                dataReaderTemp["GRADINGBASIS"].ToString(),
                                dataReaderTemp["TYPOFFERED"].ToString(),
                                dataReaderTemp["REMARKS"].ToString(),
                                dataReaderTemp["CAREERID"].ToString());

                        Logger.Info("[DatabaseConnection::readCoursesUsingProgrammePart()] PreRequisite Course Information:");
                        Logger.Info("[DatabaseConnection::readCoursesUsingProgrammePart()]" + "\nID: " + cseCourse.id + "\nNAME: " + cseCourse.name + "\nDESC: " + cseCourse.description);
                        courses.Add(cseCourse);
                    }
                }
                dbConnection.Close();
            }
            catch (Exception e)
            {
                Logger.Error("DatabaseConnection::readCoursesUsingProgrammePart() " + e.Message);
            }

            return courses;
        }
        public static List<CourseProgrammePart> readCourseProgrammePart(Programme programme)
        {
            List<CourseProgrammePart> courseProgrammePartList = new List<CourseProgrammePart>();
            String readCSECoursesStatement = "SELECT * FROM CourseProgrammePart WHERE PROGRAMMEID = '" + programme.id + "'";

            try
            {
                dbConnection.Open();
                sqlCommand = new SQLiteCommand(readCSECoursesStatement, dbConnection);
                dataReader = sqlCommand.ExecuteReader();

                while (dataReader.Read())
                {
                    CourseProgrammePart courseProgrammePart = new CourseProgrammePart(dataReader["COURSEID"].ToString(), dataReader["PART"].ToString(), dataReader["PROGRAMMEID"].ToString());
                    courseProgrammePartList.Add(courseProgrammePart);
                }
                dbConnection.Close();
            }
            catch (Exception e)
            {
                Logger.Error("DatabaseConnection::readCourseProgrammePart() " + e.Message);
            }

            return courseProgrammePartList;
        }