C# Class ActivEarth.DAO.TeamDAO

Afficher le fichier Open project: mlcamilli/ActivEarth

Méthodes publiques

Méthode Description
CreateNewTeam ( ContestTeam team ) : int

Saves a Team as a new entry in the DB.

CreateNewTeamMember ( ContestTeamMember teamMember, int teamId ) : int

Creates a new DB entry for a team member.

CreateNewTeamMember ( int userId, int teamId ) : int

Creates a new DB entry for a team member.

GetCompetitorCount ( int contestId ) : int

Retrieves the number of competitors for a contest.

GetTeamFromTeamId ( int teamId, bool loadMembers ) : ContestTeam

Retrieves a Team from the DB based on its ID.

GetTeamFromUserIdAndContestId ( int userId, int contestId, bool loadMembers ) : ContestTeam

Retrieves the team from a given contest which contains a given member.

GetTeamIdsFromGroupId ( int groupId ) : List

Retrieves all team IDs which match the provided group.

GetTeamIdsFromUserId ( int userId ) : List

Retrieves all team IDs of which the provided user is a member.

GetTeamMembersFromTeamId ( int teamId ) : List

Retrieves the list of team members for a particular team.

GetTeamsFromContestId ( int contestId, bool loadMembers ) : List

Retrieves all teams competing in a particular contest.

LockTeam ( ContestTeam team ) : void

Notes each user's state at the beginning of a contest so that the delta score can be calculated. Sets the initialized flag to true, allowing the calculation of delta scores.

RemoveTeam ( int teamId ) : bool

Removes an existing Team from the DB.

RemoveTeamMemberFromUserIdAndContestId ( int userId, int contestId ) : bool

Removes a team member DB entry.

RemoveTeamMembersFromTeamId ( int teamId ) : bool

Removes all team member entries pertaining to a given team.

UpdateTeam ( ContestTeam team ) : bool

Updates an existing Team in the DB.

UpdateTeamMembers ( ContestTeam team ) : bool

Updates the entry of any members already existing on the team, and creates new entries for new members of the team.

UpdateTeamScore ( int teamId ) : void

Recalculates and updates the team's contest score.

UserCompetingInContest ( int userId, int contestId ) : bool

Queries the DB to see if a user is registered for a particular contest.

Private Methods

Méthode Description
CalculateUserScore ( int userId, float initial, Statistic statistic ) : float

Calculates the user's change in the relevant statistic since the beginning of the contest; their 'score' for the contest.

GetContestIdFromTeamId ( int teamId ) : int

Retrieves the contest ID for the contest that a team is participating in.

Method Details

CreateNewTeam() public static méthode

Saves a Team as a new entry in the DB.
public static CreateNewTeam ( ContestTeam team ) : int
team ActivEarth.Objects.Competition.Contests.ContestTeam Team object to add to the DB.
Résultat int

CreateNewTeamMember() public static méthode

Creates a new DB entry for a team member.
public static CreateNewTeamMember ( ContestTeamMember teamMember, int teamId ) : int
teamMember ActivEarth.Objects.Competition.Contests.ContestTeamMember Member to be added to the DB.
teamId int Team ID that the member should be added to.
Résultat int

CreateNewTeamMember() public static méthode

Creates a new DB entry for a team member.
public static CreateNewTeamMember ( int userId, int teamId ) : int
userId int ID of the Member to be added to the DB.
teamId int Team ID that the member should be added to.
Résultat int

GetCompetitorCount() public static méthode

Retrieves the number of competitors for a contest.
public static GetCompetitorCount ( int contestId ) : int
contestId int ID of the contest.
Résultat int

GetTeamFromTeamId() public static méthode

Retrieves a Team from the DB based on its ID.
public static GetTeamFromTeamId ( int teamId, bool loadMembers ) : ContestTeam
teamId int Identifier of the team to retrieve.
loadMembers bool Indicates whether or not the team member list should be populated.
Résultat ActivEarth.Objects.Competition.Contests.ContestTeam

GetTeamFromUserIdAndContestId() public static méthode

Retrieves the team from a given contest which contains a given member.
public static GetTeamFromUserIdAndContestId ( int userId, int contestId, bool loadMembers ) : ContestTeam
userId int ID of the user to match the team to.
contestId int ID of the contest to match the team to.
loadMembers bool Indicates whether or not the team member lists should be populated.
Résultat ActivEarth.Objects.Competition.Contests.ContestTeam

GetTeamIdsFromGroupId() public static méthode

Retrieves all team IDs which match the provided group.
public static GetTeamIdsFromGroupId ( int groupId ) : List
groupId int
Résultat List

GetTeamIdsFromUserId() public static méthode

Retrieves all team IDs of which the provided user is a member.
public static GetTeamIdsFromUserId ( int userId ) : List
userId int
Résultat List

GetTeamMembersFromTeamId() public static méthode

Retrieves the list of team members for a particular team.
public static GetTeamMembersFromTeamId ( int teamId ) : List
teamId int Team ID to retrieve the members for.
Résultat List

GetTeamsFromContestId() public static méthode

Retrieves all teams competing in a particular contest.
public static GetTeamsFromContestId ( int contestId, bool loadMembers ) : List
contestId int ID of the contest to load teams for.
loadMembers bool Indicates whether or not the team member lists should be populated.
Résultat List

LockTeam() public static méthode

Notes each user's state at the beginning of a contest so that the delta score can be calculated. Sets the initialized flag to true, allowing the calculation of delta scores.
public static LockTeam ( ContestTeam team ) : void
team ActivEarth.Objects.Competition.Contests.ContestTeam
Résultat void

RemoveTeam() public static méthode

Removes an existing Team from the DB.
public static RemoveTeam ( int teamId ) : bool
teamId int
Résultat bool

RemoveTeamMemberFromUserIdAndContestId() public static méthode

Removes a team member DB entry.
public static RemoveTeamMemberFromUserIdAndContestId ( int userId, int contestId ) : bool
userId int User to remove.
contestId int Contest to remove the user from.
Résultat bool

RemoveTeamMembersFromTeamId() public static méthode

Removes all team member entries pertaining to a given team.
public static RemoveTeamMembersFromTeamId ( int teamId ) : bool
teamId int Team to remove the members from.
Résultat bool

UpdateTeam() public static méthode

Updates an existing Team in the DB.
public static UpdateTeam ( ContestTeam team ) : bool
team ActivEarth.Objects.Competition.Contests.ContestTeam Team whose record needs updating.
Résultat bool

UpdateTeamMembers() public static méthode

Updates the entry of any members already existing on the team, and creates new entries for new members of the team.
public static UpdateTeamMembers ( ContestTeam team ) : bool
team ActivEarth.Objects.Competition.Contests.ContestTeam Team whose members must be updated.
Résultat bool

UpdateTeamScore() public static méthode

Recalculates and updates the team's contest score.
public static UpdateTeamScore ( int teamId ) : void
teamId int
Résultat void

UserCompetingInContest() public static méthode

Queries the DB to see if a user is registered for a particular contest.
public static UserCompetingInContest ( int userId, int contestId ) : bool
userId int ID of the user.
contestId int ID of the contest to query.
Résultat bool