示例#1
0
        private void BTN_SCAN_TEST_Click(object sender, EventArgs e)
        {
            try
            {
                if (COM_PASS_SCAN.SelectedIndex < 0)
                {
                    return;
                }
                setWaitCursor(true);

                GTF_PassportScanner passScan = GTF_PassportScanner.Instance(null, Constants.PATH_TEMP);

                int nRet = 0;
                //nRet = passScan.open(COM_PASS_SCAN.SelectedIndex);
                if ("GTF-PS01(GTF)".Equals(COM_PASS_SCAN.SelectedItem))
                {
                    nRet = passScan.open(0);
                }
                else if ("NP-1000(OKPOS)".Equals(COM_PASS_SCAN.SelectedItem))
                {
                    nRet = passScan.open(3);
                }
                else if ("WISESCAN420".Equals(COM_PASS_SCAN.SelectedItem))
                {
                    nRet = passScan.open(1);
                }
                else if ("COMBOSMART(DAWIN)".Equals(COM_PASS_SCAN.SelectedItem))
                {
                    nRet = passScan.open(2);
                }

                if (nRet > 0)
                {
                    Constants.PASSPORT_SCAN_OPEN = true;
                    //COM_PASS_SCAN.Enabled = false;
                    int strmrz = passScan.scan(30);
                    if (strmrz > 0)
                    {
                        string strTempData = passScan.getMRZ1() + "\n" + passScan.getMRZ2();
                        MetroMessageBox.Show(this, strTempData /*+ "\n"+passScan.GetPassportFirstName()+"\n"+ passScan.GetPassportLastName() +"\n"+ passScan.GetPassportName()*/
                                             , "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    else
                    {
                        MetroMessageBox.Show(this, Constants.getMessage("PASSPORT_REMOVE"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    passScan.close();
                }
                else
                {
                    MetroMessageBox.Show(this, Constants.getMessage("PASSPORT_ERROR"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            finally
            {
                setWaitCursor(false);
                BTN_SCAN_TEST.Focus();
            }
        }
示例#2
0
        private void BTN_SCAN_Click(object sender, EventArgs e)
        {
            try
            {
                if (Constants.PASSPORT_TYPE < 0)//여권스캐너 미 선택시 경고창
                {
                    MetroMessageBox.Show(this, Constants.getMessage("PASSPORT_NOTHING"), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                //Wait 커서 상태면 return 처리
                //if (Cursor.Current == Cursors.WaitCursor)
                if (this.UseWaitCursor)
                {
                    return;
                }

                setWaitCursor(true);
                if (m_passScan.open(Constants.PASSPORT_TYPE) > 0)
                {
                    int strmrz = m_passScan.scan(7);
                    if (strmrz > 0)
                    {
                        //공용
                        TXT_PASSPORT_NAME.Text = m_passScan.GetPassportName();
                        TXT_PASSPORT_NO.Text   = m_passScan.GetPassportNo();
                        TXT_PASSPORT_NAT.Text  = m_passScan.GetNationality();
                        //TXT_PASSPORT_NAT_NAME.Text = this.searchNatonalityName(m_passScan.GetNationality());
                        COM_PASSPORT_SEX.Text          = m_passScan.GetSex();
                        COM_PASSPORT_SEX.SelectedValue = m_passScan.GetSex();

                        Utils  gtfUtil  = new Utils();
                        string strBirth = gtfUtil.getFullDate(m_passScan.GetBirthDate());
                        strBirth = strBirth.Substring(0, 4) + "-" + strBirth.Substring(4, 2) + "-" + strBirth.Substring(6, 2);
                        //string strExp = gtfUtil.getFullDate(m_passScan.GetExpireDate());
                        string strExp = "20" + m_passScan.GetExpireDate();
                        strExp = strExp.Substring(0, 4) + "-" + strExp.Substring(4, 2) + "-" + strExp.Substring(6, 2);
                        //TXT_PASSPORT_BIRTH.Text = gtfUtil.getFullDate(m_passScan.GetBirthDate());
                        //TXT_PASSPORT_EXP.Text = gtfUtil.getFullDate(m_passScan.GetExpireDate());

                        TXT_PASSPORT_BIRTH.Text = strBirth;
                        TXT_PASSPORT_EXP.Text   = strExp;
                    }
                    else
                    {
                        MetroMessageBox.Show(this, Constants.getMessage("PASSPORT_REMOVE"), "Issue", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            finally
            {
                setWaitCursor(false);
            }
        }
        private void BTN_SCAN_TEST_Click(object sender, EventArgs e)
        {
            GTF_PassportScanner passScan = GTF_PassportScanner.Instance();

            try
            {
                setWaitCursor(true);
                int nRet = 0;
                passScan.close();
                if ("GTF".Equals(COM_PASS_SCAN.SelectedItem))
                {
                    nRet = passScan.open(0);
                }
                else if ("OKPOS".Equals(COM_PASS_SCAN.SelectedItem))
                {
                    nRet = passScan.open(3);
                }
                else if ("WISESCAN420".Equals(COM_PASS_SCAN.SelectedItem))
                {
                    nRet = passScan.open(1);
                }
                else if ("DAWIN(GTF SG)".Equals(COM_PASS_SCAN.SelectedItem))
                {
                    nRet = passScan.open(2);
                }

                if (nRet > 0)
                {
                    int strmrz = passScan.scan(30);
                    if (strmrz > 0)
                    {
                        string strTempData = "Passport Data\n" + passScan.getMRZ1() + "\n" + passScan.getMRZ2();
                        MetroMessageBox.Show(this, strTempData, "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        MetroMessageBox.Show(this, "Please check if passport is inserted into slot", "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MetroMessageBox.Show(this, "Passport scanner not connected", "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            finally
            {
                passScan.close();
                setWaitCursor(false);
                BTN_SCAN_TEST.Focus();
            }
        }
        private void BTN_SCAN_Click(object sender, EventArgs e)
        {
            try
            {
                this.BTN_SCAN.Click -= new System.EventHandler(this.BTN_SCAN_Click);
                BTN_SCAN.Enabled     = false;
                if (txt_PassportNo.Text.Length > 0)
                {
                    return;
                }

                //scan_worker = new Thread(run_progress);
                //scan_worker.Start();
                txt_PassportNo.Text  = "";
                txt_CountryCode.Text = "";
                txt_FirstName.Text   = "";
                txt_LastName.Text    = "";
                expiry_date          = "";
                date_of_birth        = "";
                gender = "";

                Utils gtfUtil = new Utils();

                setWaitCursor(true);
                m_passScan.close();
                if (m_passScan.open(Constants.PASSPORT_TYPE) > 0)
                {
                    int strmrz = m_passScan.scan(Constants.SCAN_TIMEOUT);
                    if (strmrz > 0)
                    {
                        //싱가폴
                        if (m_passScan.GetNationality().Equals("SGP"))
                        {
                            MetroMessageBox.Show(this, Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/ValidatePassportSGP"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            txt_PassportNo.Text  = m_passScan.GetPassportNo();
                            txt_CountryCode.Text = m_passScan.GetNationality();
                            txt_FirstName.Text   = m_passScan.GetPassportLastName();
                            txt_LastName.Text    = m_passScan.GetPassportFirstName();
                            expiry_date          = "20" + m_passScan.GetExpireDate();
                            date_of_birth        = gtfUtil.getFullDate(m_passScan.GetBirthDate());
                            gender = m_passScan.GetSex();
                            txt_PurchaseAmt.Focus();
                        }
                    }
                    else
                    {
                        MetroMessageBox.Show(this, Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/PassportReadError"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                else
                {
                    MetroMessageBox.Show(this, Constants.CONF_MANAGER.getCustomValue("Message", Constants.SYSTEM_LANGUAGE + "/PassportConnectError"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                Constants.LOGGER_MAIN.Error(ex.StackTrace);
                //MessageBox.Show(ex.Message);
            }
            finally
            {
                m_passScan.close();
                BTN_SCAN.Enabled = true;
                setWaitCursor(false);

                /*
                 * if(scan_worker.IsAlive)
                 * {
                 *  scan_worker.Abort();
                 * }
                 */
                this.BTN_SCAN.Click += new System.EventHandler(this.BTN_SCAN_Click);
            }
        }
        private void BTN_SCAN_TEST_Click(object sender, EventArgs e)
        {
            try
            {
                if (COM_PASS_SCAN.SelectedIndex < 0)
                {
                    return;
                }
                setWaitCursor(true);

                GTF_PassportScanner passScan = GTF_PassportScanner.Instance(null, Constants.PATH_TEMP);

                int nRet = 0;
                //nRet = passScan.open(COM_PASS_SCAN.SelectedIndex);
                if ("GTF-PS01(GTF)".Equals(COM_PASS_SCAN.SelectedItem))
                {
                    nRet = passScan.open(0);
                }
                else if ("NP-1000(OKPOS)".Equals(COM_PASS_SCAN.SelectedItem))
                {
                    nRet = passScan.open(3);
                }
                else if ("WISESCAN420".Equals(COM_PASS_SCAN.SelectedItem))
                {
                    nRet = passScan.open(1);
                }
                else if ("COMBOSMART(DAWIN)".Equals(COM_PASS_SCAN.SelectedItem))
                {
                    nRet = passScan.open(2);
                }

                if (nRet > 0)
                {
                    Constants.PASSPORT_SCAN_OPEN = true;
                    //COM_PASS_SCAN.Enabled = false;
                    int strmrz = passScan.scan(30);
                    if (strmrz > 0)
                    {
                        string strTempData = passScan.getMRZ1() + "\n" + passScan.getMRZ2();
                        MetroMessageBox.Show(this, strTempData, "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                        string mrz2 = passScan.getMRZ2();
                        //int ncrc = int.Parse(passScan.getMRZ2());
                        Utils gtfUtil      = new Utils();
                        bool  check_result = gtfUtil.checkMRZLine2(mrz2);
                        //MetroMessageBox.Show(this, "passportNumber[" + passnumber + "] check Digit[" + ncrc+ "] Check Result[" + check_result + "]" );
                        MetroMessageBox.Show(this, "getMRZ2[" + mrz2 + "] Check Result[" + check_result + "]");
                    }
                    else
                    {
                        MetroMessageBox.Show(this, Constants.getMessage("PASSPORT_REMOVE"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    passScan.close();
                }
                else
                {
                    MetroMessageBox.Show(this, Constants.getMessage("PASSPORT_ERROR"), "Passport Info", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            finally
            {
                setWaitCursor(false);
                BTN_SCAN_TEST.Focus();
            }
        }