Beispiel #1
0
        /// <summary>
        /// 得到身份证上的信息
        /// </summary>
        public void getFillIdCardData(bool isFirst)
        {
            pictureBox1.ImageLocation = Application.StartupPath + "\\zp.bmp";
            //if (isFirst)//如果是第一次刷卡,则把照片保存到本地磁盘
            //{
            //    pictureBox1.Image.Save(GetUpLoadPath() + DateTime.Now.ToString("yyyyMMddHHmmssffff") + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp);
            //}

            byte[] name   = new byte[30];
            int    length = 30;

            CVRSDK.GetPeopleName(ref name[0], ref length);
            //MessageBox.Show();
            byte[] number = new byte[30];
            length = 36;
            CVRSDK.GetPeopleIDCode(ref number[0], ref length);
            byte[] people = new byte[30];
            length = 3;
            CVRSDK.GetPeopleNation(ref people[0], ref length);
            byte[] validtermOfStart = new byte[30];
            length = 16;
            CVRSDK.GetStartDate(ref validtermOfStart[0], ref length);
            byte[] birthday = new byte[30];
            length = 16;
            CVRSDK.GetPeopleBirthday(ref birthday[0], ref length);
            byte[] address = new byte[30];
            length = 70;
            CVRSDK.GetPeopleAddress(ref address[0], ref length);
            byte[] validtermOfEnd = new byte[30];
            length = 16;
            CVRSDK.GetEndDate(ref validtermOfEnd[0], ref length);
            byte[] signdate = new byte[30];
            length = 30;
            CVRSDK.GetDepartment(ref signdate[0], ref length);
            byte[] sex = new byte[30];
            length = 3;
            CVRSDK.GetPeopleSex(ref sex[0], ref length);

            byte[] samid = new byte[32];
            CVRSDK.CVR_GetSAMID(ref samid[0]);


            lblAddress.Text   = System.Text.Encoding.GetEncoding("GB2312").GetString(address).Replace("\0", "").Trim();
            lblSex.Text       = System.Text.Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim();
            lblBirthday.Text  = System.Text.Encoding.GetEncoding("GB2312").GetString(birthday).Replace("\0", "").Trim();
            lblDept.Text      = System.Text.Encoding.GetEncoding("GB2312").GetString(signdate).Replace("\0", "").Trim();
            lblIdCard.Text    = System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();
            lblName.Text      = System.Text.Encoding.GetEncoding("GB2312").GetString(name).Replace("\0", "").Trim();
            lblNation.Text    = System.Text.Encoding.GetEncoding("GB2312").GetString(people).Replace("\0", "").Trim();
            label11.Text      = "安全模块号:" + System.Text.Encoding.GetEncoding("GB2312").GetString(samid).Replace("\0", "").Trim();
            lblValidDate.Text = System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfStart).Replace("\0", "").Trim() + "-" + System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfEnd).Replace("\0", "").Trim();

            idcardnum = System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();
        }
Beispiel #2
0
        public string validtermOfEnd;   //有效截止日期,在识别护照时为空

        public void FillData()
        {
            try
            {
                pictureBox1.ImageLocation = Application.StartupPath + "\\zp.bmp";
                byte[] name   = new byte[30];
                int    length = 30;
                CVRSDK.GetPeopleName(ref name[0], ref length);
                //MessageBox.Show();
                byte[] number = new byte[30];
                length = 36;
                CVRSDK.GetPeopleIDCode(ref number[0], ref length);
                byte[] people = new byte[30];
                length = 3;
                CVRSDK.GetPeopleNation(ref people[0], ref length);
                byte[] validtermOfStart = new byte[30];
                length = 16;
                CVRSDK.GetStartDate(ref validtermOfStart[0], ref length);
                byte[] birthday = new byte[30];
                length = 16;
                CVRSDK.GetPeopleBirthday(ref birthday[0], ref length);
                byte[] address = new byte[30];
                length = 70;
                CVRSDK.GetPeopleAddress(ref address[0], ref length);
                byte[] validtermOfEnd = new byte[30];
                length = 16;
                CVRSDK.GetEndDate(ref validtermOfEnd[0], ref length);
                byte[] signdate = new byte[30];
                length = 30;
                CVRSDK.GetDepartment(ref signdate[0], ref length);
                byte[] sex = new byte[30];
                length = 3;
                CVRSDK.GetPeopleSex(ref sex [0], ref length);

                byte[] samid = new byte[32];
                CVRSDK.CVR_GetSAMID(ref samid[0]);


                lblAddress.Text   = System.Text.Encoding.GetEncoding("GB2312").GetString(address).Replace("\0", "").Trim();
                lblSex.Text       = System.Text.Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim();
                lblBirthday.Text  = System.Text.Encoding.GetEncoding("GB2312").GetString(birthday).Replace("\0", "").Trim();
                lblDept.Text      = System.Text.Encoding.GetEncoding("GB2312").GetString(signdate).Replace("\0", "").Trim();
                lblIdCard.Text    = System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();
                lblName.Text      = System.Text.Encoding.GetEncoding("GB2312").GetString(name).Replace("\0", "").Trim();
                lblNation.Text    = System.Text.Encoding.GetEncoding("GB2312").GetString(people).Replace("\0", "").Trim();
                label11.Text      = "安全模块号:" + System.Text.Encoding.GetEncoding("GB2312").GetString(samid).Replace("\0", "").Trim();
                lblValidDate.Text = System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfStart).Replace("\0", "").Trim() + "-" + System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfEnd).Replace("\0", "").Trim();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #3
0
        public void FillData()
        {
            try
            {
                byte[] imgData = new byte[40960];
                int    length  = 40960;
                CVRSDK.GetBMPData(ref imgData[0], ref length);
                MemoryStream myStream = new MemoryStream();
                for (int i = 0; i < length; i++)
                {
                    myStream.WriteByte(imgData[i]);
                }
                Image myImage = Image.FromStream(myStream);
                pictureBoxPhoto.Image = myImage;

                byte[] name = new byte[128];
                length = 128;
                CVRSDK.GetPeopleName(ref name[0], ref length);

                byte[] cnName = new byte[128];
                length = 128;
                CVRSDK.GetPeopleChineseName(ref cnName[0], ref length);

                byte[] number = new byte[128];
                length = 128;
                CVRSDK.GetPeopleIDCode(ref number[0], ref length);

                byte[] peopleNation = new byte[128];
                length = 128;
                CVRSDK.GetPeopleNation(ref peopleNation[0], ref length);

                byte[] peopleNationCode = new byte[128];
                length = 128;
                CVRSDK.GetNationCode(ref peopleNationCode[0], ref length);

                byte[] validtermOfStart = new byte[128];
                length = 128;
                CVRSDK.GetStartDate(ref validtermOfStart[0], ref length);

                byte[] birthday = new byte[128];
                length = 128;
                CVRSDK.GetPeopleBirthday(ref birthday[0], ref length);

                byte[] address = new byte[128];
                length = 128;
                CVRSDK.GetPeopleAddress(ref address[0], ref length);

                byte[] validtermOfEnd = new byte[128];
                length = 128;
                CVRSDK.GetEndDate(ref validtermOfEnd[0], ref length);

                byte[] signdate = new byte[128];
                length = 128;
                CVRSDK.GetDepartment(ref signdate[0], ref length);

                byte[] sex = new byte[128];
                length = 128;
                CVRSDK.GetPeopleSex(ref sex[0], ref length);

                byte[] samid = new byte[128];
                CVRSDK.CVR_GetSAMID(ref samid[0]);

                bool   bCivic   = true;
                byte[] certType = new byte[32];
                length = 32;
                CVRSDK.GetCertType(ref certType[0], ref length);

                string strType = System.Text.Encoding.ASCII.GetString(certType);
                int    nStart  = strType.IndexOf("I");
                if (nStart != -1)
                {
                    bCivic = false;
                }

                if (bCivic)
                {
                    labelCnName.Visible  = false;
                    labelAddress.Visible = true;
                    labelName.Text       = "姓名:" + System.Text.Encoding.GetEncoding("GB2312").GetString(name);
                    labelSex.Text        = "性别:" + System.Text.Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim();
                    labelNation.Text     = "民族:" + System.Text.Encoding.GetEncoding("GB2312").GetString(peopleNation).Replace("\0", "").Trim();
                    labelNationCode.Text = "民族代码:" + System.Text.Encoding.GetEncoding("GB2312").GetString(peopleNationCode).Replace("\0", "").Trim();
                    labelBirthday.Text   = "出生日期:" + System.Text.Encoding.GetEncoding("GB2312").GetString(birthday).Replace("\0", "").Trim();
                    labelIdCardNo.Text   = "身份证号:" + System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();
                    labelAddress.Text    = "地址:" + System.Text.Encoding.GetEncoding("GB2312").GetString(address).Replace("\0", "").Trim();
                    labelDepartment.Text = "签发机关:" + System.Text.Encoding.GetEncoding("GB2312").GetString(signdate).Replace("\0", "").Trim();
                    labelValidDate.Text  = "有效期限:" + System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfStart).Replace("\0", "").Trim() + "-" + System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfEnd).Replace("\0", "").Trim();
                    labelSamID.Text      = "安全模块号:" + System.Text.Encoding.GetEncoding("GB2312").GetString(samid).Replace("\0", "").Trim();
                }
                else
                {
                    labelCnName.Visible  = true;
                    labelAddress.Visible = false;
                    labelName.Text       = "姓名:" + System.Text.Encoding.GetEncoding("GB2312").GetString(name).Replace("\0", "").Trim();
                    labelCnName.Text     = "中文姓名:" + System.Text.Encoding.GetEncoding("GB2312").GetString(cnName).Replace("\0", "").Trim();
                    labelSex.Text        = "性别:" + System.Text.Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim();
                    labelNation.Text     = "国籍:" + System.Text.Encoding.GetEncoding("GB2312").GetString(peopleNation).Replace("\0", "").Trim();
                    labelNationCode.Text = "国籍代码:" + System.Text.Encoding.GetEncoding("GB2312").GetString(peopleNationCode).Replace("\0", "").Trim();
                    labelBirthday.Text   = "出生日期:" + System.Text.Encoding.GetEncoding("GB2312").GetString(birthday).Replace("\0", "").Trim();
                    labelIdCardNo.Text   = "证件号码:" + System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();
                    labelDepartment.Text = "签发机关:" + System.Text.Encoding.GetEncoding("GB2312").GetString(signdate).Replace("\0", "").Trim();
                    labelValidDate.Text  = "有效期限:" + System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfStart).Replace("\0", "").Trim() + "-" + System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfEnd).Replace("\0", "").Trim();
                    labelSamID.Text      = "安全模块号:" + System.Text.Encoding.GetEncoding("GB2312").GetString(samid).Replace("\0", "").Trim();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }