Ejemplo n.º 1
0
    /*
     * 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);
        }
    }
Ejemplo n.º 2
0
 /*
  * 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);
     }
 }
Ejemplo n.º 3
0
    /*
     * Pre:
     * Post: Adds the new audtion to the database and updates all
     *       coordinate information for the student
     */
    public bool addToDatabase()
    {
        bool success = DbInterfaceStudentAudition.CreateStudentDistrictAudition(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.GetStudentDistrictAuditionIds(yearId);
            success = success && DbInterfaceStudentAudition.UpdateExistingCoordinates(existingAuditionIds);
        }

        return(success);
    }
Ejemplo n.º 4
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);
    }