Esempio n. 1
0
        /// <summary>
        /// Reads the identifier card image.
        /// </summary>
        /// <exception cref="System.NotImplementedException"></exception>
        private void ReadIDCardImage(SDTTeleComLib.SDTDLLWrapper wrapper)
        {
            string wltfile = iDCardFolder + "idCard.wlt";
            string bmpfile = iDCardFolder + "idCard.bmp";
            int    usbPort = 2;

            using (FileStream fs = new FileStream(wltfile, FileMode.OpenOrCreate, FileAccess.ReadWrite))
            {
                fs.Write(wrapper.ImageBytes, 0, wrapper.ImageBytes.Length);
                fs.Flush();
            }

            SDTTeleComLib.SDTWin32API.GetBmp(wltfile, usbPort);

            using (FileStream fs = new FileStream(bmpfile, FileMode.OpenOrCreate, FileAccess.ReadWrite))
            {
                this.Pic_user.SizeMode = PictureBoxSizeMode.CenterImage;
                fs.Seek(0, SeekOrigin.Begin);
                this.Pic_user.Image = Image.FromStream(fs).Clone() as Image;
            }

            File.Delete(bmpfile);
        }
Esempio n. 2
0
        /// <summary>
        /// Reads the identifier card information.
        /// </summary>
        /// <param name="wrapper">The wrapper.</param>
        private void ReadIDCardInfo(SDTTeleComLib.SDTDLLWrapper wrapper)
        {
            if (wrapper == null)
            {
                return;
            }

            //report.GraphicIDGrid.Image = new Bitmap(200, 200);
            this.Txb_Addr.Text = System.Text.UTF8Encoding.Unicode.GetString(wrapper.IDCard.Address).Trim();
            this.Txb_Age.Text  = SDTTeleComLib.Uitl.ToAge(System.Text.UTF8Encoding.Unicode.GetString(wrapper.IDCard.Birth)).Trim();

            this.Txb_Birth.Text   = System.Text.UTF8Encoding.Unicode.GetString(wrapper.IDCard.Birth).Trim();
            this.Txb_IDCard.Text  = System.Text.UTF8Encoding.Unicode.GetString(wrapper.IDCard.ID).Trim();
            this.Txb_Name.Text    = System.Text.UTF8Encoding.Unicode.GetString(wrapper.IDCard.Name).Trim();
            this.Txb_Country.Text = "中华人民共和国"; // 只有中国公民才有身份证 -。-
            this.Txb_Sex.Text     = SDTTeleComLib.Uitl.ToSex(System.Text.UTF8Encoding.Unicode.GetString(wrapper.IDCard.Sex)).Trim();
            this.Txb_Nation.Text  = SDTTeleComLib.Uitl.ToNation(System.Text.UTF8Encoding.Unicode.GetString(wrapper.IDCard.Nation)).Trim();
            // this.Txb_Time.Text = System.Text.UTF8Encoding.Unicode.GetString(wrapper.IDCard.Exper).Trim();

            // No use.
            var Issue  = System.Text.UTF8Encoding.Unicode.GetString(wrapper.IDCard.Issue).Trim();
            var Exper2 = System.Text.UTF8Encoding.Unicode.GetString(wrapper.IDCard.Exper2).Trim();
        }
Esempio n. 3
0
 /// <summary>
 /// Handles the Click event of the Btn_ReadIDCard control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void Btn_ReadIDCard_Click(object sender, EventArgs e)
 {
     using (var idCardWrapper = new SDTTeleComLib.SDTDLLWrapper())
     {
         try
         {
             var success = idCardWrapper.ReadIDCard();
             if (!success)
             {
                 MessageBox.Show("读取身份证信息失败,请检查仪器是否已正确连接。");
             }
             else
             {
                 ReadIDCardInfo(idCardWrapper);
                 ReadIDCardImage(idCardWrapper);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("读取身份证信息失败," + ex.Message);
         }
     }
 }