public virtual string GetExtendedAttribute(string name)
        {
            name = name.ToLower();
            var returnValue = _extendedAttributes[name];

            if (returnValue == null && _dataItem != null)
            {
                var obj = SqlUtils.Eval(_dataItem, name);
                if (obj != null)
                {
                    if (obj is string)
                    {
                        returnValue = _extendedAttributes[name] = obj as string;
                    }
                    else
                    {
                        returnValue = _extendedAttributes[name] = obj.ToString();
                    }
                }
            }

            if (!string.IsNullOrEmpty(returnValue))
            {
                returnValue = PageUtils.UnFilterSql(returnValue);
            }

            return(returnValue ?? string.Empty);
        }
        public bool ContainsKey(string name)
        {
            var returnValue = _extendedAttributes[name];

            if (returnValue == null && _dataItem != null)
            {
                returnValue = SqlUtils.Eval(_dataItem, name);
            }

            return((returnValue == null) ? false : true);
        }
        public virtual object GetExtendedAttribute(string name)
        {
            var returnValue = _extendedAttributes[name];

            if (returnValue == null && _dataItem != null)
            {
                returnValue = SqlUtils.Eval(_dataItem, name);
            }

            return(returnValue ?? string.Empty);
        }
Beispiel #4
0
        public CountInfo(object dataItem)
        {
            if (dataItem == null)
            {
                return;
            }

            foreach (var name in AllAttributes)
            {
                var value = SqlUtils.Eval(dataItem, name);
                if (value != null)
                {
                    SetValueInternal(name, value);
                }
            }
        }
Beispiel #5
0
 protected BaseInfo(object dataItem)
 {
     if (dataItem != null)
     {
         if (AllAttributes != null)
         {
             foreach (var name in AllAttributes)
             {
                 var value = SqlUtils.Eval(dataItem, name);
                 if (value != null)
                 {
                     SetValueInternal(name, value);
                 }
             }
         }
     }
 }
Beispiel #6
0
        private static string GetValueFromContent(PageInfo pageInfo, ContextInfo contextInfo, string testTypeStr)
        {
            string theValue = null;

            if (contextInfo.ItemContainer?.ContentItem != null)
            {
                theValue = SqlUtils.Eval(contextInfo.ItemContainer.ContentItem.DataItem, testTypeStr) as string;
            }

            if (theValue == null)
            {
                if (contextInfo.ContentInfo == null)
                {
                    var tableName = NodeManager.GetTableName(pageInfo.PublishmentSystemInfo, contextInfo.ChannelId);
                    theValue = BaiRongDataProvider.ContentDao.GetValue(tableName, contextInfo.ContentId, testTypeStr);
                }
                else
                {
                    theValue = contextInfo.ContentInfo.GetExtendedAttribute(testTypeStr);
                }
            }
            return(theValue);
        }
        public bool ContainsKey(string name)
        {
            name = name.ToLower();
            var returnValue = _extendedAttributes[name];

            if (returnValue == null && _dataItem != null)
            {
                var obj = SqlUtils.Eval(_dataItem, name);
                if (obj != null)
                {
                    if (obj is string)
                    {
                        returnValue = _extendedAttributes[name] = obj as string;
                    }
                    else
                    {
                        returnValue = _extendedAttributes[name] = obj.ToString();
                    }
                }
            }

            return(returnValue != null);
        }