Difference between revisions of "QuestionnaireResourceTemplate class"

From Catglobe Wiki
Jump to: navigation, search
Line 5: Line 5:
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptConstructors_Template|Parameters=
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Resource name</nowiki>}}
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>name</nowiki>|Description=<nowiki>Resource name</nowiki>}}
|Description=<nowiki>Create a new Folder resource template</nowiki>}}
+
|Description=<nowiki>Create a new Questionnaire resource template</nowiki>}}
 
|Methods=
 
|Methods=
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>DefaultLanguage</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>DefaultLanguage</nowiki>|Parameters=

Revision as of 10:27, 13 November 2019

QuestionnaireResourceTemplate



A Questionnaire resource template.

Constructors

  • (string name "Resource name") - Create a new Questionnaire 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

  • int ErrorScriptResourceId { get; set; } - Set the OnError script
  • int GatewayScriptResourceId { get; set; } - Set the gateway script
  • 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

// EX for creating a new QuestionnaireResourceTemplate 
QuestionnaireResourceTemplate qnaireRT = new QuestionnaireResourceTemplate ("qnaireRT Name");
qnaireRT.LocalizedNames={"da-DK":" name in DK", "en-US":" name in US"}; 
qnaireRT.DefaultLanguage("da-DK");
qnaireRT.Save();


//Example for working with an existing QuestionaireResourceTemplate 
number qnaireResourceTemplateRId = 6879;
ResourceTemplateHelper rth = new ResourceTemplateHelper ();
QuestionnaireResourceTemplate qnaireRT = rth.GetTemplate(qnaireResourceTemplateRId);
qnaireRT.GatewayScriptResourceId=6884;
qnaireRT.Save();


//Example for creating new properties 
number qnaireResourceTemplateRId = 6879;
ResourceTemplateHelper rth = new ResourceTemplateHelper ();
QuestionnaireResourceTemplate qnaireRT = rth.GetTemplate(qnaireResourceTemplateRId);
 
new ResourceTemplatePropertyNumber ("propertyNameTypeNumber",false,"description",qnaireRT);
new ResourceTemplatePropertyBoolean ("propertyNameTypeBoolean",true,"description",qnaireRT);
new ResourceTemplatePropertyString ("propertyNameTypeString",false,"description",qnaireRT);
new ResourceTemplatePropertyDateTime ("propertyNameTypeDateTime",false,"description",qnaireRT);
new ResourceTemplatePropertySingle ("propertyNameTypeSingle",true,"description",qnaireRT);
new ResourceTemplatePropertyMulti ("propertyNameTypeMulti",false,"description",qnaireRT);
ResourceTemplatePropertyResource propertyResource = new ResourceTemplatePropertyResource ("propertyNameTypeResource", false, "", qnaireRT);
propertyResource.AddAllowedResourceType(Resource_Type_Project);
 
qnaireRT.SaveProperties();


//Example for working with existing properies 
number qnaireResourceTemplateRId = 6879;
ResourceTemplateHelper rth = new ResourceTemplateHelper ();
QuestionnaireResourceTemplate qnaireRT = rth.GetTemplate(qnaireResourceTemplateRId);
 
array arrayProperty = qnaireRT.Properties;
ResourceTemplatePropertyNumber propertyNumber = arrayProperty[0];
propertyNumber.IsDecimal=true;
 
ResourceTemplatePropertyString propertyString = qnaireRT.Properties.First(function (object p){return p.Label=="propertyNameTypeString";});
propertyString.Required =true;
 
ResourceTemplatePropertyResource propertyResource = qnaireRT.Properties.First(function (object p){return p.Label=="propertyNameTypeResource";});
propertyResource.RemoveAllowedResourceType(Resource_Type_Project);
propertyResource.AddAllowedResourceType(Resource_Type_Folder);
 
qnaireRT.SaveProperties();