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, bool initialLoad)
        {
            Student student = null;

            try
            {
                student = DbInterfaceStudent.LoadStudentData(studentId);

                //get eligible auditions
                if (student != null)
                {
                    DataTable table = DbInterfaceStudentAudition.GetStateAuditionsForPointEntryDropdown(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 if (!initialLoad)
                    {
                        showWarningMessage("The student has no eligible auditions for the selected year.");
                    }

                    upStudentSearch.Visible = false;
                    pnlInfo.Visible         = true;
                }
                else
                {
                    showErrorMessage("Error: An error occurred while loading the student data.");
                }
            }
            catch (Exception e)
            {
                showErrorMessage("Error: An error occurred while loading the student data.");

                Utility.LogError("Badger Point Entry", "loadStudentData", "studentId: " + studentId, "Message: " + e.Message + "   Stack Trace: " + e.StackTrace, -1);
            }

            return(student);
        }