Beispiel #1
0
        public void FillData()
        {
            try
            {
                byte[] name   = new byte[30];
                int    length = 30;
                CVRSDK.GetPeopleName(ref name[0], ref length);
                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]);
                richTextBox1.Text = Encoding.GetEncoding("GB2312").GetString(address).Replace("\0", "").Trim();
                textBox9.Text     = Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim();
                textBox8.Text     = Encoding.GetEncoding("GB2312").GetString(birthday).Replace("\0", "").Trim();
                textBox4.Text     = Encoding.GetEncoding("GB2312").GetString(signdate).Replace("\0", "").Trim();
                textBox3.Text     = Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();
                textBox1.Text     = Encoding.GetEncoding("GB2312").GetString(name).Replace("\0", "").Trim();
                textBox2.Text     = Encoding.GetEncoding("GB2312").GetString(people).Replace("\0", "").Trim();
                //label11.Text = "安全模块号:" + System.Text.Encoding.GetEncoding("GB2312").GetString(samid).Replace("\0", "").Trim();
                //textBox8.Text = Encoding.GetEncoding("GB2312").GetString(validtermOfStart).Replace("\0", "").Trim() + "-" + Encoding.GetEncoding("GB2312").GetString(validtermOfEnd).Replace("\0", "").Trim();
                richTextBox1.Text = richTextBox1.Text.Replace("?", "号");
                //把身份证图片名称zp.bpm 修改为对应的名称
                string   pName = Application.StartupPath + "\\zp.bmp";
                FileInfo inf   = new FileInfo(pName);
                if (textBox3.Text != null && !"".Equals(textBox3.Text) && textBox3.Text.Length == 18)
                {
                    if (File.Exists(Application.StartupPath + "\\cardImg\\" + textBox3.Text + ".jpg"))
                    {
                        File.Delete(Application.StartupPath + "\\cardImg\\" + textBox3.Text + ".jpg");
                    }
                    inf.MoveTo(Application.StartupPath + "\\cardImg\\" + textBox3.Text + ".jpg");

                    pictureBox1.ImageLocation = Application.StartupPath + "\\cardImg\\" + textBox3.Text + ".jpg";
                    if (File.Exists(pName))
                    {
                        File.Delete(pName);
                    }
                    DataTable dt = grjddao.judgeRepeat(textBox3.Text);
                    if (dt.Rows.Count > 0)
                    {
                        textBox1.Text = dt.Rows[0][0].ToString();
                        textBox9.Text = dt.Rows[0][1].ToString();
                        textBox8.Text = dt.Rows[0][2].ToString();
                        textBox3.Text = dt.Rows[0][3].ToString();
                        //richTextBox1.Text = dt.Rows[0][4].ToString();
                        //textBox2.Text = dt.Rows[0][5].ToString();
                        //textBox4.Text = dt.Rows[0][6].ToString();
                        pictureBox1.ImageLocation = Application.StartupPath + "\\cardImg\\" + dt.Rows[0][4].ToString();
                        textBox5.Text             = dt.Rows[0][5].ToString();
                    }
                    ;
                    this.label41.Text = "读卡成功!";
                }
                else
                {
                    inf.MoveTo(Application.StartupPath + "\\cardImg\\123.jpg");
                    if (File.Exists(pName))
                    {
                        File.Delete(pName);
                    }
                    pictureBox1.ImageLocation = Application.StartupPath + "\\cardImg\\123.jpg";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Beispiel #2
0
        public void FillData()
        {
            try
            {
                byte[] name   = new byte[30];
                int    length = 30;
                CVRSDK.GetPeopleName(ref name[0], ref length);
                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[50];
                length = 100;//40 80
                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]);
                richTextBox1.Text = Encoding.GetEncoding("GB2312").GetString(address).Replace("\0", "").Trim();
                //textBox9.Text = Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim();
                this.comboBox1.Text = Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim();
                textBox8.Text       = Encoding.GetEncoding("GB2312").GetString(birthday).Replace("\0", "").Trim();
                textBox4.Text       = Encoding.GetEncoding("GB2312").GetString(signdate).Replace("\0", "").Trim();
                textBox3.Text       = Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();
                textBox1.Text       = Encoding.GetEncoding("GB2312").GetString(name).Replace("\0", "").Trim();
                //textBox2.Text = Encoding.GetEncoding("GB2312").GetString(people).Replace("\0", "").Trim();
                string tmp = Encoding.GetEncoding("GB2312").GetString(people).Replace("\0", "").Trim();
                if (tmp.IndexOf("族") < 0)
                {
                    tmp = tmp + "族";
                }
                comboBox2.Text = tmp;
                //label11.Text = "安全模块号:" + System.Text.Encoding.GetEncoding("GB2312").GetString(samid).Replace("\0", "").Trim();
                //textBox8.Text = Encoding.GetEncoding("GB2312").GetString(validtermOfStart).Replace("\0", "").Trim() + "-" + Encoding.GetEncoding("GB2312").GetString(validtermOfEnd).Replace("\0", "").Trim();
                richTextBox1.Text = richTextBox1.Text.Replace("?", "号");
                //把身份证图片名称zp.bpm 修改为对应的名称
                string   pName = Application.StartupPath + "\\zp.bmp";
                FileInfo inf   = new FileInfo(pName);
                if (textBox1.Text != null && !"".Equals(textBox1.Text) && textBox8.Text != null && !"".Equals(textBox8.Text))
                {
                    if (textBox3.Text != null && !"".Equals(textBox3.Text))
                    {
                        if (File.Exists(Application.StartupPath + "\\cardImg\\" + textBox3.Text + ".jpg"))
                        {
                            File.Delete(Application.StartupPath + "\\cardImg\\" + textBox3.Text + ".jpg");
                        }
                        inf.MoveTo(Application.StartupPath + "\\cardImg\\" + textBox3.Text + ".jpg");

                        pictureBox1.ImageLocation = Application.StartupPath + "\\cardImg\\" + textBox3.Text + ".jpg";

                        DataTable dt = grjddao.judgeRepeat(textBox3.Text);
                        if (dt.Rows.Count > 0)
                        {
                            textBox1.Text = dt.Rows[0][0].ToString();
                            //textBox9.Text = dt.Rows[0][1].ToString();
                            string sexflag = dt.Rows[0][1].ToString();
                            if (sexflag == "1")
                            {
                                this.comboBox1.Text = "男";
                            }
                            else if (sexflag == "2")
                            {
                                this.comboBox1.Text = "女";
                            }
                            textBox8.Text             = dt.Rows[0][2].ToString();
                            textBox3.Text             = dt.Rows[0][3].ToString();
                            pictureBox1.ImageLocation = Application.StartupPath + "\\cardImg\\" + dt.Rows[0][4].ToString();
                            textBox5.Text             = dt.Rows[0][5].ToString();
                        }
                        ;
                        this.label41.Text = "读卡成功!";
                        checkPerson();//判断居民一周内是否做过体检
                    }
                    else
                    {
                        if (File.Exists(Application.StartupPath + "\\cardImg\\" + textBox1.Text + textBox8.Text + ".jpg"))
                        {
                            File.Delete(Application.StartupPath + "\\cardImg\\" + textBox1.Text + textBox8.Text + ".jpg");
                        }
                        inf.MoveTo(Application.StartupPath + "\\cardImg\\" + textBox1.Text + textBox8.Text + ".jpg");

                        pictureBox1.ImageLocation = Application.StartupPath + "\\cardImg\\" + textBox1.Text + textBox8.Text + ".jpg";

                        DataTable dt = grjddao.judgeRepeatBync(textBox1.Text, textBox8.Text);
                        if (dt.Rows.Count > 0)
                        {
                            textBox1.Text = dt.Rows[0][0].ToString();
                            //textBox9.Text = dt.Rows[0][1].ToString();
                            string sexflag = dt.Rows[0][1].ToString();
                            if (sexflag == "1")
                            {
                                this.comboBox1.Text = "男";
                            }
                            else if (sexflag == "2")
                            {
                                this.comboBox1.Text = "女";
                            }
                            textBox8.Text             = dt.Rows[0][2].ToString();
                            textBox3.Text             = dt.Rows[0][3].ToString();
                            pictureBox1.ImageLocation = Application.StartupPath + "\\cardImg\\" + dt.Rows[0][4].ToString();
                            richTextBox1.Text         = dt.Rows[0][5].ToString();
                            tmp = dt.Rows[0][6].ToString();
                            if (tmp == "")
                            {
                                tmp = "1";
                            }
                            DataRow[] drw = dtno.Select("id='" + tmp + "'");
                            if (drw != null)
                            {
                                comboBox2.Text = drw[0]["Name"].ToString();
                            }

                            textBox5.Text = dt.Rows[0][7].ToString();
                        }
                        ;
                    }
                    if (File.Exists(pName))
                    {
                        File.Delete(pName);
                    }
                }
                else
                {
                    inf.MoveTo(Application.StartupPath + "\\cardImg\\123.jpg");
                    if (File.Exists(pName))
                    {
                        File.Delete(pName);
                    }
                    pictureBox1.ImageLocation = Application.StartupPath + "\\cardImg\\123.jpg";
                }
                jkjcheckdao.updateShDevice(1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
            }
            catch (Exception ex)
            {
                loginLogBean lb = new loginLogBean();
                lb.name       = frmLogin.name;
                lb.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                lb.eventInfo  = "身份证读卡失败!";
                lb.type       = "3";
                logservice.addCheckLog(lb);
            }
        }