Exemplo n.º 1
0
        private void btnGetCustomerInfo_Click(object sender, EventArgs e)
        {
            Int32  result;
            Int32  port = 1001;   //USB接口
            UInt32 flag = 0;

            result = CardRecognise.OpenCardReader(port, flag);

            if (result != 0)    //
            {
                MessageBox.Show("设备初始化失败,请检查设备是否已连接?");
            }
            else
            {
                CardRecognise.PERSONINFOW newInfo = new CardRecognise.PERSONINFOW();
                result = CardRecognise.GetPersonMsgW(ref newInfo, "");
                if (result != 0)
                {
                    MessageBox.Show("读卡失败!");
                }
                else
                {
                    tbxName.Text          = newInfo.name;
                    tbxContactPerson.Text = newInfo.name;
                    tbxAddress.Text       = newInfo.address;
                    tbxCertNum.Text       = newInfo.cardId;
                }
            }
            CardRecognise.CloseCardReader();
        }
Exemplo n.º 2
0
        private void btnQueryByCard_Click(object sender, EventArgs e)
        {
            Int32  result;
            Int32  port = 1001;   //USB接口
            UInt32 flag = 0;

            result = CardRecognise.OpenCardReader(port, flag);

            if (result != 0)
            {
                MessageBox.Show(this, "设备初始化失败,请检查设备是否已连接?", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                CardRecognise.PERSONINFOW newInfo = new CardRecognise.PERSONINFOW();
                result = CardRecognise.GetPersonMsgW(ref newInfo, "");
                if (result != 0)
                {
                    MessageBox.Show(this, "读卡错误,请重新操作!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    this.tbxCardNumber.Text = newInfo.cardId;
                    if (CheckCartNumber() != DialogResult.OK)
                    {
                        MessageBox.Show("证件号不能为空!", "提示信息");
                    }
                    else
                    {
                        QueryByNumber();
                    }
                }
            }
            CardRecognise.CloseCardReader();
        }