Protected Sub btnxieka_Click(sender As Object, e As EventArgs)
If Xieka() Then
myLib.PublicModule.Javascript.AlertAndRedirect("写卡成功!", "CardList2.aspx")
Else
myLib.PublicModule.Javascript.Alert("写入失败!", True)
Return
End If
End Sub
Private Function Xieka() As Boolean
'写入磁卡的内容(业主ID,业主姓名,卡号,卡号ID)
Dim ownerid As String = Me.txtOwnerID.Value
Dim cardnumber As String = Me.txtCardNumber.Text
Dim cardguid As String = Me.ViewStateCardGuid
Dim key As String = ownerid & "," & cardnumber & "," & cardguid
Dim b As Boolean = DUKa.WriteIn(key)
Return b
End Function
Private Sub Button3_Click(sender As Object, e As EventArgs)
Try
Dim msg As String = ""
Dim b As Boolean = DUKa.ReadCard("", msg)
'D8读卡
If b Then
Dim cardlist As String() = msg.Split(","C)
'三个参数:业主id,卡号,卡号id
Dim dtable As New DataTable()
dtable = bll.GetOwnerInfo(Convert.ToInt32(cardlist(0)))
If dtable IsNot Nothing Then
Me.txtCardNumber.Text = cardlist(1).ToString()
Me.txtOwnerName.Text = dtable.Rows(0)("OwnerName").ToString()
Me.cardid = Convert.ToInt32(cardlist(2).ToString())
Me.ownerid = Convert.ToInt32(cardlist(0).ToString())
End If
Else
MessageBox.Show("读卡失败")
End If
Catch
MessageBox.Show("读卡失败")
End Try
End Sub