protected void LoadPreviousRequests()
        {
            using (WebhostEntities db = new WebhostEntities())
            {
                Student student = db.Students.Where(s => s.ID == SelectedStudentId).Single();
                Term    term    = db.Terms.Where(t => t.id == termId).Single();
                SeniorProjectPanel.Visible = student.GraduationYear == term.AcademicYearID;
                if (!SeniorProjectPanel.Visible)
                {
                    SeniorProjectCB.Checked = false;
                }

                List <WebhostMySQLConnection.CourseRequest> coursereqs = student.CourseRequests.Where(cr => cr.TermId == termId).ToList();

                if (student.CourseRequestComments.Where(crn => crn.TermId == termId).Count() > 0)
                {
                    NotesInput.Text = student.CourseRequestComments.Where(crn => crn.TermId == termId).Single().Notes;
                }
                else
                {
                    NotesInput.Text = "";
                }

                int eng = 0, hist = 0, sci = 0, math = 0, wl = 0, art = 0, tech = 0;

                foreach (WebhostMySQLConnection.CourseRequest cr in coursereqs)
                {
                    switch (cr.RequestableCourse.Course.DepartmentID)
                    {
                    case 0:     // Science
                        if (cr.IsGlobalAlternate)
                        {
                            Science3DDL.ClearSelection();
                            Science3DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            sci++;
                        }
                        else if (cr.IsSecondary || sci > 0)
                        {
                            Science2DDL.ClearSelection();
                            Science2DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            sci++;
                            SciencePriority.ClearSelection();
                            if (cr.IsSecondary)
                            {
                                SciencePriority.SelectedIndex = 0;
                            }
                            else
                            {
                                SciencePriority.SelectedIndex = 1;
                            }
                        }
                        else
                        {
                            Science1DDL.ClearSelection();
                            Science1DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            sci++;
                        }
                        break;

                    case 1:     // Tech
                        if (cr.IsGlobalAlternate || cr.IsSecondary || tech > 0)
                        {
                            if (!cr.IsGlobalAlternate && !cr.IsSecondary)
                            {
                                TechPriority.ClearSelection();
                                TechPriority.SelectedIndex = 1;
                            }
                            else
                            {
                                TechPriority.ClearSelection();
                                TechPriority.SelectedIndex = 0;
                            }
                            Tech2DDL.ClearSelection();
                            Tech2DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            tech++;
                        }
                        else
                        {
                            Tech1DDL.ClearSelection();
                            Tech1DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            tech++;
                        }
                        break;

                    case 2:     // English
                        if (cr.IsGlobalAlternate || cr.IsSecondary || eng > 0)
                        {
                            if (!cr.IsGlobalAlternate && !cr.IsSecondary)
                            {
                                EnglishSelectionPriority.ClearSelection();
                                EnglishSelectionPriority.SelectedIndex = 1;
                            }
                            else
                            {
                                EnglishSelectionPriority.ClearSelection();
                                EnglishSelectionPriority.SelectedIndex = 0;
                            }
                            English2DDL.ClearSelection();
                            English2DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            eng++;
                        }
                        else
                        {
                            English1DDL.ClearSelection();
                            English1DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            eng++;
                        }
                        break;

                    case 3:     // History
                        if (cr.IsGlobalAlternate || cr.IsSecondary || hist > 0)
                        {
                            if (!cr.IsGlobalAlternate && !cr.IsSecondary)
                            {
                                HistorySelectionPriority.ClearSelection();
                                HistorySelectionPriority.SelectedIndex = 1;
                            }
                            else
                            {
                                HistorySelectionPriority.ClearSelection();
                                HistorySelectionPriority.SelectedIndex = 0;
                            }
                            History2DDL.ClearSelection();
                            History2DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            hist++;
                        }
                        else
                        {
                            History1DDL.ClearSelection();
                            History1DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            hist++;
                        }
                        break;

                    case 4:     // Math
                        if (cr.IsGlobalAlternate || cr.IsSecondary || math > 0)
                        {
                            if (!cr.IsGlobalAlternate && !cr.IsSecondary)
                            {
                                MathPriority.ClearSelection();
                                MathPriority.SelectedIndex = 1;
                            }
                            else
                            {
                                MathPriority.ClearSelection();
                                MathPriority.SelectedIndex = 0;
                            }
                            Math2DDL.ClearSelection();
                            Math2DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            math++;
                        }
                        else
                        {
                            Math1DDL.ClearSelection();
                            Math1DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            math++;
                        }
                        break;

                    case 5:     // World Languages
                        if (cr.RequestableCourse.Course.Name.Contains("ESL"))
                        {
                            ESL.Checked = true;
                        }
                        else if (cr.IsGlobalAlternate || cr.IsSecondary || wl > 0)
                        {
                            if (!cr.IsGlobalAlternate && !cr.IsSecondary)
                            {
                                WorldLangPriority.ClearSelection();
                                WorldLangPriority.SelectedIndex = 1;
                            }
                            else
                            {
                                WorldLangPriority.ClearSelection();
                                WorldLangPriority.SelectedIndex = 2;
                            }
                            WorldLang2DDL.ClearSelection();
                            WorldLang2DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            wl++;
                        }
                        else
                        {
                            WorldLang1DDL.ClearSelection();
                            WorldLang1DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            wl++;
                        }
                        break;

                    case 6:     // LSP
                        LSP.Checked = true;
                        break;

                    case 9:     // Art
                        if (cr.IsGlobalAlternate)
                        {
                            Art3DDL.ClearSelection();
                            Art3DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            Art3Priority.ClearSelection();
                            Art3Priority.SelectedIndex = 0;
                            art++;
                        }
                        else if (cr.IsSecondary || art > 0)
                        {
                            if (art > 1)
                            {
                                Art3DDL.ClearSelection();
                                Art3DDL.SelectedValue = Convert.ToString(cr.CourseId);
                                art++;
                                Art3Priority.ClearSelection();
                                if (cr.IsSecondary)
                                {
                                    Art3Priority.SelectedIndex = 0;
                                }
                                else
                                {
                                    Art3Priority.SelectedIndex = 1;
                                }
                            }
                            else
                            {
                                Art2DDL.ClearSelection();
                                Art2DDL.SelectedValue = Convert.ToString(cr.CourseId);
                                art++;
                                ArtPriority.ClearSelection();
                                if (cr.IsSecondary)
                                {
                                    ArtPriority.SelectedIndex = 0;
                                }
                                else
                                {
                                    ArtPriority.SelectedIndex = 1;
                                }
                            }
                        }
                        else
                        {
                            Art1DDL.ClearSelection();
                            Art1DDL.SelectedValue = Convert.ToString(cr.CourseId);
                            art++;
                        }
                        break;

                    case 8:
                        SeniorProjectCB.Checked = true;
                        break;

                    default: break;
                    }
                }
            }
        }