Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
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();
            }
        }