GetUserGroup

Definition

Usage

Obtain the number of the group to which a specified user belongs.

Parameter

Device number

User ID

Group number of the user described by dwEnrollNumber. The value ranges from 1 to 5.

Return Value

Return True if it is successful, or return False.

Related Function

SetUserGroup

 

Ejemplo

C#

    /// <summary>
    /// Get the group number the specified user belongs to. 
    /// </summary>
    /// <param name="iUserGrp">Group number of the user described by dwEnrollNumber. The value ranges from 1 to 5.</param>
    /// <param name="IP"> Ip of device </param>
    /// <param name="Port"> Port of Device </param>
    /// <param name="MachineNumber"> Device Number </param>
    private void GetUserGroup(int iUserGrp = 0, string IP = "10.0.0.44", int Port = 4370, int MachineNumber = 1)
        {
    //Create Standalone SDK class dynamicly.
            zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
            axCZKEM1.Connect_Net(IP, Port);
    int idwErrorCode = 0;
    int userId = 0;
    if (axCZKEM1.GetUserGroup(MachineNumber, userId, ref iUserGrp))
            {
                MessageBox.Show("The user group id id=" + userId.ToString(), "Success");
            }
    else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
                MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error");
            }
        }

VB

    ''' <summary>
    ''' Get the group number the specified user belongs to. 
    ''' </summary>
    ''' <param name="UserGrp">Group number of the user described by dwEnrollNumber. The value ranges from 1 to 5.</param>
    ''' <param name="IP"> Ip of device </param>
    ''' <param name="Port"> Port of Device </param>
    ''' <param name="MachineNumber"> Device Number </param>
    Private Sub GetUserGroup(Optional UserGrp As Integer = 0, Optional IP As String = "10.0.0.44", Optional Port As Integer = 4370, Optional MachineNumber As Integer = 1)
    'Create Standalone SDK class dynamicly.
    Dim axCZKEM1 As New zkemkeeper.CZKEM
        axCZKEM1.Connect_Net(IP, Port)
    Dim idwErrorCode As Integer = 0
    Dim userId As Integer = 0
    If axCZKEM1.GetUserGroup(MachineNumber, userId, UserGrp) = True Then
            MsgBox("User Group:" & UserGrp.ToString(), MsgBoxStyle.Information, "Success")
    Else
            axCZKEM1.GetLastError(idwErrorCode)
            MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error")
    End If
    End Sub