Пример #1
0
        protected void AddProgrammingLanguageLinkButton_Click(object sender, EventArgs e)
        {
            int programmingLanguageID = int.Parse(ProgrammingLanguagesDropDownList.SelectedValue);

            if (ViewState["Languages"] != null)
            {
                List <ProgrammingLanguage> languages = (List <ProgrammingLanguage>)ViewState["Languages"];

                ProgrammingLanguage language = new ProgrammingLanguage();
                language.Name             = ProgrammingLanguagesDropDownList.SelectedItem.Text;
                language.LanguageID       = int.Parse(ProgrammingLanguagesDropDownList.SelectedValue);
                language.ProficiencyLevel = int.Parse(ProgrammingAbilityLevelDropDownList.SelectedValue);

                ((List <ProgrammingLanguage>)ViewState["Languages"]).Add(language);

                ProgrammingLanguagesGridView.DataSource = (List <ProgrammingLanguage>)ViewState["Languages"];
                ProgrammingLanguagesGridView.DataBind();

                ProgrammingLanguagesDropDownList.Items.FindByValue(language.LanguageID.ToString()).Enabled = false;
            }
            else
            {
                ViewState["Languages"] = new List <ProgrammingLanguage>();
                ProgrammingLanguage language = new ProgrammingLanguage();
                language.Name             = ProgrammingLanguagesDropDownList.SelectedItem.Text;
                language.LanguageID       = int.Parse(ProgrammingLanguagesDropDownList.SelectedValue);
                language.ProficiencyLevel = int.Parse(ProgrammingAbilityLevelDropDownList.SelectedValue);

                ((List <ProgrammingLanguage>)ViewState["Languages"]).Add(language);

                ProgrammingLanguagesGridView.DataSource = (List <ProgrammingLanguage>)ViewState["Languages"];
                ProgrammingLanguagesGridView.DataBind();
                ProgrammingLanguagesDropDownList.Items.FindByValue(language.LanguageID.ToString()).Enabled = false;
            }
        }
Пример #2
0
        protected void AddStudentLinkButton_Click(object sender, EventArgs e)
        {
            StudentListPanel.Visible = false;
            AddStudentPanel.Visible  = true;

            DuckIDTextBox.Text           = "";
            FirstNameTextBox.Text        = "";
            LastNameTextBox.Text         = "";
            AddStudentLinkButton.Visible = false;
            SendWelcomeToAllStudentsLinkButton.Visible = false;
            DeleteAllStudentsLinkButton.Visible        = false;

            ProgrammingLanguagesDropDownList.DataSource = GrouperMethods.GetLanguages();
            ProgrammingLanguagesDropDownList.DataBind();

            RolesDropDownList.DataSource = GrouperMethods.GetRoles();
            RolesDropDownList.DataBind();

            SkillsDropDownList.DataSource = GrouperMethods.GetSkills();
            SkillsDropDownList.DataBind();

            RolesGridView.DataSource = null;
            RolesGridView.DataBind();

            ProgrammingLanguagesGridView.DataSource = null;
            ProgrammingLanguagesGridView.DataBind();

            SkillsGridView.DataSource = null;
            SkillsGridView.DataBind();

            ProgrammingLanguagesDropDownList.DataSource = GrouperMethods.GetLanguages();
            ProgrammingLanguagesDropDownList.DataBind();
        }
Пример #3
0
        protected void ProgrammingLanguagesGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "delete_language")
            {
                int languageID = int.Parse(e.CommandArgument.ToString());

                if (ViewState["Languages"] != null)
                {
                    ((List <ProgrammingLanguage>)ViewState["Languages"]).RemoveAll(x => x.LanguageID == languageID).ToString();
                    ProgrammingLanguagesGridView.DataSource = (List <ProgrammingLanguage>)ViewState["Languages"];
                    ProgrammingLanguagesGridView.DataBind();

                    ProgrammingLanguagesDropDownList.Items.FindByValue(languageID.ToString()).Enabled = true;
                }
            }
        }
Пример #4
0
        protected void CancelAddStudentLinkButton_Click(object sender, EventArgs e)
        {
            AddStudentPanel.Visible      = false;
            DuckIDTextBox.Text           = "";
            FirstNameTextBox.Text        = "";
            LastNameTextBox.Text         = "";
            AddStudentLinkButton.Visible = true;
            SendWelcomeToAllStudentsLinkButton.Visible = true;
            DeleteAllStudentsLinkButton.Visible        = true;

            RolesGridView.DataSource = null;
            RolesGridView.DataBind();
            ProgrammingLanguagesGridView.DataSource = null;
            ProgrammingLanguagesGridView.DataBind();
            SkillsGridView.DataSource = null;
            SkillsGridView.DataBind();

            StudentListPanel.Visible = true;
        }
Пример #5
0
        protected void SaveAddStudentLinkButton_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(SelectedStudentIDHiddenField.Value))
            {
                Student student = new Student();
                student.InstructorCourseID = InstructorCourseID;
                student.FirstName          = FirstNameTextBox.Text.Trim();
                student.LastName           = LastNameTextBox.Text.Trim();
                student.DuckID             = DuckIDTextBox.Text.Trim();

                int studentID = GrouperMethods.InsertStudent(student);

                if (studentID > 0)
                {
                    if (ViewState["Languages"] != null)
                    {
                        if (((List <ProgrammingLanguage>)ViewState["Languages"]).Count() > 0)
                        {
                            foreach (ProgrammingLanguage language in ((List <ProgrammingLanguage>)ViewState["Languages"]))
                            {
                                GrouperMethods.InsertStudentLanguage(studentID, language.LanguageID, (int)language.ProficiencyLevel);
                            }
                        }
                    }
                    if (ViewState["Roles"] != null)
                    {
                        if (((List <Role>)ViewState["Roles"]).Count() > 0)
                        {
                            foreach (Role role in ((List <Role>)ViewState["Roles"]))
                            {
                                GrouperMethods.InsertStudentRoleInterest(studentID, role.RoleID, (int)role.InterestLevel);
                            }
                        }
                    }
                    if (ViewState["Skills"] != null)
                    {
                        if (((List <Skill>)ViewState["Skills"]).Count() > 0)
                        {
                            foreach (Skill skill in ((List <Skill>)ViewState["Skills"]))
                            {
                                GrouperMethods.InsertStudentSkill(studentID, skill.SkillID, (int)skill.ProficiencyLevel);
                            }
                        }
                    }
                }
            }
            else
            {
                int studentID = int.Parse(SelectedStudentIDHiddenField.Value);

                Student student = GrouperMethods.GetStudent(studentID);

                student.FirstName = FirstNameTextBox.Text.Trim();
                student.LastName  = LastNameTextBox.Text.Trim();
                student.DuckID    = DuckIDTextBox.Text.Trim();

                if (ViewState["Languages"] != null)
                {
                    student.Languages = (List <ProgrammingLanguage>)ViewState["Languages"];
                }

                if (ViewState["Roles"] != null)
                {
                    student.InterestedRoles = (List <Role>)ViewState["Roles"];
                }

                if (ViewState["Skills"] != null)
                {
                    student.Skills = (List <Skill>)ViewState["Skills"];
                }

                GrouperMethods.UpdateStudent(student);
            }

            StudentsGridView_BindGridView();

            SelectedStudentIDHiddenField.Value = null;

            RolesGridView.DataSource = null;
            RolesGridView.DataBind();
            ProgrammingLanguagesGridView.DataSource = null;
            ProgrammingLanguagesGridView.DataBind();
            SkillsGridView.DataSource = null;
            SkillsGridView.DataBind();

            AddStudentPanel.Visible      = false;
            DuckIDTextBox.Text           = "";
            FirstNameTextBox.Text        = "";
            LastNameTextBox.Text         = "";
            AddStudentLinkButton.Visible = true;
            SendWelcomeToAllStudentsLinkButton.Visible = true;
            DeleteAllStudentsLinkButton.Visible        = true;

            StudentListPanel.Visible = true;
        }
Пример #6
0
        protected void StudentsGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "delete_student")
            {
                int     studentID = int.Parse(e.CommandArgument.ToString());
                Student student   = GrouperMethods.GetStudent(studentID);

                ConfirmDeleteMessageBox(student);
            }
            if (e.CommandName == "edit_student")
            {
                int studentID = int.Parse(e.CommandArgument.ToString());

                SelectedStudentIDHiddenField.Value = studentID.ToString();

                Student student = GrouperMethods.GetStudent(studentID);



                FirstNameTextBox.Text = student.FirstName;
                LastNameTextBox.Text  = student.LastName;
                DuckIDTextBox.Text    = student.DuckID;

                ProgrammingLanguagesDropDownList.DataSource = GrouperMethods.GetLanguages();
                ProgrammingLanguagesDropDownList.DataBind();

                ViewState["Languages"] = new List <ProgrammingLanguage>();

                foreach (ProgrammingLanguage language in student.Languages)
                {
                    ((List <ProgrammingLanguage>)ViewState["Languages"]).Add(language);
                    ProgrammingLanguagesDropDownList.Items.FindByValue(language.LanguageID.ToString()).Enabled = false;
                }

                ProgrammingLanguagesGridView.DataSource = (List <ProgrammingLanguage>)ViewState["Languages"];
                ProgrammingLanguagesGridView.DataBind();

                RolesDropDownList.DataSource = GrouperMethods.GetRoles();
                RolesDropDownList.DataBind();

                ViewState["Roles"] = new List <Role>();

                foreach (Role role in student.InterestedRoles)
                {
                    ((List <Role>)ViewState["Roles"]).Add(role);
                    RolesDropDownList.Items.FindByValue(role.RoleID.ToString()).Enabled = false;
                }

                RolesGridView.DataSource = (List <Role>)ViewState["Roles"];
                RolesGridView.DataBind();

                SkillsDropDownList.DataSource = GrouperMethods.GetSkills();
                SkillsDropDownList.DataBind();

                ViewState["Skills"] = new List <Skill>();

                foreach (Skill skill in student.Skills)
                {
                    ((List <Skill>)ViewState["Skills"]).Add(skill);
                    SkillsDropDownList.Items.FindByValue(skill.SkillID.ToString()).Enabled = false;
                }

                SkillsGridView.DataSource = (List <Skill>)ViewState["Skills"];
                SkillsGridView.DataBind();

                GUIDLabel.Text = "Student GUID: " + student.GUID;

                StudentListPanel.Visible = false;
                AddStudentPanel.Visible  = true;
            }
            if (e.CommandName == "send_welcome")
            {
                int studentID = int.Parse(e.CommandArgument.ToString());

                Student student = GrouperMethods.GetStudent(studentID);

                SendSurveyLinkMessage(student);

                student.InitialNotificationSentDate = DateTime.Now;
                GrouperMethods.UpdateStudent(student);

                StudentsGridView_BindGridView();
            }
        }