Class PayrollRuntime
Runtime for the payroll function
Inheritance
Inherited Members
Namespace: PayrollEngine.Client.Scripting.Runtime.Api
Assembly: PayrollEngine.Client.Services.dll
Syntax
public abstract class PayrollRuntime : RuntimeBase, IPayrollRuntime, IRuntime
Constructors
View SourcePayrollRuntime(PayrollHttpClient, ScriptContext, int, int, int, int?)
Initializes a new instance of the PayrollRuntime class
Declaration
protected PayrollRuntime(PayrollHttpClient httpClient, ScriptContext scriptContext, int tenantId, int userId, int payrollId, int? employeeId = null)
Parameters
| Type | Name | Description |
|---|---|---|
| PayrollHttpClient | httpClient | The Payroll http client |
| ScriptContext | scriptContext | The calendar |
| int | tenantId | The tenant id |
| int | userId | The user id |
| int | payrollId | The payroll id |
| int? | employeeId | The employee id |
Properties
View SourceCalendarService
The calendar service
Declaration
protected ICalendarService CalendarService { get; }
Property Value
| Type | Description |
|---|---|
| ICalendarService |
Cycle
The payroll cycle
Declaration
public IPayrollPeriod Cycle { get; }
Property Value
| Type | Description |
|---|---|
| IPayrollPeriod |
DivisionId
The division id
Declaration
public int DivisionId { get; }
Property Value
| Type | Description |
|---|---|
| int |
Employee
The employee
Declaration
protected Employee Employee { get; }
Property Value
| Type | Description |
|---|---|
| Employee |
EmployeeId
The employee id
Declaration
public int? EmployeeId { get; }
Property Value
| Type | Description |
|---|---|
| int? |
EmployeeIdentifier
The employee identifier
Declaration
public string EmployeeIdentifier { get; }
Property Value
| Type | Description |
|---|---|
| string |
EmployeeService
The employee service
Declaration
protected IEmployeeService EmployeeService { get; }
Property Value
| Type | Description |
|---|---|
| IEmployeeService |
EvaluationDate
The evaluation date
Declaration
public DateTime EvaluationDate { get; }
Property Value
| Type | Description |
|---|---|
| DateTime |
Namespace
The script namespace
Declaration
public string Namespace { get; }
Property Value
| Type | Description |
|---|---|
| string |
Payroll
The payroll
Declaration
public Payroll Payroll { get; }
Property Value
| Type | Description |
|---|---|
| Payroll |
PayrollCulture
The payroll culture by priority: script > tenant > system
Declaration
public string PayrollCulture { get; }
Property Value
| Type | Description |
|---|---|
| string |
PayrollId
The payroll id
Declaration
public int PayrollId { get; }
Property Value
| Type | Description |
|---|---|
| int |
PayrollService
The payroll service
Declaration
protected IPayrollService PayrollService { get; }
Property Value
| Type | Description |
|---|---|
| IPayrollService |
Period
The payroll period
Declaration
public IPayrollPeriod Period { get; }
Property Value
| Type | Description |
|---|---|
| IPayrollPeriod |
RegulationDate
The regulation date
Declaration
public DateTime RegulationDate { get; }
Property Value
| Type | Description |
|---|---|
| DateTime |
RegulationService
The regulation service
Declaration
protected IRegulationService RegulationService { get; }
Property Value
| Type | Description |
|---|---|
| IRegulationService |
ScriptCalendar
The script calendar
Declaration
public ScriptCalendar ScriptCalendar { get; }
Property Value
| Type | Description |
|---|---|
| ScriptCalendar |
ScriptContext
The script context
Declaration
public ScriptContext ScriptContext { get; }
Property Value
| Type | Description |
|---|---|
| ScriptContext |
Methods
View SourceApplyRangeValue(string, decimal, string)
Apply a range value to the lookup ranges, and multiplying the lookup value with the range amount
Declaration
public decimal ApplyRangeValue(string lookupName, decimal rangeValue, string valueFieldName = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | lookupName | The lookup name |
| decimal | rangeValue | The range value |
| string | valueFieldName | Value field name |
Returns
| Type | Description |
|---|---|
| decimal | Summary of all lookup ranges |
Remarks
Only numeric JSON lookup values are supported. The first lookup range value must be zero.
GetCaseFieldAttribute(string, string)
Get case field attribute value
Declaration
public virtual object GetCaseFieldAttribute(string caseFieldName, string attributeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | caseFieldName | The name of the case field |
| string | attributeName | Name of the attribute |
Returns
| Type | Description |
|---|---|
| object | The case field attribute value |
GetCasePeriodValues(DateTime, DateTime, params string[])
Get case period values of multiple cases by date range and case field name
Declaration
public virtual Dictionary<string, List<Tuple<DateTime, DateTime?, DateTime?, object>>> GetCasePeriodValues(DateTime startDate, DateTime endDate, params string[] caseFieldNames)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | startDate | The time period start date |
| DateTime | endDate | The time period end date |
| string[] | caseFieldNames | The name of the case fields |
Returns
| Type | Description |
|---|---|
| Dictionary<string, List<Tuple<DateTime, DateTime?, DateTime?, object>>> | The period values of multiple cases |
GetCaseValue(string, DateTime)
Get case value from a specific moment
Declaration
public virtual Tuple<string, DateTime, Tuple<DateTime?, DateTime?>, object, DateTime?, List<string>, Dictionary<string, object>> GetCaseValue(string caseFieldName, DateTime valueDate)
Parameters
| Type | Name | Description |
|---|---|---|
| string | caseFieldName | The case field name |
| DateTime | valueDate | The value date |
Returns
| Type | Description |
|---|---|
| Tuple<string, DateTime, Tuple<DateTime?, DateTime?>, object, DateTime?, List<string>, Dictionary<string, object>> | Case value from a specific date |
Remarks
Use nested tuples to reduce the tuple item count to 7
GetCaseValueAttribute(string, string)
Get case field value attribute value
Declaration
public virtual object GetCaseValueAttribute(string caseFieldName, string attributeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | caseFieldName | The name of the case field |
| string | attributeName | Name of the attribute |
Returns
| Type | Description |
|---|---|
| object | The case field value attribute value |
GetCaseValueSlots(string)
Get the case value slots
Declaration
public virtual List<string> GetCaseValueSlots(string caseFieldName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | caseFieldName | The name of the case field |
Returns
| Type | Description |
|---|---|
| List<string> | The case slot names, empty on unknown case field |
GetCaseValueTags(string, DateTime)
Get the case value tags
Declaration
public virtual List<string> GetCaseValueTags(string caseFieldName, DateTime valueDate)
Parameters
| Type | Name | Description |
|---|---|---|
| string | caseFieldName | The name of the case field |
| DateTime | valueDate | The value date |
Returns
| Type | Description |
|---|---|
| List<string> | The case value tas, empty on unknown case field |
GetCaseValueType(string)
Get case value type
Declaration
public virtual int? GetCaseValueType(string caseFieldName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | caseFieldName | The case field name |
Returns
| Type | Description |
|---|---|
| int? | The case value type |
GetCaseValues(IList<string>, DateTime)
Get case values from a specific moment
Declaration
public virtual List<Tuple<string, DateTime, Tuple<DateTime?, DateTime?>, object, DateTime?, List<string>, Dictionary<string, object>>> GetCaseValues(IList<string> caseFieldNames, DateTime valueDate)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<string> | caseFieldNames | The case field names |
| DateTime | valueDate | The value date |
Returns
| Type | Description |
|---|---|
| List<Tuple<string, DateTime, Tuple<DateTime?, DateTime?>, object, DateTime?, List<string>, Dictionary<string, object>>> | Case value from a specific date |
Remarks
Use nested tuples to reduce the tuple item count to 7
GetCaseValues(string, DateTime?, DateTime?)
Get case values by date range
Declaration
public virtual List<Tuple<string, DateTime, Tuple<DateTime?, DateTime?>, object, DateTime?, List<string>, Dictionary<string, object>>> GetCaseValues(string caseFieldName, DateTime? startDate = null, DateTime? endDate = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | caseFieldName | The case field name |
| DateTime? | startDate | The date after the case value was created |
| DateTime? | endDate | The date before the case value was created |
Returns
| Type | Description |
|---|---|
| List<Tuple<string, DateTime, Tuple<DateTime?, DateTime?>, object, DateTime?, List<string>, Dictionary<string, object>>> | Case values from the current period |
Remarks
Use nested tuples to reduce the tuple item count to 7
GetCycle(DateTime, int)
Get cycle by moment and offset
Declaration
public virtual Tuple<DateTime, DateTime> GetCycle(DateTime cycleMoment, int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | cycleMoment | The cycle moment |
| int | offset | The cycle offset: 0=current, -1=previous, 1=next |
Returns
| Type | Description |
|---|---|
| Tuple<DateTime, DateTime> | The offset cycle including the moment |
GetEmployeeAttribute(string)
Get employee attribute value
Declaration
public virtual object GetEmployeeAttribute(string attributeName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | attributeName | Name of the attribute |
Returns
| Type | Description |
|---|---|
| object | The employee attribute value |
GetEvaluationPeriod()
Get evaluation period
Declaration
public virtual Tuple<DateTime, DateTime> GetEvaluationPeriod()
Returns
| Type | Description |
|---|---|
| Tuple<DateTime, DateTime> |
GetLookup(string, string, string)
Get lookup value by key
Declaration
public virtual string GetLookup(string lookupName, string lookupKey, string culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | lookupName | The name of the lookup |
| string | lookupKey | The lookup value key |
| string | culture | The value culture |
Returns
| Type | Description |
|---|---|
| string | The lookup value matching tho the lookup key |
GetLookupRanges(string, decimal?)
Get payroll lookup range brackets
Declaration
public List<Tuple<string, string, decimal, decimal, decimal?>> GetLookupRanges(string lookupName, decimal? rangeValue = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | lookupName | The name of the lookup |
| decimal? | rangeValue | The range value (supported by threshold and progressive lookups) |
Returns
| Type | Description |
|---|---|
| List<Tuple<string, string, decimal, decimal, decimal?>> | List of lookup range brackets |
Remarks
Use nested tuples to reduce the tuple item count to 7
GetPeriod(DateTime, int)
Get period by moment and offset
Declaration
public virtual Tuple<DateTime, DateTime> GetPeriod(DateTime periodMoment, int offset)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | periodMoment | The period moment |
| int | offset | The period offset: 0=current, -1=previous, 1=next |
Returns
| Type | Description |
|---|---|
| Tuple<DateTime, DateTime> | The offset period including the moment |
GetRangeLookup(string, decimal, string, string)
Get lookup value by range
Declaration
public virtual string GetRangeLookup(string lookupName, decimal rangeValue, string lookupKey = null, string culture = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | lookupName | The name of the lookup |
| decimal | rangeValue | The range value |
| string | lookupKey | The lookup key |
| string | culture | The value culture |
Returns
| Type | Description |
|---|---|
| string | The lookup value matching tho the lookup key |
HasLookup(string)
Test for existing lookup
Declaration
public bool HasLookup(string lookupName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | lookupName | The name of the lookup |
Returns
| Type | Description |
|---|---|
| bool | True on existing lookup |