public void insertIngredientConsumtionData(Ingredient i)
        {
            var db  = new DatabaseAccess();
            var dbI = new DatabaseAccessIngredient();
            var dbConsumptionOuncesConsumed = new DatabaseAccessConsumptionOuncesConsumed();
            var convertWeight = new ConvertWeight();
            var convert       = new ConvertDensity();
            var myIngredientIngredientTable = dbI.queryIngredientFromIngredientsTableByName(i);
            var myConsumptionTable          = queryConsumptionTable();
            //i need to make sure i have all my information from my sql tables... that's why im getting null reference exceptions...
            var  temp = new Ingredient();
            bool alreadyContainsIngredient = new bool();

            if (myIngredientIngredientTable.classification.ToLower().Contains("egg"))
            {
                temp.name = "Egg";
                //i would prefer this to be eggs, but i am matching the ingredient_classification if the ingredient.name doesn't match for querying the ingredients table and the consumption table, and the classifications are singular...
                //i'm going to have to put a warning or something in the READ ME asking the user not to change the name of the consumption table ignredients... i'm not a big fan of that. I want there to be flexibility for what the user needs
                i.ouncesConsumed = convertWeight.EggsConsumedFromIngredientMeasurement(myIngredientIngredientTable.measurement);
            }
            else
            {
                i.ouncesConsumed = dbConsumptionOuncesConsumed.CalculateOuncesConsumedFromMeasurement(i);
            }
            foreach (var ingredient in myConsumptionTable)
            {
                if (ingredient.name.ToLower() == i.name.ToLower() && (ingredient.name.ToLower().Contains(i.classification.ToLower()) && i.classification != " ") ||
                    ingredient.name == temp.name)
                {
                    //if the name is the same && the classification is the same || the ingredient.name is the temp.name, noting the eggs already being present
                    alreadyContainsIngredient = true;
                    break;
                }
            }
            if (string.IsNullOrEmpty(temp.name))
            {
                temp.name = i.name;
            }
            if (alreadyContainsIngredient == false)
            {
                var commandText = @"Insert into consumption (name, density, ounces_consumed, ounces_remaining, measurement) values (@name, @density, @ounces_consumed, @ounces_remaining, @measurement);";
                db.executeVoidQuery(commandText, cmd => {
                    cmd.Parameters.AddWithValue("@name", temp.name);
                    cmd.Parameters.AddWithValue("@density", i.density);
                    cmd.Parameters.AddWithValue("@ounces_consumed", i.ouncesConsumed);
                    cmd.Parameters.AddWithValue("@ounces_remaining", i.ouncesRemaining);
                    cmd.Parameters.AddWithValue("@measurement", i.measurement);
                    return(cmd);
                });
                updateConsumptionTable(i);
            }
            else
            {
                updateConsumptionTable(i);
            }
            var myUpdatedIngredient = queryConsumptionTable();
            var myConsumptionOuncesConsumedTable = dbConsumptionOuncesConsumed.queryConsumptionOuncesConsumed();
        }
        public void updateConsumptionTable(Ingredient i)
        {
            var db  = new DatabaseAccess();
            var dbI = new DatabaseAccessIngredient();
            var dbConsumptionOuncesConsumed = new DatabaseAccessConsumptionOuncesConsumed();
            var convert      = new ConvertWeight();
            var dbD          = new DatabaseAccessDensities();
            var myIngredient = dbI.queryIngredientFromIngredientsTableByName(i);
            var myConsumptionTableIngredient = queryConsumptionTableRowByName(i);
            var myDensityTableIngredient     = dbD.queryIngredientFromDensityTableByName(i);
            //var myDensityTableIngredient = dbD.queryIngredientFromDensityTableByName(i);
            var temp = new Ingredient();

            //this handles egg classifications, calculates ounces consumed and ounces remaining
            if (myIngredient.classification.ToLower().Contains("egg"))
            {
                var currentOuncesConsumed = convert.EggsConsumedFromIngredientMeasurement(i.measurement);
                if (myConsumptionTableIngredient.ouncesConsumed != currentOuncesConsumed)
                {
                    i.ouncesConsumed = convert.EggsConsumedFromIngredientMeasurement(i.measurement);
                }
                if (myConsumptionTableIngredient.ouncesRemaining == 0m)
                {
                    i.ouncesRemaining = i.sellingWeightInOunces - i.ouncesConsumed;
                }
                else
                {
                    i.ouncesRemaining = myConsumptionTableIngredient.ouncesRemaining - i.ouncesConsumed;
                }
            }
            //this handles other ingredients; eggs have to be calculated by usage of egg, not by an actual measurement
            else
            {
                //if (i.ouncesConsumed == 0m)
                myConsumptionTableIngredient.ouncesConsumed = dbConsumptionOuncesConsumed.CalculateOuncesConsumedFromMeasurement(i);
                i.ouncesConsumed = myConsumptionTableIngredient.ouncesConsumed;
                if (myConsumptionTableIngredient.ouncesRemaining == 0m)
                {
                    myConsumptionTableIngredient.ouncesRemaining = myDensityTableIngredient.sellingWeightInOunces - myConsumptionTableIngredient.ouncesConsumed;
                }
                else
                {
                    myConsumptionTableIngredient.ouncesRemaining = myConsumptionTableIngredient.ouncesRemaining - myConsumptionTableIngredient.ouncesConsumed;
                }
                i.ouncesRemaining = myConsumptionTableIngredient.ouncesRemaining;
            }
            //if (string.IsNullOrEmpty(temp.name) && !(i.classification.ToLower().Contains("egg")))
            if (i.classification.ToLower().Contains("egg"))
            {
                temp.name = "Egg";
            }
            if (string.IsNullOrEmpty(temp.name))
            {
                temp.name = i.name;
            }
            //temp.name = i.name;
            //subtractOuncesRemainingIfExpirationDateIsPast(i);
            // this needs to be fixed, maybe for hte moment having a condition for ig it is eggs or dairy... flour and sugar, etc. should be totally fine
            var commandText = "update consumption set ounces_consumed=@ounces_consumed, ounces_remaining=@ounces_remaining, refill=@refill where name=@name;";

            db.executeVoidQuery(commandText, cmd => {
                cmd.Parameters.AddWithValue("@name", temp.name);
                cmd.Parameters.AddWithValue("@ounces_consumed", i.ouncesConsumed);
                cmd.Parameters.AddWithValue("@ounces_remaining", i.ouncesRemaining);
                cmd.Parameters.AddWithValue("@refill", i.restock);
                return(cmd);
            });
            doesIngredientNeedRestocking(i);
            //this is after the consumption insertion and update... so it should work fine...
            var myUpdatedIngredient = queryConsumptionTableRowByName(i);

            dbConsumptionOuncesConsumed.insertIngredientIntoConsumptionOuncesConsumed(i);
            //still not getting the ouncesRemaining... need to change this
            var consumptionOuncesConsumed = dbConsumptionOuncesConsumed.queryConsumptionOuncesConsumed();
            var myUpdatedIngredient2      = queryConsumptionTableRowByName(i);
            //why am i not inserting this into the database?
            var myUpdatedConsumptionOuncesConsumedTable = dbConsumptionOuncesConsumed.queryConsumptionOuncesConsumed();
        }