Difference between revisions of "User class"

From Catglobe Wiki
Jump to: navigation, search
(Created page with "{{CGscriptClass_Template |Name=<nowiki>User</nowiki> |Description=<nowiki>A user</nowiki> |Methods= {{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>Any</nowiki>|Parame...")
 
Line 129: Line 129:
 
|Description=<nowiki>Save the user</nowiki>}}
 
|Description=<nowiki>Save the user</nowiki>}}
 
}}
 
}}
 +
=== <span style="color:#DF8621">'''Examples'''</span> ===
 +
<source lang="javascript">
 +
number userResourceTemplateRId = 1842;
 +
User user = User_new (userResourceTemplateRId);
 +
user.ParentResourceId = 5224516;
 +
user.LanguageIsoCode = "da-DK";
 +
user.CultureIsoCode = "da-DK";
 +
user.Save();
 +
print(user);//User class
 +
</source>

Revision as of 06:50, 24 March 2020

User



A user


Methods

  • bool Any(Function predicate "A function that takes 1 parameter of the types in the array, and return true/false") - Return true if the array contains the element using the given function.
  • Empty ChangePassword(string newPassword "The new password") - Change the users password
  • bool Contains(object element "Element to check for") - Return true if the array contains the element using the normal equal operator.
  • Empty DeleteUser() - Delete the user
  • array Except(array elements "Elements to remove") - Return all elements that does not exist in the other collection.
  • object First(Function selector "A function to test each element for a condition.") - Returns the first element in a sequence that satisfies a specified condition.
  • object FirstOrDefault(Function selector "A function to test each element for a condition.") - Returns the first element in a sequence that satisfies a specified condition or empty if not found.
  • int Frequency(number number "The number to search for") - Counts the number of times a given Number object exists in the Array. Can only use if all the elements are of type Number
  • object this[] { get; }(int index "Index") - Backward-compatible indexer
  • int IndexOf(object element "Element to search for") - Return index of the given element, or -1.
  • bool IsCharacterArray() - check if array is an array of characters
  • bool IsNumericArray() - check if array is an array of integer numbers
  • bool IsStringArray() - check if array is an array of string
  • array OrderBy(Function comparer "Function that compares two objects of the same type. Must return a signed integer that indicates the relative values of first param A and second param B. Value Less than 0 : A is less than B.Value 0 : A equals B.Value Greater than 0 : A is greater than B.It can also be a function that takes 1 parameter and returns a string or number.") - Sorts the elements of a sequence in ascending order by using a specified comparer.
  • Empty Randomize() - Randomize the order of the elements in the current array.
  • array Reverse() - Returns an array with all the elements in the opposite order.
  • Empty Save() - Save the user
  • array Select(Function selector "A transform function to apply to each element.") - Projects each element of a sequence into a new form.
  • array SelectMany(Function selector "A transform function to get each sub array.") - Projects each array element of a sequence into a new form.
  • Empty this[] { set; }(int index "Index", object value "Value to set") - Backward-compatible indexer
  • array Skip(int n "How many elements to skip") - Get all but the n first elements.
  • array Take(int n "How many elements to take") - Get the n first elements.
  • Dictionary ToDictionary(Function keySelector "A transform function to get the key of each element.") - Return a dictionary with the elements of the array.
  • Dictionary ToDictionary(Function keySelector "A transform function to get the key of each element.", Function valueSelector "A transform function to get the value of each element.") - Return a dictionary with the elements of the array.
  • string ToString() - The string representation of the object.
  • array Where(Function predicate "A function that takes 1 parameter of the types in the array and return true/false") - Filters a sequence of values based on a predicate.

Properties

  • DateTime AccessExpiration { get; set; } - After this date the user can no longer login
  • number Average { get; } - Average of the objects in the Array object. Can only use if all the elements are of type Number
  • bool CalculatedManHours { get; set; } - True if it Man Hours is calculated. Set to true to recalculate.
  • string City { get; set; } - City of the address
  • string CountryIsoCode { get; set; } - Iso code of the country of the address
  • int CreatedByUserId { get; } - Id of the user that created this user
  • DateTime CreatedDate { get; } - Date of creation
  • string CultureIsoCode { get; set; } - Iso code of the culture of the user
  • string CurrencyIsoName { get; set; } - Iso 4217 name of the currency of the user
  • bool Deleted { get; } - True if deleted
  • DateTime DeletedDate { get; } - Date of deletion
  • bool Disabled { get; set; } - True if user is disabled
  • DateTime DisabledDate { get; set; } - Date user was disabled
  • string DiscountName { get; set; } - Current applied discount in webshop
  • string Email { get; set; } - Email of the user
  • string FirstName { get; set; } - Firstname of the user
  • string LanguageIsoCode { get; set; } - Iso code of the language of the user
  • DateTime LastDateUpdatePassWord { get; set; } - Date the user last changed their password
  • string LastName { get; set; } - LastName of the user
  • number Max { get; } - Largest of all the objects in the Array object. Can only use if all the elements are of type Number
  • string MiddleName { get; set; } - MiddleName of the user
  • number Min { get; } - Smallest of all the objects in the Array object. Can only use if all the elements are of type Number
  • int ModifiedByUserId { get; } - Id of the user that modified this user
  • DateTime ModifiedDate { get; } - Date of last modification
  • string ObjectTypeName { get; } - The name of the type of object.
  • int ParentResourceId { get; set; } - Resource id of the parent
  • array PhoneNumbers { get; set; } - Get/set phonenumbers
  • int PointBalance { get; } - Currenct number of points available
  • string Postbox { get; set; } - Postbox of the address
  • int PrimaryKey { get; } - Id of the user
  • DateTime ProtectedUntilDate { get; set; } - Prior to this date the user can not be sampled
  • string Region { get; set; } - Region of the address
  • string ResourceGuid { get; } - Guid of the user
  • int ResourceId { get; } - Resource id of the user
  • int ResourceManHours { get; set; } - Man Hours of the user
  • string ResourceManHoursAsString { get; } - Formatted Man Hours as Hours:Min
  • int ResourceTemplateId { get; } - Id of the template
  • int ResourceTemplateResourceId { get; set; } - Resource Id of the template
  • string StreetAddress { get; set; } - Street of the address
  • number Sum { get; } - Sum of all the objects in the Array object. Can only use if all the elements are of type Number
  • bool TimeRegEnabled { get; set; } - True if it is possible to register time for this resource
  • int TimezoneId { get; set; } - Id of the timezone of the user
  • TypeInformation TypeInformation { get; } - Get information about this class.
  • string Username { get; set; } - Login username of the user
  • string Website { get; set; } - Website of the address
  • string ZipCode { get; set; } - ZipCode of the address

Static Methods

  • string User_formatName(User user "User to save") - Generate full name ofuser
  • User User_new(int userResourceTemplateId "Resource Id of the template") - Create a new user instance
  • User User_new(int userResourceTemplateId "Resource Id of the template", string mask "Mask to use to generate username") - Create a new user instance
  • User User_new(string username "Username of new user", string password "Password of new user", int userResourceTemplateId "Resource Id of the template") - Create a new user instance
  • Empty User_save(User user "User to save") - Save the user

Examples

number userResourceTemplateRId = 1842;
User user = User_new (userResourceTemplateRId);
user.ParentResourceId = 5224516;
user.LanguageIsoCode = "da-DK";
user.CultureIsoCode = "da-DK";
user.Save();
print(user);//User class