Example #1
0
        public object GetItemValue(DatastoreItem dsItem, string dsPropName, string publicPropName)
        {
            object value;

            if (!CompositeRegistry.GetValueFromComposite(dsItem, dsPropName, publicPropName, out value))
            {
                value = GetBackingValue(dsItem, dsPropName);
            }

            return(value);
        }
Example #2
0
        //------------------------------------------------------------------------------------
        /// <summary>
        /// For the given StoreItem, set the current value of the specified property directly
        /// into the backing store.  If isOpen is true, the item will be assumed to already
        /// be open for edit, and won't be opened again.
        /// </summary>
        //------------------------------------------------------------------------------------
        public void SetItemBackingValue(StoreItem item, string dsPropName, string publicPropName, object value, IsOpenedForEdit isOpen = IsOpenedForEdit.No)
        {
            DatastoreItem dsItem = item.DSItem;

            if (dsItem != null)
            {
                if (isOpen == IsOpenedForEdit.No && item.ID != 0)
                {
                    OpenForEdit(item.DSItem);
                }

                Field field = dsItem.Fields[dsPropName];
                if (!field.IsReadOnly)
                {
                    object finalValue;
                    if (!CompositeRegistry.GetCompositeFromValue(dsItem, dsPropName, publicPropName, value, out finalValue))
                    {
                        finalValue = value;
                    }

                    field.Value = finalValue;
                }
            }
        }