Exemple #1
0
        public virtual string GetPropertyValue(DynamicNode model, string propertyAlias, Func <DynamicNode, bool> func = null)
        {
            string rtnValue = "";

            if (model != null && !string.IsNullOrEmpty(propertyAlias))
            {
                //Check if this node or ancestor has it
                DynamicNode currentNode = func != null?model.AncestorOrSelf(func) : model;

                if (currentNode != null)
                {
                    rtnValue = GetPropertyValueInternal(currentNode, propertyAlias, func == null);
                }

                //Check if we found the value
                if (string.IsNullOrEmpty(rtnValue))
                {
                    //Check if we can find a master relation
                    string masterRelationNodeId = GetPropertyValueInternal(model, Constants.ProductPropertyAliases.MasterRelationPropertyAlias, true);
                    if (!string.IsNullOrEmpty(masterRelationNodeId))
                    {
                        rtnValue = GetPropertyValue(new DynamicNode(masterRelationNodeId), propertyAlias, func);
                    }
                }
            }

            return(rtnValue);
        }