Beispiel #1
0
 public IEnumerable <U> GetMappedObjects(T tObj)
 {
     if (uLookup.ContainsKey(tObj.InternalIdentifier))
     {
         return(uLookup[tObj.InternalIdentifier]);
     }
     return(new List <U>());
 }
        /// <summary>
        /// Updates the properties on the represented business object
        /// </summary>
        public override void ApplyChangesToBusinessObject()
        {
            if (_businessObject == null || _comboBox.SelectedIndex == -1)
            {
                return;
            }
            var    selectedOption = GetSelectedOption();
            object newValue       = null;

            if (LookupList.ContainsKey(selectedOption))
            {
                newValue = !string.IsNullOrEmpty(selectedOption)
                               ? LookupList[selectedOption]
                               : null;
            }
            if (newValue != null)
            {
                object propertyValue = GetPropertyValue();
                if (newValue.Equals(Guid.Empty))
                {
                    if (propertyValue != null)
                    {
                        SetPropertyValue(null);
                    }
                }
                else if (propertyValue == null ||
                         !newValue.Equals(propertyValue))
                {
                    SetPropertyValue(newValue);
                }
            }
            else
            {
                SetPropertyValue(null);
            }
        }