LogOff(Int32,String,Nullable<Int32>,Nullable<DateTime>) Method
- Last UpdatedNov 06, 2025
- 2 minute read
The LogOff() method logs the user off a specific entity or all entities that they are logged on to within a session.
If an entity is being specified, this overload of the method specifies the entity by its ID.
'Declaration
Public Overloads Shared Sub LogOff( _
ByVal sessionId As Integer, _
ByVal userId As String, _
ByVal entId As Nullable(Of Integer), _
ByVal logOffTime As Nullable(Of Date) _
)
'Usage
Dim sessionId As Integer
Dim userId As String
Dim entId As Nullable(Of Integer)
Dim logOffTime As Nullable(Of Date)
Session.LogOff(sessionId, userId, entId, logOffTime)
public static void LogOff(
int sessionId,
string userId,
Nullable<int> entId,
Nullable<DateTime> logOffTime
)
Parameters
- sessionId
Required. Holds the session ID and thus the user who is making this method call.
- userId
- Required. Holds the ID of the user who is being logged off one or more entities.
- entId
- Optional. Holds the ID of the entity from which to log off the user. Set to null to log the user off all entities that they are logged on to.
- logOffTime
- Optional. Holds the actual date/time the logoff took place. Defaults to Now. This is useful when importing logoff data from external timekeeping systems.
This method removes relevant entries from the Ent_Logon table. If the entId is excluded, then the method logs this user off all entities that they are logged on to. If the entId is specified, then the user is logged off the specified entity.
Note that this user can still be the active user on this session even though they are no longer be logged on to any entities. Another user would need to SwitchUser or Login to become the active user on the session; ending the session would obviously log the user out of the session.
If the labor collection module is licensed, this method also updates the durations and closes off the relevant entries in the Labor_Usage table. If a value for the LogOffTime is supplied, then this value must be before the current date and time, otherwise the current date and time is used. If a valid LogOffTime is included, then all labor tracking data will be based on this specified time.