我使用axCZKEM1_OnAttTransactionEx(string EnrollNumber,int IsInValid,int AttState,int VerifyMethod,int Year,int Month,int Day,int Hour,int Minute,int Second,int WorkCode)将数据插入db,但找不到设备编号。我需要知道是哪台机器触发了此事件。
我已经通过axCZKEM数组完成了,事件运行正常,但是无法获取触发机器的ip
For i = 0 To LsvMachines.Items.Count - 1
If LsvMachines.Items(i).SubItems(2).Text = "Connected" Then
axCZKEMiu(Val(LsvMachines.Items(i).SubItems(3).Text)).Disconnect()
RemoveHandler axCZKEMiu(Val(LsvMachines.Items(i).SubItems(3).Text)).OnAttTransactionEx, AddressOf AxCZKEM1_OnAttTransactionEx
bIsConnected = False
LsvMachines.Items(i).SubItems(2).Text = "Connect"
Else
ReDim Preserve axCZKEMiu(mIndex)
axCZKEMiu(mIndex) = New zkemkeeper.CZKEM
bIsConnected = axCZKEMiu(mIndex).Connect_Net(LsvMachines.Items(i).Text, 4370) 'IP , Port
If bIsConnected = True Then
LsvMachines.Items(i).SubItems(2).Text = "Connected"
LsvMachines.Items(i).SubItems(3).Text = mIndex
If axCZKEMiu(mIndex).RegEvent(1, 65535) = True Then
'Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all)
AddHandler axCZKEMiu(mIndex).OnAttTransactionEx, AddressOf AxCZKEM1_OnAttTransactionEx
End If
mIndex = mIndex + 1
bIsConnected = False
End If
End If
Next
#Region "RealTime Events"
Private Sub AxCZKEM1_OnAttTransactionEx(ByVal sEnrollNumber As String, ByVal iIsInValid As Integer, ByVal iAttState As Integer, ByVal iVerifyMethod As Integer, _
ByVal iYear As Integer, ByVal iMonth As Integer, ByVal iDay As Integer, ByVal iHour As Integer, ByVal iMinute As Integer, ByVal iSecond As Integer, ByVal iWorkCode As Integer)
'I want to get ip address of triggered machine before saving
End Sub
#End Region
答案 0 :(得分:0)
您不能通过IP连接解决方案定义计算机ID,只需为其分配编号1。但是您可以使用IP地址来标识计算机。
namespace XXXXX
{
internal class DeviceInfo
{
public string IPAddress { get; set; }
public string Port { get; set; }
public string MachineNumber { get; set; }
}
}