Example #1
0
        /*
         * Pre:  studentId must exist as a StudentId in the system
         * Post: The existing data for the student associated to the studentId
         *       is loaded to the page.
         * @param studentId is the StudentId of the student being registered
         */
        private Student loadStudentData(int studentId)
        {
            Student student = DbInterfaceStudent.LoadStudentData(studentId);

            //get eligible auditions
            if (student != null)
            {
                DataTable table = DbInterfaceStudentAudition.GetDistrictAuditionsForDropdownByYear(student, Convert.ToInt32(ddlYear.SelectedValue));
                cboAudition.DataSource = null;
                cboAudition.Items.Clear();
                cboAudition.DataSourceID = "";

                //load student name
                txtFirstName.Text = student.firstName;
                txtLastName.Text  = student.lastName;
                lblStudent.Text   = student.firstName + " " + student.lastName;

                if (table.Rows.Count > 0)
                {
                    cboAudition.DataSource     = table;
                    cboAudition.DataTextField  = "DropDownInfo";
                    cboAudition.DataValueField = "AuditionId";
                    cboAudition.Items.Add(new ListItem(""));
                    cboAudition.DataBind();
                }
                else
                {
                    lblAuditionError.InnerText = "This student has no district auditions to award points to for the selected year";
                    lblAuditionError.Visible   = true;
                }
            }
            else
            {
                lblErrorMsg.Text    = "An error occurred while loading the student's audition data";
                lblErrorMsg.Visible = true;
            }

            return(student);
        }