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); }
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); }
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)); }
public string UniqueKey() { return(OptionSelection.GenerateUniqueKeyForSelections(Selections)); }