示例#1
0
文件: YesNoExp.cs 项目: rinavin/RCJS
 /// <summary>
 ///   returns the value of the Yes/No/Expression
 /// </summary>
 internal bool getVal()
 {
     if (_exp != null)
     {
         return(DisplayConvertor.toBoolean(_exp.evaluate(StorageAttribute.BOOLEAN, 0)));
     }
     return(_val);
 }
示例#2
0
文件: FieldDef.cs 项目: rinavin/RCJS
        /// <summary>
        /// set the field attribute in parsing
        /// </summary>
        protected virtual bool setAttribute(string attribute, string valueStr)
        {
            bool isTagProcessed = true;

            switch (attribute)
            {
            case XMLConstants.MG_ATTR_TYPE:
                _type = (StorageAttribute)valueStr[0];
                break;

            case XMLConstants.MG_ATTR_SIZE:
                _size = XmlParser.getInt(valueStr);
                if (_size <= 0)
                {
                    Events.WriteExceptionToLog("in Field.initElements(): size must be greater than zero");
                }
                break;

            case XMLConstants.MG_ATTR_VAR_NAME:
                _varName = XmlParser.unescape(valueStr);
                break;

            case XMLConstants.MG_ATTR_VAR_DISP_NAME:
                VarDisplayName = XmlParser.unescape(valueStr);
                break;

            case XMLConstants.MG_ATTR_PICTURE:
                _picture = XmlParser.unescape(valueStr);
                break;

            case XMLConstants.MG_ATTR_VEC_CELLS_SIZE:
                _vecCellsSize = Int32.Parse(valueStr);
                break;

            case XMLConstants.MG_ATTR_VEC_CELLS_ATTR:
                _vecCellsType = (StorageAttribute)valueStr[0];
                break;

            case XMLConstants.MG_ATTR_VEC_CELLS_CONTENT:
                _vecCellsContentType = valueStr[0];
                break;

            case XMLConstants.MG_ATTR_NULLVALUE:
                if (_type == StorageAttribute.NUMERIC || _type == StorageAttribute.DATE ||
                    _type == StorageAttribute.TIME)
                {
                    //working in hex or base64
                    if (Manager.Environment.GetDebugLevel() > 1)
                    {
                        _nullValue = XmlParser.unescape(valueStr);
                    }
                    else
                    {
                        _nullValue = Base64.decodeToHex(valueStr);
                    }
                }
                else
                {
                    _nullValue = XmlParser.unescape(valueStr);
                }
                break;

            case XMLConstants.MG_ATTR_NULLDISPLAY:
                _nullDisplay = XmlParser.unescape(valueStr);
                break;

            case XMLConstants.MG_ATTR_NULLDEFAULT:
                _nullDefault = DisplayConvertor.toBoolean(valueStr);
                break;

            case XMLConstants.MG_ATTR_DB_MODIFIABLE:
                DbModifiable = DisplayConvertor.toBoolean(valueStr);
                break;

            case XMLConstants.MG_ATTR_DEFAULTVALUE:
                DefaultValue = valueStr;
                if (_type == StorageAttribute.ALPHA || _type == StorageAttribute.UNICODE)
                {
                    DefaultValue = XmlParser.unescape(valueStr);
                    DefaultValue = StrUtil.padStr(DefaultValue, _size);
                }
                else if (_type != StorageAttribute.BLOB && _type != StorageAttribute.BOOLEAN)
                //working in hex or base64
                {
                    if ((_type == StorageAttribute.BLOB_VECTOR &&
                         (_vecCellsType == StorageAttribute.NUMERIC ||
                          _vecCellsType == StorageAttribute.DATE ||
                          _vecCellsType == StorageAttribute.TIME)) ||
                        (_type == StorageAttribute.NUMERIC || _type == StorageAttribute.DATE ||
                         _type == StorageAttribute.TIME))
                    {
                        if (Manager.Environment.GetDebugLevel() < 1)
                        {
                            DefaultValue = Base64.decodeToHex(valueStr);
                        }
                    }
                }
                else if (DefaultValue.Length == 0 && _type != StorageAttribute.BLOB &&
                         _type != StorageAttribute.BLOB_VECTOR)
                {
                    DefaultValue = null;
                }
                else if (_type == StorageAttribute.BLOB)
                {
                    DefaultValue = BlobType.createFromString(DefaultValue, _contentType);
                }
                break;

            case XMLConstants.MG_ATTR_NULLALLOWED:
                NullAllowed = DisplayConvertor.toBoolean(valueStr);
                break;

            case XMLConstants.MG_ATTR_BLOB_CONTENT:
                _contentType = valueStr[0];
                break;

            case XMLConstants.MG_ATTR_PART_OF_DATAVIEW:
                _partOfDataview = DisplayConvertor.toBoolean(valueStr);
                break;

            case XMLConstants.MG_ATTR_DOTNET_TYPE:
                _dotNetType = XmlParser.unescape(valueStr);
                break;

            case XMLConstants.MG_ATTR_DOTNET_ASSEMBLY_ID:
                _assemblyId = XmlParser.getInt(valueStr);
                break;

            case XMLConstants.MG_ATTR_STORAGE:
                Storage = (FldStorage)XmlParser.getInt(valueStr);
                break;

            default:
                isTagProcessed = false;
                break;
            }

            return(isTagProcessed);
        }