public bool IsOptionSelected(ActiveProductAttribute apo, IAttributeOption ao, IActiveProductAttribute a) {

            if (apo.Name == a.Name && apo.AttributeOptionList.Count > 0) {
                foreach (AttributeOption lee in apo.AttributeOptionList) {
                    if (lee.ShortCode == ao.ShortCode) {
                        return true;
                    }
                }
            }

            return false;
        }
        public List<IActiveProductAttribute> GetProductAttributes(IProduct ep) {

            List<IActiveProductAttribute> attributeList = new List<IActiveProductAttribute>();
            IActiveProductAttribute active = null;
            int lastAttributeID = 0;

            //Replaced with a stored procedure to make it far, far quicker
            using (SpHandler sph = new SpHandler("getProductAttributes", new SqlParameter("@productID", ep.ProductID))) {

                sph.ExecuteReader();

                while (sph.DataReader.Read()) {

                    int attributeID = Convert.ToInt32(sph.DataReader["attributeID"]);

                    //Create a new attribute as it is found. Relies on values returned grouped by attributeid
                    if (attributeID != lastAttributeID) {

                        active = new ActiveProductAttribute();
                        active.DataType = Convert.ToString(sph.DataReader["type"]);
                        active.BaseUnit = Convert.ToString(sph.DataReader["baseUnit"]);
                        active.Name = Convert.ToString(sph.DataReader["attributeDescription"]);

                        lastAttributeID = attributeID;
                    }

                    if (active != null) {

                        //Add options to the current attribute
                        IAttributeOption option = new AttributeOption();

                        option.PickListValue = Convert.ToString(sph.DataReader["optionName"]);
                        option.ShortCode = Convert.ToString(sph.DataReader["optionID"]);
                        option.Url = Convert.ToString(sph.DataReader["optionData"]);
                        option.Price = Convert.ToDecimal(sph.DataReader["optionPrice"]);

                        active.AttributeOptionList.Add(option);
                    }
                }
            }

            return attributeList;
        }
        public decimal UpdateOptionPrice(ActiveProductAttribute apo, IAttributeOption ao, IActiveProductAttribute a) {

            if (apo.Name == a.Name && apo.AttributeOptionList.Count > 0) {
                foreach (AttributeOption lee in apo.AttributeOptionList) {
                    if (lee.ShortCode == ao.ShortCode) {
                        ao.Price = lee.Price;
                    }
                }
            }

            return ao.Price;
        }