Ejemplo n.º 1
0
        public bool ContainsVariantSelection(OptionSelection selection)
        {
            // look through a list of options to see if it contains a valid option
            // for the given selection data

            bool result = false;

            foreach (Option o in this.VariantsOnly())
            {
                if (o.Bvin.Replace("-", "") == selection.OptionBvin.Replace("-", ""))
                {
                    if (o.ItemsContains(selection.SelectionData))
                    {
                        return(true);
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 2
0
        public List <string> SelectionNames(List <Option> options)
        {
            List <string> result = new List <string>();

            foreach (Option opt in options)
            {
                OptionSelection sel = Selections.FindByOptionId(opt.Bvin);
                if (sel != null)
                {
                    string itemBvin = sel.SelectionData;
                    foreach (OptionItem oi in opt.Items)
                    {
                        string cleaned = OptionSelection.CleanBvin(oi.Bvin);
                        if (cleaned == itemBvin)
                        {
                            result.Add(oi.Name);
                            break;
                        }
                    }
                }
            }

            return(result);
        }
Ejemplo n.º 3
0
        public Variant FindBySelectionData(OptionSelectionList selections, OptionList options)
        {
            OptionSelectionList variantSelections = new OptionSelectionList();

            foreach (Option opt in options)
            {
                if (opt.IsVariant)
                {
                    OptionSelection sel = selections.FindByOptionId(opt.Bvin);
                    if (sel != null)
                    {
                        variantSelections.Add(sel);
                    }
                    else
                    {
                        return(null);
                    }
                }
            }

            string selectionKey = OptionSelection.GenerateUniqueKeyForSelections(variantSelections);

            return(this.FindByKey(selectionKey));
        }
Ejemplo n.º 4
0
 public string UniqueKey()
 {
     return(OptionSelection.GenerateUniqueKeyForSelections(Selections));
 }