ResourceTemplatePropertyNumber class

From Catglobe Wiki
Jump to: navigation, search

ResourceTemplatePropertyNumber


A numeric property on a resource template

Parent class

Inherits from ResourceTemplateProperty

Constructors

  • (string label "Set label", bool required "Set required", string description "Set description", ResourceTemplate resourceTemplate "ResourceTemplate property gets added to") - Create new numeric property

Methods

Properties


Examples

//Example for creating new properties 
number folderResourceTemplateRId = 15547989;
ResourceTemplateHelper rth = new ResourceTemplateHelper ();
FolderResourceTemplate folderRT = rth.GetTemplate(folderResourceTemplateRId); 
new ResourceTemplatePropertyNumber ("propertyNameTypeNumber",false,"description",folderRT); 
folderRT.SaveProperties();


//Example for working with existing properies 
number folderResourceTemplateRId = 15547989;
ResourceTemplateHelper rth = new ResourceTemplateHelper ();
FolderResourceTemplate folderRT = rth.GetTemplate(folderResourceTemplateRId); 
array arrayProperty = folderRT.Properties;
ResourceTemplatePropertyNumber propertyNumber = arrayProperty[0];
propertyNumber.IsDecimal=true;
propertyNumber.MaxValue=5;
propertyNumber.MaxValue=1;
folderRT.SaveProperties();


//Example for deleting a property
number folderResourceTemplateRId = 15547989;
ResourceTemplateHelper rth = new ResourceTemplateHelper ();
FolderResourceTemplate folderRT = rth.GetTemplate(folderResourceTemplateRId);
ResourceTemplatePropertyNumber propertyNumber = folderRT.Properties.First(function (object p){return p.Label=="propertyNameTypeNumber";});
propertyNumber.Delete();//if the property is in use, you can not delete and will get error message: Property in use @