/// <summary> /// Values the maximum index of the dictionary match in hierarchy. /// </summary> /// <param name="values">The values.</param> /// <param name="array">The array.</param> /// <param name="index">The index.</param> /// <returns></returns> public int ValueDictionaryMatchInHierarchyMaxIndex(Dictionary <string, string> values, List <UPSEListingFieldMatch> array, int index) { int maxIndex = index; if (maxIndex > array.Count || maxIndex == 0) { maxIndex = array.Count; } for (int i = 0; i < maxIndex; i++) { UPSEListingFieldMatch item = array[i]; UPSEListingFieldMatchResult result = item.ListingMatchesValues(this, values); if (result == UPSEListingFieldMatchResult.Yes) { return(item.Index); } if (result == UPSEListingFieldMatchResult.No) { return(-1); } } return(-1); }
/// <summary> /// Listings the matches values. /// </summary> /// <param name="listing">The listing.</param> /// <param name="values">The values.</param> /// <returns></returns> public UPSEListingFieldMatchResult ListingMatchesValues(UPSEListing listing, Dictionary <string, string> values) { UPSEListingFieldMatchResult result = UPSEListingFieldMatchResult.Yes; foreach (string functionName in this.FunctionNames) { string value = values.ValueOrDefault(functionName); string listingValue = listing.ValueDictionary.ValueOrDefault(functionName) as string; if (string.IsNullOrEmpty(value) || value == "0" || string.IsNullOrEmpty(listingValue) || listingValue == "0") { result = UPSEListingFieldMatchResult.Open; } else if (value != listingValue) { return(UPSEListingFieldMatchResult.No); } } return(result); }