Beispiel #1
0
        //i need to rewrite the query to call a different () to get all the information for all the ingredients... i'm not getting an ing.id, densities...
        //only the name and the measurement

        public void UpdateRecipeYield(Recipe r)
        {
            var db          = new DatabaseAccess();
            var dbDensities = new DatabaseAccessDensityInformation();
            var convert     = new ConvertMeasurement();
            var myRecipeBox = MyRecipeBox();

            foreach (var recipe in myRecipeBox)
            {
                var myIngredients  = db.queryAllTablesForAllIngredients(recipe.ingredients);
                var tempIngredient = new Ingredient();
                if (recipe.id == r.id)
                {
                    foreach (var ingredient in recipe.ingredients)
                    {
                        tempIngredient = ingredient;
                        if (tempIngredient.density == 0)
                        {
                            tempIngredient.density = dbDensities.queryDensityTableRowDensityValueByName(ingredient);
                        }
                        tempIngredient.measurement    = convert.AdjustIngredientMeasurement(ingredient.measurement, recipe.yield, r.yield);
                        tempIngredient.ouncesConsumed = ingredient.ouncesConsumed * (HomeController.currentRecipe.yield / r.yield);
                        db.updateAllTables(tempIngredient, r);
                        var myUpdatedIngredient = db.queryAllRelevantTablesSQLByIngredientName(tempIngredient);
                    }
                    recipe.yield = r.yield;
                    GetFullRecipePrice(recipe);
                    var myUpdatedIngredients = db.queryAllTablesForAllIngredients(recipe.ingredients);
                }
            }
        }