Beispiel #1
0
        //Function triggered when student selects different concurrent class from dropdown
        protected void CurrentCoursesDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (CurrentCoursesDropDownList.SelectedIndex > 0)
            {
                //Figure out which course
                int    courseID = int.Parse(CurrentCoursesDropDownList.SelectedValue);
                Course course   = GrouperMethods.GetCourse(courseID);

                if (ViewState["CurrentCourses"] == null)
                {
                    ViewState["CurrentCourses"] = new List <Course>();
                }
                else //Check if the use is trying to select a course they've already selected
                {
                    foreach (Course curCourse in ((List <Course>)ViewState["CurrentCourses"]))
                    {
                        if (curCourse.CourseID == courseID) //They've already selected this course, so don't re-add it
                        {
                            return;
                        }
                    }
                }

                //Add selected course to gridview
                ((List <Course>)ViewState["CurrentCourses"]).Add(course);

                //Rebind
                CurrentCoursesGridView.DataSource = (List <Course>)ViewState["CurrentCourses"];
                CurrentCoursesGridView.DataBind();
            }
        }
Beispiel #2
0
        //Function triggered when studen de-selects a current course
        protected void CurrentCoursesGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "delete_course")
            {
                //get course
                int courseID = int.Parse(e.CommandArgument.ToString());

                //remvove the course from the view
                if (ViewState["CurrentCourses"] != null)
                {
                    ((List <Course>)ViewState["CurrentCourses"]).RemoveAll(x => x.CourseID == courseID);

                    //Rebind
                    CurrentCoursesGridView.DataSource = (List <Course>)ViewState["CurrentCourses"];
                    CurrentCoursesGridView.DataBind();
                }
            }
        }
Beispiel #3
0
        //This executes whenever the page is loaded (or re-loaded)
        protected void Page_Load(object sender, EventArgs e)
        {
            //instantiate the student object
            if (ThisStudent == null)
            {
                ThisStudent = new Student();
            }

            if (!TEST_FLAG)
            {
                //If the GUID does not idicate a valid student, redirect
                if ((ThisStudent.SurveySubmittedDate != null) || (GUID == "") || (GUID == null))
                {
                    Response.Redirect("Oops.aspx");
                }
            }

            //Only do these things the firsrt time the page loads (not on post-backs)
            if (!IsPostBack)
            {
                //Fill out name information
                FirstNameLabel.Text      = ThisStudent.FirstName;
                LastNameLabel.Text       = ThisStudent.LastName;
                PreferedNameTextBox.Text = ThisStudent.FirstName;

                //Bind data for drop-down repeaters
                ClassesRepeater_BindRepeater();
                RolesRepeater_BindRepeater();
                LanguagesRepeater_BindRepeater();
                SkillsRepeater_BindRepeater();

                //Bind data for current courses section
                CurrentCoursesDropDownList.DataSource = GrouperMethods.GetCourses();
                CurrentCoursesDropDownList.DataBind();
                CurrentCoursesGridView.DataSource = null;
                CurrentCoursesGridView.DataBind();
            }
        }