/// <summary> /// 下发用户卡和人脸数据 /// </summary> /// <param name="message"></param> /// <param name="deviceIPAddr"></param> /// <param name="devicePort"></param> /// <param name="userInfo"></param> /// <param name="user"></param> /// <param name="password"></param> /// <returns></returns> public bool MemberEnroll( out string message, string deviceIPAddr, int devicePort, UserInfo userInfo, string user = "******", string password = "******") { bool retCardInsert = false; bool retFaceInsert = false; message = string.Empty; userInfo.CardType = CHCNetSDK.CARD_TYPE.NORMAL; userInfo.CardPassword = "******"; CardManage srvCardManage = new CardManage(); retCardInsert = srvCardManage.CardInsert(out message, deviceIPAddr, devicePort, userInfo, user, password); System.Threading.Thread.Sleep(100); if (retCardInsert) { message = string.Empty; FaceManage srvFaceManage = new FaceManage(); retFaceInsert = srvFaceManage.FaceInsert(out message, deviceIPAddr, devicePort, userInfo, user, password); } return(retCardInsert && retFaceInsert); }
public void FaceInsert() { FaceManage srvFaceManage = new FaceManage(); bool ret = false; string message = string.Empty; string deviceIPAddr = "127.0.0.1"; int port = 8000; Core.Domain.EntranceControl.UserInfo userInfo = new Core.Domain.EntranceControl.UserInfo(); userInfo.CardNo = "123456"; userInfo.EmployeeNo = 123456; userInfo.Name = "张三"; userInfo.DepartmentNo = 12; userInfo.CardType = CHCNetSDK.CARD_TYPE.NORMAL; userInfo.CardPassword = "******"; string user = "******"; string password = "******"; using (FileStream fs = new FileStream("e:\\face-storage\\" + userInfo.CardNo + ".jpg", FileMode.OpenOrCreate)) { if (fs.Length > 0 && fs.Length < 200 * 1024) { userInfo.Avator = new byte[fs.Length]; fs.Read(userInfo.Avator, 0, (int)fs.Length); ret = srvFaceManage.FaceInsert(out message, deviceIPAddr, port, userInfo, user, password); } else { message = "人脸文件不能大于200K"; ret = false; } } Console.WriteLine(message); //Assert.AreEqual(ret, true); }