public static IList <LeaderboardEntry> RetrieveLocalLeaderboard(int userId, int locality = 2) { var parameters = new List <SqlParameter> { new SqlParameter("userId", userId), new SqlParameter("locality", locality) }; var dataTable = DatabaseCommon.PerformAction("GetLocalLeaderboardInfo", parameters); return(DatabaseCommon.ConvertTable(dataTable, LeaderboardEntry.FromDataRow)); }
public static User UpdatePassword(int userId, string userPassword) { var parameters = new List <SqlParameter> { new SqlParameter("userId", userId), new SqlParameter("password", userPassword) }; var dt = DatabaseCommon.PerformAction("UpdateUserPassword", parameters); return(DatabaseCommon.ConvertRow(dt, PopulateUser)); }
public static IList <LeaderboardEntry> RetrieveTopLeaderboard(int rowCount, int?currentUserId = null) { var parameters = new List <SqlParameter> { new SqlParameter("rowCount", rowCount), new SqlParameter("userId", currentUserId) }; var dataTable = DatabaseCommon.PerformAction("GetTopLeaderboardInfo", parameters); return(DatabaseCommon.ConvertTable(dataTable, LeaderboardEntry.FromDataRow)); }
public static Hire SetEndMileage(int hireId, int endMileage) { var parameters = new List <SqlParameter> { new SqlParameter("hireId", hireId), new SqlParameter("mileage", endMileage) }; var dt = DatabaseCommon.PerformAction("UpdateHireFinalMileage", parameters); return(DatabaseCommon.ConvertRow(dt, Hire.FromDataRow)); }
public static Hire RetrieveSingleHire(string bookingReference, string emailAddress) { var parameters = new List <SqlParameter> { new SqlParameter("bookingReference", bookingReference), new SqlParameter("emailAddress", emailAddress) }; var dataTable = DatabaseCommon.PerformAction("GetHireForBookingReferenceAndEmailAddress", parameters); return(DatabaseCommon.ConvertRow(dataTable, Hire.FromDataRow)); }
public static User CreateUser(string emailAddress, string firstName, string surname) { var parameters = new List <SqlParameter> { new SqlParameter("emailAddress", emailAddress), new SqlParameter("firstName", firstName), new SqlParameter("surname", surname) }; var dt = DatabaseCommon.PerformAction("CreateNewUser", parameters); return(DatabaseCommon.ConvertRow(dt, PopulateUser)); }
public static Hire CreateHire(int userId, string bookingReference, DateTime hireEndDate, int startMileage) { var parameters = new List <SqlParameter> { new SqlParameter("userId", userId), new SqlParameter("bookingReference", bookingReference), new SqlParameter("hireEndDate", hireEndDate == DateTime.MinValue ? DBNull.Value : (object)hireEndDate), new SqlParameter("startMileage", startMileage) }; var dt = DatabaseCommon.PerformAction("CreateNewHire", parameters); return(DatabaseCommon.ConvertRow(dt, Hire.FromDataRow)); }
public static User RetrieveUser(string email) { var parameters = new List <SqlParameter> { new SqlParameter { ParameterName = "email", Value = email } }; var dataTable = DatabaseCommon.PerformAction("GetUserForEmail", parameters); return(DatabaseCommon.ConvertRow(dataTable, PopulateUser)); }
public static User RetrieveUser(Guid sessionId) { var parameters = new List <SqlParameter> { new SqlParameter { ParameterName = "SessionId", Value = sessionId } }; var dataTable = DatabaseCommon.PerformAction("GetUserForSessionId", parameters); return(DatabaseCommon.ConvertRow(dataTable, PopulateUser)); }
public static Session CreateSession(int userId) { var parameters = new List <SqlParameter> { new SqlParameter { ParameterName = "UserId", Value = userId } }; var dataTable = DatabaseCommon.PerformAction("AddSession", parameters); return(DatabaseCommon.ConvertRow(dataTable, PopulateSession)); }
public static TagType RetrieveTagType(int tagTypeId) { var parameters = new List <SqlParameter> { new SqlParameter { ParameterName = "TagTypeId", Value = tagTypeId } }; var dataTable = DatabaseCommon.PerformAction("GetTagTypeForTageTypeId", parameters); return(dataTable != null && dataTable.Rows.Count > 0 ? PopulateTagType(dataTable.Rows[0]) : null); }
public static List <Achievement> RetrieveOutstandingUserAchievements(int userId) { var parameters = new List <SqlParameter> { new SqlParameter { ParameterName = "userId", Value = userId } }; var dataTable = DatabaseCommon.PerformAction("GetOutstandingAchievementsForUserId", parameters); return(dataTable != null && dataTable.Rows.Count > 0 ? PopulateAchievements(dataTable) : null); }
public static void CreateUserAchievement(int achievementId, int userId) { var parameters = new List <SqlParameter> { new SqlParameter { ParameterName = "achievementId", Value = achievementId }, new SqlParameter { ParameterName = "userId", Value = userId } }; DatabaseCommon.PerformAction("AddUserAchievement", parameters); }
public static List <Transaction> RetrieveXTransactionsForUser(int count, int userId) { var parameters = new List <SqlParameter> { new SqlParameter { ParameterName = "count", Value = count }, new SqlParameter { ParameterName = "userId", Value = userId } }; var dataTable = DatabaseCommon.PerformAction("GetXTransactionsForUser", parameters); return(dataTable != null && dataTable.Rows.Count > 0 ? PopulateTransactionList(dataTable) : new List <Transaction>()); }
public static Transaction CreateTransactionForUserAndTag(int userId, int points, int tagId, TransactionType transactionTypeId) { var transaction = CreateTransaction(userId, points, transactionTypeId); var parameters = new List <SqlParameter> { new SqlParameter { ParameterName = "tagId", Value = tagId }, new SqlParameter { ParameterName = "transactionId", Value = transaction.TransactionId } }; var dataTable = DatabaseCommon.PerformAction("AddTransactionTag", parameters); return(dataTable != null && dataTable.Rows.Count > 0 ? PopulateTransaction(dataTable.Rows[0]) : null); }
public static int GetUsersUsablePoints(int userId) { var parameters = new List <SqlParameter> { new SqlParameter { ParameterName = "userId", Value = userId } }; var dataTable = DatabaseCommon.PerformAction("GetUsersUsablePoints", parameters); var usablePoints = 0; if (dataTable != null && dataTable.Rows.Count > 0) { usablePoints = dataTable.Rows[0].Field <int>("Points"); } return(usablePoints); }
public static IList <Hire> RetrieveAllHires() { var dataTable = DatabaseCommon.PerformAction("GetAllHires", null); return(DatabaseCommon.ConvertTable(dataTable, Hire.FromDataRow)); }