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.

GroupBuilderGroupVariable class

From Catglobe Wiki
Revision as of 04:56, 30 March 2017 by Nguyenduyan (talk | contribs)

GroupBuilderGroupVariable



Represents a group builder variable for group membership.

Constructors

  • (bool include "Include users, or if false exclude users") - Create new variable

Methods

  • Empty Add(int groupResourceId "Group resource id to add") - Add a new group
  • int this[] { get; }(int index "Index") - Get group resource id at index
  • bool Remove(int groupResourceId "Group resource id to remove") - Remove group. Return true if removed
  • string ToString() - The string representation of the object.

Properties

  • int Count { get; } - Number of groups
  • bool Include { get; } - Include users that match rule, or exclude
  • string ObjectTypeName { get; } - The name of the type of object.
  • TypeInformation TypeInformation { get; } - Get information about this class.


Examples

Example: Add group variable

//Create a new group
string groupName = "Test Group Builder: groupVariable";
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);

GroupBuilderGroupVariable groupVariable = new GroupBuilderGroupVariable (true);//true: include; false: exclude
groupVariable.Add(15547043);// 15547043: resourceId of group want to add to
groupVariable.Add(15085949);// 15085949: resourceId of group want to add to 

GroupBuilderRule rule = new GroupBuilderRule (root);
rule.Add(groupVariable);

GroupBuilderRuleCollection ruleColection = root.RootRules;
ruleColection.Add(rule);

root.Save();

//Rebuild group
Group_rebuildGroup(groupRId,true);


Example: Remove group variable

number groupRId = 15560550;

GroupBuilderRoot root = new GroupBuilderRoot (groupRId);

GroupBuilderRuleCollection ruleColection = root.RootRules;
GroupBuilderRule rule = ruleColection[0];
GroupBuilderGroupVariable groupVariable = rule[0];
print(groupVariable.Count);
groupVariable.Remove(15085949);

root.Save();