public void Refresh()
 {
     txtCourseCredit.Text    = "";
     txtCourseName.Text      = "";
     txtCreditTaken.Text     = "";
     txtRemainingCredit.Text = "";
     DepartmentDropDownList.ClearSelection();
     TeacherDropDownList.ClearSelection();
     CourseDropDownList.ClearSelection();
 }
        public void GetAllCourseCodeByDepartment()
        {
            Courses _Course = new Courses();

            _Course.DepartmentId              = Convert.ToInt32(DepartmentDropDownList.SelectedValue);
            CourseDropDownList.DataSource     = _CourseAssigneManager.GetAllCourseCodeByDepartment(_Course.DepartmentId);
            CourseDropDownList.DataTextField  = "CourseCode";
            CourseDropDownList.DataValueField = "Id";
            CourseDropDownList.DataBind();
            CourseDropDownList.Items.Insert(0, new ListItem("Select Course Code", "0"));
        }
 /*          METHOD HEADER
  * NAME: CollegeListDropDown_SelectedIndexChanged
  * PURPOSE: Called when a different selection is chosen in College drop down list.
  *          Changes bindings on Course Dropdown list so they are always relevant.
  *
  */
 protected void CollegeListDropDown_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         int selectedIndex = CollegeListDropDown.SelectedIndex + 1;
         CourseDropDownList.DataTextField = "_course_name";
         CourseDropDownList.DataSource    = myDal.DisplayCoursesByInstitution(selectedIndex);
         CourseDropDownList.DataBind();
         //courseLoaded = true;
     }
     catch (Exception ex)
     {
         logger.AddEventToLog(ex.ToString(), "Exception", "Set Course Books");
     }
 }
        //static bool collegeLoaded = false;



        /*          METHOD HEADER
         * NAME: Page_Load
         * PURPOSE: Called when the page is initally loaded.
         *          Sets bindings on Institute Dropdown List.
         *          Also Binds all books to booklistview.
         *
         */
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable myDataTablee = new DataTable();

            //Page Authentication 1
            if (Request.IsAuthenticated)
            {
                if (!IsPostBack)
                {
                    string useremail = User.Identity.Name;
                    // Get User Data from FormsAuthenticationTicket and show it in WelcomeBackMessage
                    FormsIdentity ident = User.Identity as FormsIdentity;

                    if (ident != null)
                    {
                        FormsAuthenticationTicket ticket = ident.Ticket;

                        string[] buffer  = ticket.UserData.Split('|');
                        string   GroupID = buffer[0];
                        string   UserID  = buffer[1];

                        if (Int32.Parse(GroupID) < 3)
                        {
                            Button14.Visible = true;
                        }

                        // Bind Book ListView
                        allBookListTable           = myDal.getStoredProcData("GetAllBooks");
                        AllBookListView.DataSource = allBookListTable;
                        AllBookListView.DataBind();

                        int currentUserID = 0;

                        // Get user ID
                        try
                        {
                            currentUserID = Int32.Parse(buffer[1]);
                        }
                        catch
                        {
                            currentUserID = 1;
                            logger.AddEventToLog("Couldnt Validate UserID Defaulting to Basic User", "Exception", "Login Page");
                        }

                        myDataTablee = myDal.GetInstituteIDByUserID(Int32.Parse(UserID));
                        int institution_id = Int32.Parse(myDataTablee.Rows[0].ItemArray[0].ToString());

                        // Bind Insitute Dropdown Based on User ID
                        CollegeListDropDown.DataTextField = "_institution_name";
                        CollegeListDropDown.DataSource    = myDal.GetInstituteByUserID(currentUserID);// NEEDS TO GET USER ID
                        CollegeListDropDown.DataBind();


                        //THIS NEEDS TO GET FIXED.
                        CourseDropDownList.DataTextField = "_course_name";
                        CourseDropDownList.DataSource    = myDal.DisplayCoursesByInstitution(institution_id);
                        CourseDropDownList.DataBind();

                        string selectedCourse = CourseDropDownList.Text;
                        courseBookListTable           = myDal.DisplayBooksByCourses(selectedCourse);
                        CourseBookListView.DataSource = courseBookListTable;
                        CourseBookListView.DataBind();

                        logger.AddEventToLog("Page Loaded Successfully", "Successful Operation", "Login Page");
                    }
                    else
                    {
                        Response.Redirect("~/LoginPage.aspx", true);
                    }
                }
            }
            else
            {
                Response.Redirect("~/LoginPage.aspx", true);
            }
        }