Ejemplo n.º 1
0
 /// <summary>
 /// 读取身份证
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtEdit_oc003_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     try
     {
         int authenticate = CVRSDK.CVR_Authenticate();
         if (authenticate == 1)
         {
             int readContent = CVRSDK.CVR_Read_Content(4);
             if (readContent == 1)
             {
                 FillData();
             }
             else
             {
                 XtraMessageBox.Show("读卡失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             XtraMessageBox.Show("未放卡或卡片放置不正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 读取身份证
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtedit_rc014_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (!Envior.IDC_Reader_State)
     {
         XtraMessageBox.Show("身份证读卡器未连接!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     try
     {
         int authenticate = CVRSDK.CVR_Authenticate();
         if (authenticate == 1)
         {
             int readContent = CVRSDK.CVR_Read_Content(4);
             if (readContent == 1)
             {
                 FillData();
                 txtEdit_rc050.Focus();
             }
             else
             {
                 XtraMessageBox.Show("读卡失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             XtraMessageBox.Show("未放卡或卡片放置不正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            jg = (int)(Convert.ToDecimal(textBox1.Text.Trim()) * 1000);
            int iPort;

            for (iPort = 1001; iPort <= 1016; iPort++)
            {
                iRetUSB = CVRSDK.CVR_InitComm(iPort);
                if (iRetUSB == 1)
                {
                    break;
                }
            }
            if (iRetUSB != 1)
            {
                this.Invoke(new Action(() => { this.richTextBox1.AppendText(DateTime.Now.ToString("HH:mm:ss:fff") + "身份证读卡器初始化失败,请重试!\r\n"); }));
            }
            else
            {
                isread = true;
                this.Invoke(new Action(() =>
                {
                    this.richTextBox1.AppendText(DateTime.Now.ToString("HH:mm:ss:fff") + "初始化成功,循环读卡开始(0.2秒执行一次)...\r\n");
                }));
                new Thread(new ThreadStart(ReadIDCard))
                {
                    IsBackground = true
                }.Start();
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 关闭端口
 /// </summary>
 public void ClosePort()
 {
     try
     {
         CVRSDK.CVR_CloseComm();
     }
     catch (Exception ex)
     {
         throw new  Exception(ex.ToString());
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 得到身份证信息
        /// </summary>
        /// <returns>身份证信息实体</returns>
        public IDCardInfo FillData()
        {
            try
            {
                IDCardInfo cardInfo = new IDCardInfo();
                // cardInfo.ImagePath = 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);

                cardInfo.Address   = System.Text.Encoding.GetEncoding("GB2312").GetString(address).Replace("\0", "").Trim();
                cardInfo.Sex       = System.Text.Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim();
                cardInfo.Birthday  = System.Text.Encoding.GetEncoding("GB2312").GetString(birthday).Replace("\0", "").Trim();
                cardInfo.Signdate  = System.Text.Encoding.GetEncoding("GB2312").GetString(signdate).Replace("\0", "").Trim();
                cardInfo.Number    = System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();
                cardInfo.Name      = System.Text.Encoding.GetEncoding("GB2312").GetString(name).Replace("\0", "").Trim();
                cardInfo.People    = System.Text.Encoding.GetEncoding("GB2312").GetString(people).Replace("\0", "").Trim();
                cardInfo.ValidDate = System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfStart).Replace("\0", "").Trim() + "-" + System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfEnd).Replace("\0", "").Trim();
                return(cardInfo);
            }
            catch (Exception ex)
            {
                throw new  Exception(ex.ToString());
            }
        }
Ejemplo n.º 6
0
 //读取身份证
 private void button3_Click(object sender, EventArgs e)
 {
     textBox5.Text = "";
     textBox6.Text = "";
     try
     {
         if ((iRetCOM == 1) || (iRetUSB == 1))
         {
             int authenticate = CVRSDK.CVR_Authenticate();
             if (authenticate == 1)
             {
                 int readContent = CVRSDK.CVR_Read_Content(4);
                 if (readContent == 1)
                 {
                     FillData();
                 }
                 else
                 {
                     this.label41.Text = "读卡操作失败!";
                 }
             }
             else
             {
                 MessageBox.Show("未放卡或卡片放置不正确");
             }
         }
         else
         {
             //MessageBox.Show("初始化失败!");
             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);
         }
     }
     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);
         jkjcheckdao.updateShDevice(0, -1, -1, -1, -1, -1, -1, -1, -1, -1);
         //MessageBox.Show("读卡错误,请重试!");
     }
 }
Ejemplo n.º 7
0
        public void InitIdReader()
        {
            int iPort, iRetUSB = 0;

            for (iPort = 1001; iPort <= 1016; iPort++)
            {
                iRetUSB = CVRSDK.CVR_InitComm(iPort);
                if (iRetUSB == 1)
                {
                    break;
                }
            }

            if (iRetUSB != 1)
            {
                throw new Exception();
            }
        }
Ejemplo n.º 8
0
        private bool prepareRead()
        {
            int authenticate = CVRSDK.CVR_Authenticate();

            if (authenticate == 1)
            {
                int readContent = CVRSDK.CVR_Read_Content(1);

                if (readContent == 1)
                {
                    return(true);
                }
            }
            else if (authenticate == 4)
            {
                Program.reader = null;
            }
            return(false);
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 读取身份证信息
 /// </summary>
 /// <returns>身份证信息实体</returns>
 public IDCardInfo ReadIDCard()
 {
     try
     {
         int authenticate = CVRSDK.CVR_Authenticate();
         if (authenticate == 1)
         {
             int readContent = CVRSDK.CVR_Read_Content(2);
             if (readContent == 1)
             {
                 return(FillData());
             }
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw new  Exception(ex.ToString());
     }
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 打开身份证读卡器端口
 /// </summary>
 /// <returns>true成功 false失败</returns>
 public bool openPort()
 {
     try
     {
         int iPort = 1002;
         iRetUSB = CVRSDK.CVR_InitComm(iPort);
         if (iRetUSB == 1)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Ejemplo n.º 11
0
        private void FormMR_Load(object sender, EventArgs e)
        {
            //身份证读卡相关
            try
            {
                int iPort;
                for (iPort = 1001; iPort <= 1016; iPort++)
                {
                    //Console.WriteLine("iPort:" + iPort);
                    iRetUSB = CVRSDK.CVR_InitComm(iPort);
                    if (iRetUSB == 1)
                    {
                        break;
                    }
                }
                if (iRetUSB != 1)
                {
                    for (iPort = 1; iPort <= 4; iPort++)
                    {
                        iRetCOM = CVRSDK.CVR_InitComm(iPort);
                        if (iRetCOM == 1)
                        {
                            break;
                        }
                    }
                }

                if ((iRetCOM == 1) || (iRetUSB == 1))
                {
                    lblMsgQueryClient.Text = DateTime.Now.ToString("HH:mm:ss") + " 初始化成功!";
                }
                else
                {
                    lblMsgQueryClient.Text = DateTime.Now.ToString("HH:mm:ss") + " 初始化失败!";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 读取身份证
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void txtedit_ac014_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (!Envior.IDC_Reader_State)
     {
         XtraMessageBox.Show("身份证读卡器未连接!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     if (action == "edit" && MiscAction.HasIDC(AC001))
     {
         if (XtraMessageBox.Show("是否替换已有的身份证信息?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
         {
             return;
         }
     }
     try
     {
         int authenticate = CVRSDK.CVR_Authenticate();
         if (authenticate == 1)
         {
             int readContent = CVRSDK.CVR_Read_Content(4);
             if (readContent == 1)
             {
                 FillData();
                 dateEdit_ac010.Focus();
             }
             else
             {
                 XtraMessageBox.Show("读卡失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             XtraMessageBox.Show("未放卡或卡片放置不正确", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(ex.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Ejemplo n.º 13
0
        /// <summary>
        /// 读身份证
        /// </summary>
        public void readCard(object sender, EventArgs e)
        {
            //不管能否读出,界面先切换
            rbIdCard.Checked = true; panelIdCard.BackColor = Color.SandyBrown;
            rbPhone.Checked  = false; panelPhone.BackColor = Color.Transparent;

            try
            {
                if ((iRetCOM == 1) || (iRetUSB == 1))
                {
                    int authenticate = CVRSDK.CVR_Authenticate();
                    if (authenticate == 1)
                    {
                        int readContent = CVRSDK.CVR_Read_Content(4);
                        if (readContent == 1)
                        {
                            lblMsgQueryClient.Text = DateTime.Now.ToString("HH:mm:ss") + " 读卡成功!";
                            fillData();
                        }
                        else
                        {
                            lblMsgQueryClient.Text = DateTime.Now.ToString("HH:mm:ss") + " 读卡失败";
                        }
                    }
                    else
                    {
                        MessageBox.Show("未放卡或卡片放置不正确");
                    }
                }
                else
                {
                    MessageBox.Show("初始化失败!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 14
0
 //读取身份证
 private void button3_Click(object sender, EventArgs e)
 {
     textBox5.Text = "";
     textBox6.Text = "";
     try
     {
         if ((iRetCOM == 1) || (iRetUSB == 1))
         {
             int authenticate = CVRSDK.CVR_Authenticate();
             if (authenticate == 1)
             {
                 int readContent = CVRSDK.CVR_Read_Content(4);
                 if (readContent == 1)
                 {
                     FillData();
                 }
                 else
                 {
                     this.label41.Text = "读卡操作失败!";
                 }
             }
             else
             {
                 MessageBox.Show("未放卡或卡片放置不正确");
             }
         }
         else
         {
             MessageBox.Show("初始化失败!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("读卡错误,请重试!");
     }
 }
Ejemplo n.º 15
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            OracleDataAdapter bo01Adapter = SqlAssist.getSingleTableAdapter("select * from bo01");

            bo01Adapter.Fill(dt_bo01);

            List <Bo01> bo01_rows = ModelHelper.TableToEntity <Bo01>(dt_bo01);

            businessTab = bo01_rows.ToDictionary(key => key.bo001, value => value);

            Frm_login f_login = new Frm_login();

            f_login.ShowDialog();

            if (f_login.DialogResult == DialogResult.OK)              //登录成功处理..........
            {
                Bs_CURUSER.Caption = Envior.cur_userName;
                bs_version.Caption = AppInfo.AppVersion;
                f_login.Dispose();

                //读取发票基础信息
                this.ReadInvoiceBaseInfo();
            }

            //连接打印进程
            this.ConnectPrtServ();

            //自动连接博思服务器
            //string autoConnect = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath).AppSettings.Settings["ConnectFinInvoice"].Value.ToString();
            //if (autoConnect == "1") FinInvoice.AutoConnectBosi();

            //创建打印服务对象
            //Envior.prtserv = new n_prtserv();

            //读取 税务开票 APPID
            Envior.TAX_APPID = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath).AppSettings.Settings["APPID"].Value.ToString();
            //读取 财政发票 开票点编码
            Envior.FIN_BILL_SITE = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath).AppSettings.Settings["BILLSITE"].Value.ToString();

            //打开身份证读取器
            Envior.IDC_Reader_State = false;
            if (ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath).AppSettings.Settings["IDC_Reader"].Value.ToString() == "1")
            {
                Envior.IDC_Reader_Rate = int.Parse(ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath).AppSettings.Settings["IDC_Reader_Rate"].Value.ToString());
                Envior.IDC_Reader_Port = int.Parse(ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath).AppSettings.Settings["IDC_Reader_Port"].Value.ToString());
                CVRSDK.CVR_SetComBaudrate(Envior.IDC_Reader_Rate);  // 设置波特率
                if (0 == Envior.IDC_Reader_Port)                    //usb
                {
                    for (int i = 1001; i <= 1016; i++)
                    {
                        if (1 == CVRSDK.CVR_InitComm(i))
                        {
                            Envior.IDC_Reader_State = true;
                            Envior.IDC_Reader_Port  = i;
                            break;
                        }
                    }
                }
                else if (CVRSDK.CVR_InitComm(Envior.IDC_Reader_Port) == 1)                  //UART
                {
                    Envior.IDC_Reader_State = true;
                }

                if (!Envior.IDC_Reader_State)
                {
                    XtraMessageBox.Show("打开身份证读卡器失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                Envior.IDC_Reader_State = false;
            }

            if (Envior.IDC_Reader_State)
            {
                bsi_idc.Caption = "已连接";
            }
            else
            {
                bsi_idc.Caption = "未连接";
            }
        }
Ejemplo n.º 16
0
        private void FillData()
        {
            try
            {
                int length;

                IDC_FLAG = true;

                // 照片保存在当前目录
                String szXPPath          = "zp.bmp";
                System.Drawing.Image img = System.Drawing.Image.FromFile(szXPPath);
                System.Drawing.Image bmp = new System.Drawing.Bitmap(img);
                img.Dispose();
                pictureEdit1.Image = bmp;


                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[] Uid = new byte[128];
                length = 128;

                //CVRSDK.GetIDCardUID(ref Uid[0], 128);

                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 (ic01 == null)
                {
                    ic01       = new Ic01();
                    ic01.ic001 = Tools.GetEntityPK("IC01");
                }

                ic01.ic000 = "0";                                                        //0-逝者 1-家属
                ic01.ic003 = System.Text.Encoding.GetEncoding("GB2312").GetString(name); //姓名
                ic01.ic002 = System.Text.Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim() == "男" ? "0" : "1";

                //出生日期
                string s_birth = System.Text.Encoding.GetEncoding("GB2312").GetString(birthday).Replace("\0", "").Trim();
                ic01.ic004 = Convert.ToDateTime(s_birth.Substring(0, 4) + "-" + s_birth.Substring(4, 2) + "-" + s_birth.Substring(6));

                //身份证号
                ic01.ic014 = System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();

                //地址
                ic01.ic016 = System.Text.Encoding.GetEncoding("GB2312").GetString(address).Replace("\0", "").Trim();

                //签发机关
                ic01.ic017 = System.Text.Encoding.GetEncoding("GB2312").GetString(signdate).Replace("\0", "").Trim();

                //有效期限
                ic01.ic018 = System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfStart).Replace("\0", "").Trim() + "-" + System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfEnd).Replace("\0", "").Trim();

                txtEdit_rc003.EditValue = ic01.ic003;
                rg_rc002.EditValue      = ic01.ic002;

                txtEdit_rc004.EditValue = MiscAction.Calc_Age_Via_Birth(ic01.ic004.ToString("yyyy-MM-dd"));
                txtedit_rc014.EditValue = ic01.ic014;
            }
            catch (Exception ex)
            {
                XtraMessageBox.Show(ex.ToString(), "读卡错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 17
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            share.Init();
            this.notifyIcon1.ShowBalloonTip(3000);
            int iPort;

            for (iPort = 1001; iPort <= 1016; iPort++)
            {
                iRetUSB = CVRSDK.CVR_InitComm(iPort);
                if (iRetUSB == 1)
                {
                    break;
                }
            }
            if (iRetUSB != 1)
            {
                this.Invoke(new Action(() =>
                {
                    ShowMsg("身份证读卡器初始化失败,请重试!", true);
                }));
            }
            else
            {
                this.Invoke(new Action(() =>
                {
                    ShowMsg("初始化读卡成功,开始读卡...", true);
                }));
                new Thread(new ThreadStart(ReadIDCard))
                {
                    IsBackground = true
                }.Start();
            }
            this.Hide();
            new Thread(() =>
            {
                int index = 0;
                while (true)
                {
                    if (index > 10)
                    {
                        BeginInvoke(new Action(() => { this.Hide(); }));
                        break;
                    }
                    Thread.Sleep(200);
                    index++;
                }
            })
            {
                IsBackground = true
            }.Start();

            new Thread(() =>
            {
                while (true)
                {
                    Thread.Sleep(60 * 2 * 1000);//每2分钟清空一次
                    BeginInvoke(new Action(() => { txtSoundMesInfo.Text = ""; }));
                }
            })
            {
                IsBackground = true
            }.Start();
        }
Ejemplo n.º 18
0
 private void btnExit_Click(object sender, EventArgs e)
 {
     try { CVRSDK.CVR_CloseComm(); }
     catch { }
     Application.ExitThread();
 }
Ejemplo n.º 19
0
        private void ReadIDCard()
        {
            int time = 0;

            while (isread)
            {
                time++;
                int isHaveCard = CVRSDK.CVR_Authenticate();
                if (isHaveCard == 1)
                {
                    int readOk = CVRSDK.CVR_Read_Content(4);
                    if (readOk == 1)
                    {
                        #region
                        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[] address = new byte[30];
                        length = 70;
                        CVRSDK.GetPeopleAddress(ref address[0], ref length);
                        var iCard   = System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();
                        var iName   = System.Text.Encoding.GetEncoding("GB2312").GetString(name).Replace("\0", "").Trim();
                        var iAdress = System.Text.Encoding.GetEncoding("GB2312").GetString(address).Replace("\0", "").Trim();
                        if (iCard != "")
                        {
                            int t = time;
                            new Thread(() =>
                            {
                                BeginInvoke(new Action(() =>
                                {
                                    this.BeginInvoke(new Action(() => { this.richTextBox1.AppendText(DateTime.Now.ToString("HH:mm:ss:fff") + string.Format("身份证读卡成功:本次读卡循环读取了{3}次,证件号码{0} 姓名{1} 地址{2}\r\n", iCard, iName, iAdress, t)); }));
                                }));
                            })
                            {
                                IsBackground = true
                            }.Start();
                            time = 0;
                        }
                        else
                        {
                            BeginInvoke(new Action(() =>
                            {
                                this.richTextBox1.AppendText(DateTime.Now.ToString("HH:mm:ss:fff") + " 未读取到身份证号码\r\n");
                            }));
                        }

                        #endregion
                    }
                    else
                    {
                        BeginInvoke(new Action(() =>
                        {
                            this.richTextBox1.AppendText(DateTime.Now.ToString("HH:mm:ss:fff") + " 读卡操作失败!请重新放上卡片。\r\n");
                        }));
                    }
                }
                else
                {
                    BeginInvoke(new Action(() =>
                    {
                        this.richTextBox1.AppendText(DateTime.Now.ToString("HH:mm:ss:fff") + " 未放卡或卡片放置不正确,请重新放上卡片。\r\n");
                    }));
                }
                Thread.Sleep(jg);
            }
        }
Ejemplo n.º 20
0
        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();
                 */

                string address1          = System.Text.Encoding.GetEncoding("GB2312").GetString(address).Replace("\0", "").Trim();
                string sex1              = System.Text.Encoding.GetEncoding("GB2312").GetString(sex).Replace("\0", "").Trim();
                string birthday1         = System.Text.Encoding.GetEncoding("GB2312").GetString(birthday).Replace("\0", "").Trim();
                string signdate1         = System.Text.Encoding.GetEncoding("GB2312").GetString(signdate).Replace("\0", "").Trim();
                string number1           = System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();
                string name1             = System.Text.Encoding.GetEncoding("GB2312").GetString(name).Replace("\0", "").Trim();
                string people1           = System.Text.Encoding.GetEncoding("GB2312").GetString(people).Replace("\0", "").Trim();
                string samid1            = System.Text.Encoding.GetEncoding("GB2312").GetString(samid).Replace("\0", "").Trim();
                string validtermOfStart1 = System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfStart).Replace("\0", "").Trim() + "-" + System.Text.Encoding.GetEncoding("GB2312").GetString(validtermOfEnd).Replace("\0", "").Trim();

                tbxIdCardNo.Text = number1;
                tbxName.Text     = name1;

                if (sex1.Equals("男"))
                {
                    cbxGender.SelectedIndex = 0;
                }
                if (sex1.Equals("女"))
                {
                    cbxGender.SelectedIndex = 1;
                }

                getClientInfoAfterReadCard(null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 21
0
 private void button2_Click(object sender, EventArgs e)
 {
     isread = false;
     try { CVRSDK.CVR_CloseComm(); }
     catch { }
 }
Ejemplo n.º 22
0
        private void ReadIDCard()
        {
            int time = 0;

            while (true)
            {
                time++;
                int isHaveCard = CVRSDK.CVR_Authenticate();
                if (isHaveCard == 1)
                {
                    int readOk = CVRSDK.CVR_Read_Content(4);
                    if (readOk == 1)
                    {
                        #region
                        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[] address = new byte[30];
                        length = 70;
                        CVRSDK.GetPeopleAddress(ref address[0], ref length);
                        var iCard   = System.Text.Encoding.GetEncoding("GB2312").GetString(number).Replace("\0", "").Trim();
                        var iName   = System.Text.Encoding.GetEncoding("GB2312").GetString(name).Replace("\0", "").Trim();
                        var iAdress = System.Text.Encoding.GetEncoding("GB2312").GetString(address).Replace("\0", "").Trim();
                        if (iCard != "")
                        {
                            int t = time;
                            new Thread(() =>
                            {
                                //写入共享内存
                                var p = new Person()
                                {
                                    idcard = iCard, name = iName, address = iAdress
                                };
                                var bytes = FormatterMessageBytes(p);
                                share.Write(bytes, 0, bytes.Length);
                                BeginInvoke(new Action(() =>
                                {
                                    ShowMsg(string.Format("身份证读卡成功:本次读卡循环读取了{3}次,证件号码{0} 姓名{1} 地址{2}\r\n", iCard, iName, iAdress, t), false);
                                }));
                            })
                            {
                                IsBackground = true
                            }.Start();
                            time = 0;
                        }
                        else
                        {
                            BeginInvoke(new Action(() =>
                            {
                                ShowMsg("未读取到身份证号码", false);
                            }));
                        }

                        #endregion
                    }
                    else
                    {
                        BeginInvoke(new Action(() =>
                        {
                            ShowMsg("读卡操作失败!请重新放上卡片。", false);
                        }));
                    }
                }
                else
                {
                    BeginInvoke(new Action(() =>
                    {
                        ShowMsg("未放卡或卡片放置不正确,请重新放上卡片。", false);
                    }));
                }
                Thread.Sleep(50);
            }
        }
Ejemplo n.º 23
0
        private IDCard GetData()
        {
            try
            {
                //byte[] imgData = new byte[40960];
                int length = 40960;
                //CVRSDK.Getbase64BMPData(ref imgData[0], ref length);

                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;
                }

                Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
                var encoding = Encoding.GetEncoding("GB18030");
                if (bCivic)
                {
                    IDCard card = new IDCard()
                    {
                        //ImgString = Encoding.GetEncoding("GB2312").GetString(imgData).Trim('\0'),
                        sex              = Encoding.GetEncoding("GB2312").GetString(sex).Trim('\0'),
                        name             = Encoding.GetEncoding("GB18030").GetString(name).Trim('\0'),
                        number           = Encoding.GetEncoding("GB18030").GetString(number).Trim('\0'),
                        peopleNation     = Encoding.GetEncoding("GB18030").GetString(peopleNation).Trim('\0'),
                        birthday         = Encoding.GetEncoding("GB18030").GetString(birthday).Trim('\0'),
                        address          = Encoding.GetEncoding("GB18030").GetString(address).Trim('\0'),
                        signdate         = Encoding.GetEncoding("GB18030").GetString(signdate).Trim('\0'),
                        validtermOfStart = Encoding.GetEncoding("GB18030").GetString(validtermOfStart).Trim('\0'),
                        samid            = Encoding.GetEncoding("GB18030").GetString(samid).Trim('\0'),
                    };
                    return(card);
                }
            }
            catch (Exception)
            {
                //MessageBox.Show(ex.ToString());
            }
            return(new IDCard());
        }
Ejemplo n.º 24
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);
            }
        }
Ejemplo n.º 25
0
        private void personRegist_Load(object sender, EventArgs e)
        {
            this.label1.Text      = "居民健康档案登记";
            this.label1.ForeColor = Color.SkyBlue;
            label1.Font           = new Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, GraphicsUnit.Point, ((byte)(134)));
            label1.Left           = (this.panel1.Width - this.label1.Width) / 2;
            label1.BringToFront();

            this.label13.Text      = "登记记录";
            this.label13.ForeColor = Color.SkyBlue;
            label13.Font           = new Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, GraphicsUnit.Point, ((byte)(134)));
            label13.Left           = (this.panel4.Width - this.label13.Width) / 2;
            label13.BringToFront();

            BindNation();
            Common.SetComboBoxInfo(comboBox7, ltdorganizationDao.GetShengInfo());//区域
            DataTable dtbasic = bsdao.checkBasicsettingInfo();

            if (dtbasic.Rows.Count > 0)
            {
                xcuncode  = dtbasic.Rows[0]["cun_code"].ToString();
                shengcode = dtbasic.Rows[0]["sheng_code"].ToString();
                Common.SetComboBoxInfo(comboBox6, ltdorganizationDao.GetCityInfo(shengcode));
                shicode = dtbasic.Rows[0]["shi_code"].ToString();
                Common.SetComboBoxInfo(comboBox3, ltdorganizationDao.GetCountyInfo(shicode));
                qxcode = dtbasic.Rows[0]["qx_code"].ToString();
                Common.SetComboBoxInfo(comboBox4, areadao.zhenInfo(qxcode));
                xzcode = dtbasic.Rows[0]["xz_code"].ToString();
                Common.SetComboBoxInfo(comboBox5, areadao.cunInfo(xzcode));
                //因为名称有可能对应不上那么就用code对应
                Common.SetComboBoxSelectIndex(comboBox7, shengcode);
                Common.SetComboBoxSelectIndex(comboBox6, shicode);
                Common.SetComboBoxSelectIndex(comboBox3, qxcode);
                Common.SetComboBoxSelectIndex(comboBox4, xzcode);
                Common.SetComboBoxSelectIndex(comboBox5, xcuncode);
            }

            label14.Text = DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString() + "月" + DateTime.Now.Day.ToString() + "日";
            registrationRecordCheck();//右侧统计信息
            //身份证读卡初始化
            try
            {
                int iPort;
                for (iPort = 1001; iPort <= 1016; iPort++)
                {
                    iRetUSB = CVRSDK.CVR_InitComm(iPort);
                    if (iRetUSB == 1)
                    {
                        break;
                    }
                }
                if (iRetUSB != 1)
                {
                    for (iPort = 1; iPort <= 4; iPort++)
                    {
                        iRetCOM = CVRSDK.CVR_InitComm(iPort);
                        if (iRetCOM == 1)
                        {
                            break;
                        }
                    }
                }

                if ((iRetCOM == 1) || (iRetUSB == 1))
                {
                    this.label42.Text = "初始化成功!";
                    jkjcheckdao.updateShDevice(1, -1, -1, -1, -1, -1, -1, -1, -1, -1);
                }
                else
                {
                    this.label42.Text = "初始化失败!";
                    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);
                    jkjcheckdao.updateShDevice(0, -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);
                jkjcheckdao.updateShDevice(0, -1, -1, -1, -1, -1, -1, -1, -1, -1);
            }

            //摄像头初始化
            try
            {
                // 枚举所有视频输入设备
                videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

                if (videoDevices.Count == 0)
                {
                    throw new ApplicationException();
                }
                //foreach (FilterInfo device in videoDevices)
                //{
                //    tscbxCameras.Items.Add(device.Name);
                //}
                //tscbxCameras.SelectedIndex = 0;

                VideoCaptureDevice videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
                videoSource.DesiredFrameSize   = new System.Drawing.Size(320, 240);
                videoSource.DesiredFrameRate   = 1;
                videoSourcePlayer1.VideoSource = videoSource;
                videoSourcePlayer1.Start();
            }
            catch (ApplicationException)
            {
                videoDevices = null;
                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);
                jkjcheckdao.updateShDevice(-1, 0, -1, -1, -1, -1, -1, -1, -1, -1);
            }
            //读取默认的打印条数
            ReadPrintBarCodeNumber();
        }
Ejemplo n.º 26
0
        private void personRegist_Load(object sender, EventArgs e)
        {
            this.label1.Text      = "居民健康档案登记";
            this.label1.ForeColor = Color.SkyBlue;
            label1.Font           = new Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, GraphicsUnit.Point, ((byte)(134)));
            label1.Left           = (this.panel1.Width - this.label1.Width) / 2;
            label1.BringToFront();

            this.label13.Text      = "登记记录";
            this.label13.ForeColor = Color.SkyBlue;
            label13.Font           = new Font("微软雅黑", 20F, System.Drawing.FontStyle.Bold, GraphicsUnit.Point, ((byte)(134)));
            label13.Left           = (this.panel4.Width - this.label13.Width) / 2;
            label13.BringToFront();

            label14.Text = DateTime.Now.Year.ToString() + "年" + DateTime.Now.Month.ToString() + "月" + DateTime.Now.Day.ToString() + "日";

            //身份证读卡初始化
            try
            {
                int iPort;
                for (iPort = 1001; iPort <= 1016; iPort++)
                {
                    iRetUSB = CVRSDK.CVR_InitComm(iPort);
                    if (iRetUSB == 1)
                    {
                        break;
                    }
                }
                if (iRetUSB != 1)
                {
                    for (iPort = 1; iPort <= 4; iPort++)
                    {
                        iRetCOM = CVRSDK.CVR_InitComm(iPort);
                        if (iRetCOM == 1)
                        {
                            break;
                        }
                    }
                }

                if ((iRetCOM == 1) || (iRetUSB == 1))
                {
                    this.label42.Text = "初始化成功!";
                }
                else
                {
                    this.label42.Text = "初始化失败!";
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            //摄像头初始化
            try
            {
                // 枚举所有视频输入设备
                videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);

                if (videoDevices.Count == 0)
                {
                    throw new ApplicationException();
                }
                //foreach (FilterInfo device in videoDevices)
                //{
                //    tscbxCameras.Items.Add(device.Name);
                //}
                //tscbxCameras.SelectedIndex = 0;

                VideoCaptureDevice videoSource = new VideoCaptureDevice(videoDevices[0].MonikerString);
                videoSource.DesiredFrameSize   = new System.Drawing.Size(320, 240);
                videoSource.DesiredFrameRate   = 1;
                videoSourcePlayer1.VideoSource = videoSource;
                videoSourcePlayer1.Start();
            }
            catch (ApplicationException)
            {
                videoDevices = null;
            }
        }
Ejemplo n.º 27
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());
            }
        }