Exemple #1
0
 private void AutoReadCard()
 {
     if (_readMode == AutoReadMode.IdentityCard)
     {
         var card = ReadIdentityCard();
         if (card != null)
         {
             TriggerClient("read-identitycard", card);
         }
     }
     else if (_readMode == AutoReadMode.ICCardNO)
     {
         var reader = Reader.Singleton;
         if (reader.Connect())
         {
             var cardNo = reader.ReadICCardNO();
             if (cardNo.Length > 0)
             {
                 var authDto = new UserCardAuth().GetByCardNo(cardNo);
                 if (authDto.User != null)
                 {
                     authDto.User.SetIdentityPhotoWebPath();
                 }
                 TriggerClient("read-iccardno", authDto);
             }
         }
     }
 }
Exemple #2
0
        private JSResult ReceiveCmd(string cmd, string arg = "")
        {
            var result = new JSResult()
            {
                success = true
            };

            if (cmd.StartsWith("repo."))
            {
                result.jsonData = CmdRouter.RepoRoute(cmd, arg);
            }
            else if (cmd == "showDevTools")
            {
                _webBrowser.ShowDevTools();
            }
            else if (cmd == "read-identity-card")
            {
                var cardInfo = ReadIdentityCard();
                if (cardInfo != null)
                {
                    result.jsonData = JsonUtil.Stringify(cardInfo);
                }
            }
            else if (cmd == "auto-readcard")
            {
                var readMode = AutoReadMode.None;
                Enum.TryParse <AutoReadMode>(arg, out readMode);
                this._readMode = readMode;
            }
            else if (cmd == "submit-auth")
            {
                var dto = JsonUtil.Parse <UserCardAuthDto>(arg);
                var r   = SubmitAuth(dto);
                result.success = r == 1;
            }
            else if (cmd == "query-auth")
            {
                var ps  = arg.Split(',');
                var dto = new UserCardAuth().GetByCardIdOrUserId(ps[0], ps[1]);
                if (dto != null && dto.User != null)
                {
                    dto.User.SetIdentityPhotoWebPath();
                }
                result.jsonData = JsonUtil.Stringify(dto);
            }
            return(result);
        }