public void LoadRecipesNames(ComboBox comboBox) { List <string> recipeNames = new List <string>(); recipeQuery.UserRecipes().ForEach(x => recipeNames.Add(x.RecipeName)); comboBox.ItemsSource = recipeNames; }
private void ListOfRecipeNames(RecipeQuery recipe) { int recipeNumber = 1; recipe.UserRecipes().ForEach(x => { Console.WriteLine("nr {0}: {1}", recipeNumber, x.RecipeName); recipeNumber++; }); }
private void InsertBatch() { RecipeQuery recipe = new RecipeQuery(); string[] listOfRecipeNames = new string[10]; string[] listOfPreparedBaches = new string[10]; int listIndex = 0; Console.WriteLine("----Dodaj Zesatw----"); Console.Write("Wpisz datę: "); string date = Console.ReadLine(); DateTime date1 = StringToDateConverter(date); Console.WriteLine("Dostępne Receptury: "); ListOfRecipeNames(recipe); //Loop where you can write how meny batches where prepared while (true) { Console.Write("Nazwa receptury: "); string nameOfRecipe = Console.ReadLine(); Console.Write("Ile Zestawów: "); string howMeny = Console.ReadLine(); listOfRecipeNames[listIndex] = nameOfRecipe; listOfPreparedBaches[listIndex] = howMeny; listIndex++; string com = Console.ReadLine(); if (com == "q") { break; } if (com == "r") { ListOfRecipeNames(recipe); } } //Insert batches to DB for (int j = 0; j < listIndex; j++) { recipe.UserRecipes().ForEach(x => { if (listOfRecipeNames[j] == x.RecipeName) { query.InsertBatch(date1, x.GetID(), int.Parse(listOfPreparedBaches[j])); } }); } }