Difference between revisions of "FolderResourceTemplate class"
Nguyenduyan (talk | contribs) (Created page with "{{CGscriptClass_Template |Name=FolderResourceTemplate |Description=A Folder resource template. |Constructors= {{CGscriptConstructors_Template|Parameters= {{CGscriptParameters_...") |
|||
Line 1: | Line 1: | ||
{{CGscriptClass_Template | {{CGscriptClass_Template | ||
− | |Name=FolderResourceTemplate | + | |Name=<nowiki>FolderResourceTemplate</nowiki> |
− | |Description=A Folder resource template. | + | |Description=<nowiki>A Folder resource template.</nowiki> |
|Constructors= | |Constructors= | ||
{{CGscriptConstructors_Template|Parameters= | {{CGscriptConstructors_Template|Parameters= | ||
− | {{CGscriptParameters_Template|Type=string|Name=name|Description=Resource name}} | + | {{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Resource name</nowiki>}} |
− | |Description=Create a new Folder resource template}} | + | |Description=<nowiki>Create a new Folder resource template</nowiki>}} |
|Methods= | |Methods= | ||
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=DefaultLanguage|Parameters= | + | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>DefaultLanguage</nowiki>|Parameters= |
− | {{CGscriptParameters_Template|Type=string|Name=isocode|Description=Iso code to set as default}} | + | {{CGscriptParameters_Template|Type=string|Name=<nowiki>isocode</nowiki>|Description=<nowiki>Iso code to set as default</nowiki>}} |
− | |Description=Which Localized Name is the default}} | + | |Description=<nowiki>Which Localized Name is the default</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=Save|Description=Save the ResourceTemplate resource}} | + | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Save</nowiki>|Description=<nowiki>Save the ResourceTemplate resource</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=SaveProperties|Description=Save the properties of the ResourceTemplate resource. Ignores changes to all constant options in use}} | + | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>SaveProperties</nowiki>|Description=<nowiki>Save the properties of the ResourceTemplate resource. Ignores changes to all constant options in use</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}} | + | {{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}} |
|Properties= | |Properties= | ||
− | {{CGscriptProperties_Template|ReturnType=Dictionary|Name=LocalizedNames|HasGetter=1|HasSetter=1|Description=Localized Name of the ResourceTemplate resource}} | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>LocalizedName</nowiki>|HasGetter=1|Description=<nowiki>Localized Name for current user of the ResourceTemplate resource</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}} | + | {{CGscriptProperties_Template|ReturnType=Dictionary|Name=<nowiki>LocalizedNames</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Localized Name of the ResourceTemplate resource</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=array|Name=Properties|HasGetter=1|Description=Get the list of current properties. Use AddProperty/RemoveProperty to edit order}} | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=int|Name=ResourceId|HasGetter=1|Description=The Id of the ResourceTemplate}} | + | {{CGscriptProperties_Template|ReturnType=array|Name=<nowiki>Properties</nowiki>|HasGetter=1|Description=<nowiki>Get the list of current properties. Use AddProperty/RemoveProperty to edit order</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=string|Name=ResourceName|HasGetter=1|Description=Name of the ResourceTemplate resource}} | + | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>ResourceId</nowiki>|HasGetter=1|Description=<nowiki>The Id of the ResourceTemplate</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=ResourceTimeregEnabled|HasGetter=1|HasSetter=1|Description=Get/set ResourceTimeregEnabled}} | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ResourceName</nowiki>|HasGetter=1|Description=<nowiki>Name of the ResourceTemplate resource</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}} | + | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>ResourceTemplateType</nowiki>|HasGetter=1|Description=<nowiki>The type of resource that this ResourceTemplate covers</nowiki>}} |
+ | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>ResourceTimeregEnabled</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set ResourceTimeregEnabled</nowiki>}} | ||
+ | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}} | ||
}} | }} | ||
+ | |||
=== <span style="color:#DF8621">'''Examples'''</span> === | === <span style="color:#DF8621">'''Examples'''</span> === |
Revision as of 03:37, 28 February 2019
FolderResourceTemplate
A Folder resource template.
Constructors
- (string name "Resource name") - Create a new Folder resource template
Methods
- Empty DefaultLanguage(string isocode "Iso code to set as default") - Which Localized Name is the default
- Empty Save() - Save the ResourceTemplate resource
- Empty SaveProperties() - Save the properties of the ResourceTemplate resource. Ignores changes to all constant options in use
- string ToString() - The string representation of the object.
Properties
- string LocalizedName { get; } - Localized Name for current user of the ResourceTemplate resource
- Dictionary LocalizedNames { get; set; } - Localized Name of the ResourceTemplate resource
- string ObjectTypeName { get; } - The name of the type of object.
- array Properties { get; } - Get the list of current properties. Use AddProperty/RemoveProperty to edit order
- int ResourceId { get; } - The Id of the ResourceTemplate
- string ResourceName { get; } - Name of the ResourceTemplate resource
- int ResourceTemplateType { get; } - The type of resource that this ResourceTemplate covers
- bool ResourceTimeregEnabled { get; set; } - Get/set ResourceTimeregEnabled
- TypeInformation TypeInformation { get; } - Get information about this class.
Examples
//Example for creating a new FolderResourceTemplate
FolderResourceTemplate folderRT = new FolderResourceTemplate("folderRT name");
folderRT.LocalizedNames={"da-DK":" name in DK", "en-US":" name in US"};
folderRT.DefaultLanguage("da-DK");
folderRT.Save();
//Example for working with an existing FolderResourceTemplate
number folderResourceTemplateRId = 15547989;
ResourceTemplateHelper rth = new ResourceTemplateHelper ();
FolderResourceTemplate folderRT = rth.GetTemplate(folderResourceTemplateRId);
folderRT.ResourceTimeregEnabled=false;
folderRT.Save();
print(folderRT.ResourceName);//folderRT name
print(folderRT.ResourceId);//15547989
//Example for creating new properties
number folderResourceTemplateRId = 15547989;
ResourceTemplateHelper rth = new ResourceTemplateHelper ();
FolderResourceTemplate folderRT = rth.GetTemplate(folderResourceTemplateRId);
new ResourceTemplatePropertyNumber ("propertyNameTypeNumber",false,"description",folderRT);
new ResourceTemplatePropertyBoolean ("propertyNameTypeBoolean",true,"description",folderRT);
new ResourceTemplatePropertyString ("propertyNameTypeString",false,"description",folderRT);
new ResourceTemplatePropertyDateTime ("propertyNameTypeDateTime",false,"description",folderRT);
new ResourceTemplatePropertySingle ("propertyNameTypeSingle",true,"description",folderRT);
new ResourceTemplatePropertyMulti ("propertyNameTypeMulti",false,"description",folderRT);
ResourceTemplatePropertyResource propertyResource = new ResourceTemplatePropertyResource ("propertyNameTypeResource", false, "", folderRT);
propertyResource.AddAllowedResourceType(Resource_Type_Folder,{2071,15504791});
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;
ResourceTemplatePropertyString propertyString = folderRT.Properties.First(function (object p){return p.Label=="propertyNameTypeString";});
propertyString.Required =true;
ResourceTemplatePropertyResource propertyResource = folderRT.Properties.First(function (object p){return p.Label=="propertyNameTypeResource";});
propertyResource.RemoveAllowedResourceType(Resource_Type_Folder);
propertyResource.AddAllowedResourceType(Resource_Type_Report);
folderRT.SaveProperties();