/// <summary> /// 添加用户 /// </summary> /// <returns>true:成功 false:失败</returns> public bool AddCardUser(CHDUserInfo userInfo) { bool b = false; if (userInfo != null) { CHDOperate op = GetOPByIP(userInfo.DeviceIp); //CHDDoorUseInfo info = GetUseInfo(userInfo.DeviceIp); if (null != op) { if (op.isLinkOn) { b = op.AddUser(userInfo); return(b); } else { TextMsg?.Invoke(string.Format("门禁主机 {0} 添加用户失败,无权限,请稍后再试···", userInfo.DeviceIp)); op.LinkOn(); } } } TextMsg?.Invoke(string.Format("门禁主机 {0} 添加用户失败,设备无法通讯,请稍后再试···", userInfo.DeviceIp)); return(b); }
/// <summary> /// 获取用户信息根据卡号 /// </summary> /// <param name="cardNo">用户卡号</param> /// <param name="deviceIp">门禁主机ip</param> /// <returns>返回卡用户信息</returns> public CHDUserInfo GetUserInfoByCard(string cardNo, string deviceIp) { CHDOperate op = GetOPByIP(deviceIp); CHDUserInfo info = new CHDUserInfo(); if (null != op && !string.IsNullOrWhiteSpace(deviceIp)) { if (op.isLinkOn) { info = op.GetUserInfoByCard(cardNo); return(info); } else { TextMsg?.Invoke(string.Format("门禁主机 {0} 获取卡 {1} 用户失败,无权限,请稍后再试···", deviceIp, cardNo)); } } TextMsg?.Invoke(string.Format("门禁主机 {0} 获取卡 {1} 用户失败,设备无法通讯,请稍后再试···", deviceIp, cardNo)); return(null); }