private void btnUninit_Click(object sender, EventArgs e) { //=========================================================================// // Uninit scanner module //=========================================================================// UFS_STATUS ufs_res; Cursor.Current = Cursors.WaitCursor; ufs_res = m_ScannerManager.Uninit(); Cursor.Current = this.Cursor; if (ufs_res == UFS_STATUS.OK) { tbxMessage.AppendText("UFScanner Uninit: OK\r\n"); } else { UFScanner.GetErrorString(ufs_res, out m_strError); tbxMessage.AppendText("UFScanner Uninit: " + m_strError + "\r\n"); } //=========================================================================// //=========================================================================// // Close database //=========================================================================// UFD_STATUS ufd_res; if (m_Database != null) { ufd_res = m_Database.Close(); if (ufd_res == UFD_STATUS.OK) { tbxMessage.AppendText("UFDatabase Close: OK\r\n"); } else { UFDatabase.GetErrorString(ufd_res, out m_strError); tbxMessage.AppendText("UFDatabase Close: " + m_strError + "\r\n"); } } lvDatabaseList.Items.Clear(); //=========================================================================// }
public string GetCardID() { try { Log("Start Get Card ID"); byte[][] DBTemplate = null; int[] DBTemplateSize = null; int[] DBSerial = null; int DBTemplateNum; int nMatchIndex; // Initialize scanners UFS_STATUS ufs_res = new UFS_STATUS(); int nScannerNumber; ufs_res = m_ScannerManager.Init(); nScannerNumber = m_ScannerManager.Scanners.Count; if (nScannerNumber <= 0) { strLastError = "There are no suprema scanner"; Log(strLastError); return(""); } m_Scanner = m_ScannerManager.Scanners[0]; // Database m_Database = new UFDatabase(); if (m_szConnectionString != null) { m_ufd_res = m_Database.Open(m_szConnectionString, "", ""); } // Create matcher m_Matcher = new UFMatcher(); if (!ExtractTemplate(m_bTemplate1, out m_nTemplateSize1)) { m_ScannerManager.Uninit(); m_Database.Close(); return(""); } m_ScannerManager.Uninit(); //Identify loyee fingerprint :GetTemplateListWithSerial m_ufd_res = m_Database.GetTemplateListWithSerial(out DBTemplate, out DBTemplateSize, out DBTemplateNum, out DBSerial); //Identify employee fingerprint :Identify m_ufm_res = m_Matcher.Identify(m_bTemplate1, m_nTemplateSize1, DBTemplate, DBTemplateSize, DBTemplateNum, 5000, out nMatchIndex); string m_strUserID = ""; int m_nFingerIndex = 0; string memo = ""; int x = 0; if (nMatchIndex >= 0 && DBSerial != null) { m_ufd_res = m_Database.GetDataBySerial(DBSerial[nMatchIndex], out m_strUserID, out m_nFingerIndex, m_bTemplate1, out m_nTemplateSize1, null, out x, out memo); } else { m_strUserID = ""; } if (m_ufm_res != UFM_STATUS.OK) { return(""); } Log(m_strUserID.Replace('\0', ' ').Trim()); return(m_strUserID.Replace('\0', ' ').Trim()); } catch (Exception ex) { strLastError = "Unkown Error Happened:\n" + ex.Message; Log(strLastError); return(""); } }