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
         * @returns the student information
         */
        private Student LoadStudentData(int studentId)
        {
            Student student = null;

            try
            {
                student = DbInterfaceStudent.LoadStudentData(studentId);

                //get general student information
                if (student != null)
                {
                    lblStudentId.Text = studentId.ToString();
                    txtFirstName.Text = student.firstName;
                    txtLastName.Text  = student.lastName;
                    lblName.Text      = student.lastName + ", " + student.firstName + " " + student.middleInitial;

                    // Get editable auditions
                    DataTable table = DbInterfaceStudentAudition.GetDistrictAuditionsForDropdown(student, false);
                    cboAudition.DataSource = null;
                    cboAudition.Items.Clear();
                    cboAudition.DataSourceID = "";

                    if (table.Rows.Count > 0 && (student.grade.Equals("11") || student.grade.Equals("12")))
                    {
                        cboAudition.DataSource = table;
                        cboAudition.Items.Add(new ListItem(""));
                        cboAudition.DataBind();
                    }
                    else if (!(student.grade.Equals("11") || student.grade.Equals("12")))
                    {
                        showWarningMessage("The selected student is not in 11/12th grade, the audition length cannot be adjusted.");
                    }
                    else
                    {
                        showWarningMessage("This student has no editable auditions. Add a new registration for this student with the 'Add Registration' option");
                    }
                }
                else
                {
                    showErrorMessage("An error occurred loading the student data");
                }
            }
            catch (Exception e)
            {
                showErrorMessage("An error occurred loading the student data");

                Utility.LogError("Add Extra Audition Time", "LoadStudentData", "studentId: " + studentId, "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }

            return(student);
        }