Delete a short message with the specified number from the device.
Device number
Short message number
Return True if it is successful, or return False.
SetSMS, ClearSMS
/// <summary> /// Delete the short message by its id. /// You should input the id of the short message that you want to delete /// </summary> /// <param name="SMSID">Short message number</param> /// <param name="IP"> Ip of device </param> /// <param name="Port"> Port of Device </param> /// <param name="MachineNumber"> Device Number </param> private void DeleteSMS(int SMSID, 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; int iTag = 0; int iValidMins = 0; string sStartTime = ""; string sContent = ""; if (axCZKEM1.GetSMS(MachineNumber, SMSID, ref iTag, ref iValidMins, ref sStartTime, ref sContent) == false) { MessageBox.Show("The SMS doesn't exist!", "Error"); return; } if (axCZKEM1.DeleteSMS(MachineNumber, SMSID)) { axCZKEM1.RefreshData(MachineNumber);//After you have delete the short message,you should refresh the data of the device MessageBox.Show("Successfully Delete corresponding SMS! ", "Success"); } else { axCZKEM1.GetLastError(ref idwErrorCode); MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error"); } }
''' <summary> ''' Delete the short message by its id. ''' You should input the id of the short message that you want to delete ''' </summary> ''' <param name="SMSID">Short message number</param> ''' <param name="IP"> Ip of device </param> ''' <param name="Port"> Port of Device </param> ''' <param name="MachineNumber"> Device Number </param> Private Sub DeleteSMS(SMSID As Integer, 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)) Dim Tag As Integer Dim ValidMins As Integer Dim StartTime As String = "" Dim Content As String = "" If axCZKEM1.GetSMS(MachineNumber, SMSID, Tag, ValidMins, StartTime, Content) = False Then MsgBox("The SMS doesn't exist! ", MsgBoxStyle.Exclamation, "Error") Return End If If axCZKEM1.DeleteSMS(MachineNumber, SMSID) = True Then axCZKEM1.RefreshData(MachineNumber) 'After you have delete the short message,you should refresh the data of the device MsgBox("Successfully Delete corresponding SMS!", MsgBoxStyle.Information, "Success") Else axCZKEM1.GetLastError(idwErrorCode) MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error") End If End Sub