Interface IRuntime
Runtime during the execution of a scripting function PayrollEngine.Client.Scripting.Function
Namespace: PayrollEngine.Client.Scripting.Runtime
Assembly: PayrollEngine.Client.Scripting.dll
Syntax
public interface IRuntime
Properties
TenantId
The tenant id
Declaration
int TenantId { get; }
Property Value
| Type | Description |
|---|---|
| int |
TenantIdentifier
The tenant identifier
Declaration
string TenantIdentifier { get; }
Property Value
| Type | Description |
|---|---|
| string |
UserCulture
The user culture
Declaration
string UserCulture { get; }
Property Value
| Type | Description |
|---|---|
| string |
UserId
The user id
Declaration
int UserId { get; }
Property Value
| Type | Description |
|---|---|
| int |
UserIdentifier
The user identifier
Declaration
string UserIdentifier { get; }
Property Value
| Type | Description |
|---|---|
| string |
UserType
The user type
Declaration
int UserType { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
AddLog(int, string, string, string)
Add a log
Declaration
void AddLog(int level, string message, string error = null, string comment = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int | level | The log level |
| string | message | The log message |
| string | error | The log error |
| string | comment | The log comment |
AddTask(string, string, DateTime, string, Dictionary<string, object>)
Add task
Declaration
void AddTask(string name, string instruction, DateTime scheduleDate, string category, Dictionary<string, object> attributes = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | The task name |
| string | instruction | The task instruction |
| DateTime | scheduleDate | The task schedule date |
| string | category | The task category |
| Dictionary<string, object> | attributes | The task attributes |
GetCalendarDayCount(string, DateTime, DateTime, string)
Count the calendar days from a date period
Declaration
int GetCalendarDayCount(string calendarName, DateTime start, DateTime end, string culture)
Parameters
| Type | Name | Description |
|---|---|---|
| string | calendarName | The calendar name |
| DateTime | start | The period start date |
| DateTime | end | The period end date |
| string | culture | The calendar culture |
Returns
| Type | Description |
|---|---|
| int |
GetCalendarPeriod(string, DateTime, int, string)
Gets the calendar period
Declaration
Tuple<DateTime, DateTime> GetCalendarPeriod(string calendarName, DateTime moment, int offset, string culture)
Parameters
| Type | Name | Description |
|---|---|---|
| string | calendarName | The calendar name |
| DateTime | moment | Moment within the period |
| int | offset | The period offset |
| string | culture | The calendar culture |
Returns
| Type | Description |
|---|---|
| Tuple<DateTime, DateTime> |
GetDerivedCalendar(int, int)
Gets the derived calendar name by priority: - employee (optional) - division (optional) - tenant (fallback)
Declaration
string GetDerivedCalendar(int divisionId, int employeeId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | divisionId | The division id, use 0 to ignore the division calendar |
| int | employeeId | The employee id, use 0 to ignore the employee calendar |
Returns
| Type | Description |
|---|---|
| string | The most derived calendar name |
GetDerivedCulture(int, int)
Gets the derived culture name by priority: - employee (optional) - division (optional) - tenant (fallback)
Declaration
string GetDerivedCulture(int divisionId, int employeeId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | divisionId | The division id, use 0 to ignore the division culture (mandatory with employee id) |
| int | employeeId | The employee id, use 0 to ignore the employee culture |
Returns
| Type | Description |
|---|---|
| string | The most derived culture name |
GetNextWorkDays(string, DateTime)
Get next working days
Declaration
List<DateTime> GetNextWorkDays(string calendarName, DateTime moment)
Parameters
| Type | Name | Description |
|---|---|---|
| string | calendarName | The calendar name |
| DateTime | moment | The start moment (not included in results) |
Returns
| Type | Description |
|---|---|
| List<DateTime> | Returns true for valid time units |
GetPreviousWorkDays(string, DateTime)
Get previous working days
Declaration
List<DateTime> GetPreviousWorkDays(string calendarName, DateTime moment)
Parameters
| Type | Name | Description |
|---|---|---|
| string | calendarName | The calendar name |
| DateTime | moment | The start moment (not included in results) |
Returns
| Type | Description |
|---|---|
| List<DateTime> |
GetTenantAttribute(string)
Get tenant attribute value
Declaration
object GetTenantAttribute(string attributeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName | Name of the attribute |
Returns
| Type | Description |
|---|---|
| object | The tenant attribute value |
GetUserAttribute(string)
Get user attribute value
Declaration
object GetUserAttribute(string attributeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName | Name of the attribute |
Returns
| Type | Description |
|---|---|
| object | The user attribute value |
InvokeWebhook(string, string)
Invoke case relation webhook and receive the response JSON data
Declaration
string InvokeWebhook(string requestOperation, string requestMessage = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | requestOperation | The request operation |
| string | requestMessage | The JSON request message |
Returns
| Type | Description |
|---|---|
| string | The webhook response object as JSON |
IsCalendarWorkDay(string, DateTime)
Test for calendar working day
Declaration
bool IsCalendarWorkDay(string calendarName, DateTime moment)
Parameters
| Type | Name | Description |
|---|---|---|
| string | calendarName | The calendar name |
| DateTime | moment | Test day |
Returns
| Type | Description |
|---|---|
| bool |