Example #1
0
        public static bool IsValueEnum(ConstructItem constructItem, object value, out string errorMsg)
        {
            bool isValid = true;

            errorMsg = "";

            string valueType = (string)value;

            if (string.IsNullOrEmpty(valueType))
            {//空值直接返回
                return(true);
            }

            EnumInfo enumInfo = EnumManager.Instance.GetEnum(constructItem.ItemType2[0].Name);

            if (enumInfo == null)
            {
                errorMsg = "枚举无效";
                return(false);
            }

            EnumItem enumItem = enumInfo.GetEnumItemByValue(valueType);

            if (enumItem == null)
            {
                errorMsg = "枚举值无效";
                return(false);
            }

            return(isValid);
        }
Example #2
0
        private void SetDisaplyInfo()
        {
            if (_DisplayInfo != null)
            {
                return;
            }

            if (_ItemConstruct.ItemType2.Count == 0)
            {
                return;
            }

            if (string.IsNullOrEmpty(_Value))
            {
                return;
            }

            if (_ItemConstruct.ItemType1 == ConstructConfig.CONSTRUCT_ITEM_TYPE_ENUM)
            {
                EnumInfo enumInfo = EnumManager.Instance.GetEnum(_ItemConstruct.ItemType2[0].Name) as EnumInfo;
                if (enumInfo == null)
                {
                    return;
                }

                _DisplayInfo = enumInfo.GetEnumItemByValue(_Value) as ITableDisplay;
            }
            else if (_ItemConstruct.ItemType1 == ConstructConfig.CONSTRUCT_ITEM_TYPE_TABLE_ID)
            {
            }
        }