中控考勤机-C#操作
引用:Interop.zkemkeeper.dll
实例化:
public zkemkeeper.CZKEM axCZKEM1 = new zkemkeeper.CZKEM();
首先从数据库中获取考勤机列表:表名“Machines”;
连接考勤机:
bool bIsConnected = axCZKEM1.Connect_Net(machines.IP, machines.Port);
machines.IP : 考勤机IP machines.Port : 连接端口 默认 4370
获取考勤机中人员ID:
1:将数据读取到内存
axCZKEM1.ReadAllUserID(machines.ID);
2:从内存中获取用户
int iEnrollNumber = 0; int iEMachineNumber = 0; int iBackupNumber = 0; int iPrivilege = 0; int iEnabled = 0; while (axCZKEM1.GetAllUserID(machines.ID, ref iEnrollNumber, ref iEMachineNumber, ref iBackupNumber, ref iPrivilege, ref iEnabled)) { userIDList.Add(iEnrollNumber); }
删除指定用户
if (axCZKEM1.DeleteEnrollData(machines.ID, u, 1, 12)) { txtDelete.AppendText(machines.MachineAlias + " " + u.ToString() + " 门禁删除成功! " + "\r\n\r\n"); }
machines.ID : 设备号 u : 用户编号