You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

61 lines
1.8 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ShenTun.IcCard.Common;
using ShenTun.IcCard.Instance;
namespace ShenTun.IcCard
{
public class IcCardClient
{
public async Task<string> getReadCardAsync(RequestIcCardInterface req)
{
return await Task.Run(() => ReadCard(req));
}
private string ReadCard(RequestIcCardInterface req)
{
IDCardInfo info = new IDCardInfo();
Response res = new Response()
{
code = -100,
message = "",
};
try
{
IReadCard iReadCard = null;
if (req.IcCardInterface.Equals(1))
{
iReadCard = new ReadCardByYT100();
}
else if (req.IcCardInterface.Equals(2))
{
iReadCard = new ReadCardByDCT10D();
}
else if (req.IcCardInterface.Equals(3))
{
iReadCard = new ReadCardByIDR210();
}
else if (req.IcCardInterface.Equals(4))
{
iReadCard = new ReadCardByHXFDX3S();
}
if (BaseData.nList.Count == 0) BaseData.CreateNationList();
if (BaseData.sList.Count == 0) BaseData.CreateSexList();
res = iReadCard.GetReadCard();
}
catch (Exception err)
{
res.code = -100;
res.message = "系统级错误,读卡失败";
MessageBox.Show(err.Message);
}
return JsonHelper.SerializeObject(res);
}
}
}