예제 #1
0
 public IEnumerable <VerificationDb> GetAll()
 {
     return(crud.Read(table, attributes).Select(item => {
         EntityMapping.Map(item, out VerificationDb verify);
         return verify;
     }));
 }
예제 #2
0
        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();
        }
예제 #3
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
        // 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);
        }
예제 #9
0
        // 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);
        }
예제 #10
0
        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);
        }
예제 #11
0
        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);
        }
예제 #12
0
        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);
        }
예제 #13
0
        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);
        }
예제 #14
0
        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);
        }
예제 #15
0
        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);
        }
예제 #16
0
        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);
        }
예제 #17
0
        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);
        }
예제 #18
0
        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);
        }
예제 #19
0
        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);
        }
예제 #20
0
        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);
        }
예제 #21
0
        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);
        }
예제 #23
0
        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);
        }
예제 #24
0
        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);
        }
예제 #25
0
        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);
        }
예제 #26
0
        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);
        }
예제 #27
0
        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);
        }
예제 #29
0
        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.");
            }
        }