//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; }
public List<IngredientEN> Ingredients(RecipeEN recipe) { List<IngredientEN> ingredientes = new List<IngredientEN>(); return ingredientes; }
public List<CookwareEN> Cookware(RecipeEN recipe) { List<CookwareEN> utensilios = new List<CookwareEN>(); return utensilios; }
public List<CommentEN> Comments(RecipeEN recipe) { List<CommentEN> comentarios = new List<CommentEN>(); return comentarios; }
// Returns a list with the recipes that a user have done public List<RecipeEN> RecipesUser() { List<RecipeEN> recetas = new List<RecipeEN>(); return recetas; }
// 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; }
// Returns a list with the recipes that use this ingredient public List<RecipeEN> ListRecipes() { List<RecipeEN> recetas = new List<RecipeEN>(); return recetas; }
// 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; }
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; }
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; }
/*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; }
public List<IngredientEN> IngredientsPerRecipe() { List<IngredientEN> ingredientes = new List<IngredientEN>(); return ingredientes; }
public List<CookwareEN> CookwarePerRecipe() { List<CookwareEN> utensilios = new List<CookwareEN>(); return utensilios; }
public List<CommentEN> CommentsPerRecipe() { List<CommentEN> comentarios = new List<CommentEN>(); return comentarios; }
// Returns a list with the comments that a user have done public List<CommentEN> CommentsUser() { List<CommentEN> comments = new List<CommentEN>(); return comments; }
// 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; }
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; }
// 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; }