Difference between revisions of "Timereg class"

From Catglobe Wiki
Jump to: navigation, search
(Created page with "{{CGscriptClass_Template |Name=Timereg |Description=Represent a registration time |Methods= {{CGscriptMethods_Template|ReturnType=empty|Name=Lock|Description=Lock the timereg...")
 
Line 16: Line 16:
 
{{CGscriptProperties_Template|ReturnType=number|Name=TotalHours|HasGetter=1|Description=Get total hours registered}}
 
{{CGscriptProperties_Template|ReturnType=number|Name=TotalHours|HasGetter=1|Description=Get total hours registered}}
 
}}
 
}}
 +
 +
 +
<source lang="javascript">
 +
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);
 +
print("Count regtime: " + regtime[urid].Count);
 +
print("==========================================================\n");
 +
number i = 0;
 +
for(i=0;i<regtime[urid].Count;i++) {
 +
    Timereg a = regtime[urid][i];
 +
    print("Date : " + convertToString(a.Date));
 +
    print("Locked: " + convertToString(a.Locked));
 +
    print("ObjectTypeName: " + convertToString(a.ObjectTypeName));
 +
    print("Status: " + convertToString(a.Status));
 +
    print("==========================================================\n");
 +
}
 +
/*
 +
Count regtime: 1
 +
==========================================================
 +
 +
Date : 2016-03-29 00:00:00
 +
Locked: False
 +
ObjectTypeName: Timereg
 +
Status: Met
 +
==========================================================
 +
*/
 +
</source>

Revision as of 11:14, 14 April 2016

Timereg



Represent a registration time


Methods

  • empty Lock() - Lock the timereg and save it
  • string ToString() - The string representation of the object.

Properties

  • DateTime Date { get; } - Get registration date
  • bool Locked { get; } - Get if the registration is locked
  • string ObjectTypeName { get; } - The name of the type of object.
  • string Status { get; } - Get registration type of day (Met, Weekend,... etc)
  • TimeregPeriod TimeregPeriod { get; } - Get a TimePeriod object in association with the registration
  • number TotalHours { get; } - Get total hours registered


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);
print("Count regtime: " + regtime[urid].Count);
print("==========================================================\n");
number i = 0;
for(i=0;i<regtime[urid].Count;i++) {
    Timereg a = regtime[urid][i];
    print("Date : " + convertToString(a.Date));
    print("Locked: " + convertToString(a.Locked));
    print("ObjectTypeName: " + convertToString(a.ObjectTypeName));
    print("Status: " + convertToString(a.Status));
    print("==========================================================\n");
}
/*
Count regtime: 1
==========================================================

Date : 2016-03-29 00:00:00
Locked: False
ObjectTypeName: Timereg
Status: Met
==========================================================
*/