真心感谢狐爸帮忙将全局代码搞定,但目前急于测试是否能调用。所以我不得不再贴上一段C#的write和read代码。麻烦狐爸看看,然后帮忙转换一下。万分感谢!
写卡:
protected void btnxieka_Click(object sender, EventArgs e)
{
if (Xieka())
{
myLib.PublicModule.Javascript.AlertAndRedirect("写卡成功!", "CardList2.aspx");
}
else
{
myLib.PublicModule.Javascript.Alert("写入失败!", true);
return;
}
}
private bool Xieka()
{
//写入磁卡的内容(业主ID,业主姓名,卡号,卡号ID)
string ownerid = this.txtOwnerID.Value;
string cardnumber = this.txtCardNumber.Text;
string cardguid = this.ViewStateCardGuid;
string key = ownerid + "," + cardnumber + "," + cardguid;
bool b = DUKa.WriteIn(key);
return b;
}
读卡:
private void Button3_Click(object sender, EventArgs e)
{
try
{
string msg = "";
bool b = DUKa.ReadCard("", out msg);//D8读卡
if (b)
{
string[] cardlist = msg.Split(',');//三个参数:业主id,卡号,卡号id
DataTable dtable = new DataTable();
dtable = bll.GetOwnerInfo(Convert.ToInt32(cardlist[0]));
if (dtable != null)
{
this.txtCardNumber.Text = cardlist[1].ToString();
this.txtOwnerName.Text = dtable.Rows[0]["OwnerName"].ToString();
this.cardid = Convert.ToInt32(cardlist[2].ToString());
this.ownerid = Convert.ToInt32(cardlist[0].ToString());
}
}
else
{
MessageBox.Show("读卡失败");
}
}
catch {
MessageBox.Show("读卡失败");
}
}