Пример #1
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);
     }
 }
Пример #2
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);
     }
 }
Пример #3
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("读卡错误,请重试!");
     }
 }
Пример #4
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);
        }
Пример #5
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());
     }
 }
Пример #6
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);
     }
 }
Пример #7
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());
            }
        }
Пример #8
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("读卡错误,请重试!");
     }
 }
Пример #9
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);
            }
        }
Пример #10
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);
            }
        }