public IEnumerable <VerificationDb> GetAll() { return(crud.Read(table, attributes).Select(item => { EntityMapping.Map(item, out VerificationDb verify); return verify; })); }
void RemoveOutdated() { VerificationDb unverify; string now = DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss"); //Get all users that don't verify email var unverified = crud.ReadBellow($"TO_TIMESTAMP(\'{now}\', 'DD.MM.YYYY HH24:MI:SS')", "ENDVERIFYDATE", attributes, tokens_table); var allTokens = crud.ReadFieldValues("TOKEN", $"{users_table} u INNER JOIN {tokens_table} t ON u.EMAIL = t.TOKEN"); foreach (var entity in unverified) { EntityMapping.Map(entity, out unverify); if (allTokens.Contains(unverify.Token)) { crud.Delete($"'{unverify.Token}'", users_table, "EMAIL"); } crud.Delete($"'{unverify.Token}'", tokens_table, "TOKEN"); } if (timer != null) { timer.Stop(); timer.Dispose(); timerStart = false; } TryToStart(); }
private void RemoveOutdated() { VerificationDb unverify; string now = DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss"); //Get all users that don't verify email var unverified = crud.Read(tokens_table, attributes, new DbTools.WhereRequest[] { new DbTools.WhereRequest("ENDVERIFYDATE", DbTools.RequestOperator.Less, $"TO_TIMESTAMP(\'{now}\', 'DD.MM.YYYY HH24:MI:SS')") }); var allTokens = crud.Read($"{users_table} u INNER JOIN {tokens_table} t ON u.EMAIL = t.TOKEN", token_attribute).Select(item => item.attributeValue["TOKEN"]).ToList(); foreach (var entity in unverified) { EntityMapping.Map(entity, out unverify); if (allTokens.Contains(unverify.Token)) { crud.Delete($"'{unverify.Token}'", users_table, "EMAIL"); } crud.Delete($"'{unverify.Token}'", tokens_table, "TOKEN"); } if (timer != null) { timer.Stop(); timer.Dispose(); timerStart = false; } TryToStart(); }
// Here they will be #endregion #endregion public long Save(GameReviewDb gameReview) { EntityORM entity = EntityMapping.Map(gameReview, attributes); entity.attributeValue.Remove("ID"); // getting sure that ID value is not touched long idGameReview = crud.Create(table, idColumn, entity); return(idGameReview); }
// Here they will be #endregion #endregion public long Save(StatisticsDb statistics) { EntityORM entity = EntityMapping.Map(statistics, attributes); entity.attributeValue.Remove("ID"); // getting sure that ID value is not touched long idStatistic = crud.Create(table, idColumn, entity); return(idStatistic); }
public long Save(VerificationDb verify) { EntityORM entity = EntityMapping.Map(verify, attributes); long verify_id = crud.Create(table, idColumn, entity, false); logger.Info($"User with id = {verify_id} was created"); return(verify_id); }
public long Save(GameDb game) { EntityORM entity = EntityMapping.Map(game, attributes); // Making sure that ID value is not touched. entity.attributeValue.Remove("ID"); long idGame = crud.Create(table, idColumn, entity); return(idGame); }
// Here they will be #endregion #endregion public long Save(UserReviewDb userReview) { EntityORM entity = EntityMapping.Map(userReview, attributes); // Making sure that ID value is not touched. entity.attributeValue.Remove("ID"); long idUserReview = crud.Create(table, idColumn, entity); return(idUserReview); }
// Here they will be #endregion #endregion public long Save(ChatDb chat) { EntityORM entity = EntityMapping.Map(chat, attributes); // Making sure that ID value is not touched. entity.attributeValue.Remove("ID"); long idChat = crud.Create(table, idColumn, entity); return(idChat); }
public VerificationDb Get(object id) { VerificationDb verify = null; EntityORM entity = crud.Read(id, "TOKEN", attributes, table); if (entity != null) { EntityMapping.Map(entity, out verify); } return(verify); }
public VerificationDb Get(object id) { VerificationDb verify = null; List <EntityORM> entities = (List <EntityORM>)(crud.Read(table, attributes, new DbTools.WhereRequest[] { new DbTools.WhereRequest(idColumn, DbTools.RequestOperator.Equal, id) })); if (entities.Any()) { EntityMapping.Map(entities[0], out verify); } return(verify); }
public MessageDb Get(long id) { MessageDb message = null; EntityORM entity = crud.Read(id, idColumn, attributes, table); if (entity != null) { EntityMapping.Map(entity, out message); } return(message); }
public ChatDb Get(long id) { ChatDb chat = null; EntityORM entity = crud.Read(id, idColumn, attributes, table); if (entity != null) { EntityMapping.Map(entity, out chat); } return(chat); }
public GameDb Get(object id) { GameDb game = null; EntityORM entity = crud.Read(id, idColumn, attributes, table); if (entity != null) { EntityMapping.Map(entity, out game); } return(game); }
public UserReviewDb Get(long id) { UserReviewDb userReview = null; EntityORM entity = crud.Read(id, idColumn, attributes, table); if (entity != null) { EntityMapping.Map(entity, out userReview); } return(userReview); }
public GameDb Get(object id) { GameDb game = null; List <EntityORM> entities = (List <EntityORM>)(crud.Read(table, attributes, new DbTools.WhereRequest[] { new DbTools.WhereRequest(idColumn, DbTools.RequestOperator.Equal, id) })); if (entities.Any()) { EntityMapping.Map(entities[0], out game); } return(game); }
public StatisticsDb Get(long id) { StatisticsDb statistics = null; List <EntityORM> entities = (List <EntityORM>)(crud.Read(table, attributes, new DbTools.WhereRequest[] { new DbTools.WhereRequest(idColumn, DbTools.RequestOperator.Equal, id) })); if (entities.Any()) { EntityMapping.Map(entities[0], out statistics); } return(statistics); }
public GameReviewDb Get(long id) { GameReviewDb gameReview = null; EntityORM entity = crud.Read(id, idColumn, attributes, table); if (entity != null) { EntityMapping.Map(entity, out gameReview); } return(gameReview); }
public long Save(UserDb user) { EntityORM entity = EntityMapping.Map(user, attributes); // Making sure that ID value is not touched. entity.attributeValue.Remove("ID"); long user_id = crud.Create(table, idColumn, entity); logger.Info($"User with id = {user_id} was created"); return(user_id); }
public MessageDb Get(long id) { MessageDb message = null; List <EntityORM> entities = (List <EntityORM>)(crud.Read(table, attributes, new DbTools.WhereRequest[] { new DbTools.WhereRequest(idColumn, DbTools.RequestOperator.Equal, id) })); if (entities.Any()) { EntityMapping.Map(entities[0], out message); } return(message); }
public UserReviewDb Get(long id) { UserReviewDb userReview = null; List <EntityORM> entities = (List <EntityORM>)(crud.Read(table, attributes, new DbTools.WhereRequest[] { new DbTools.WhereRequest(idColumn, DbTools.RequestOperator.Equal, id) })); if (entities.Any()) { EntityMapping.Map(entities[0], out userReview); } return(userReview); }
public StatisticsDb Get(long id) { StatisticsDb statistics = null; EntityORM entity = crud.Read(id, idColumn, attributes, table); if (entity != null) { EntityMapping.Map(entity, out statistics); } return(statistics); }
public IEnumerable <GameDb> GetAll() { List <GameDb> games = new List <GameDb>(); List <EntityORM> entities = (List <EntityORM>)crud.ReadAll(table, attributes); foreach (EntityORM entity in entities) { EntityMapping.Map(entity, out GameDb game); games.Add(game); } return(games); }
public IEnumerable <UserDb> GetAll() { List <UserDb> users = new List <UserDb>(); List <EntityORM> entities = (List <EntityORM>)crud.ReadAll(table, attributes); foreach (EntityORM entity in entities) // Mapping entities to users { EntityMapping.Map(entity, out UserDb user); users.Add(user); } return(users); }
public IEnumerable <MessageDb> GetAll() { List <MessageDb> messages = new List <MessageDb>(); List <EntityORM> entities = (List <EntityORM>)crud.ReadAll(table, attributes); foreach (EntityORM entity in entities) // Mapping entities to messages { EntityMapping.Map(entity, out MessageDb message); messages.Add(message); } return(messages); }
public IEnumerable <UserReviewDb> GetAll() { List <UserReviewDb> userReviews = new List <UserReviewDb>(); List <EntityORM> entities = (List <EntityORM>)crud.Read(table, attributes); foreach (EntityORM entity in entities) { EntityMapping.Map(entity, out UserReviewDb userReview); userReviews.Add(userReview); } return(userReviews); }
public IEnumerable <ChatDb> GetAll() { List <ChatDb> chats = new List <ChatDb>(); List <EntityORM> entities = (List <EntityORM>)crud.Read(table, attributes); foreach (EntityORM entity in entities) { EntityMapping.Map(entity, out ChatDb chat); chats.Add(chat); } return(chats); }
public IEnumerable <StatisticsDb> GetAll() { List <StatisticsDb> statistics = new List <StatisticsDb>(); List <EntityORM> entities = (List <EntityORM>)crud.ReadAll(table, attributes); foreach (EntityORM entity in entities) // Mapping entities to messages { EntityMapping.Map(entity, out StatisticsDb statistic); statistics.Add(statistic); } return(statistics); }
public IEnumerable <GameReviewDb> GetAll() { List <GameReviewDb> gameReviews = new List <GameReviewDb>(); List <EntityORM> entities = (List <EntityORM>)crud.ReadAll(table, attributes); foreach (EntityORM entity in entities) // Mapping entities to userReviews { EntityMapping.Map(entity, out GameReviewDb userReview); gameReviews.Add(userReview); } return(gameReviews); }
public void Update(StatisticsDb statistics) { EntityORM entity = EntityMapping.Map(statistics, attributes); entity.attributeValue.Remove("ID"); // getting sure that ID value is not touched bool ifUpdated = crud.Update(statistics.Id, table, idColumn, entity); if (ifUpdated) { logger.Info($"Game statistics with id={statistics.Id} was successfully updated."); } else { logger.Info($"Updating statistics with id={statistics.Id} was failed."); } }