Example #1
0
        //get all the books
        public List<BookEN> getCookwares()
        {
            List<BookEN> books = new List<BookEN>();

            String sql = "SELECT * FROM Book";
            // string sql = "SELECT * FROM NOTES ORDER BY ID DESC";
            SqlConnection con = new SqlConnection(db);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand(sql, con);
                SqlDataReader reader = cmd.ExecuteReader();
                BookEN bookTemp = new BookEN();

                while (reader.Read())
                {
                    bookTemp = new BookEN();

                    bookTemp.Author = reader["Author"].ToString();
                    bookTemp.Date = reader["Date"].ToString();
                    bookTemp.Isbn = reader["Isbn"].ToString();
                    bookTemp.Title = reader["Title"].ToString();

                    books.Add(bookTemp);
                }
            }
            catch (Exception ex) { }
            finally
            {
                con.Close();
            }

            return books;
        }
        // Returns a list with the recipes that use this ingredient
        public List<RecipeEN> ListRecipes(IngredientEN ing)
        {
            List<RecipeEN> recetas = new List<RecipeEN>();

            return recetas;
        }
Example #3
0
        public List<IngredientEN> Ingredients(RecipeEN recipe)
        {
            List<IngredientEN> ingredientes = new List<IngredientEN>();

            return ingredientes;
        }
Example #4
0
        public List<CookwareEN> Cookware(RecipeEN recipe)
        {
            List<CookwareEN> utensilios = new List<CookwareEN>();

            return utensilios;
        }
Example #5
0
        public List<CommentEN> Comments(RecipeEN recipe)
        {
            List<CommentEN> comentarios = new List<CommentEN>();

            return comentarios;
        }
Example #6
0
        // Returns a list with the recipes that a user have done
        public List<RecipeEN> RecipesUser()
        {
            List<RecipeEN> recetas = new List<RecipeEN>();

            return recetas;
        }
Example #7
0
        // Returns a list of the users that has equals or more puntation that the given by parameter
        public List<UserEN> PuntuationUser(int puntuacion)
        {
            List<UserEN> puntuaciones = new List<UserEN>();

            return puntuaciones;
        }
Example #8
0
        // Returns a list with the recipes that use this ingredient
        public List<RecipeEN> ListRecipes()
        {
            List<RecipeEN> recetas = new List<RecipeEN>();

            return recetas;
        }
Example #9
0
        // Returns a list with the recipes that a user have done
        public List<RecipeEN> RecipesUser(UserEN user)
        {
            List<RecipeEN> lista = new List<RecipeEN>();
            RecipeCAD recipeCad = new RecipeCAD();
            RecipeEN recipe;
            SqlConnection c = new SqlConnection(db);
            try
            {
                c.Open();
                SqlCommand com = new SqlCommand("SELECT Id FROM Recipe WHERE User = '******'", c);
                SqlDataReader dr = com.ExecuteReader();
                while (dr.Read())
                {
                    recipe = recipeCad.getRecipe(long.Parse(dr["Id"].ToString()));

                    lista.Add(recipe);
                }
                dr.Close();
            }
            catch (Exception ex) { }
            finally
            {
                c.Close();
            }
            return lista;
        }
Example #10
0
        private List<RecipeEN> getRecipesName(RecipeEN reci)
        {
            List<RecipeEN> recipes = new List<RecipeEN>();
            RecipeEN recipe = new RecipeEN();
            SqlConnection c = new SqlConnection(db);

            try
            {
                c.Open();
                SqlCommand com = new SqlCommand("SELECT * FROM Recipe WHERE Name = '" + reci.Name + "'", c);
                SqlDataReader dr = com.ExecuteReader();
                while (dr.Read())
                {
                    recipe.Id = int.Parse(dr["Id"].ToString());
                    recipe.Name = dr["Name"].ToString();
                    recipe.Time = int.Parse(dr["Time"].ToString());
                    recipe.Subtitle = dr["Subtitle"].ToString();
                    recipe.Description = dr["Description"].ToString();
                    recipe.Video = dr["Video"].ToString();
                    recipe.Origin = dr["Origin"].ToString();
                    recipe.Difficulty = dr["Difficulty"].ToString();
                    recipe.Type = dr["Type"].ToString();
                    recipe.Imagen = dr["Imagen"].ToString();
                    recipes.Add(recipe);
                }
                dr.Close();
            }
            catch (Exception ex) { }
            finally { c.Close(); }

            return recipes;
        }
Example #11
0
        public List<RecipeEN> getRecipes(string tipoBusqueda, RecipeEN reci)
        {
            List<RecipeEN> fr = new List<RecipeEN>();
            SqlConnection c = new SqlConnection(db);

            try
            {
                c.Open();
                switch (tipoBusqueda)
                {
                    case "Name":
                        return getRecipesName(reci);
                        break;
                    case "Hard":
                        return getRecipesHard(reci);
                        break;
                    case "Impossible":
                        return getRecipesImpossible(reci);
                        break;
                    case "Middle":
                        return getRecipesMedium(reci);
                        break;
                    case "Author":
                        return getRecipesAuth(reci);
                        break;
                }
            }
            catch (Exception ex) { }
            finally { c.Close(); }
            return fr;
        }
Example #12
0
        /*public bool updateRecipe(RecipeEN recipe, long id)
        {
            bool updated = false;
            SqlConnection c = new SqlConnection(db);
            try
            {
                c.Open();
                SqlCommand com = new SqlCommand("", c);
                com.ExecuteNonQuery();
                updated = true;
            }
            catch (Exception ex) { updated=false;}
            finally
            {
                c.Close();
            }
            return updated;
        }*/
        public List<CommentEN> getComments(RecipeEN reci)
        {
            List<CommentEN> lista = new List<CommentEN>();
            CommentsCAD recipeCad = new CommentsCAD();
            CommentEN recipe;
            SqlConnection c = new SqlConnection(db);
            try
            {
                c.Open();
                SqlCommand com = new SqlCommand("SELECT Code FROM Ternary WHERE Id = " + reci.Id, c);
                SqlDataReader dr = com.ExecuteReader();
                while (dr.Read())
                {
                    recipe = recipeCad.READ(long.Parse(dr["Id"].ToString()));

                    lista.Add(recipe);
                }
                dr.Close();
            }
            catch (Exception ex) { }
            finally
            {
                c.Close();
            }
            return lista;
        }
Example #13
0
        public List<IngredientEN> IngredientsPerRecipe()
        {
            List<IngredientEN> ingredientes = new List<IngredientEN>();

            return ingredientes;
        }
Example #14
0
        public List<CookwareEN> CookwarePerRecipe()
        {
            List<CookwareEN> utensilios = new List<CookwareEN>();

            return utensilios;
        }
Example #15
0
        public List<CommentEN> CommentsPerRecipe()
        {
            List<CommentEN> comentarios = new List<CommentEN>();

            return comentarios;
        }
Example #16
0
        // Returns a list with the comments that a user have done
        public List<CommentEN> CommentsUser()
        {
            List<CommentEN> comments = new List<CommentEN>();

            return comments;
        }
Example #17
0
        // Returns a list of the users that has equals or more puntation that the given by parameter
        public List<UserEN> PuntuationUser(int puntuacion)
        {
            List<UserEN> users = new List<UserEN>();

            return users;
        }
Example #18
0
        public List<CookwareEN> getCookwares()
        {
            List<CookwareEN> cookwareList = new List<CookwareEN>();

            String sql = "SELECT * FROM Cookware";
            // string sql = "SELECT * FROM NOTES ORDER BY ID DESC";
            SqlConnection con = new SqlConnection(db);

            try
            {
                con.Open();
                SqlCommand cmd = new SqlCommand(sql, con);
                SqlDataReader reader = cmd.ExecuteReader();
                CookwareEN cookwareTemp = new CookwareEN();

                while (reader.Read())
                {
                    cookwareTemp = new CookwareEN();

                    cookwareTemp.Name = reader["Name"].ToString();
                    cookwareTemp.Material = reader["Material"].ToString();

                    cookwareList.Add(cookwareTemp);
                }
            }
            catch (Exception ex) { }
            finally
            {
                con.Close();
            }

            return cookwareList;
        }
Example #19
0
        // Returns a list with the comments that a user have done
        public List<CommentEN> CommentsUser(UserEN user)
        {
            List<CommentEN> comentarios = new List<CommentEN>();

            return comentarios;
        }