/// <summary>
 /// 加载指纹dat文件
 /// </summary>
 /// <param name="entity"></param>
 private void LoadFingerDat(CmcsFinger entity)
 {
     if (!IsConnect)
     {
         ShowInfomation("请先打开设备...");
         return;
     }
     ret = Fingerdll.ZAZDownCharFromFile(hHandle, nDevAddr, 1, entity.FingerUrl);
     ret = Fingerdll.ZAZDownCharFromFile(hHandle, nDevAddr, 2, entity.FingerUrl);
     if (ret == 0)
     {
         byte[] ImgData = new byte[ImageSize];
         int[]  ImgLen  = new int[1];
         ret = Fingerdll.ZAZUpImage(hHandle, nDevAddr, ImgData, ImgLen);                  //上传图象
         if (ret != 0)
         {
             ShowInfomation(Fingerdll.ZAZErr2Strt(ret));
             return;
         }
         strFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ZAZFinger.bmp");
         ret     = Fingerdll.ZAZImgData2BMP(ImgData, strFile);
         if (ret != 0)
         {
             ShowInfomation(Fingerdll.ZAZErr2Strt(ret), eOutputType.Error);
             return;
         }
         ShowImage(strFile);
     }
 }
Example #2
0
 /// <summary>
 /// 开始指纹检测
 /// </summary>
 public void StartCheck()
 {
     GrossCheck = false;
     if (GetFinger(1) == 1)
     {
         if (FingerCheckCount == 2)
         {
             finger = commonDao.SelfDber.Entities <CmcsFinger>("where UserId!=:UserId", new { UserId = SelfVars.LoginUser.PartyId });
         }
         foreach (CmcsFinger item in finger)
         {
             Fingerdll.ZAZDownCharFromFile(hHandle, nDevAddr, 2, item.FingerUrl);
             int[] nScore = new int[1];
             ret = Fingerdll.ZAZMatch(hHandle, nDevAddr, nScore);                      //比对模板
             if (nScore[0] > 50)
             {
                 if (FingerCheckCount == 1)
                 {
                     ShowToolTip("匹配成功,监督人进行指纹验证");
                     SelfVars.LoginUser = user;
                     GrossCheck         = true;
                     FingerCheckCount   = 2;
                     break;
                 }
                 else if (FingerCheckCount == 2)
                 {
                     SelfVars.LoginUser2 = commonDao.SelfDber.Get <User>(item.UserId);
                     if (SelfVars.LoginUser2.UserName == SelfVars.LoginUser.UserName)
                     {
                         ShowToolTip("指纹不能与登录人一样");
                         break;
                     }
                     GrossCheck = true;
                     taskSimpleScheduler.Cancal();
                     InvokeEx(() =>
                     {
                         if (GrossCheck)
                         {
                             ShowToolTip("指纹匹配成功...");
                             LoginSuccess();
                         }
                     });
                     break;
                 }
             }
         }
         if (!GrossCheck)
         {
             ShowToolTip("指纹不匹配...");
         }
     }
 }