/* * 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.GetStudentStateAuditionIds(DbInterfaceStudent.GetStudentYearId(districtAudition.student.id)); foreach (int id in currStudAuditionIds) { DbInterfaceStudentAudition.RemoveAuditionCoordinates(coordinatesToRemove, id); } }
/* * Pre: * Post: The audition ids are set for the current student's auditions for the year * @param districtAudition signifies whether the current coordinate is being created for * a district or state audition */ private void setAuditionIds(bool districtAudition) { if (districtAudition) { auditionIds = DbInterfaceStudentAudition.GetStudentDistrictAuditionIds(yearId); } else { auditionIds = DbInterfaceStudentAudition.GetStudentStateAuditionIds(yearId); } }
/* * Pre: * Post: Adds the new audition to thr database and updates all coordinate information for the student */ public bool addToDatabase() { bool success = DbInterfaceStudentAudition.CreateStudentStateAudition(this); if (success) { //create coordinates if (coordinates.Count > 0) { success = success && createCoordinateRides(); } //update coordinate rides that already exist for the student List <int> existingAuditionIds = DbInterfaceStudentAudition.GetStudentStateAuditionIds(yearId); success = success && DbInterfaceStudentAudition.UpdateExistingCoordinates(existingAuditionIds); } return(success); }
/* * Pre: The audition must already exist in the database * Post: The audition is updated with the current information * @param coordinatesToRemove contains a list of coordinates that were removed * from the audition */ public bool updateInDatabase(List <StudentCoordinateSimple> coordinatesToRemove) { bool success = DbInterfaceStudentAudition.UpdateStudentStateAudition(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) { if (coord.auditionIds.Count() > 0) { success = success && DbInterfaceStudentAudition.CreateAuditionCoordinate(auditionId, coord.auditionIds.ElementAt(0), coord.reason); } success = success && DbInterfaceStudentAudition.UpdateExistingCoordinates(DbInterfaceStudentAudition.GetStudentStateAuditionIds(DbInterfaceStudent.GetStudentYearId(coord.student.id))); } if (coordinates.Count > 0) { success = success && DbInterfaceStudentAudition.UpdateExistingCoordinates(DbInterfaceStudentAudition.GetStudentStateAuditionIds(DbInterfaceStudent.GetStudentYearId(districtAudition.student.id))); } } return(success); }