Esempio n. 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();
            }
        }
Esempio n. 2
0
        //Function triggered when submit button clicked
        protected void SubmitLinkButton_Click(object sender, EventArgs e)
        {
            Student student = ThisStudent;

            //Set submit time
            student.SurveySubmittedDate = DateTime.Now;

            //Set prefered name
            student.PreferredName = PreferedNameTextBox.Text;

            //Set UOID

            int uoid;

            if (int.TryParse(UOIDTextBox.Text.Trim(), out uoid))
            {
                student.UOID = uoid;
            }

            //Set Primary/Secondary language info
            if (SecondLanguageDropDownList.SelectedIndex > 0)
            {
                student.EnglishSecondLanguageFlag = true;
                student.NativeLanguage            = SecondLangTextBox.Text;
            }

            //Set current courses
            if (ViewState["CurrentCourses"] != null)
            {
                foreach (Course curCourse in ((List <Course>)ViewState["CurrentCourses"]))
                {
                    student.CurrentCourses.Add(curCourse);
                }
            }

            //Set prior courses
            foreach (RepeaterItem courseItem in ClassesRepeater.Items)
            {
                HiddenField courseIdHiddenField = (HiddenField)courseItem.FindControl("CourseIdHiddenField");
                int         courseID            = int.Parse(courseIdHiddenField.Value);
                Course      course = GrouperMethods.GetCourse(courseID);

                DropDownList courseGradeDropDownList = (DropDownList)courseItem.FindControl("GradeDropDownList");

                if (courseGradeDropDownList.SelectedIndex > 0)
                {
                    int grade = int.Parse(courseGradeDropDownList.SelectedValue);
                    course.Grade = grade;
                    student.PriorCourses.Add(course);
                }
            }

            //Set Prefered Roles
            foreach (RepeaterItem roleItem in RolesRepeater.Items)
            {
                HiddenField roleIDHiddenField = (HiddenField)roleItem.FindControl("RoleIDHiddenField");
                int         roleID            = int.Parse(roleIDHiddenField.Value);
                Role        role = GrouperMethods.GetRole(roleID);

                DropDownList roleInterestDropDownList = (DropDownList)roleItem.FindControl("InterestDropDownList");
                int          interestLevel            = int.Parse(roleInterestDropDownList.SelectedValue);

                if (interestLevel > 0)
                {
                    role.InterestLevel = interestLevel;
                    student.InterestedRoles.Add(role);
                }
            }

            //Set languages
            foreach (RepeaterItem languageItem in LanguagesRepeater.Items)
            {
                HiddenField         languageHiddenField = (HiddenField)languageItem.FindControl("LanguageIDHiddenField");
                int                 languageID          = int.Parse(languageHiddenField.Value);
                ProgrammingLanguage language            = GrouperMethods.GetLanguage(languageID);

                DropDownList languageDropDownList = (DropDownList)languageItem.FindControl("LanguageDropDownList");
                int          languageProficiency  = int.Parse(languageDropDownList.SelectedValue);

                if (languageProficiency > 0)
                {
                    language.ProficiencyLevel = languageProficiency;
                    student.Languages.Add(language);
                }
            }

            //Set skills
            foreach (RepeaterItem skillItem in SkillsRepeater.Items)
            {
                HiddenField skillHiddenField = (HiddenField)skillItem.FindControl("SkillIDHiddenField");
                int         skillID          = int.Parse(skillHiddenField.Value);
                Skill       skill            = GrouperMethods.GetSkill(skillID);

                DropDownList skillDropDownList = (DropDownList)skillItem.FindControl("SkillDropDownList");
                int          skillProficiency  = int.Parse(skillDropDownList.SelectedValue);

                //Check for Outgoing Level
                if (skill.Name == "OutgoingLevel")
                {
                    student.OutgoingLevel = skill.ProficiencyLevel;
                }
                else
                {
                    skill.ProficiencyLevel = skillProficiency;
                    student.Skills.Add(skill);
                }
            }

            //Get dev. experience!
            student.DevelopmentExperience = DevelopmentExperienceTextBox.Text;

            //Get learning expectations
            student.LearningExpectations = LearningExpectationsTextBox.Text;

            //Update Database
            GrouperMethods.UpdateStudent(student);

            //Redirect to Thanks page
            string idString = "?id=" + ThisStudent.StudentID.ToString();

            Response.Redirect("ThankYou.aspx" + idString);
        }