Set a short message of a user, that is, allocate the short message with the specified number in the device to a specific user.
Device number
User ID
Short message number
Return True if it is successful, or return False.
SetSMS, GetSMS, DeleteSMS, ClearSMS
Only TFT devices support this function. For black & white devices, see ssr_SetUserSMS.
/// <summary> /// Set a certain user's corresponding short message /// You should input the two parameters: the user's enrollnumber(ID) and the short message's ID. /// </summary> /// <param name="SMSID">Short message number</param> /// <param name="EnrollNumber">User ID</param> /// <param name="IP"> Ip of device </param> /// <param name="Port"> Port of Device </param> /// <param name="MachineNumber"> Device Number </param> private void SSR_SetUserSMS(int SMSID, string EnrollNumber, 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 Tag = 0; int ValidMins = 0; string StartTime = ""; string Content = ""; if (axCZKEM1.GetSMS(MachineNumber, SMSID, ref Tag, ref ValidMins, ref StartTime, ref Content) == false) { MessageBox.Show("The SMSID doesn't exist!!", "Error"); return; } if (axCZKEM1.SSR_SetUserSMS(MachineNumber, EnrollNumber, SMSID)) { axCZKEM1.RefreshData(MachineNumber);//After you have set user short message,you should refresh the data of the device MessageBox.Show("Successfully Set user SMS! ", "Success"); } else { axCZKEM1.GetLastError(ref idwErrorCode); MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error"); } }
''' <summary> ''' Set a certain user's corresponding short message ''' You should input the two parameters: the user 's enrollnumber(ID) and the short message's ID. ''' </summary> ''' <param name="SMSID">Short message number</param> ''' <param name="EnrollNumber">User ID</param> ''' <param name="IP"> Ip of device </param> ''' <param name="Port"> Port of Device </param> ''' <param name="MachineNumber"> Device Number </param> Private Sub SSR_SetUserSMS(SMSID As Integer, EnrollNumber 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 SMSID doesn't exist!", MsgBoxStyle.Exclamation, "Error") Return End If If axCZKEM1.SSR_SetUserSMS(MachineNumber, EnrollNumber, SMSID) = True Then axCZKEM1.RefreshData(MachineNumber) 'the data in the device should be refreshed MsgBox("Successfully Set user SMS!", MsgBoxStyle.Information, "Success") Else axCZKEM1.GetLastError(idwErrorCode) MsgBox("Operation failed,ErrorCode=" & idwErrorCode.ToString(), MsgBoxStyle.Exclamation, "Error") End If End Sub