예제 #1
0
 protected void DeleteFromRecipe_Click(object sender, EventArgs e)
 {
     if (IngredientList.SelectedDataKey != null)
     {
         var id = Convert.ToInt32(IngredientList.SelectedDataKey.Value);
         var listofdeletions = new List <FoodList>();
         foreach (FoodList x in Global.foods.FoodLists)
         {
             if (x.NDB_Number == id)
             {
                 listofdeletions.Add(x);
             }
         }
         foreach (var y in listofdeletions)
         {
             Global.foods.FoodLists.Remove(y);
         }
         IngredientList.DataSource = Global.foods.FoodLists.ToList();
         IngredientList.DataBind();
     }
     else
     {
         AnotherError.Text = "No ingredient selected for deletion.";
     }
 }
예제 #2
0
 /// <summary>
 /// This method invokes method for adding ingredient to recipe.
 /// </summary>
 public void AddIngredientExecute()
 {
     if (String.IsNullOrEmpty(Ingredient.IngredientName) || String.IsNullOrEmpty(Ingredient.Quantity.ToString()) || Ingredient.Quantity == 0)
     {
         MessageBox.Show("Please fill all fields.", "Notification");
     }
     else if (IngredientList != null && (IngredientList.Where(x => x.IngredientName == Ingredient.IngredientName).Any() ||
                                         AddedIngredientList.Where(x => x.IngredientName == Ingredient.IngredientName).Any()))
     {
         MessageBox.Show("You already added this ingredient.", "Notification");
     }
     else
     {
         try
         {
             ingredients.AddIngredient(Ingredient, out int id);
             Ingredient.IngredientId = id;
             //add to collection of added ingredients
             AddedIngredientList.Add(Ingredient);
             //remove from collection of deleted ingredients
             DeletedIngredientList.Remove(Ingredient);
             //invokes method to update a list of ingredients
             IngredientList      = ingredients.GetRecipeIngredients(Recipe);
             Ingredient          = new vwIngredient();
             Ingredient.RecipeId = Recipe.RecipeId;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }
        async Task ExecuteLoadIngredientCommand()
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                IngredientList.Clear();
                var items = await DataStore.GetItemAsync(Item.Id);

                foreach (var ingredient in items.IngredientList)
                {
                    IngredientList.Add(ingredient);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }
    protected override void OnUpdate()
    {
        for (int i = 0; i < data.Length; ++i)
        {
            Entity         spawnedEntity = data.Entities[i];
            PizzaSpawnData spawnData     = data.SpawnData[i];

            PostUpdateCommands.RemoveComponent <PizzaSpawnData>(spawnedEntity);

            PostUpdateCommands.AddSharedComponent(spawnedEntity, spawnData.PizzaGroup);
            PostUpdateCommands.AddComponent(spawnedEntity, spawnData.Position);
            IngredientList ingredientList = new IngredientList {
                Value = generatePizzaIngredients()
            };
            PostUpdateCommands.AddSharedComponent(spawnedEntity, ingredientList);

            PostUpdateCommands.AddComponent(spawnedEntity, new Pizza {
            });
            PostUpdateCommands.AddComponent(spawnedEntity, new Heading2D {
                Value = new float2(0, -1)
            });
            PostUpdateCommands.AddComponent(spawnedEntity, default(TransformMatrix));
            PostUpdateCommands.AddSharedComponent(spawnedEntity, BootStrap.PizzaLook);

            PostUpdateCommands.AddComponent(spawnedEntity, getPizzaCost(ingredientList));

            BootStrap.SetPizzaOrderUIIngredients(ingredientList.Value, spawnData.PizzaGroup.PizzaId);
        }
    }
예제 #5
0
 public bool Equals(IngredientList <DB> other)
 {
     if (!object.ReferenceEquals(other, this))
     {
         if (((other == null) || (this.unsorted.Length != other.unsorted.Length)) || (this.hashCode != other.hashCode))
         {
             return(false);
         }
         DB[] sorted      = this.sorted;
         DB[] localArray2 = other.sorted;
         int  index       = 0;
         int  length      = sorted.Length;
         while (index < length)
         {
             if (sorted[index] != localArray2[index])
             {
                 return(false);
             }
             if (--length <= index)
             {
                 break;
             }
             if (sorted[length] != localArray2[length])
             {
                 return(false);
             }
             index++;
         }
     }
     return(true);
 }
        // GET: Recommendations
        public async Task <ActionResult> Index()
        {
            var userClaims = User.Identity as System.Security.Claims.ClaimsIdentity;

            ViewBag.Name = userClaims?.FindFirst("name")?.Value;

            IEnumerable <PreferenceEntity> preferenceEntities = TableActions.GetPreferencesResult("PreferenceTable", userClaims?.FindFirst(System.IdentityModel.Claims.ClaimTypes.Name)?.Value);
            IEnumerable <PantryEntity>     pantryEntities     = TableActions.GetPantryResult("PantryTable", userClaims?.FindFirst(System.IdentityModel.Claims.ClaimTypes.Name)?.Value);

            var preference = preferenceEntities.FirstOrDefault();
            IEnumerable <string> dietaryRestrictions = null;
            string diet = null;

            if (preference != null)
            {
                dietaryRestrictions = preference.healthPreference.Split(',');
                diet = preference.dietPreference;
            }

            string[]       foods                = { "pork", "bread", "peppers", "sugar", "corn" };
            string[]       pantryList           = pantryEntities.Select(x => x.RowKey).ToArray();
            IngredientList userPreferences      = new IngredientList(foods);
            IngredientList pantry               = new IngredientList(pantryList);
            List <Tuple <Recipe, double> > recs = await Recommender.GetRecommendations(userPreferences, pantry, dietaryRestrictions, diet);

            return(View(recs));
        }
예제 #7
0
    //Dodawanie nowego skladnika do listy
    private void AddIngredient()
    {
        var ingredient = new Ingredient();

        ingredient.Name = IngredientNameTxt;
        if (IngredientNameTxt == null || IngredientNameTxt == "")
        {
            MessageBox.Show("Uzupełnij nazwę składnika");
            return;
        }
        try
        {
            ingredient.Quantity = double.Parse(IngredientQuantityTxt);
        }
        catch (Exception)
        {
            return;
        }

        using (var contex = new CookingBookEntities1())
        {
            ingredient.TypeID = contex.QuantityTypes.Where(x => x.Name == SelectedQuantityCB).First().ID;
        }

        IngredientList.Add(ingredient);
        IngredientNameTxt     = null;
        IngredientQuantityTxt = null;
    }
예제 #8
0
 public Menu(string mealName, string mealDescription, int mealNumber, IngredientList typeOfIngredient, double mealPrice)
 {
     MealName         = mealName;
     MealDescription  = mealDescription;
     MealNumber       = mealNumber;
     TypeOfIngredient = typeOfIngredient;
     MealPrice        = mealPrice;
 }
예제 #9
0
 public async void setupRecipesList(IngredientList il, string name)
 {
     this.ingName = name;
     foreach (IngredientModel im in il.meals)
     {
         listBox1.Items.Add(im.strMeal);
     }
 }
예제 #10
0
 public KomodoCafeContent(int mealNumber, string mealName, string description, IngredientList ingredient, decimal price)
 {
     MealNumber  = mealNumber;
     MealName    = mealName;
     Description = description;
     Ingredient  = ingredient;
     Price       = price;
 }
예제 #11
0
 public Sandwitch(IBread topbread, CondimentList topcondimentList, IngredientList ingredientList, CondimentList bottomcondimentList, IBread bottomBread)
 {
     this.topBread            = topbread;
     this.topcondimentList    = topcondimentList;
     this.ingredientList      = ingredientList;
     this.bottomcondimentList = bottomcondimentList;
     this.bottomBread         = bottomBread;
 }
예제 #12
0
    private void Start()
    {
        if (type == ContType.Bandeja)
        {
            list = new IngredientList();
        }

        poss = 0;
    }
예제 #13
0
    private bool isPizzaComplete(int pizzaIndex)
    {
        List <int>     currentIngredients = getIngredientsOnPizza(pizzaIndex);
        IngredientList ingredientList     = pizzaData.PizzaOrder[pizzaIndex];

        List <int> missingIngredients = ingredientList.Value.Except <int>(currentIngredients).ToList();

        return(missingIngredients.Count == 0);
    }
예제 #14
0
        private async void openForm2()
        {
            IngredientList il = await RecipesByCategoryDataProc.LoadMealIngredients(this.ingName);

            Form2 form2 = new Form2();

            form2.setWindow(il.meals[listBox1.SelectedIndex].idMeal);
            form2.Show();
        }
예제 #15
0
 protected void DumpSession(object sender, EventArgs e)
 {
     HttpContext.Current.Session.Clear();
     IngredientList.DataBind();
     SearchResults.DataBind();
     SelectedIngredient.Text     = "";
     AnotherError.Text           = "";
     SearchResults.SelectedIndex = -1;
 }
예제 #16
0
 //Czyszczenie pól
 public void ClearPage()
 {
     DescriptionTxt = "";
     TitleTxt       = "";
     AuthorTxt      = "";
     IngredientList.Clear();
     SelectedCategoryCB.ID = 0;
     SelectedQuantityCB    = "Szklanka";
 }
예제 #17
0
        //functions
        public static void addIngredient(string name, double cost, int stock)
        {
            var ingredient = new Ingredient();

            ingredient.setName(name);
            ingredient.setCost(cost);
            ingredient.setStock(stock);

            IngredientList.Add(ingredient);
        }
예제 #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         IngredientList.DataSource = Global.foods.FoodLists.ToList();
         IngredientList.DataBind();
         RecipeTitle.Text = Global.foods.Name;
         Servings.Text    = Global.foods.Servings.ToString();
     }
 }
예제 #19
0
 public TropicalPizza()
 {
     Name        = "Tropical";
     ImagePath   = @"\Resources\TropicalPizza.jpg";
     Ingredients = new IngredientList {
         new Mozzarella(),
         new Ham(),
         new Pineapple()
     };
 }
예제 #20
0
        private async void loadList(string name)
        {
            IngredientList il = await RecipesByCategoryDataProc.LoadMealIngredients(name);

            Form6 form6 = new Form6();

            form6.setupRecipesList(il, name);
            form6.Text = "Recipes with main ingredient - " + name;
            form6.Show();
        }
 public void PopulateBindingLists()
 {
     IngredientList.Clear();
     IngredientQuantities.Clear();
     foreach (var kvp in PantryContents)
     {
         IngredientList.Add(kvp.Key);
         IngredientQuantities.Add(kvp.Value);
     }
 }
예제 #22
0
        private async void loadList()
        {
            IngredientList il = await RecipesByCategoryDataProc.LoadMealIngredients(listBox1.SelectedItem.ToString());

            Form6 form6 = new Form6();

            form6.setupRecipesList(il, listBox1.SelectedItem.ToString()); //calling function that will contain list of recipes
            form6.Text = "Recipes with main ingredient - " + listBox1.SelectedItem.ToString();
            form6.Show();
        }
예제 #23
0
        public void PopulateIngredientList()
        {
            IngredientList.Clear();
            MealPlan mealPlan = new MealPlan();

            foreach (Ingredient i in mealPlan.Ingredients)
            {
                IngredientModel item = new IngredientModel(i.IngredientName, i.IngredientID, i.PricePerPack, i.NumberInPack);
                IngredientList.Add(item);
            }
        }
 public FourCheesePizza()
 {
     Name        = "4 Quesos";
     ImagePath   = @"\Resources\4Cheese.jpg";
     Ingredients = new IngredientList {
         new Mozzarella(),
         new BlueCheese(),
         new Parmesano(),
         new OldCheese()
     };
 }
예제 #25
0
        public async Task <IngredientList> GetIngredientListAsync()
        {
            var ingredients = new IngredientList
            {
                Flavour  = await _ingredientsRepository.GetFlavours(),
                Frosting = await _ingredientsRepository.GetFrostings(),
                Topping  = await _ingredientsRepository.GetToppings()
            };

            return(ingredients);
        }
예제 #26
0
 public FarmerPizza()
 {
     Name        = "Granjera";
     ImagePath   = @"\Resources\FarmerPizza.jpg";
     Ingredients = new IngredientList {
         new Mozzarella(),
         new Sausage(),
         new Onion(),
         new Corn(),
         new Chicken()
     };
 }
예제 #27
0
 private void Start()
 {
     txtPedido.text = null;
     orden          = pedidosList[Random.Range(0, pedidosList.Count)];
     for (int i = 0; i < orden.ingredientList.Count; i++)
     {
         for (int j = 0; j < orden.ingredientList.Count; j++)
         {
             txtPedido.text += orden.ingredientList[j].id + '\n';
         }
         break;
     }
 }
예제 #28
0
 /// <summary>
 /// This method invokes method for selecting ingredient.
 /// </summary>
 public void AddIngredientExecute()
 {
     if (String.IsNullOrEmpty(IngredientName))
     {
         MessageBox.Show("Please fill name.", "Notification");
     }
     else
     {
         IngredientList.Add(IngredientName);
         MessageBox.Show("Ingredient has been selected.");
         IngredientName = null;
     }
 }
예제 #29
0
 public CarbonaraPizza()
 {
     Name        = "Carbonara";
     ImagePath   = @"\Resources\CarbonaraPizza.jpg";
     Ingredients = new IngredientList {
         new Bacon(),
         new Pancetta(),
         new Onion(),
         new Eggs(),
         new Mozzarella(),
         new Parmesano()
     };
 }
예제 #30
0
 public void RemoveIngredientExecute()
 {
     try
     {
         if (Ingredient != null)
         {
             IngredientList.Remove(Ingredient);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }