Class RuntimeBase
Runtime for the function
Implements
Inherited Members
Namespace: PayrollEngine.Client.Scripting.Runtime.Api
Assembly: PayrollEngine.Client.Services.dll
Syntax
public abstract class RuntimeBase : IRuntime
Constructors
View SourceRuntimeBase(PayrollHttpClient, int, int)
Initializes a new instance of the RuntimeBase class
Declaration
protected RuntimeBase(PayrollHttpClient httpClient, int tenantId, int userId)
Parameters
| Type | Name | Description |
|---|---|---|
| PayrollHttpClient | httpClient | The Payroll http client |
| int | tenantId | The tenant id |
| int | userId | The user id |
Properties
View SourceHttpClient
The Payroll http client
Declaration
public PayrollHttpClient HttpClient { get; }
Property Value
| Type | Description |
|---|---|
| PayrollHttpClient |
LogOwner
The log owner, the source identifier
Declaration
protected abstract string LogOwner { get; }
Property Value
| Type | Description |
|---|---|
| string |
LogOwnerType
The log owner type
Declaration
protected abstract string LogOwnerType { get; }
Property Value
| Type | Description |
|---|---|
| string |
Tenant
The tenant
Declaration
public Tenant Tenant { get; }
Property Value
| Type | Description |
|---|---|
| Tenant |
TenantCulture
The tenant culture
Declaration
public CultureInfo TenantCulture { get; }
Property Value
| Type | Description |
|---|---|
| CultureInfo |
TenantId
The tenant id
Declaration
public int TenantId { get; }
Property Value
| Type | Description |
|---|---|
| int |
TenantIdentifier
The tenant identifier
Declaration
public string TenantIdentifier { get; }
Property Value
| Type | Description |
|---|---|
| string |
TenantService
The tenant service
Declaration
protected ITenantService TenantService { get; }
Property Value
| Type | Description |
|---|---|
| ITenantService |
User
The user
Declaration
public User User { get; }
Property Value
| Type | Description |
|---|---|
| User |
UserCulture
The user culture
Declaration
public virtual string UserCulture { get; }
Property Value
| Type | Description |
|---|---|
| string |
UserId
The user id
Declaration
public int UserId { get; }
Property Value
| Type | Description |
|---|---|
| int |
UserIdentifier
The user identifier
Declaration
public string UserIdentifier { get; }
Property Value
| Type | Description |
|---|---|
| string |
UserService
The user service
Declaration
protected IUserService UserService { get; }
Property Value
| Type | Description |
|---|---|
| IUserService |
UserType
The user type
Declaration
public int UserType { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
View SourceAddLog(int, string, string, string)
Add a log
Declaration
public 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
public 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
public 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
public 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
public 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
public 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
public 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
public 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
public 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
public 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
public 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
public bool IsCalendarWorkDay(string calendarName, DateTime moment)
Parameters
| Type | Name | Description |
|---|---|---|
| string | calendarName | The calendar name |
| DateTime | moment | Test day |
Returns
| Type | Description |
|---|---|
| bool |