Add Method (ShiftSchedule)
- Last UpdatedNov 06, 2025
- 5 minute read
The Add() method adds a shift schedule record to the Shift_Schedule table.
'Declaration
Public Shared Sub Add( _
ByVal sessionId As Integer, _
ByVal patternId As Integer, _
ByVal startTime As Date, _
ByVal endTime As Date, _
ByVal endDaySpan As Integer, _
ByVal shiftId As Integer, _
ByVal sunday As Boolean, _
ByVal monday As Boolean, _
ByVal tuesday As Boolean, _
ByVal wednesday As Boolean, _
ByVal thursday As Boolean, _
ByVal friday As Boolean, _
ByVal saturday As Boolean, _
ByVal break1Start As Nullable(Of Date), _
ByVal break1End As Nullable(Of Date), _
ByVal break2Start As Nullable(Of Date), _
ByVal break2End As Nullable(Of Date), _
ByVal break3Start As Nullable(Of Date), _
ByVal break3End As Nullable(Of Date), _
ByVal spare1 As String, _
ByVal spare2 As String, _
ByVal spare3 As String, _
ByVal spare4 As String, _
ByVal spare5 As String, _
ByVal spare6 As String, _
ByRef lastEditAt As Date _
)
'Usage
Dim sessionId As Integer
Dim patternId As Integer
Dim startTime As Date
Dim endTime As Date
Dim endDaySpan As Integer
Dim shiftId As Integer
Dim sunday As Boolean
Dim monday As Boolean
Dim tuesday As Boolean
Dim wednesday As Boolean
Dim thursday As Boolean
Dim friday As Boolean
Dim saturday As Boolean
Dim break1Start As Nullable(Of Date)
Dim break1End As Nullable(Of Date)
Dim break2Start As Nullable(Of Date)
Dim break2End As Nullable(Of Date)
Dim break3Start As Nullable(Of Date)
Dim break3End As Nullable(Of Date)
Dim spare1 As String
Dim spare2 As String
Dim spare3 As String
Dim spare4 As String
Dim spare5 As String
Dim spare6 As String
Dim lastEditAt As Date
ShiftSchedule.Add(sessionId, patternId, startTime, endTime, endDaySpan, shiftId, sunday, monday, tuesday, wednesday, thursday, friday, saturday, break1Start, break1End, break2Start, break2End, break3Start, break3End, spare1, spare2, spare3, spare4, spare5, spare6, lastEditAt)
public static void Add(
int sessionId,
int patternId,
DateTime startTime,
DateTime endTime,
int endDaySpan,
int shiftId,
bool sunday,
bool monday,
bool tuesday,
bool wednesday,
bool thursday,
bool friday,
bool saturday,
Nullable<DateTime> break1Start,
Nullable<DateTime> break1End,
Nullable<DateTime> break2Start,
Nullable<DateTime> break2End,
Nullable<DateTime> break3Start,
Nullable<DateTime> break3End,
string spare1,
string spare2,
string spare3,
string spare4,
string spare5,
string spare6,
out DateTime lastEditAt
)
Parameters
- sessionId
- Required. Holds the session ID and thus the user who is making this method call.
- patternId
- Required. Holds the ID of the shift pattern to which the shift is assigned.
- startTime
- Required. Holds the shift's start time (the date portion of the parameter is ignored). When the shift pattern for this shift schedule is assigned to entities, this time is considered to be in the local time specific to each entity.
- endTime
- Required. Holds the shift's end time (the date portion of the parameter is ignored). When the shift pattern for this shift schedule is assigned to entities, this time is considered to be in the local time specific to each entity.
- endDaySpan
Required. Holds the shift's end day span.
For a shift that spans one or more days, this property specifies the number of days beyond the start day of the day the shift ends. A shift can span up to 6 additional days. If the shift does not span into another day, set the value to 0.
- shiftId
- Required. Holds the ID of the shift to which the schedule applies.
- sunday
- Required. Holds a flag that, if set to true, specifies that the shift is enabled on Sunday.
- monday
- Required. Holds a flag that, if set to true, specifies that the shift is enabled on Monday.
- tuesday
- Required. Holds a flag that, if set to true, specifies that the shift is enabled on Tuesday.
- wednesday
- Required. Holds a flag that, if set to true, specifies that the shift is enabled on Wednesday.
- thursday
- Required. Holds a flag that, if set to true, specifies that the shift is enabled on Thursday.
- friday
- Required. Holds a flag that, if set to true, specifies that the shift is enabled on Friday.
- saturday
- Required. Holds a flag that, if set to true, specifies that the shift is enabled on Saturday.
- break1Start
- Optional. Holds the shift's break1 start time (the date portion of the parameter is ignored).
- break1End
- Optional. Holds the shift's break1 end time (the date portion of the parameter is ignored).
- break2Start
- Optional. Holds the shift's break2 start time (the date portion of the parameter is ignored).
- break2End
- Optional. Holds the shift's break2 end time (the date portion of the parameter is ignored).
- break3Start
- Optional. Holds the shift's break3 start time (the date is portion of the parameter ignored).
- break3End
- Optional. Holds the shift's break3 end time (the date portion of the parameter is ignored).
- spare1
- Optional. Holds user-defined content for the spare1 field. Defaults to null.
- spare2
- Optional. Holds user-defined content for the spare2 field. Defaults to null.
- spare3
- Optional. Holds user-defined content for the spare3 field. Defaults to null.
- spare4
- Optional. Holds user-defined content for the spare4 field. Defaults to null.
- spare5
- Optional. Holds user-defined content for the spare5 field. Defaults to null.
- spare6
- Optional. Holds user-defined content for the spare6 field. Defaults to null.
- lastEditAt
- Output. Holds the returned date/time 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.
For a given shift pattern, there will be a shift schedule record for each unique combination of a shift that is assigned to the pattern, the shift's start time, and the shift's end time. For example, if the Morning shift is assigned to a shift pattern, there will be a unique shift record that includes the shift pattern ID, the Morning shift ID, and the shift start time.
Note the following:
- A shift can be assigned to a shift pattern more than once, as long as the start or end times are different. For example, the Morning shift could be assigned to the same shift pattern twice, as long as each instance has a different start or end time.
- Only regular shift patterns and overtime shift patterns can have shift schedules assigned to them. Holiday shift patterns will generate shift history records with the "no shift" or shift 0 ID.