Class UserSession
A class to hold information on the currently logged on user. It also provides methods for date and time formatting using the users preferences and other useful options.
public class UserSession
- Inheritance
-
UserSession
- Inherited Members
Properties
this[UserOptions]
Gets or sets the value of the current users preference for various options.
public string this[UserOptions fieldName] { get; set; }
Parameters
fieldName
UserOptionsThe name of the preference option - use Sage.UserOptions for full list of available options ParamNames.
Property Value
- string
The value of that option.
this[string]
Get or set the value of the current users preference for various options.
public string this[string fieldName] { get; set; }
Parameters
fieldName
stringThe name of the preference option.
Property Value
- string
The value of that option.
Logon
The logon name of the current user (readonly).
public string Logon { get; }
Property Value
TeamId
The Team ID of the current user (readonly).
public int TeamId { get; }
Property Value
TeamName
The Team name of the current user (readonly).
public string TeamName { get; }
Property Value
Teams
Return the Teams of the current user.
public List<string> Teams { get; }
Property Value
TerritoryId
The Primary Territory ID of the current user (readonly).
public double TerritoryId { get; }
Property Value
UserEmailAddress
The email address of the current user (readonly).
public string UserEmailAddress { get; }
Property Value
UserId
The ID of the current user from the user's table (readonly).
public int UserId { get; }
Property Value
UserLanguage
The language code for the current user (readonly).
public string UserLanguage { get; }
Property Value
UserName
The current user's full name (First Name + Last Name) (readonly).
public string UserName { get; }
Property Value
UserPhone
The current user's phone number (readonly).
public string UserPhone { get; }
Property Value
Methods
HasInfoAdminRight(InfoAdminRights)
Check if the user has various "Info Admin" rights. String constants for these rights are declared in Sage.InfoAdminRights.
public bool HasInfoAdminRight(InfoAdminRights infoAdminRight)
Parameters
infoAdminRight
InfoAdminRights
Returns
HasRights(PermissionType, string)
Check if the current user has access rights to a given table.
public bool HasRights(PermissionType perType, string tableName)
Parameters
perType
PermissionTypeThe Permission Type. Can be Insert/Update/Delete see Sage.PermissionType for details.
tableName
stringThe table to check, must be a primary table.
Returns
IsAdmin()
Check if the current user has Admin Rights.
public bool IsAdmin()
Returns
- bool
True if the user has admin rights.
IsInfoAdmin()
Returns true if the user has "Info Admin" rights.
public bool IsInfoAdmin()
Returns
IsInRange(PermissionType, string, int, int, int, int)
Check whether a specific record is within a users security view for the given permission type.
public bool IsInRange(PermissionType perType, string tableName, int territoryId, int userId, int teamId, int createdByUserId)
Parameters
perType
PermissionTypePermission type to check eg Edit/Insert/Delete see Sage.PermissionType for details.
tableName
stringTablename, must be a primary entity.
territoryId
intTerritory ID of the record.
userId
intAssiged to user of the record.
teamId
intTeam ID of the record.
createdByUserId
intCreated by user of the record.
Returns
SessionRead(string)
Returns one object added to the user session.
public object SessionRead(string key)
Parameters
key
string
Returns
SessionWrite(string, object)
Write a value to the user session.
public void SessionWrite(string key, object value)
Parameters
Remarks
Complex objects like class needs to be serialized before adding to the user session and deserialized later.
VirtualImgPath()
Path to images to be used in HTML pages. For example /crm62/Themes/img/default/. The path must always end with '/'.
public string VirtualImgPath()