/// <summary> /// Utility method. If already have a MappingLovEFElement just return it. If not /// then lookup the MappingLovEFElement using the string and ListOfValuesType. /// This latter situation means that a user has used the keyboard to select /// a value from a drop-down which has come through to here as text. /// </summary> internal MappingLovEFElement GetLovElementFromLovElementOrString( MappingLovEFElement lovElement, string lovDisplayName, ListOfValuesCollection lovType) { if (lovElement != null) { return(lovElement); } return(FindMappingLovElement(lovDisplayName, lovType)); }
// <summary> // Looks for an LOV Element in this item's list of values. // </summary> // <param name="lovDisplayName">What to look for</param> // <param name="lovType">Which LOV collection to search</param> // <returns>If none are found it will return a null item.</returns> internal MappingLovEFElement FindMappingLovElement(string lovDisplayName, ListOfValuesCollection lovType) { MappingLovEFElement mappingLovElement = null; Debug.Assert(lovDisplayName != null, "Null lovDisplayName in FindMappingLovElement()"); if (lovDisplayName != null) { var lov = GetListOfValues(lovType); foreach (var entry in lov) { if (lovDisplayName == entry.Value) { mappingLovElement = entry.Key; break; } } Debug.Assert( mappingLovElement != null, "Could not find MappingLovElement for lovDisplayName " + lovDisplayName + ", lovType " + lovType.ToString()); } return mappingLovElement; }
// <summary> // Utility method. If already have a MappingLovEFElement just return it. If not // then lookup the MappingLovEFElement using the string and ListOfValuesType. // This latter situation means that a user has used the keyboard to select // a value from a drop-down which has come through to here as text. // </summary> internal MappingLovEFElement GetLovElementFromLovElementOrString( MappingLovEFElement lovElement, string lovDisplayName, ListOfValuesCollection lovType) { if (lovElement != null) { return lovElement; } return FindMappingLovElement(lovDisplayName, lovType); }