C# Class JustPressPlay.Models.Repositories.AchievementRepository

Inheritance: Repository
Show file Open project: RIT-MAGIC/JustPressPlay Class Usage Examples

Public Methods

Method Description
AchievementRepository ( UnitOfWork unitOfWork ) : System

Creates a new achievement repository

AchievementTitleExists ( String title, int id = null ) : bool
AdminAddAchievement ( AddAchievementViewModel model ) : void
AdminEditAchievement ( int id, EditAchievementViewModel model ) : void
AssignAchievement ( int userID, int achievementID, int assignedByID = null, bool autoSave = true, System.DateTime dateAssigned = null, bool cardGiven = false, bool isGlobal = false ) : JPPConstants.AssignAchievementResult

Assigns an achievement TODO: Put in lots more error checking!

AssignGlobalAchievement ( int achievementID, System.DateTime startRange, System.DateTime endRange, int assignedByID ) : void

Assigns the specified achievement to all users in the system.

AwardCard ( achievement_instance instance ) : void
CheckFacebookLinkSystemAchievement ( int userID ) : void

Checks for Facebook Link System Achievement (User connects their JPP account with their Facebook account)

CheckFriendSystemAchievements ( int userID ) : void

Checks for Friends_x1, Friends_x10, and Friends_x25 System Achievements (User acquires 1 Friend, acquires 10 friends, acquires 25 friends)

CheckOneKAndTenKSystemAchievements ( int userID ) : void

Checks for One-K and Ten-K System Achievements (1000 and 10000 achievements systemwide)

CheckProfilePictureSystemAchievement ( int userID ) : void

Check Profile Picture System Achievement (User adds a profile picture for the first time)

CheckPublicProfileSystemAchievement ( int userID ) : void

Checks for Public Profile System Achievement (User changes privacy setting to "Public")

CheckRingSystemAchievements ( int userID, List userAchievements = null ) : void

Checks for Ring_x4, Ring_x25, and Ring_x100 System Achievements (User gets 4 points in each quadrant, 25 points in each quadrant, 100 points in each quadrant)

CheckSixWordBioSystemAchievements ( int userID ) : void

Checks for Six Word Bio System Achievement (User add a Six Word Bio for the first time)

DiscardAchievementDraft ( int id ) : String
DoesUserHaveAchievement ( int userId, int achievementId ) : bool
GetAchievementState ( int id ) : int
GetAchievementType ( int id ) : int
GetAchievementsForFeed ( ) : List
GetAssignableAchievements ( int userID, bool isFullAdmin ) : List
GetParentAchievements ( ) : List
GetSystemAchievementID ( int systemAchievementType ) : int
GetTemplateById ( int id ) : achievement_template
GetUserAchievementInstance ( int achievementID ) : achievement_instance
GetUserAchievementInstance ( int userId, int achievementId ) : achievement_instance
HandleContentSubmission ( int contentID, JPPConstants handleContent, string reason = null ) : void
InstanceExists ( int instanceID ) : achievement_instance
RevokeAchievement ( int instanceID, string reason, bool autoSave = true, int adminID = null ) : void
RevokeCard ( achievement_instance instance ) : void
Save ( ) : void
SystemAchievementExists ( int systemAchievementType ) : System.Boolean
UserAddAchievementStoryImage ( int instanceID, String imagePath ) : System.Boolean

Adds or Edits an Image for a User's story

UserAddAchievementStoryText ( int instanceID, String text ) : System.Boolean
UserSubmittedContentForImage ( int achievementID, int userID, string imageLocation, string text ) : System.Boolean
UserSubmittedContentForText ( int achievementID, int userID, String text ) : System.Boolean
UserSubmittedContentForURL ( int achievementID, int userID, String text, String url ) : System.Boolean

Private Methods

Method Description
AddAchievementToDatabase ( achievement_template achievementTemplate ) : void
AddCaretakersToDatabase ( List caretakersList ) : void
AddRequirementsToDatabase ( List requirementsList ) : void
AssignContentSubmissionAchievement ( int approvedByID, achievement_user_content_pending pendingContent ) : void

Assigns an achievement with user content associated with it. TODO: CHECK THE LOGIC TO MAKE SURE IT ALL WORKS THE WAY IT SHOULD

CanAwardRepeatableAchievement ( achievement_template template, int userID ) : AchievementInstanceResult
CheckForThresholdUnlock ( int achievementID, int userID ) : bool

Check to see if an scan achievement instance triggers a threshold achievement

DenyContentSubmission ( achievement_user_content_pending pendingContent, string reason ) : void

Method Details

AchievementRepository() public method

Creates a new achievement repository
public AchievementRepository ( UnitOfWork unitOfWork ) : System
unitOfWork UnitOfWork The unit of work that created this repository
return System

AchievementTitleExists() public method

public AchievementTitleExists ( String title, int id = null ) : bool
title String
id int
return bool

AdminAddAchievement() public method

public AdminAddAchievement ( AddAchievementViewModel model ) : void
model JustPressPlay.ViewModels.AddAchievementViewModel
return void

AdminEditAchievement() public method

public AdminEditAchievement ( int id, EditAchievementViewModel model ) : void
id int
model JustPressPlay.ViewModels.EditAchievementViewModel
return void

AssignAchievement() public method

Assigns an achievement TODO: Put in lots more error checking!
public AssignAchievement ( int userID, int achievementID, int assignedByID = null, bool autoSave = true, System.DateTime dateAssigned = null, bool cardGiven = false, bool isGlobal = false ) : JPPConstants.AssignAchievementResult
userID int The id of the user getting the achievement
achievementID int The id of the achievement template
assignedByID int The id of the user assigning the achievement
autoSave bool
dateAssigned System.DateTime
cardGiven bool Was the card given to the user?
isGlobal bool
return JPPConstants.AssignAchievementResult

AssignGlobalAchievement() public method

Assigns the specified achievement to all users in the system.
public AssignGlobalAchievement ( int achievementID, System.DateTime startRange, System.DateTime endRange, int assignedByID ) : void
achievementID int The ID of the achievement to assign
startRange System.DateTime
endRange System.DateTime
assignedByID int The ID of the User who assigned the achievement
return void

AwardCard() public method

public AwardCard ( achievement_instance instance ) : void
instance JustPressPlay.Models.achievement_instance
return void

CheckFacebookLinkSystemAchievement() public method

Checks for Facebook Link System Achievement (User connects their JPP account with their Facebook account)
public CheckFacebookLinkSystemAchievement ( int userID ) : void
userID int
return void

CheckFriendSystemAchievements() public method

Checks for Friends_x1, Friends_x10, and Friends_x25 System Achievements (User acquires 1 Friend, acquires 10 friends, acquires 25 friends)
public CheckFriendSystemAchievements ( int userID ) : void
userID int
return void

CheckOneKAndTenKSystemAchievements() public method

Checks for One-K and Ten-K System Achievements (1000 and 10000 achievements systemwide)
public CheckOneKAndTenKSystemAchievements ( int userID ) : void
userID int
return void

CheckProfilePictureSystemAchievement() public method

Check Profile Picture System Achievement (User adds a profile picture for the first time)
public CheckProfilePictureSystemAchievement ( int userID ) : void
userID int
return void

CheckPublicProfileSystemAchievement() public method

Checks for Public Profile System Achievement (User changes privacy setting to "Public")
public CheckPublicProfileSystemAchievement ( int userID ) : void
userID int
return void

CheckRingSystemAchievements() public method

Checks for Ring_x4, Ring_x25, and Ring_x100 System Achievements (User gets 4 points in each quadrant, 25 points in each quadrant, 100 points in each quadrant)
public CheckRingSystemAchievements ( int userID, List userAchievements = null ) : void
userID int
userAchievements List
return void

CheckSixWordBioSystemAchievements() public method

Checks for Six Word Bio System Achievement (User add a Six Word Bio for the first time)
public CheckSixWordBioSystemAchievements ( int userID ) : void
userID int
return void

DiscardAchievementDraft() public method

public DiscardAchievementDraft ( int id ) : String
id int
return String

DoesUserHaveAchievement() public method

public DoesUserHaveAchievement ( int userId, int achievementId ) : bool
userId int
achievementId int
return bool

GetAchievementState() public method

public GetAchievementState ( int id ) : int
id int
return int

GetAchievementType() public method

public GetAchievementType ( int id ) : int
id int
return int

GetAchievementsForFeed() public method

public GetAchievementsForFeed ( ) : List
return List

GetAssignableAchievements() public method

public GetAssignableAchievements ( int userID, bool isFullAdmin ) : List
userID int
isFullAdmin bool
return List

GetParentAchievements() public method

public GetParentAchievements ( ) : List
return List

GetSystemAchievementID() public method

public GetSystemAchievementID ( int systemAchievementType ) : int
systemAchievementType int
return int

GetTemplateById() public method

public GetTemplateById ( int id ) : achievement_template
id int
return JustPressPlay.Models.achievement_template

GetUserAchievementInstance() public method

public GetUserAchievementInstance ( int achievementID ) : achievement_instance
achievementID int
return JustPressPlay.Models.achievement_instance

GetUserAchievementInstance() public method

public GetUserAchievementInstance ( int userId, int achievementId ) : achievement_instance
userId int
achievementId int
return JustPressPlay.Models.achievement_instance

HandleContentSubmission() public method

public HandleContentSubmission ( int contentID, JPPConstants handleContent, string reason = null ) : void
contentID int
handleContent JPPConstants
reason string
return void

InstanceExists() public method

public InstanceExists ( int instanceID ) : achievement_instance
instanceID int
return JustPressPlay.Models.achievement_instance

RevokeAchievement() public method

public RevokeAchievement ( int instanceID, string reason, bool autoSave = true, int adminID = null ) : void
instanceID int
reason string
autoSave bool
adminID int
return void

RevokeCard() public method

public RevokeCard ( achievement_instance instance ) : void
instance JustPressPlay.Models.achievement_instance
return void

Save() public method

public Save ( ) : void
return void

SystemAchievementExists() public method

public SystemAchievementExists ( int systemAchievementType ) : System.Boolean
systemAchievementType int
return System.Boolean

UserAddAchievementStoryImage() public method

Adds or Edits an Image for a User's story
public UserAddAchievementStoryImage ( int instanceID, String imagePath ) : System.Boolean
instanceID int Achievement Instance
imagePath String Filepath of the new Image
return System.Boolean

UserAddAchievementStoryText() public method

public UserAddAchievementStoryText ( int instanceID, String text ) : System.Boolean
instanceID int
text String
return System.Boolean

UserSubmittedContentForImage() public method

public UserSubmittedContentForImage ( int achievementID, int userID, string imageLocation, string text ) : System.Boolean
achievementID int
userID int
imageLocation string
text string
return System.Boolean

UserSubmittedContentForText() public method

public UserSubmittedContentForText ( int achievementID, int userID, String text ) : System.Boolean
achievementID int
userID int
text String
return System.Boolean

UserSubmittedContentForURL() public method

public UserSubmittedContentForURL ( int achievementID, int userID, String text, String url ) : System.Boolean
achievementID int
userID int
text String
url String
return System.Boolean