public void CreateMenu(Operator operations, string connectionString) { Console.WriteLine("Created Ingredients"); foreach (Ingredient blah in createdIngredients) { blah.printIngredient(); } Console.WriteLine("Created Instructions"); foreach (Instruction meh in createdInstruction) { meh.printInstructionToConsole(); } Console.WriteLine("All who venture here be warnded"); Console.WriteLine("This is the create/insert menu! Please pick from these options"); Console.WriteLine("Create new: \n"); Console.WriteLine("Recipe '1'"); Console.WriteLine("Ingredient '2'"); Console.WriteLine("Show All Created ingredients/instructions '4'"); Console.WriteLine("Insert Created Ingredient '5'"); Console.WriteLine("Insert Created Instruction '6'"); Console.WriteLine("Main Menu 'menu'"); string userInput = Console.ReadLine(); bool acted = false; if (userInput == "1") { RecipeGuide myGuide = new RecipeGuide("Test Recipe", UserID); Recipe myrecipe = myGuide.startUpRecipeGuide(connectionString, UserID); myGuide.previewRecipe(myrecipe); } if (userInput == "2") { Ingredient myingredient = new Ingredient(); createdIngredients.Add(myingredient); } if (userInput == "4") { Console.WriteLine("Created ingredients:"); foreach (Ingredient temp in createdIngredients) { temp.printIngredient(); } Console.WriteLine("Created instructions:"); foreach (Instruction temp in createdInstruction) { temp.instructionRelavant(); } } if (userInput == "5") { Console.WriteLine("Created ingredients:"); foreach (Ingredient temp in createdIngredients) { temp.printIngredient(); } Console.WriteLine("Select Created Ingredient By Name"); string ingname = Console.ReadLine(); foreach (Ingredient temp in createdIngredients) { if (temp.getName() == ingname) { operations.insertIngredient(connectionString, temp, UserID); } } } if (userInput == "6") { Console.WriteLine("Created instructions:"); foreach (Instruction temp in createdInstruction) { temp.printInstructionToConsole(); } Console.WriteLine("Select Created Instruction By Name"); string insname = Console.ReadLine(); foreach (Instruction temp in createdInstruction) { if (temp.getTitle() == insname) { operations.insertInstruction(connectionString, temp, UserID); } } } if (userInput == "menu") { acted = true; } if (acted == false) { CreateMenu(operations, connectionString); } }
public void RecipeMenu(Operator operations, string connectionString, int userID) { //this speeds up the process by bipassing the database interaction if its already local // as a team we need to figure how to do this on a much bigger scale to minimize interactions that happen //in real time so that users feel like the app is fast if (Recipes.Any <Recipe>() == false) { Recipes = operations.allRecipes(connectionString); } // if (userInput == "1" || userInput == "recipe") { List <Recipe> myRecipes = operations.allRecipes(connectionString); foreach (Recipe temprecipe in myRecipes) { temprecipe.printRecipe(); } } Console.WriteLine("\nRecipe Menu! Options: \n "); // Console.Write("All Recipes (recipe or 1)" + "\n"); Console.Write("See ingredients from a recipe '2' " + "\n"); Console.Write("See instructions from a recipe '3' " + "\n"); Console.WriteLine("Print Recipe by ID '4' "); Console.WriteLine("Delete Recipe '5'"); Console.WriteLine("Update Recipe '6'"); Console.WriteLine("Reorder Recipe '7'"); Console.Write("'menu' for main menu" + "\n"); Console.WriteLine(); // Console.Write("all Ingredients in a receipe" + "\n"); string userInput = Console.ReadLine(); userInput = userInput.ToLower(); // operations.allIngredientInRecipe(connectionString); bool acted = false; if (userInput == "2") { operations.allIngredientInRecipe(connectionString); } if (userInput == "3") { operations.allInstructionInRecipe(connectionString); string wait = Console.ReadLine(); } if (userInput == "4") { Recipe myRecipe = operations.RecipeByID(connectionString, userID); myRecipe.printRecipe(); RecipeGuide myGuide = new RecipeGuide(UserID); myGuide.previewRecipe(myRecipe); string wait = Console.ReadLine(); } if (userInput == "5") { operations.allRecipes(connectionString); Console.WriteLine("Select Recipe By ID"); Recipe Rec = operations.RecipeByID(connectionString, userID); if (Rec.getInstructionRecipe().Any <Instruction>()) { operations.DeleteRecipeWithInstruction(connectionString, userID, Rec); } else { operations.DeleteRecipeWithoutInstruction(connectionString, userID, Rec); } string wait = Console.ReadLine(); } if (userInput == "6") { Recipe myrecipe = operations.RecipeByID(connectionString, userID); RecipeGuide guide = new RecipeGuide(userID); string wait = Console.ReadLine(); } if (userInput == "menu") { acted = true; } if (acted == false) { RecipeMenu(operations, connectionString, userID); } }
public void startMenu(int userID, string connectionString) { Operator operations = new Operator(); Console.WriteLine("Main Menu! \nOptions \n"); Console.Write("Ingredients '1'" + "\n"); Console.Write("Recipes '2'" + "\n"); Console.Write("Instructions '3' " + "\n"); Console.WriteLine("CookSmart '4' "); Console.WriteLine("User Menu '5' "); Console.WriteLine("Recipe Builder '6'"); Console.WriteLine("Create menu '7'"); Console.WriteLine("Kitchen '8'"); Console.WriteLine("Calendar '11'"); Console.WriteLine("Meal Menu '13'"); Console.WriteLine("Enter 'exit' to quit"); Console.WriteLine(""); string userInput = Console.ReadLine(); userInput = userInput.ToLower(); bool acted = false; if (userInput == "1" || userInput == "ingredients") { IngredientMenu(operations, connectionString, userID); } if (userInput == "2" || userInput == "recipes") { Console.WriteLine("recipes menu"); RecipeMenu(operations, connectionString, userID); } if (userInput == "3" || userInput == "instructions") { Console.WriteLine("instructions menu"); InstructionMenu(operations, connectionString, userID); } if (userInput == "4" || userInput == "cookSmart") { Console.WriteLine(); operations.cookSmart(connectionString, UserID); } if (userInput == "5" || userInput == "users") { Console.WriteLine("User menu"); UserMenu(operations, connectionString, userID); } if (userInput == "6") { Console.WriteLine("New Recipe"); RecipeGuide myGuide = new RecipeGuide("Test Recipe", userID); Recipe newRecipe = myGuide.startUpRecipeGuide(connectionString, userID); } if (userInput == "7") { Console.WriteLine("Create menu"); CreateMenu(operations, connectionString); } if (userInput == "8") { Console.WriteLine("Kitchen Menu"); kitchenMenu(connectionString, operations, userID); } if (userInput == "10") { Console.WriteLine("A quick spot for bebuggig"); Console.ReadLine(); } if (userInput == "11" || userInput == "calender") { calenderMenu(connectionString, operations, userID); } if (userInput == "13") { Console.WriteLine("Meal Menu"); mealMenu(connectionString, operations, userID); } if (userInput == "exit") { acted = true; } if (acted == false) { startMenu(userID, connectionString); } }