public List <ItemResponse> GetListItemResponses(Ingredient i)
        {
            var db                    = new DatabaseAccessRecipe();
            var convert               = new ConvertWeight();
            var items                 = MakeRequest <SearchResponse>(buildSearchRequest(i)).Items;
            var sellingWeightOunces   = convert.ConvertWeightToOunces(i.sellingWeight);
            var myListOfItemResponses = new List <ItemResponse>();

            foreach (var item in items)
            {
                if (!item.name.Contains('('))
                {
                    if ((!item.name.ToLower().Contains("pack of")) || (!item.name.ToLower().Contains(("pk"))))
                    {
                        if ((parseItemResponseName(item).Count() != 0) && (CompareWeightInOuncesFromItemResponseToIngredientSellingWeight(item, i) && (CompareItemResponseNameAndIngredientName(item, i))))
                        {
                            myListOfItemResponses.Add(item);
                        }
                    }
                }
            }
            return(myListOfItemResponses);
            //i would like to be able to return all brands that fit a certain selling weight, and give all of them as an option, and give the best price?
            //i think a good idea would be to have the item id associated with the ingredient in the ingredient database or the cost database, that way you can get the exact same item
        }
        public void TestConvertImproperWeight()
        {
            var convert  = new ConvertWeight();
            var expected = 0m;
            var actual   = convert.ConvertWeightToOunces("5-6");

            Assert.AreEqual(expected, actual);
        }
        public void TestConvertWeightToOunces17()
        {
            var convert  = new ConvertWeight();
            var expected = .33m;
            var actual   = convert.ConvertWeightToOunces("1/3 ounces");

            Assert.AreEqual(expected, actual);
        }
        public void TestConvertWeightToOunces16()
        {
            var convert  = new ConvertWeight();
            var expected = 13.12m;
            var actual   = convert.ConvertWeightToOunces("13 1/8 ounces");

            Assert.AreEqual(expected, actual);
        }
        public void TestConvertWeightToOunces12()
        {
            var convert  = new ConvertWeight();
            var expected = 2.26m;
            var actual   = convert.ConvertWeightToOunces("64 grams");

            Assert.AreEqual(expected, actual);
        }
        public void TestConvertWeightToOunces11()
        {
            var convert  = new ConvertWeight();
            var expected = 1m;
            var actual   = convert.ConvertWeightToOunces("28.35 gram");

            Assert.AreEqual(expected, actual);
        }
        public void TestConvertWeightToOunces10()
        {
            var convert  = new ConvertWeight();
            var expected = 377.60m;;
            var actual   = convert.ConvertWeightToOunces("2.95 gallons");

            Assert.AreEqual(expected, actual);
        }
        public void TestConvertWeightToOunces9()
        {
            var convert  = new ConvertWeight();
            var expected = 128m;
            var actual   = convert.ConvertWeightToOunces("1 gallon");

            Assert.AreEqual(expected, actual);
        }
        public void TestConvertWeightToOunces8()
        {
            var convert  = new ConvertWeight();
            var expected = 24m;
            var actual   = convert.ConvertWeightToOunces("3 cups");

            Assert.AreEqual(expected, actual);
        }
        public void TestConvertWeightToOunces6()
        {
            var convert  = new ConvertWeight();
            var expected = 58.67m;
            var actual   = convert.ConvertWeightToOunces("3 2/3 pint");

            Assert.AreEqual(expected, actual);
        }
        public void TestConvertWeightToOunces5()
        {
            var convert  = new ConvertWeight();
            var expected = 16m;
            var actual   = convert.ConvertWeightToOunces("1 lb");

            Assert.AreEqual(expected, actual);
        }
        public void TestConvertWeightToOunces4()
        {
            var convert  = new ConvertWeight();
            var expected = 108m;
            var actual   = convert.ConvertWeightToOunces("6.75 pint");

            Assert.AreEqual(expected, actual);
        }
        public void TestConvertWeightToOunces2()
        {
            var convert  = new ConvertWeight();
            var expected = 32m;
            var actual   = convert.ConvertWeightToOunces("1/4 gallon milk");

            Assert.AreEqual(expected, actual);
        }
        public bool CompareWeightInOuncesFromItemResponseToIngredientSellingWeight(ItemResponse response, Ingredient i)
        {
            var convert             = new ConvertWeight();
            var productNameArray    = parseItemResponseName(response);
            var productWeight       = productNameArray[1];
            var productWeightOunces = convert.ConvertWeightToOunces(productWeight);

            //this product weight in ounces is incorrect...
            if (convert.ConvertWeightToOunces(i.sellingWeight) == productWeightOunces)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public ItemResponse GetItemResponse(Ingredient i)
        {
            var db               = new DatabaseAccessRecipe();
            var convert          = new ConvertWeight();
            var newItemResponse  = new ItemResponse();
            var tempItemResponse = new ItemResponse();

            try {
                if (string.IsNullOrEmpty(i.classification) || (i.classification == " ") || !(i.classification.ToLower().Contains("dairy")) || !(i.classification.ToLower().Contains("egg")))
                {
                    if ((MakeRequest <SearchResponse>(buildSearchRequest(i)).Items.Count() == 0))
                    {
                        return(newItemResponse);//ok, selling weight is not being transfered
                    }
                    var items = MakeRequest <SearchResponse>(buildSearchRequest(i)).Items;
                    var sellingWeightOunces = convert.ConvertWeightToOunces(i.sellingWeight);
                    foreach (var item in items)
                    {
                        if (!item.name.Contains('('))
                        {
                            if ((!item.name.ToLower().Contains("pack of")) || (!item.name.ToLower().Contains(("pk"))))
                            {
                                if ((parseItemResponseName(item).Count() != 0) && (CompareWeightInOuncesFromItemResponseToIngredientSellingWeight(item, i) && (CompareItemResponseNameAndIngredientName(item, i))))
                                {
                                    tempItemResponse = item;
                                    break;
                                }
                            }
                        }
                    }
                }
                else
                {
                    if ((i.classification.ToLower().Contains("dairy")) || i.classification.ToLower().Contains("eggs"))
                    {
                        return(newItemResponse);
                    }
                }
            } catch {
                return(newItemResponse);
            }
            return(tempItemResponse);
            //i would like to be able to return all brands that fit a certain selling weight, and give all of them as an option, and give the best price?
        }