protected void Page_Load(object sender, EventArgs e)
        {
            msgLabel.Text = "";
            try
            {

                List<Department> departments = new List<Department>();
                List<Semester> semester = new List<Semester>();
                departmentDropDownList.DataTextField = "DepartmentCode";
                departmentDropDownList.DataValueField = "departmentId";
                semesterDropDownList.DataTextField = "SemesterName";
                semesterDropDownList.DataValueField = "SemesterId";
                aDepartmentManager = new DepartmentManager();
                departments = aDepartmentManager.GetAllDepartments();
                SemesterManager aSemesterManager = new SemesterManager();
                semester = aSemesterManager.GetAllSemesters();

                if (!IsPostBack)
                {
                    departmentDropDownList.DataSource = departments;
                    departmentDropDownList.DataBind();
                    semesterDropDownList.DataSource = semester;
                    semesterDropDownList.DataBind();
                }
            }
            catch (Exception exception)
            {
                msgLabel.ForeColor = Color.Red;
                msgLabel.Text = exception.Message;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            msgLabel.Text = "";

            try
            {
                departmentDropDownList.DataTextField = "DepartmentCode";
                departmentDropDownList.DataValueField = "departmentId";
                semesterDropDownList.DataTextField = "SemesterName";
                semesterDropDownList.DataValueField = "SemesterId";
                dayDropDownList.DataTextField = "dayName";
                dayDropDownList.DataValueField = "dayId";
                buildingDropDownList.DataTextField = "buildingName";
                buildingDropDownList.DataValueField = "buildingId";
                courseDropDownList.DataTextField = "courseCode";
                courseDropDownList.DataValueField = "courseId";
                roomDropDownList.DataTextField = "roomName";
                roomDropDownList.DataValueField = "roomId";

                if (!IsPostBack)
                {

                    List<Course> courses = new List<Course>();
                    List<Day> days = new List<Day>();
                    List<Department> departments = new List<Department>();
                    List<Semester> semester = new List<Semester>();
                    List<Building> buildings = new List<Building>();
                    aDepartmentManager = new DepartmentManager();
                    departments = aDepartmentManager.GetAllDepartments();
                    SemesterManager aSemesterManager = new SemesterManager();
                    semester = aSemesterManager.GetAllSemesters();
                    aScheduleManager = new ScheduleManager();
                    buildings = aScheduleManager.GetAllBuildings();
                    days = aScheduleManager.GetAllDays();
                    aCourseManager = new CourseManager();
                    courses = aCourseManager.GetAllCourses();
                    dayDropDownList.DataSource = days;
                    dayDropDownList.DataBind();
                    departmentDropDownList.DataSource = departments;
                    departmentDropDownList.DataBind();
                    semesterDropDownList.DataSource = semester;
                    semesterDropDownList.DataBind();
                    buildingDropDownList.DataSource = buildings;
                    buildingDropDownList.DataBind();
                    courseDropDownList.DataSource = courses;
                    courseDropDownList.DataBind();
                }
            }
            catch (Exception exception)
            {
                msgLabel.ForeColor = Color.Red;
                msgLabel.Text = exception.Message;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            msgLabel.Text = "";
            try
            {
                departmentDropDownList.DataTextField = "DepartmentCode";
                departmentDropDownList.DataValueField = "departmentId";
                semesterDropDownList.DataTextField = "SemesterName";
                semesterDropDownList.DataValueField = "SemesterId";
                if (!IsPostBack)
                {
                    List<Department> departments = new List<Department>();
                    List<Semester> semester = new List<Semester>();
                    aDepartmentManager = new DepartmentManager();
                    departments = aDepartmentManager.GetAllDepartments();
                    SemesterManager aSemesterManager = new SemesterManager();
                    semester = aSemesterManager.GetAllSemesters();
                    departmentDropDownList.DataSource = departments;
                    departmentDropDownList.DataBind();
                    semesterDropDownList.DataSource = semester;
                    semesterDropDownList.DataBind();
                    GetAllUnscheduleCourses();
                }

            }

            catch (SqlException sqlException)
            {
                msgLabel.ForeColor = Color.Red;
                msgLabel.Text = "Database error.See details error: " + sqlException.Message;

            }
            catch (Exception exception)
            {
                msgLabel.ForeColor = Color.Red;
                string errorMessage = "Unknow error occured.";
                errorMessage += exception.Message;
                if (exception.InnerException != null)
                {
                    errorMessage += exception.InnerException.Message;
                }
                msgLabel.Text = errorMessage;
            }
        }