Example #1
0
        public Invitation GetServicedObjectWhere(string condition)
        {
            string    query  = string.Format("select * from Invitations where {0}", condition);
            DataTable result = database.ExecuteQuery(query);

            return(new Invitation()
            {
                Id = Convert.ToInt32(result.Rows[0]["id"]),
                UserId = Convert.ToInt32(result.Rows[0]["user_id"]),
                EventId = Convert.ToInt32(result.Rows[0]["event_id"])
            });
        }
        public Game GetServicedObjectWhere(string condition)
        {
            string    query  = string.Format("select * from Games where {0}", condition);
            DataTable result = database.ExecuteQuery(query);

            return(new Game()
            {
                Id = Convert.ToInt32(result.Rows[0]["id"]),
                Title = result.Rows[0]["title"].ToString(),
                Description = result.Rows[0]["description"].ToString(),
                Category = Convert.ToInt32(result.Rows[0]["category"]),
                UserId = Convert.ToInt32(result.Rows[0]["user_id"])
            });
        }
Example #3
0
        public Event GetServicedObjectWhere(string condition)
        {
            string    query  = string.Format("select * from Events where {0}", condition);
            DataTable result = database.ExecuteQuery(query);

            return(new Event()
            {
                Id = Convert.ToInt32(result.Rows[0]["id"]),
                Title = result.Rows[0]["title"].ToString(),
                Description = result.Rows[0]["description"].ToString(),
                Date = Convert.ToDateTime(result.Rows[0]["date"]),
                UserId = Convert.ToInt32(result.Rows[0]["user_id"]),
                GameId = Convert.ToInt32(result.Rows[0]["game_id"])
            });
        }
Example #4
0
        public User GetServicedObjectWhere(string condition)
        {
            string    query  = string.Format("select * from Users where {0}", condition);
            DataTable result = database.ExecuteQuery(query);

            if (result == null || result.Rows.Count == 0)
            {
                return(null);
            }
            return(new User()
            {
                Id = Convert.ToInt32(result.Rows[0]["id"]),
                Name = result.Rows[0]["name"].ToString(),
                LastName = result.Rows[0]["last_name"].ToString(),
                Email = result.Rows[0]["email"].ToString(),
                Password = result.Rows[0]["password"].ToString()
            });
        }