Define the work code with the specified number. Note: Black & white devices support work
codes in all ranges. However, after this function is used to define work codes, only the work
codes within the defined range can be input. For example:
SetWorkCode (1, 345)
SetWorkCode (2, 567)
In the preceding example, only the work codes 345 and 567 can be input.
ID of a work code
ID of the work code described by WorkCodeID.
Return True if it is successful, or return False.
GetWorkCode
/// <summary> /// Set the workcode specified id. /// </summary> /// <param name="AWorkCode">ID of the work code described by WorkCodeID</param> /// <param name="WorkCodeID">ID of a work code</param> /// <param name="IP"> Ip of device </param> /// <param name="Port"> Port of Device </param> /// <param name="MachineNumber"> Device Number </param> private void SetWorkCode(int AWorkCode,int WorkCodeID, 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.SetWorkCode(WorkCodeID, AWorkCode)) { axCZKEM1.RefreshData(MachineNumber);//the data in the device should be refreshed MessageBox.Show("SetWorkCode!", "Success"); } else { axCZKEM1.GetLastError(ref idwErrorCode); MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error"); } }
''' <summary> ''' Set the workcode specified id. ''' </summary> ''' <param name="AWorkCode"></param> ''' <param name="WorkCodeID"></param> ''' <param name="IP"> Ip of device </param> ''' <param name="Port"> Port of Device </param> ''' <param name="MachineNumber"> Device Number </param> Private Sub SetWorkCode(AWorkCode As Integer, WorkCodeID 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.SetWorkCode(WorkCodeID, AWorkCode) = True Then axCZKEM1.RefreshData(MachineNumber) 'the data in the device should be refreshed MsgBox("SetWorkCode!", MsgBoxStyle.Information, "Success") Else axCZKEM1.GetLastError(idwErrorCode) MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error") End If End Sub