Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

GroupBuilderRuleCollection class

From Catglobe Wiki
Revision as of 03:54, 19 April 2017 by Nguyenduyan (talk | contribs)

GroupBuilderRuleCollection



Represents a level of group builder rules.


Methods

Properties

  • int Count { get; } - Number of rules at this level
  • string ObjectTypeName { get; } - The name of the type of object.
  • TypeInformation TypeInformation { get; } - Get information about this class.

Examples

Example: Add new rules

//Create a new group
string groupName = "Test Group Builder: GroupBuilderRuleCollection";
number groupTemplateResourceId=2066;
number parentResourceId = 11088827;
array group = Group_new(groupName, groupTemplateResourceId, parentResourceId);
Group_save(group);
number groupRId = group[GROUP_RESOURCE_ID ]; 
//Create rule for the group
GroupBuilderRoot root = new GroupBuilderRoot (groupRId);
GroupBuilderRule rule1 = new GroupBuilderRule (root);
GroupBuilderRule rule2 = new GroupBuilderRule (root);
GroupBuilderRule rule3 = new GroupBuilderRule (root);
GroupBuilderRuleCollection ruleColection = root.RootRules;
ruleColection.Add(rule1);
ruleColection.Add(rule2);
ruleColection.Add(rule3);
root.Save();


Example: Remove rule

GroupBuilderRoot root = new GroupBuilderRoot (15560827);
GroupBuilderRuleCollection ruleColection = root.RootRules;
print(ruleColection.Count);//3
GroupBuilderRule rule2 = ruleColection[1];
ruleColection.Remove(rule2);
print(ruleColection.Count);//2
root.Save();