SetDaylight

Definition

Usage

Set whether to use daylight saving time (DST), start time and end time of DST.

Parameter

Device number

Whether to use DST. 1: use, 0: not use

Start time of DST, in format of mmdd hh:mm

End time of DST, in format of mmdd hh:mm

Return Value

Return True if it is successful, or return False.

Related Function

GetDaylight

 

Ejemplo

C#

        /// <summary>
        /// Set the beginning and ending of the daylight saving time,when you enable this fuction.
        /// </summary>
        /// <param name="Support">Whether to use DST. 1: use, 0: not use</param>
        /// <param name="BeginTime">Start time of DST, in format of mmdd hh:mm</param>
        /// <param name="EndTime">End time of DST, in format of mmdd hh:mm</param>
        /// <param name="IP"> Ip of device </param>
        /// <param name="Port"> Port of Device </param>
        /// <param name="MachineNumber"> Device Number </param>
        private void SetDaylight(int Support, string BeginTime, string EndTime, 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.SetDaylight(MachineNumber, Support, BeginTime, EndTime))
            {
                axCZKEM1.RefreshData(MachineNumber);//the data in the device should be refreshed
                MessageBox.Show("SetDaylight! ", "Success");
            }
        else
            {
                axCZKEM1.GetLastError(ref idwErrorCode);
                MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error");
            }
        }

VB

        ''' <summary>
        ''' Set the beginning and ending of the daylight saving time,when you enable this fuction.
        ''' </summary>
        ''' <param name="Support">Whether to use DST. 1: use, 0: not use</param>
        ''' <param name="BeginTime">Start time of DST, in format of mmdd hh:mm</param>
        ''' <param name="EndTime">End time of DST, in format of mmdd hh:mm</param>
        ''' <param name="IP"> Ip of device </param>
        ''' <param name="Port"> Port of Device </param>
        ''' <param name="MachineNumber"> Device Number </param>
        Private Sub SetDaylight(Support As Integer, BeginTime As String, EndTime 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.SetDaylight(MachineNumber, Support, BeginTime, EndTime) = True Then
            axCZKEM1.RefreshData(MachineNumber) 'the data in the device should be refreshed
            MsgBox("SetDaylight", MsgBoxStyle.Information, "Success")
        Else
            axCZKEM1.GetLastError(idwErrorCode)
            MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error")
        End If
        End Sub