C# Класс ActivEarth.Server.Service.Competition.ContestManager

Показать файл Открыть проект

Открытые методы

Метод Описание
AddGroup ( int contestId, Group group ) : bool

Adds a group to a group Contest; will fail if a group is added to an individual contest.

AddUser ( int contestId, User user ) : void

Adds a user to the Contest.

CalculateContestReward ( int days, int teams ) : int

Calculates the reward for a time-based contest.

CleanUp ( ) : void

Cleans up the contest list, deactivating expired time-based contests and deleting deactivated contests that have reached the end of their retainment period.

CreateContest ( ContestType type, string name, string description, System.DateTime start, System.DateTime end, bool searchable, Statistic statistic, int creatorId ) : int

Creates a new time-based Contest

CreateContest ( ContestType type, string name, string description, System.DateTime start, float end, bool searchable, Statistic statistic, int creatorId ) : int

Creates a new goal-based Contest

DistributeContestReward ( int contestId ) : void

Distributes the ActivityScore reward for a contest and deactivates it.

GetContest ( int id, bool loadTeams, bool loadTeamMembers ) : Contest

Retrieves a Contest based on its ID.

GetTeamsToDisplay ( ContestTeam userTeam, Contest contest ) : List

Finds the list of teams that should be displayed to the user as part of the contest standings report. For the user's current bracket, the user's team will be shown. For brackets better than the user's current standing, the lowest team in the bracket is shown (the team that the user needs to pass to enter that bracket). For brackets worse than the user's current standing, the top team in the bracket is shown (the team that the user needs to stay ahead of to avoid falling into that bracket).

LockContest ( int contestId ) : void

Locks competitor initial values such that the calculation of deltas can begin (to calculate team scores).

RemoveGroup ( int contestId, Group group ) : bool

Removes a group from a Contest.

RemoveUser ( int contestId, User user ) : bool

Adds a user to the Contest.

UpdateTeamScore ( int teamId ) : void
UserCompetingInContest ( int userId, int contestId ) : bool

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

Приватные методы

Метод Описание
CalculateEstimatedLengthInDays ( Contest contest ) : int

Returns the length of a contest of a time-based contest, and estimates the length of a goal-based contest.

ContestManager ( ) : System

Private constructor, can not instantiate.

Описание методов

AddGroup() публичный статический Метод

Adds a group to a group Contest; will fail if a group is added to an individual contest.
public static AddGroup ( int contestId, Group group ) : bool
contestId int ID for the contest the group should be added to.
group ActivEarth.Objects.Groups.Group Group to be added.
Результат bool

AddUser() публичный статический Метод

Adds a user to the Contest.
public static AddUser ( int contestId, User user ) : void
contestId int
user ActivEarth.Objects.Profile.User User to be added.
Результат void

CalculateContestReward() публичный статический Метод

Calculates the reward for a time-based contest.
public static CalculateContestReward ( int days, int teams ) : int
days int Duration of the contest, in days.
teams int Number of teams competing in the contest.
Результат int

CleanUp() публичный статический Метод

Cleans up the contest list, deactivating expired time-based contests and deleting deactivated contests that have reached the end of their retainment period.
public static CleanUp ( ) : void
Результат void

CreateContest() публичный статический Метод

Creates a new time-based Contest
public static CreateContest ( ContestType type, string name, string description, System.DateTime start, System.DateTime end, bool searchable, Statistic statistic, int creatorId ) : int
type ContestType Determines whether the contest in Individual or Group-based.
name string Contest Name.
description string Contest Description.
start System.DateTime Time to start the contest.
end System.DateTime Time to end the contest.
searchable bool True if the Contest can be found by searching (public), false if private.
statistic Statistic Statistic on which the Contest is based.
creatorId int UserID of the creator of the contest.
Результат int

CreateContest() публичный статический Метод

Creates a new goal-based Contest
public static CreateContest ( ContestType type, string name, string description, System.DateTime start, float end, bool searchable, Statistic statistic, int creatorId ) : int
type ContestType Determines whether the contest in Individual or Group-based.
name string Contest Name.
description string Contest Description.
start System.DateTime Time to start the contest.
end float Score at which to end the contest.
searchable bool True if the Contest can be found by searching (public), false if private.
statistic Statistic Statistic on which the Contest is based.
creatorId int UserID of the creator of the contest.
Результат int

DistributeContestReward() публичный статический Метод

Distributes the ActivityScore reward for a contest and deactivates it.
public static DistributeContestReward ( int contestId ) : void
contestId int ID of the contest to process.
Результат void

GetContest() публичный статический Метод

Retrieves a Contest based on its ID.
public static GetContest ( int id, bool loadTeams, bool loadTeamMembers ) : Contest
id int ID of the Contest to be retrieved.
loadTeams bool
loadTeamMembers bool
Результат ActivEarth.Objects.Competition.Contests.Contest

GetTeamsToDisplay() публичный статический Метод

Finds the list of teams that should be displayed to the user as part of the contest standings report. For the user's current bracket, the user's team will be shown. For brackets better than the user's current standing, the lowest team in the bracket is shown (the team that the user needs to pass to enter that bracket). For brackets worse than the user's current standing, the top team in the bracket is shown (the team that the user needs to stay ahead of to avoid falling into that bracket).
public static GetTeamsToDisplay ( ContestTeam userTeam, Contest contest ) : List
userTeam ActivEarth.Objects.Competition.Contests.ContestTeam Team that the current user is on.
contest ActivEarth.Objects.Competition.Contests.Contest Contest to be analyzed.
Результат List

LockContest() публичный статический Метод

Locks competitor initial values such that the calculation of deltas can begin (to calculate team scores).
public static LockContest ( int contestId ) : void
contestId int
Результат void

RemoveGroup() публичный статический Метод

Removes a group from a Contest.
public static RemoveGroup ( int contestId, Group group ) : bool
contestId int ID for the contest the group should be removed from.
group ActivEarth.Objects.Groups.Group Group to be removed.
Результат bool

RemoveUser() публичный статический Метод

Adds a user to the Contest.
public static RemoveUser ( int contestId, User user ) : bool
contestId int
user ActivEarth.Objects.Profile.User User to be added.
Результат bool

UpdateTeamScore() публичный статический Метод

public static UpdateTeamScore ( int teamId ) : void
teamId int
Результат void

UserCompetingInContest() публичный статический Метод

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.
Результат bool