/* * Pre: The student must have an entry in the DataStudentYearHistory table * for the current year. * Post: The year id is set for the current student */ private void setYearId() { //if (!reason.ToUpper().Equals("DUET")) yearId = DbInterfaceStudent.GetStudentYearId(student.id); //else // yearId = -1; }
/* * Pre: The audition must have previously existed in the system * Post: The coordinates in the input list are removed from the system for each of the current student's auditions * @param coordinatesToRemove contains a list of coordinates that were removed * from the audition */ private void removeCoordinates(List <StudentCoordinateSimple> coordinatesToRemove) { List <int> currStudAuditionIds = DbInterfaceStudentAudition.GetStudentDistrictAuditionIds(DbInterfaceStudent.GetStudentYearId(student.id)); foreach (int id in currStudAuditionIds) { DbInterfaceStudentAudition.RemoveAuditionCoordinates(coordinatesToRemove, id); } }
/* * Pre: The audition must have previously existed in the system * Post: The audition information is updated in the database * @param coordinatesToRemove contains a list of coordinates that were removed * from the audition * @returns true if the audition is successfully updated and false otherwise */ public bool updateInDatabase(List <StudentCoordinateSimple> coordinatesToRemove) { bool success = DbInterfaceStudentAudition.UpdateStudentDistrictAudition(this); //update coordinates if (success) { //if coordinates were removed from the audition, remove them in the database if (coordinatesToRemove.Count > 0) { removeCoordinates(coordinatesToRemove); } //update coordinates foreach (StudentCoordinate coord in coordinates) { success = success && DbInterfaceStudentAudition.CreateAuditionCoordinate(auditionId, coord.auditionIds.ElementAt(0), coord.reason); success = success && DbInterfaceStudentAudition.UpdateExistingCoordinates(DbInterfaceStudentAudition.GetStudentDistrictAuditionIds(DbInterfaceStudent.GetStudentYearId(coord.student.id))); } if (coordinates.Count > 0) { success = success && DbInterfaceStudentAudition.UpdateExistingCoordinates(DbInterfaceStudentAudition.GetStudentDistrictAuditionIds(DbInterfaceStudent.GetStudentYearId(student.id))); } } return(success); }