SSR_SetWorkCode

Definition

Usage

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.

Parameter

ID of a work code

ID of the work code described by WorkCodeID

Return Value

Return True if it is successful, or return False.

Related Function

GetWorkCode

 

Ejemplo

C#

        /// <summary>
        /// Set the workcode specified Name.
        /// </summary>
        /// <param name="AWorkCodeID">ID of a work code</param>
        /// <param name="AWorkCode">ID of the work code described by WorkCodeID</param>
        /// <param name="IP"> Ip of device </param>
        /// <param name="Port"> Port of Device </param>
        /// <param name="MachineNumber"> Device Number </param>
        private void SSR_SetWorkCode(int WorkCodeID, string AWorkCode, 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.SSR_SetWorkCode(WorkCodeID, AWorkCode))
            {
                axCZKEM1.RefreshData(MachineNumber); //the data in the device should be refreshed
                MessageBox.Show("SetWorkCode!Name=" + AWorkCode, "Success");
            }
        else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
                MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error");
            }
        }

VB

        ''' <summary>
        ''' Set the workcode specified Name.
        ''' </summary>
        ''' <param name="WorkCodeID">ID of a work code</param>
        ''' <param name="AWorkCode">ID of the work code described by 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(WorkCodeID As Integer, AWorkCode As String, Optional IP As String = "10.0.0.44", Optional Port As Integer = 4370, Optional MachineNumber As Integer = 1)
        Dim idwErrorCode As Integer = 0
        'Create Standalone SDK class dynamicly.
        Dim axCZKEM1 As New zkemkeeper.CZKEM
        axCZKEM1.Connect_Net(IP, Convert.ToInt32(Port))
        If axCZKEM1.SSR_SetWorkCode(WorkCodeID, AWorkCode) = True Then
            axCZKEM1.RefreshData(MachineNumber) 'the data in the device should be refreshed
            MsgBox("SetWorkCode!Name=" + AWorkCode, MsgBoxStyle.Information, "Success")
        Else
            axCZKEM1.GetLastError(idwErrorCode)
            MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error")
        End If
        End Sub