/* * Pre: * Post: Loads the information of the selected audition and saves it to a session variable */ private void resetAuditionVar() { try { int auditionId = Convert.ToInt32(cboAudition.SelectedValue); int studentId = Convert.ToInt32(Convert.ToInt32(txtStudentId.Text)); Student student = DbInterfaceStudent.LoadStudentData(studentId); //get all audition info associated with audition id and save as session variable if (student != null) { audition = new StateAudition(auditionId, student, false); audition = DbInterfaceStudentAudition.GetStudentStateAudition(audition.districtAudition, auditionId); if (audition != null) { Session[auditionVar] = audition; //if the audition was a duet, show label to inform user that the points for the //partner will also be updated if (audition.auditionType.ToUpper().Equals("DUET")) { showInfoMessage("The composition points of the student's duet partner will also be updated."); } setPoints(); } } } catch (Exception e) { Utility.LogError("Badger Point Entry", "resetAuditionVar", "", "Message: " + e.Message + " Stack Trace: " + e.StackTrace, -1); } }
/* * Populate the ridiculous huge table with audition data */ private DataTable PopulateTable(Dictionary <int, StateAudition> auditions) { DataTable table = CreateTable(); foreach (int auditionId in auditions.Keys) { StateAudition stateAudition = auditions[auditionId]; DistrictAudition audition = auditions[auditionId].districtAudition; // Assign composition and coordinate variables since there is a variable number of each int compositionPoints = 0; string comp1 = "", composer1 = "", period1 = "", comp2 = "", composer2 = "", period2 = "", comp3 = "", composer3 = "", period3 = "", coordName1 = "", coordReason1 = "", coordName2 = "", coordReason2 = "", coordName3 = "", coordReason3 = "", coordName4 = "", coordReason4 = "", coordName5 = "", coordReason5 = ""; AssignCompositionVariables(audition.compositions, 0, ref comp1, ref composer1, ref period1, ref compositionPoints); AssignCompositionVariables(audition.compositions, 1, ref comp2, ref composer2, ref period2, ref compositionPoints); AssignCompositionVariables(audition.compositions, 2, ref comp3, ref composer3, ref period3, ref compositionPoints); AssignCoordinateVariables(audition.simpleCoordinates, 0, ref coordName1, ref coordReason1); AssignCoordinateVariables(audition.simpleCoordinates, 1, ref coordName2, ref coordReason2); AssignCoordinateVariables(audition.simpleCoordinates, 2, ref coordName3, ref coordReason3); AssignCoordinateVariables(audition.simpleCoordinates, 3, ref coordName4, ref coordReason4); AssignCoordinateVariables(audition.simpleCoordinates, 4, ref coordName5, ref coordReason5); bool badgerEligible = compositionPoints >= 14 && audition.theoryPoints >= 4 && verifyAge(audition.student.grade); // Get the time preference string timePref = ""; if (audition.am) { timePref = "AM"; } else if (audition.pm) { timePref = "PM"; } else if (audition.earliest) { timePref = "Earliest"; } else if (audition.latest) { timePref = "Latest"; } AddRow(table, audition.student.id, audition.student.lastName, audition.student.firstName, audition.student.grade, audition.instrument, audition.auditionType, audition.auditionTrack, audition.theoryLevel, audition.student.teacherName, timePref, comp1, composer1, period1, comp2, composer2, period2, comp3, composer3, period3, audition.student.totalPoints - compositionPoints - audition.theoryPoints - stateAudition.points, audition.startTime, audition.room, compositionPoints, audition.theoryPoints, compositionPoints + audition.theoryPoints, audition.awards, badgerEligible, stateAudition.points, compositionPoints + audition.theoryPoints + stateAudition.points, audition.student.totalPoints, stateAudition.awards, coordName1, coordReason1, coordName2, coordReason2, coordName3, coordReason3, coordName4, coordReason4, coordName5, coordReason5); } return(table); }
protected void Page_Load(object sender, EventArgs e) { checkPermissions(); //clear session variables if (!Page.IsPostBack) { Session[auditionVar] = null; Session[studentSearch] = null; loadYearDropdown(); } //if an audition object has been instantiated, reload if (Page.IsPostBack && Session[auditionVar] != null) { audition = (StateAudition)Session[auditionVar]; } }