Add Method (ShiftPattern)
- Last UpdatedNov 06, 2025
- 3 minute read
The Add() method adds a shift pattern record to the Shift_Pattern table.
'Declaration
Public Shared Sub Add( _
ByVal sessionId As Integer, _
ByVal patternName As String, _
ByVal startEffLocal As Date, _
ByVal endEffLocal As Nullable(Of Date), _
ByVal recurring As Boolean, _
ByVal additive As Boolean, _
ByVal enabled As Boolean, _
ByVal comments As String, _
ByRef patternId As Integer, _
ByRef lastEditAt As Date _
)
'Usage
Dim sessionId As Integer
Dim patternName As String
Dim startEffLocal As Date
Dim endEffLocal As Nullable(Of Date)
Dim recurring As Boolean
Dim additive As Boolean
Dim enabled As Boolean
Dim comments As String
Dim patternId As Integer
Dim lastEditAt As Date
ShiftPattern.Add(sessionId, patternName, startEffLocal, endEffLocal, recurring, additive, enabled, comments, patternId, lastEditAt)
public static void Add(
int sessionId,
string patternName,
DateTime startEffLocal,
Nullable<DateTime> endEffLocal,
bool recurring,
bool additive,
bool enabled,
string comments,
out int patternId,
out DateTime lastEditAt
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
- patternName
- Required. Holds the shift pattern name.
- startEffLocal
- Required. Holds the effective local start time of the shift pattern.
- endEffLocal
- Optional. Holds effective local end time of the shift pattern.
- recurring
- Required. Holds a flag that, if set to true, specifies that the pattern's shift schedule is recurring (a regular or overtime shift) within its effective time period. If set to false, specifies that the pattern is a holiday exception and that it cannot have a shift schedule.
- additive
- Required. Holds a flag that, if set to true, specifies that the shift is additive (Overtime). If set to false, specifies that the shift is a regular shift. Only used when recurring is true.
- enabled
- Required. Holds a flag that, if set to true, specifies that the shift pattern is enabled.
- comments
- Optional. Holds comments about the shift pattern.
- patternId
- Output. Holds the returned shift pattern ID number.
- lastEditAt
- Output. Holds the returned datetime when this record was added. The lastEditAt parameter is used by other methods that modify or delete this type of record for optimistic concurrency control.
Observe the following input parameter rules:
- Required non-DB* parameters: Must pass a value. Cannot be empty or null.
- Optional non-DB* parameters: Either enter a value or use the default, if one has been defined for the object being added, by passing a null.
- Required DB* parameters: Must pass a value. To enter an empty value for the parameter, pass DB*.null (e.g., DBInt.null).
- Optional DB* parameters: To enter no value for the parameter, pass DB*.null (e.g., DBInt.null). To use the default value for the parameter if one has been defined for the object being added, pass a null.
How the recurring and additive Flags Determine the Shift Pattern Type
- If recurring is true and additive is false, the pattern is a recurring (regular) shift.
- If recurring is true and additive is true, the pattern is an overtime pattern.
- If recurring is false and additive is false, the pattern is a holiday pattern.
- The system does not allow for recurring to be false and additive to be true, so the add will set recurring to 1 in this case.