ToBoolean() static private method

static private ToBoolean ( object value ) : bool
value object
return bool
Example #1
0
 private void BuildPropertyTypeAssignments(DataTable table)
 {
     foreach (DataRow row in table.Rows)
     {
         int          propertyTypeId = TypeConverter.ToInt32(row["PropertyTypeId"]);
         int          propertySetId  = TypeConverter.ToInt32(row["PropertySetID"]);
         bool         isDeclared     = TypeConverter.ToBoolean(row["IsDeclared"]);
         PropertyType propertyType   = _propertyTypes.GetItemById(propertyTypeId);
         if (propertyType == null)
         {
             throw new InvalidSchemaException(String.Concat(SR.Exceptions.Schema.Msg_PropertyTypeDoesNotExist, ": id=", propertyTypeId));
         }
         PropertySet propertySet = null;
         if (propertyType.IsContentListProperty)
         {
             propertySet = _contentListTypes.GetItemById(propertySetId);
         }
         else
         {
             propertySet = _nodeTypes.GetItemById(propertySetId);
         }
         if (isDeclared)
         {
             AddPropertyTypeToPropertySet(propertyType, propertySet);
         }
     }
 }
Example #2
0
        private void BuildPropertyTypes(DataTable table, Dictionary <int, DataType> dataTypes)
        {
            foreach (DataRow row in table.Rows)
            {
                int      id       = TypeConverter.ToInt32(row["PropertyTypeID"]);
                string   name     = TypeConverter.ToString(row["Name"]);
                DataType dataType = dataTypes[TypeConverter.ToInt32(row["DataTypeID"])];
                int      mapping  = TypeConverter.ToInt32(row["Mapping"]);
                bool     isContentListProperty = TypeConverter.ToBoolean(row["IsContentListProperty"]);

                CreatePropertyType(id, name, dataType, mapping, isContentListProperty);
            }
        }
Example #3
0
        private void BuildPropertyTypeAssignments(DataTable table)
        {
            foreach (DataRow row in table.Rows)
            {
                int          propertyTypeId = TypeConverter.ToInt32(row["PropertyTypeId"]);
                int          propertySetId  = TypeConverter.ToInt32(row["PropertySetID"]);
                bool         isDeclared     = TypeConverter.ToBoolean(row["IsDeclared"]);
                PropertyType propertyType   = _propertyTypes.GetItemById(propertyTypeId);
                if (propertyType == null)
                {
                    throw new InvalidSchemaException(String.Concat(SR.Exceptions.Schema.Msg_PropertyTypeDoesNotExist, ": id=", propertyTypeId));
                }
                PropertySet propertySet = null;
                if (propertyType.IsContentListProperty)
                {
                    propertySet = _contentListTypes.GetItemById(propertySetId);
                }
                else
                {
                    propertySet = _nodeTypes.GetItemById(propertySetId);
                }

                try
                {
                    if (isDeclared)
                    {
                        AddPropertyTypeToPropertySet(propertyType, propertySet);
                    }
                }
                catch (ArgumentNullException ex)
                {
                    SnLog.WriteWarning("Unknown property set: " + propertySetId, properties: new Dictionary <string, object>
                    {
                        { "PropertyTypeId", propertyType.Id },
                        { "Content list types: ", string.Join(", ", _contentListTypes.Select(cl => cl.Id)) },
                        { "Node types: ", string.Join(", ", _nodeTypes.Select(nt => string.Format("{0} ({1})", nt.Name, nt.Id))) },
                    });

                    throw new InvalidSchemaException("Unknown property set: " + propertySetId, ex);
                }
            }
        }