Example #1
0
    /*
     * 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);
    }