Set the group to which a specified user belongs.
Device number
User ID
Group number. The value ranges from 1 to 5.
Return True if it is successful, or return False.
GetUserGroup
/// <summary> /// Set the group number by the specified user.  /// </summary> /// <param name="UserID">User ID</param> /// <param name="UserGrp">Group number. 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 SetUserGroup(int UserID, int UserGrp, 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; if (axCZKEM1.SetUserGroup(MachineNumber, UserID, UserGrp)) { axCZKEM1.RefreshData(MachineNumber);//the data in the device should be refreshed MessageBox.Show("SetUserGroup,UserID:" + UserID.ToString() + " UserGrp:" + UserGrp.ToString(), "Success"); } else { axCZKEM1.GetLastError(ref idwErrorCode); MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error"); } }
''' <summary> ''' Set the group number by the specified user. ''' </summary> ''' <param name="userId">User ID</param> ''' <param name="UserGrp">Group number. 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 SetUserGroup(userId As Integer, UserGrp As Integer, 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 If axCZKEM1.SetUserGroup(MachineNumber, userId, UserGrp) = True Then axCZKEM1.RefreshData(MachineNumber) 'the data in the device should be refreshed MsgBox("SetUserGroup, UserID:" & userId.ToString() & " UserGrp:" & UserGrp.ToString(), MsgBoxStyle.Information, "Success") Else axCZKEM1.GetLastError(idwErrorCode) MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error") End If End Sub