Set the device time (or specify the time).
Device number.
Date and time to be set.
Return True if it is successful, or return False.
SetDeviceTime, GetDeviceTime
/// <summary> /// Set the device time (or specify the time). /// </summary> /// <param name="idwYear">Year to set</param> /// <param name="idwMonth">Month to set</param> /// <param name="idwDay">Day to set</param> /// <param name="idwHour">Hour to set</param> /// <param name="idwMinute">Minute to set</param> /// <param name="idwSecond">Second to set</param> /// <param name="IP"> Device IP</param> /// <param name="Port">Port of device</param> /// <param name="MachineNumber">Device number</param> private void SetDeviceTime2(int idwYear = 0, int idwMonth = 0, int idwDay = 0, int idwHour = 0, int idwMinute = 0, int idwSecond = 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; Cursor = Cursors.WaitCursor; if (axCZKEM1.SetDeviceTime2(MachineNumber, idwYear, idwMonth, idwDay, idwHour, idwMinute, idwSecond)) { axCZKEM1.RefreshData(MachineNumber);//the data in the device should be refreshed MessageBox.Show("Successfully set the time of the machine as you have set!", "Error"); } else { axCZKEM1.GetLastError(ref idwErrorCode); MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error"); } }
Private Sub SetDeviceTime2(Optional idwYear As Integer = 0, Optional idwMonth As Integer = 0, Optional idwDay As Integer = 0, Optional idwHour As Integer = 0, Optional idwMinute As Integer = 0, Optional idwSecond As Integer = 0, 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.SetDeviceTime2(MachineNumber, idwYear, idwMonth, idwDay, idwHour, idwMinute, idwSecond) = True Then axCZKEM1.RefreshData(MachineNumber) 'the data in the device should be refreshed MsgBox("Successfully set the time of the machine as you have set!", MsgBoxStyle.Information, "Success") Else axCZKEM1.GetLastError(idwErrorCode) MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error") End If End Sub