public void updateAllTables(Ingredient i, Recipe r)
        {
            var dbRecipes     = new DatabaseAccessRecipe();
            var dbIngredients = new DatabaseAccessIngredient();
            var dbConsumptionOuncesConsumed = new DatabaseAccessConsumptionOuncesConsumed();
            var dbConsumption        = new DatabaseAccessConsumption();
            var dbDensities          = new DatabaseAccessDensities();
            var dbDensityInformation = new DatabaseAccessDensityInformation();
            var dbCosts     = new DatabaseAccessCosts();
            var myCostTable = dbCosts.queryCostTable();

            foreach (var ingredient in myCostTable)
            {
                if (ingredient.ingredientId == i.ingredientId)
                {
                    if (ingredient.sellingPrice == 0m && i.sellingPrice != 0m)
                    {
                        dbCosts.updateCostDataTable(i);
                        break;
                    }
                }
            }
            dbRecipes.UpdateRecipe(r);
            dbIngredients.UpdateIngredient(i);
            var updatedIngredient = queryAllRelevantTablesSQLByIngredientName(i);

            dbDensityInformation.updateDensityInfoTable(i);
            dbDensities.updateDensityTable(i);
            dbCosts.updateCostDataTable(i);
        }
        public void insertIngredientIntoAllTables(Ingredient i, Recipe r)
        {
            var dbRecipes     = new DatabaseAccessRecipe();
            var dbIngredients = new DatabaseAccessIngredient();
            var dbConsumptionOuncesConsumed = new DatabaseAccessConsumptionOuncesConsumed();
            var dbConsumption          = new DatabaseAccessConsumption();
            var dbDensities            = new DatabaseAccessDensities();
            var dbDensitiesInformation = new DatabaseAccessDensityInformation();
            var dbCosts   = new DatabaseAccessCosts();
            var myRecipes = dbRecipes.queryRecipes();
            //var myIngredientBox = dbIngredients.queryAllIngredientsFromIngredientTable();
            var myIngredients = queryAllRelevantTablesSQLByIngredientName(i);
            var myRecipe      = dbRecipes.queryRecipeFromRecipesTableByName(r);

            if (string.IsNullOrEmpty(myRecipe.name))
            {
                dbRecipes.InsertRecipe(r);
            }
            dbIngredients.insertIngredient(i, r);
            var myIng = queryAllRelevantTablesSQLByIngredientName(i);

            dbDensitiesInformation.insertIngredientIntoDensityInfoDatabase(i);
            dbDensities.insertIngredientDensityData(i);
            dbConsumption.insertIngredientConsumtionData(i);
            var myIngUpdated = queryAllRelevantTablesSQLByIngredientName(i);

            dbCosts.insertIngredientCostDataCostTable(i);
            var myConsumptionIngredient = dbConsumption.queryConsumptionTableRowByName(i);

            dbIngredients.UpdateIngredient(i);
            var myUpdatedIngredient = queryAllRelevantTablesSQLByIngredientName(i);
        }
        public void insertListOfIngredientsIntoAllTables(List <Ingredient> ListOfIngredients, Recipe r)
        {
            var dbR = new DatabaseAccessRecipe();

            foreach (var ingredient in ListOfIngredients)
            {
                insertIngredientIntoAllTables(ingredient, r);
            }
            dbR.UpdateRecipe(r);
            var myIngredientsSecond = queryAllTablesForAllIngredients(ListOfIngredients);
        }