Difference between revisions of "TimeregPeriod class"

From Catglobe Wiki
Jump to: navigation, search
(Created page with "{{CGscriptClass_Template |Name=TimeregPeriod |Description=Define a registration period |Methods= {{CGscriptMethods_Template|ReturnType=empty|Name=Activate|Description=Activa...")
 
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
{{CGscriptClass_Template
 
{{CGscriptClass_Template
|Name=TimeregPeriod  
+
|Name=<nowiki>TimeregPeriod</nowiki>
|Description=Define a registration period
+
|Description=<nowiki>Define a registration period</nowiki>
 +
|InheritsFrom=object|Constructors=
 +
{{CGscriptConstructors_Template|Parameters=
 +
{{CGscriptParameters_Template|Type=Dictionary|Name=<nowiki>versions</nowiki>|Description=<nowiki>Dictionary of iso and translation of name</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=DateTime|Name=<nowiki>from</nowiki>|Description=<nowiki>Date from</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=DateTime|Name=<nowiki>to</nowiki>|Description=<nowiki>Date to</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>active</nowiki>|Description=<nowiki>Start activated or not</nowiki>}}
 +
|Description=<nowiki>Create a new period in the database</nowiki>}}
 +
|Methods=
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Activate</nowiki>|Description=<nowiki>Activate the period and save it</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>AddGroup</nowiki>|Parameters=
 +
{{CGscriptParameters_Template|Type=int|Name=<nowiki>resourceId</nowiki>|Description=<nowiki>Resource Id of the group</nowiki>}}
 +
|Description=<nowiki>Add all non-deleted, non-disabled users in group. Ignores users that are already added</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Deactivate</nowiki>|Description=<nowiki>Deactivate the period and save it</nowiki>}}
 +
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}}
 +
|Properties=
 +
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Active</nowiki>|HasGetter=1|Description=<nowiki>Get if the period is active</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>DefaultLanguage</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/set isocode of default language</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>FromDate</nowiki>|HasGetter=1|Description=<nowiki>Get start date of the period</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Name</nowiki>|HasGetter=1|Description=<nowiki>Get name of the period</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>ToDate</nowiki>|HasGetter=1|Description=<nowiki>Get end date of the period</nowiki>}}
 +
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}}
 +
}}
  
|Methods=
+
<source lang="javascript">
{{CGscriptMethods_Template|ReturnType=empty|Name=Activate|Description=Activate the period and save it}}
+
array startDate = DateTime_fromInvariant("2015-09-10 00:00:00");
{{CGscriptMethods_Template|ReturnType=empty|Name=Deactivate|Description=Deactivate the period and save it}}
+
array endDate = DateTime_fromInvariant("2016-09-10 00:00:00");
{{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}}
+
array user = User_getCurrentUser();
 +
number urid = user[USER_RESOURCE_ID];
 +
Dictionary regtime = TimeregStatus_getByUsers({urid}, startDate, endDate);
 +
 
 +
number i = 0;
 +
for(i=0;i<regtime[urid].Count;i++) {
 +
    Timereg a = regtime[urid][i];
 +
    print("TimeregPeriod Name: " + convertToString(a.TimeregPeriod.Name));
 +
    print("TimeregPeriod ObjectTypeName: " + convertToString(a.TimeregPeriod.ObjectTypeName));
 +
    print("TimeregPeriod FromDate: " + convertToString(a.TimeregPeriod.FromDate));
 +
    print("TimeregPeriod ToDate: " + convertToString(a.TimeregPeriod.ToDate));
 +
    print("TimeregPeriod Active: " + convertToString(a.TimeregPeriod.Active));
 +
    print("TotalHours: " + convertToString(a.TotalHours));
 +
    print("==========================================================\n");
 +
}
  
 +
/*
 +
TimeregPeriod Name: 39.03.2016
 +
TimeregPeriod ObjectTypeName: TimeregPeriod
 +
TimeregPeriod FromDate: 2016-03-29 00:00:00
 +
TimeregPeriod ToDate: 2016-03-29 00:00:00
 +
TimeregPeriod Active: True
 +
TotalHours: 8
 +
==========================================================
  
|Properties=
+
*/
{{CGscriptProperties_Template|ReturnType=bool|Name=Active|HasGetter=1|Description=Get if the period is active}}
+
</source>
{{CGscriptProperties_Template|ReturnType=DateTime|Name=FromDate|HasGetter=1|Description=Get start date of the period}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=Name|HasGetter=1|Description=Get name of the period}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName |HasGetter=1|Description=The name of the type of object.}}
 
{{CGscriptProperties_Template|ReturnType=DateTime|Name=ToDate |HasGetter=1|Description=Get end date of the period}}
 
}}
 

Latest revision as of 08:15, 2 July 2020

TimeregPeriod



Define a registration period

Parent class

Inherits from object

Constructors

  • (Dictionary versions "Dictionary of iso and translation of name", DateTime from "Date from", DateTime to "Date to", bool active "Start activated or not") - Create a new period in the database

Methods

  • Empty Activate() - Activate the period and save it
  • Empty AddGroup(int resourceId "Resource Id of the group") - Add all non-deleted, non-disabled users in group. Ignores users that are already added
  • Empty Deactivate() - Deactivate the period and save it
  • (From object) string ToString() - The string representation of the object.

Properties

  • bool Active { get; } - Get if the period is active
  • string DefaultLanguage { get; set; } - Get/set isocode of default language
  • DateTime FromDate { get; } - Get start date of the period
  • string Name { get; } - Get name of the period
  • string ObjectTypeName { get; } - The name of the type of object.
  • DateTime ToDate { get; } - Get end date of the period
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.


array startDate = DateTime_fromInvariant("2015-09-10 00:00:00");
array endDate = DateTime_fromInvariant("2016-09-10 00:00:00");
array user = User_getCurrentUser();
number urid = user[USER_RESOURCE_ID];
Dictionary regtime = TimeregStatus_getByUsers({urid}, startDate, endDate);

number i = 0;
for(i=0;i<regtime[urid].Count;i++) {
    Timereg a = regtime[urid][i];
    print("TimeregPeriod Name: " + convertToString(a.TimeregPeriod.Name));
    print("TimeregPeriod ObjectTypeName: " + convertToString(a.TimeregPeriod.ObjectTypeName));
    print("TimeregPeriod FromDate: " + convertToString(a.TimeregPeriod.FromDate));
    print("TimeregPeriod ToDate: " + convertToString(a.TimeregPeriod.ToDate));
    print("TimeregPeriod Active: " + convertToString(a.TimeregPeriod.Active));
    print("TotalHours: " + convertToString(a.TotalHours));
    print("==========================================================\n");
}

/*
TimeregPeriod Name: 39.03.2016
TimeregPeriod ObjectTypeName: TimeregPeriod
TimeregPeriod FromDate: 2016-03-29 00:00:00
TimeregPeriod ToDate: 2016-03-29 00:00:00
TimeregPeriod Active: True
TotalHours: 8
==========================================================

*/