/// <summary> /// Only for changing a user's role in the organisation /// </summary> /// <param name="organisationMembership"></param> public void UpdateOrganisationMembership(OrganisationMembership organisationMembership) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { organisationMembership.UserType }; var sql = SqlCrudHelper.GetUpdateStatement(parameters, organisationMembership.GetType().Name); sql += " WHERE OrganisationMembershipId = @OrganisationMembershipId"; db.Execute(sql, organisationMembership); } }
public Guid CreatePasswordReset(PasswordReset passwordReset) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { passwordReset.UserAccountId }; var sql = SqlCrudHelper.GetInsertStatement(parameters, passwordReset.GetType().Name, "PasswordResetId"); Guid newId = db.ExecuteScalar <Guid>(sql, parameters); return(newId); } }
public void UpdateLevel(Level level) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { level.Name, level.Description }; var sql = SqlCrudHelper.GetUpdateStatement(parameters, level.GetType().Name); sql += " WHERE LevelId = @LevelId"; db.Execute(sql, level); } }
public Guid CreateLevel(Level level) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { level.Name, level.Description }; var sql = SqlCrudHelper.GetInsertStatement(parameters, level.GetType().Name, "LevelId"); Guid newId = db.ExecuteScalar <Guid>(sql, parameters); return(newId); } }
public bool UpdateOrganisation(Organisation organisation) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { organisation.OrganisationName }; var sql = SqlCrudHelper.GetUpdateStatement(parameters, organisation.GetType().Name); sql += " WHERE OrganisationId = @OrganisationId"; var result = db.Execute(sql, parameters); var boolResult = result == 1 ? true : false; return(boolResult); } }
public Guid CreateOrganisation(Organisation organisation) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { organisation.OrganisationName, organisation.CreatedById }; var sql = SqlCrudHelper.GetInsertStatement(parameters, organisation.GetType().Name, "OrganisationId"); Guid newId = db.ExecuteScalar <Guid>(sql, parameters); return(newId); } }
public Guid CreateScoreboard(Scoreboard scoreboard) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { scoreboard.UserAccountId, scoreboard.LevelConfigurationId, scoreboard.Score }; var sql = SqlCrudHelper.GetInsertStatement(parameters, scoreboard.GetType().Name, "ScoreboardId"); Guid newId = db.ExecuteScalar <Guid>(sql, parameters); return(newId); } }
public void UpdateTargetZone(TargetZone targetZone) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { targetZone.TargetZoneShape, targetZone.TargetZoneX, targetZone.TargetZoneY, targetZone.TargetZoneZ }; var sql = SqlCrudHelper.GetUpdateStatement(parameters, targetZone.GetType().Name); sql += " WHERE TargetZoneId = @TargetZoneId"; db.Execute(sql, targetZone); } }
public Guid CreateTargetAppearance(TargetAppearance targetAppearance) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { targetAppearance.TargetId, targetAppearance.ScoreboardId, targetAppearance.TargetUptime, targetAppearance.WasMissed }; var sql = SqlCrudHelper.GetInsertStatement(parameters, targetAppearance.GetType().Name, "TargetAppearanceId"); Guid newId = db.ExecuteScalar <Guid>(sql, parameters); return(newId); } }
public Guid CreateTargetZone(TargetZone targetZone) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { targetZone.TargetZoneShape, targetZone.TargetZoneX, targetZone.TargetZoneY, targetZone.TargetZoneZ }; var sql = SqlCrudHelper.GetInsertStatement(parameters, targetZone.GetType().Name, "TargetZoneId"); Guid newId = db.ExecuteScalar <Guid>(sql, parameters); return(newId); } }
public void UpdateLevelConfiguration(LevelConfiguration levelConfiguration) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { levelConfiguration.Name, levelConfiguration.Description, levelConfiguration.TargetSpawnDelay, levelConfiguration.TargetLifespan, levelConfiguration.IsPublic }; var sql = SqlCrudHelper.GetUpdateStatement(parameters, levelConfiguration.GetType().Name); sql += " WHERE LevelConfigurationId = @LevelConfigurationId"; db.Execute(sql, levelConfiguration); } }
public Guid CreateOrganisationMembership(OrganisationMembership organisationMembership) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { organisationMembership.OrganisationId, organisationMembership.UserAccountId, organisationMembership.UserType, organisationMembership.OrganisationInviteId }; var sql = SqlCrudHelper.GetInsertStatement(parameters, organisationMembership.GetType().Name, "OrganisationMembershipId"); Guid newId = db.ExecuteScalar <Guid>(sql, parameters); return(newId); } }
public void UpdateTarget(Target target) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { target.TargetShape, target.TargetX, target.TargetY, target.TargetZ, target.OffsetX, target.OffsetY, target.OffsetZ }; var sql = SqlCrudHelper.GetUpdateStatement(parameters, target.GetType().Name); sql += " WHERE TargetId = @TargetId"; db.Execute(sql, target); } }
public bool UpdateUserAccount(UserAccount userAccount) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { userAccount.Name, userAccount.EmailAddress, userAccount.Salt, userAccount.Hash }; var sql = SqlCrudHelper.GetUpdateStatement(parameters, userAccount.GetType().Name); sql += " WHERE UserAccountId = @UserAccountId"; var result = db.Execute(sql, userAccount); var boolResult = result == 1 ? true : false; return(boolResult); } }
public Guid CreateUserAccount(UserAccount userAccount) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { userAccount.UserAccountId, userAccount.Name, userAccount.EmailAddress, userAccount.Salt, userAccount.Hash, userAccount.CreatedDate, userAccount.IsDeleted }; var sql = SqlCrudHelper.GetInsertStatement(parameters, userAccount.GetType().Name, "UserAccountId"); Guid newId = db.ExecuteScalar <Guid>(sql, parameters); return(newId); } }
public Guid CreateTarget(Target target) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { target.LevelConfigurationId, target.TargetShape, target.TargetX, target.TargetY, target.TargetZ, target.OffsetX, target.OffsetY, target.OffsetZ }; var sql = SqlCrudHelper.GetInsertStatement(parameters, target.GetType().Name, "TargetId"); Guid newId = db.ExecuteScalar <Guid>(sql, parameters); return(newId); } }
public Guid CreateLevelConfiguration(LevelConfiguration levelConfiguration) { using (var db = new SqlConnection(_connectionString)) { var parameters = new { levelConfiguration.LevelId, levelConfiguration.OrganisationId, levelConfiguration.CreatedById, levelConfiguration.Name, levelConfiguration.Description, levelConfiguration.TargetSpawnDelay, levelConfiguration.TargetLifespan, levelConfiguration.IsPublic }; var sql = SqlCrudHelper.GetInsertStatement(parameters, levelConfiguration.GetType().Name, "LevelConfigurationId"); Guid newId = db.ExecuteScalar <Guid>(sql, parameters); return(newId); } }