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