private void savefingerprint() { try { Dictionary <int, string> Fmds = new Dictionary <int, string>(); Dictionary <int, List <string> > Fids = new Dictionary <int, List <string> >(); foreach (int finger in mobj.Fmds.Keys) { Fmds.Add(finger, Fmd.SerializeXml(mobj.Fmds[finger])); //MessageBox.Show("extracted fmd :" + Fmd.SerializeXml(mobj.Fmds[finger]), "Alert"); List <string> fds = new List <string>(); foreach (Fid fd in mobj.Fids[finger]) { fds.Add(Fid.SerializeXml(fd)); // MessageBox.Show("extracted fid :"+Fid.SerializeXml(fd), "Alert"); } Fids.Add(finger, fds); } PersonRepository repo = new PersonRepository(); bool b = repo.saveFingerPrint(Fmds, Fids, pvm.PersonId, null); if (b) { bio_altered = false; MessageBox.Show("FingerPrint Saved Successully", "Alert", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Error Saving FingerPrint. ", "Alert"); } } catch (Exception ex) { MessageBox.Show("Error Saving FingerPrint. Details:" + ex.StackTrace, "Alert"); } }
private ProductionXmlFileTemplate getSpeedGuideXmlFileContent(Workbook warGuideBWorkbook) { var template = new ProductionXmlFileTemplate(); Worksheet insertV3Sheet = ExcelUtil.GetWorksheet(configObj.WorksheetWarrantGuideBInsertV3, warGuideBWorkbook); if (insertV3Sheet == null) { LogMessage(string.Format("There's no worksheet {0} in workbook {1}", configObj.WorksheetWarrantGuideBInsertV3, warGuideBWorkbook.FullName)); } int lastAddedRicNum; for (int i = 86; i < 1966; i++) { if (i % 20 == 6) { Core.Ric ric = new Core.Ric { Name = string.Format("HK/WTS{0}", (i / 20 + 2).ToString("D2")) }; template.rics.rics.Add(ric); } Fid fid = new Fid { Id = ((i - 86) % 20) + 319, Value = getFidValue(insertV3Sheet, i) }; lastAddedRicNum = template.rics.rics.Count - 1; template.rics.rics[lastAddedRicNum].fids.Add(fid); } return(template); }
private IEnumerable <Fmd> CaptureAndExtractFmd() { while (!objVariables.reset) { DataResult <Fmd> resultConversion; try { if (objVariables.count >= 8) { MessageBox.Show("El registro no se completó, vuelve a intentarlo.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); objVariables.count = 0; break; } Fid fid = null; if (objVariables.currentReader == null) { objVariables.currentReader = objDevice.IndexDevice(); objDevice.InitializeDevice(ref objVariables.currentReader); } if (!CaptureFinger(ref fid)) { //break; } if (fid == null) { continue; } objVariables.count++; resultConversion = FeatureExtraction.CreateFmdFromFid(fid, Constants.Formats.Fmd.ANSI); objPrincipal.txtSalida.Dispatcher.BeginInvoke(new Action(delegate() { objPrincipal.txtSalida.AppendText("\nLa huella se ha capturado. Captura Numero: " + objVariables.count); })); if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS) { break; } } catch (Exception) { break; } yield return(resultConversion.Data); } }
private void CaptureThread() { variables.reset = false; while (!variables.reset) { Fid fid = null; if (variables.currentReader == null) { variables.currentReader = device.IndexDevice(); device.InitializeDevice(ref variables.currentReader); } if (!CaptureFinger(ref fid)) { //break; } if (fid == null) { continue; } foreach (Fid.Fiv fiv in fid.Views) { SendMessage(CreateBitmap(fiv.RawImage, fiv.Width, fiv.Height)); } } if (variables.currentReader != null) { variables.currentReader.Dispose(); } }
protected void btnSearchButton_Click(object sender, EventArgs e) { if (Session["id"] == null || Session["id"].ToString().Equals("")) { Session["link"] = "MovieDetails.aspx?Mid=" + Mid; Response.Redirect("Login.aspx"); } else { if (SearchBox.Text.Equals("")) { } else { check_friend_found(); if (Fid.Equals("") && Fname.Equals("") && FimageURL.Equals("")) { MessageNotFound.Visible = true; } else { ImageUser.Visible = true; NameUser.Visible = true; ImageUser.ImageUrl = FimageURL; NameUser.Text = Fname; btnSuggestSearchFriend.Visible = true; } } } }
/// <summary> /// Until a break occurs, capture finger and display the fid as a bitmap. /// </summary> private void CaptureThread() { reset = false; while (!reset) { Fid fid = null; if (!_sender.CaptureFinger(ref fid)) { break; } if (fid == null) { continue; } foreach (Fid.Fiv fiv in fid.Views) { SendMessage(CreateBitmap(fiv.RawImage, fiv.Width, fiv.Height)); } } if (_sender.CurrentReader != null) { _sender.CurrentReader.Dispose(); } }
public override int GetHashCode() { int hashCode = 17; // we *know* we are using this in a dictionary, so pre-compute this hashCode = hashCode * 23 + Id.GetHashCode(); hashCode = hashCode * 23 + (Fid == null ? 0 : Fid.GetHashCode()); hashCode = hashCode * 23 + (EnableDate == null ? 0 : EnableDate.GetHashCode()); hashCode = hashCode * 23 + (DisableDate == null ? 0 : DisableDate.GetHashCode()); hashCode = hashCode * 23 + Dr.GetHashCode(); hashCode = hashCode * 23 + Ts.GetHashCode(); hashCode = hashCode * 23 + (CreateBy == null ? 0 : CreateBy.GetHashCode()); hashCode = hashCode * 23 + (CreateDate == null ? 0 : CreateDate.GetHashCode()); hashCode = hashCode * 23 + (CreateName == null ? 0 : CreateName.GetHashCode()); hashCode = hashCode * 23 + (UpdateBy == null ? 0 : UpdateBy.GetHashCode()); hashCode = hashCode * 23 + (UpdateDate == null ? 0 : UpdateDate.GetHashCode()); hashCode = hashCode * 23 + (UpdateName == null ? 0 : UpdateName.GetHashCode()); hashCode = hashCode * 23 + (TableName == null ? 0 : TableName.GetHashCode()); hashCode = hashCode * 23 + (TableComment == null ? 0 : TableComment.GetHashCode()); hashCode = hashCode * 23 + (TableMode == null ? 0 : TableMode.GetHashCode()); hashCode = hashCode * 23 + (SubTable == null ? 0 : SubTable.GetHashCode()); hashCode = hashCode * 23 + IsTree.GetHashCode(); hashCode = hashCode * 23 + IsPagination.GetHashCode(); hashCode = hashCode * 23 + IsSync.GetHashCode(); return(hashCode); }
//17 lines each page private void GenerateEnglishVersionXmlFile(List <BrokerInfo> brokerList, string xmlFilePath) { int lineNumEachPage = 22; int lastAddedRicNum = 0; ProductionXmlFileTemplate template = new ProductionXmlFileTemplate(); for (int i = 0; i < lineNumEachPage * 34; i++) { if (i % lineNumEachPage == 0) { Core.Ric ric = new Core.Ric(); ric.Name = string.Format("HKBK{0}", ((i / lineNumEachPage) + 2).ToString("D2")); template.rics.rics.Add(ric); } Fid fid = new Fid(); fid.Id = 317 + i % lineNumEachPage; if (i < brokerList.Count) { fid.Value = getFidValueForEnglishVersionFile(brokerList[i]); } else { fid.Value = "\"\""; } lastAddedRicNum = template.rics.rics.Count - 1; template.rics.rics[lastAddedRicNum].fids.Add(fid); } ConfigUtil.WriteXml(xmlFilePath, template); TaskResultList.Add(new TaskResultEntry("English Version XML Format File", "", xmlFilePath)); }
private ProductionXmlFileTemplate GetHKMAINSSXmlFileContent(Worksheet worksheet) { ProductionXmlFileTemplate template = new ProductionXmlFileTemplate(); int lastAddedRicNum = 0; // the default id value of the first fid node in each ric node int lastStartId = 316; // the start row of the range which will be copied from the HKMAINSSExcel file to the HKMAINSSXml file int startRow = (configObj.HKMAINSS_CONFIG_StartPage - 1) * configObj.HKMAINSS_CONFIG_LineNum + 1; // the end row of the range which will be copied from the HKMAINSSExcel file to the HKMAINSSXml file int endRow = configObj.HKMAINSS_CONFIG_TotalPage * configObj.HKMAINSS_CONFIG_LineNum; //copy the records whose Range is from startRow to endRow in the HKMAINSSExcel file for (int i = startRow; i <= endRow; i++) { if ((i - startRow) % configObj.HKMAINSS_CONFIG_LineNum == 0) { lastAddedRicNum = template.rics.rics.Count - 1; Core.Ric ric = new Core.Ric(); ric.Name = string.Format("HK/MAINSS{0}", (((i - startRow) / configObj.HKMAINSS_CONFIG_LineNum) + configObj.HKMAINSS_CONFIG_StartPage).ToString("D2")); template.rics.rics.Add(ric); if (lastAddedRicNum >= 0) { Fid lastFid = new Fid(); lastFid.Id = 339; string continuedPageDescription = "Continued on <" + template.rics.rics[lastAddedRicNum + 1].Name + ">"; continuedPageDescription = continuedPageDescription.PadLeft(recordTotalLength); lastFid.Value = string.Format("\"{0}\"", continuedPageDescription); template.rics.rics[lastAddedRicNum].fids.Add(lastFid); } } if ((i - startRow) % configObj.HKMAINSS_CONFIG_LineNum == 3) { lastStartId = 315; continue; } Fid fid = new Fid(); fid.Id = lastStartId + (i - startRow) % configObj.HKMAINSS_CONFIG_LineNum; string colValue = GetFormatedValue(i, worksheet); fid.Value = string.Format("\"{0}\"", colValue); lastAddedRicNum = template.rics.rics.Count - 1; template.rics.rics[lastAddedRicNum].fids.Add(fid); if ((i - startRow) % configObj.HKMAINSS_CONFIG_LineNum == (configObj.HKMAINSS_CONFIG_LineNum - 1)) { lastStartId = 316; } } return(template); }
private ProductionXmlFileTemplate GetGemssXmlFileContent(Worksheet gemssWorksheet) { ProductionXmlFileTemplate template = new ProductionXmlFileTemplate(); int lastAddedRicNum = 0; for (int i = 1; i <= 240; i++) { if (i % 24 == 1) { lastAddedRicNum = template.rics.rics.Count - 1; if (lastAddedRicNum > 0) { Fid lastFid = new Fid(); lastFid.Id = 339; lastFid.Value = string.Format("\"Continued on <{0}>\"", template.rics.rics[lastAddedRicNum].Name); } Core.Ric ric = new Core.Ric(); ric.Name = string.Format("HK/GEMSS{0}", (i / 24 + 1).ToString("D2")); template.rics.rics.Add(ric); } if (i % 24 == 0) { continue; } Fid fid = new Fid(); fid.Id = 316 + (i - 1) % 24; if (ExcelUtil.GetRange(i, 1, gemssWorksheet).Text != null) { fid.Value = string.Format("\"{0}\"", ExcelUtil.GetRange(i, 1, gemssWorksheet).Text.ToString()); if (fid.Value == "\" \"") { fid.Value = " ".PadLeft(recordTotalLength); fid.Value = "\"" + fid.Value + "\""; } } else { fid.Value = string.Format("\"{0}\"", " ".PadLeft(recordAlignrightLength)); } lastAddedRicNum = template.rics.rics.Count - 1; template.rics.rics[lastAddedRicNum].fids.Add(fid); } return(template); }
private IEnumerable <Fmd> CaptureAndExtractFmd() { while (!reset) { DataResult <Fmd> resultConversion; try { if (count >= 8) { SendMessage("Enrollment was unsuccessful. Please try again."); count = 0; break; } Fid fid = null; if (!_sender.CaptureFinger(ref fid)) { break; } if (fid == null) { continue; } count++; resultConversion = FeatureExtraction.CreateFmdFromFid(fid, Constants.Formats.Fmd.ANSI); SendMessage("A finger was captured. \r\nCount: " + (count)); if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS) { break; } } catch (Exception) { break; } yield return(resultConversion.Data); } }
public override int GetHashCode() { int hash = 1; if (Fid.Length != 0) { hash ^= Fid.GetHashCode(); } if (Name.Length != 0) { hash ^= Name.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { int hashCode = 17; // we *know* we are using this in a dictionary, so pre-compute this hashCode = hashCode * 23 + Id.GetHashCode(); hashCode = hashCode * 23 + (Fid == null ? 0 : Fid.GetHashCode()); hashCode = hashCode * 23 + (EnableDate == null ? 0 : EnableDate.GetHashCode()); hashCode = hashCode * 23 + (DisableDate == null ? 0 : DisableDate.GetHashCode()); hashCode = hashCode * 23 + Dr.GetHashCode(); hashCode = hashCode * 23 + Ts.GetHashCode(); hashCode = hashCode * 23 + (CreateBy == null ? 0 : CreateBy.GetHashCode()); hashCode = hashCode * 23 + (CreateDate == null ? 0 : CreateDate.GetHashCode()); hashCode = hashCode * 23 + (CreateName == null ? 0 : CreateName.GetHashCode()); hashCode = hashCode * 23 + (UpdateBy == null ? 0 : UpdateBy.GetHashCode()); hashCode = hashCode * 23 + (UpdateDate == null ? 0 : UpdateDate.GetHashCode()); hashCode = hashCode * 23 + (UpdateName == null ? 0 : UpdateName.GetHashCode()); hashCode = hashCode * 23 + (TableName == null ? 0 : TableName.GetHashCode()); hashCode = hashCode * 23 + (ColName == null ? 0 : ColName.GetHashCode()); hashCode = hashCode * 23 + (ColComment == null ? 0 : ColComment.GetHashCode()); hashCode = hashCode * 23 + (ColDefault == null ? 0 : ColDefault.GetHashCode()); hashCode = hashCode * 23 + (ColType == null ? 0 : ColType.GetHashCode()); hashCode = hashCode * 23 + ColProperty.GetHashCode(); hashCode = hashCode * 23 + ColLength.GetHashCode(); hashCode = hashCode * 23 + DisplayWidth.GetHashCode(); hashCode = hashCode * 23 + ColOrder.GetHashCode(); hashCode = hashCode * 23 + ColPrecision.GetHashCode(); hashCode = hashCode * 23 + NullAble.GetHashCode(); hashCode = hashCode * 23 + ShowAble.GetHashCode(); hashCode = hashCode * 23 + IsDefaultCol.GetHashCode(); hashCode = hashCode * 23 + (CtrlType == null ? 0 : CtrlType.GetHashCode()); hashCode = hashCode * 23 + (RefTable == null ? 0 : RefTable.GetHashCode()); hashCode = hashCode * 23 + (RefID == null ? 0 : RefID.GetHashCode()); hashCode = hashCode * 23 + (RefCode == null ? 0 : RefCode.GetHashCode()); hashCode = hashCode * 23 + (RefName == null ? 0 : RefName.GetHashCode()); hashCode = hashCode * 23 + (RefCondition == null ? 0 : RefCondition.GetHashCode()); hashCode = hashCode * 23 + (RefCols == null ? 0 : RefCols.GetHashCode()); hashCode = hashCode * 23 + (RefType == null ? 0 : RefType.GetHashCode()); hashCode = hashCode * 23 + (MainTable == null ? 0 : RefType.GetHashCode()); hashCode = hashCode * 23 + (MainTableCol == null ? 0 : MainTableCol.GetHashCode()); hashCode = hashCode * 23 + (CalculationExpr == null ? 0 : CalculationExpr.GetHashCode()); return(hashCode); }
private ProductionXmlFileTemplate GetHKMAINXmlFileContent(Worksheet worksheet) { ProductionXmlFileTemplate template = new ProductionXmlFileTemplate(); int lastAddedRicNum = 0; string dateStr = ExcelUtil.GetRange(1, 1, worksheet).Text.ToString(); string titleLine = "RIC STOCK NAME SHARES TURNOVER ($)"; string partingLine = "========= ==================== =============== ==============="; for (int i = 4; i <= 503; i++) { if (i % 20 == 4) { Ric.Core.Ric ric = new Ric.Core.Ric(); ric.Name = string.Format("HK/MAINSS{0}", (i / 20 + 1).ToString("D2")); template.rics.rics.Add(ric); Fid fidDate = new Fid(); fidDate.Id = 316; fidDate.Value = string.Format("\"{0}\"", dateStr); lastAddedRicNum = template.rics.rics.Count - 1; template.rics.rics[lastAddedRicNum].fids.Add(fidDate); Fid fidTitleLine = new Fid(); fidTitleLine.Id = 317; fidTitleLine.Value = string.Format("\"{0}\"", titleLine); template.rics.rics[lastAddedRicNum].fids.Add(fidTitleLine); Fid fidPartingLine = new Fid(); fidPartingLine.Id = 318; fidPartingLine.Value = string.Format("\"{0}\"", partingLine); template.rics.rics[lastAddedRicNum].fids.Add(fidPartingLine); } Fid fid2 = new Fid(); fid2.Id = (i - 4) % 20 + 319; fid2.Value = GetFidValue(worksheet, i); lastAddedRicNum = template.rics.rics.Count - 1; template.rics.rics[lastAddedRicNum].fids.Add(fid2); } return(template); }
protected void btnSuggestSearchFriend_Click(object sender, EventArgs e) { check_friend_found(); if (Fid.Equals(Session["id"].ToString())) { Response.Write("<script>alert('You can not suggest yourself');</script>"); } else { if (store_friend_suggestion()) { ImageUser.Visible = false; NameUser.Visible = false; Fid = ""; Fname = ""; FimageURL = ""; btnSuggestSearchFriend.Visible = false; SearchBox.Text = ""; Response.Write("<script>alert('Suggessted Successfully');</script>"); } } }
private void RegButton_Click(object sender, EventArgs e) { if (ValidateControls()) { basicAuthDone = true; UseWaitCursor = true; Cursor = Cursors.WaitCursor; if (basicAuthDone && fingerprintRegDone && faceCaptureDone) { var userSaved = false; try { CreatorData.User = UserRepository.CreateUser(new User { Name = NameTextBox.Text, Address = AddressTextBox.Text, Phone = PhoneTextBox.Text, Email = EmailTextBox.Text, ZipOrPostalAddress = ZipOrPostalCodeTextBox.Text, HashSalt = Guid.NewGuid().ToString() }); CreatorData.User.PasswordHash = BitConverter.ToString(SHA512.Create().ComputeHash(Encoding.UTF8.GetBytes(PasswordTextBox.Text + CreatorData.User.HashSalt))); userSaved = true; } catch (Exception ex) { string addMessage(string message, Exception exception) { if (message == null) { message = string.Format("{0}\n", ex.Message); } else { message = string.Format("{0}\nCaused by {1}\n", message, ex.Message); } if (ex.InnerException != null) { return(addMessage(message, ex.InnerException)); } else { return(message); } } MessageBox.Show(addMessage(null, ex), "Error"); } var fingerprintSaved = false; if (userSaved) { try { var Fmds = new Dictionary <int, string>(); var Fids = new Dictionary <int, List <string> >(); foreach (var finger in CreatorData.FingerprintData.MainObject.Fmds.Keys) { Fmds.Add(finger, Fmd.SerializeXml(CreatorData.FingerprintData.MainObject.Fmds[finger])); //MessageBox.Show("extracted fmd :" + Fmd.SerializeXml(CreatorData.FingerprintData.MainObject.Fmds[finger]), "Alert"); var fids = new List <string>(); foreach (var fid in CreatorData.FingerprintData.MainObject.Fids[finger]) { fids.Add(Fid.SerializeXml(fid)); // MessageBox.Show("extracted fid :"+Fid.SerializeXml(fd), "Alert"); } Fids.Add(finger, fids); } var b = UserRepository.SaveFingerPrint(Fmds, Fids, CreatorData.User.Email, null); if (b) { fingerprintSaved = true; CreatorData.FingerprintData.MainObject.Fids.Clear(); CreatorData.FingerprintData.MainObject.Fmds.Clear(); } else { MessageBox.Show("Error Saving FingerPrint. ", "Alert"); } } catch (Exception ex) { MessageBox.Show("Error Saving FingerPrint. Details:" + ex.StackTrace, "Alert"); } if (fingerprintSaved) { // Registration complete, display form to enter required input data var financialDataForm = new FinancialDataForm(CreatorData.User, FinancialDataFormMode.edit); financialDataForm.ShowDialog(); UseWaitCursor = false; CreatorData.Reciever.LoadTask("QuestionAndAnswer"); } else { Console.Beep(); } } else { MessageBox.Show("Error Saving User. ", "Alert"); Console.Beep(); } } } else { Console.Beep(); } }
/// <summary> /// Open the reader and capture two fingers to compare. /// </summary> private void VerifyThread() { Constants.ResultCode result = Constants.ResultCode.DP_DEVICE_FAILURE; result = currentinstance.CurrentReader.Open(Constants.CapturePriority.DP_PRIORITY_COOPERATIVE); if (result != Constants.ResultCode.DP_SUCCESS) { MessageBox.Show("Error: " + result); if (currentinstance.CurrentReader != null) { currentinstance.CurrentReader.Dispose(); currentinstance.CurrentReader = null; } return; } Fmd fmd1 = null; // Fmd fmd2 = null; SendMessage("Place a finger on the reader."); int count = 0; while (!reset) { Fid fid = null; if (!currentinstance.CaptureFinger(ref fid)) { break; } if (fid == null) { continue; } SendMessage("A finger was captured."); DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(fid, Constants.Formats.Fmd.ANSI); if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS) { break; } /* if (count == 0) * { * fmd1 = resultConversion.Data; * count += 1; * SendMessage("Now place the same or a different finger on the reader."); * } * else if (count == 1) * { * fmd2 = resultConversion.Data; * CompareResult compareResult = Comparison.Compare(fmd1, 0, fmd2, 0); * * if (compareResult.ResultCode != Constants.ResultCode.DP_SUCCESS) * { * break; * } * * SendMessage("Comparison resulted in a dissimilarity score of " + compareResult.Score.ToString() + (compareResult.Score < (PROBABILITY_ONE/100000) ? " (fingerprints matched)" : " (fingerprints did not match)")); * SendMessage("Place a finger on the reader."); * count = 0; * }*/ fmd1 = resultConversion.Data; bool pass_threshold = false; foreach (Fmd fd in database) { CompareResult compareResult = Comparison.Compare(fmd1, 0, fd, 0); if (compareResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { break; } pass_threshold = compareResult.Score < (PROBABILITY_ONE / 100000); SendMessage("Comparison resulted in a dissimilarity score of " + compareResult.Score.ToString() + (pass_threshold ? " (fingerprints matched)" : " (fingerprints did not match)")); //SendMessage("Place a finger on the reader."); if (pass_threshold) { MessageBox.Show("Verification Successful", "Success", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); break; } } if (!pass_threshold) { MessageBox.Show("Verification Failed!!!", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (currentinstance.CurrentReader != null) { currentinstance.CurrentReader.Dispose(); } }
/// <summary> /// Open the reader and capture two fingers to compare. /// </summary> private void VerifyThread() { var result = Constants.ResultCode.DP_DEVICE_FAILURE; result = Currentinstance.CurrentReader.Open(Constants.CapturePriority.DP_PRIORITY_COOPERATIVE); if (result != Constants.ResultCode.DP_SUCCESS) { MessageBox.Show("Error: " + result); if (Currentinstance.CurrentReader != null) { Currentinstance.CurrentReader.Dispose(); Currentinstance.CurrentReader = null; } return; } Fmd fmd1 = null; // Fmd fmd2 = null; SendMessage("Place a finger on the reader."); while (!reset) { Fid fid = null; if (!Currentinstance.CaptureFinger(ref fid)) { break; } if (fid == null) { continue; } SendMessage("A finger was captured."); var resultConversion = FeatureExtraction.CreateFmdFromFid(fid, Constants.Formats.Fmd.ANSI); if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS) { break; } /* if (count == 0) * { * fmd1 = resultConversion.Data; * count += 1; * SendMessage("Now place the same or a different finger on the reader."); * } * else if (count == 1) * { * fmd2 = resultConversion.Data; * CompareResult compareResult = Comparison.Compare(fmd1, 0, fmd2, 0); * * if (compareResult.ResultCode != Constants.ResultCode.DP_SUCCESS) * { * break; * } * * SendMessage("Comparison resulted in a dissimilarity score of " + compareResult.Score.ToString() + (compareResult.Score < (PROBABILITY_ONE/100000) ? " (fingerprints matched)" : " (fingerprints did not match)")); * SendMessage("Place a finger on the reader."); * count = 0; * }*/ fmd1 = resultConversion.Data; var pass_threshold = false; foreach (var fd in database) { var compareResult = Comparison.Compare(fmd1, 0, fd, 0); if (compareResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { break; } pass_threshold = compareResult.Score < (PROBABILITY_ONE / 100000); SendMessage("Comparison resulted in a dissimilarity score of " + compareResult.Score.ToString() + (pass_threshold ? " (fingerprints matched)" : " (fingerprints did not match)")); //SendMessage("Place a finger on the reader."); if (pass_threshold) { break; } } if (Currentinstance.CurrentReader != null) { Currentinstance.CurrentReader.Dispose(); Currentinstance.CurrentReader = null; } FormClosed += (o, e) => { if (pass_threshold) { SuccessReading = Fmd.SerializeXml(fmd1); } OnComplete(pass_threshold); }; verifyThreadHandle.Abort(); } if (Currentinstance.CurrentReader != null) { Currentinstance.CurrentReader.Dispose(); Currentinstance.CurrentReader = null; } }
private void IdentifyThread() { while (!reset) { Fid fid = null; if (!CaptureFinger(ref fid)) { //break; } if (objReader == null) { objReader = objDeviceReader.IndexDevice(); objDeviceReader.InitializeDevice(ref objReader); } if (fid == null) { continue; } DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(fid, Constants.Formats.Fmd.ANSI); if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS) { //break; if (objReader != null) { objReader.Dispose(); objReader = null; } return; } int thresholdScore = DPFJ_PROBABILITY_ONE * 1 / 100000; Fmd aux = resultConversion.Data; Fmd temp; foreach (Clases.Persona item in listPersons) { try { temp = Fmd.DeserializeXml(item.huella); CompareResult identifyResult = Comparison.Compare(aux, 0, temp, 0); if (identifyResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { break; } var responseString = ""; if (identifyResult.Score < thresholdScore) { //guardar la asistencia en la base de datos try { using (var client = new WebClient()) { DateTime checada = DateTime.Now; var values = new NameValueCollection(); values["cuenta"] = item.id; values["evento"] = _evento; values["checada"] = checada.ToString("yyyy-MM-dd H:mm:ss"); var response = client.UploadValues("http://facite.uas.edu.mx/agenda/registrar_checada.php", values); responseString = Encoding.Default.GetString(response); } } catch (Exception err) { MessageBox.Show(err.Message); } SendMessage(responseString, item.Nombre, "Se registró a las " + DateTime.Now.ToShortTimeString(), "", "", ""); Thread.Sleep(3000); SendMessage("Coloque el dedo en el checador...", "", "", "", "", ""); menuPrincipal.Dispatcher.BeginInvoke(new Action(delegate() { menuPrincipal.lbl_fechas.Content = ""; menuPrincipal.lbl_resto.Content = ""; })); break; } else { //SendMessage("No se encuentra registrada la huella", "", "", "","",""); // Thread.Sleep(2000); SendMessage("Coloque el dedo en el checador...", "", "", "", "", ""); menuPrincipal.Dispatcher.BeginInvoke(new Action(delegate() { menuPrincipal.lbl_fechas.Content = ""; menuPrincipal.lbl_resto.Content = ""; })); //break; } } catch (Exception error) { MessageBox.Show(error.Message); } } } if (objReader != null) { objReader.Dispose(); } }
void reader_On_Captured(CaptureResult result) { if (this.InvokeRequired) { this.BeginInvoke(new Function(delegate { if (result.ResultCode != Constants.ResultCode.DP_SUCCESS) { MessageBox.Show("Capture failed."); return; } Fid fid = result.Data; //Extract pre-registration features DataResult <Fmd> fmd = FeatureExtraction.CreateFmdFromFid(result.Data, Constants.Formats.Fmd.DP_PRE_REGISTRATION); if (fmd.ResultCode != Constants.ResultCode.DP_SUCCESS) { MessageBox.Show("Error extracting features from image. Please try again"); return; } listPreRegFMDs.Add(fmd.Data); //Add good image to list of fids //Attempt to create enrollment Fmd from list of fids DataResult <Fmd> enrollmentFMD = Enrollment.CreateEnrollmentFmd(Constants.Formats.Fmd.DP_REGISTRATION, listPreRegFMDs); if (enrollmentFMD.ResultCode == Constants.ResultCode.DP_ENROLLMENT_INVALID_SET) { MessageBox.Show("Enrollment failed. Please try again."); pressCount = 0; pb1.Image = null; pb2.Image = null; pb3.Image = null; pb4.Image = null; //reader.CaptureAsync(Constants.Formats.Fid.ISO, Constants.CaptureProcessing.DP_IMG_PROC_DEFAULT, reader.Capabilities.Resolutions[0]); return; } if (pressCount == 0) { pb1.Image = new Bitmap(Fid2Bitmap.CreateBitmap(result.Data.Views[0].Bytes, fid.Views[0].Width, fid.Views[0].Height), pb1.Size); } else if (pressCount == 1) { pb2.Image = new Bitmap(Fid2Bitmap.CreateBitmap(fid.Views[0].Bytes, fid.Views[0].Width, fid.Views[0].Height), pb2.Size); } else if (pressCount == 2) { pb3.Image = new Bitmap(Fid2Bitmap.CreateBitmap(fid.Views[0].Bytes, fid.Views[0].Width, fid.Views[0].Height), pb3.Size); } else if (pressCount == 3) //Dont increment. Say on last picture box until successfull registration { pb4.Image = new Bitmap(Fid2Bitmap.CreateBitmap(fid.Views[0].Bytes, fid.Views[0].Width, fid.Views[0].Height), pb4.Size); } ++pressCount; if (enrollmentFMD.ResultCode == Constants.ResultCode.DP_SUCCESS) //enrollment FMD created { //if (rbLeftIndex.Checked) //{ // leftIndex = enrollmentFMD.Data; // //rbRightIndex.Checked = true; // lblInfo.Text = "Now press your right index 4 or more times."; // pb1.Image = null; pb2.Image = null; pb3.Image = null; pb4.Image = null; // pressCount = 0; // listPreRegFMDs.Clear(); //} //else //{ fmd1 = enrollmentFMD.Data; btnSave.Enabled = true; //reader.CancelCapture(); //MessageBox.Show("Fingerprint enrollment complete. Click 'Save' to complete registration."); //} } })); } }
/// <summary> /// Initializes a new instance of the <see cref="Fingerprint"/> class. /// </summary> /// <param name="fid">The Fingerprint Image Data.</param> internal Fingerprint(Fid fid) => this.Fid = fid;
private void IdentifyThread() { while (!reset) { Fid fid = null; if (!CaptureFinger(ref fid)) { //break; } if (objReader == null) { objReader = objDeviceReader.IndexDevice(); objDeviceReader.InitializeDevice(ref objReader); } if (fid == null) { continue; } DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(fid, Constants.Formats.Fmd.ANSI); if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS) { //break; if (objReader != null) { objReader.Dispose(); objReader = null; } return; } int thresholdScore = DPFJ_PROBABILITY_ONE * 1 / 100000; Fmd aux = resultConversion.Data; Fmd temp; foreach (Clases.Persona item in listPersons) { try { temp = Fmd.DeserializeXml(item.huella); CompareResult identifyResult = Comparison.Compare(aux, 0, temp, 0); if (identifyResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { break; } if (identifyResult.Score < thresholdScore) { List <Datos.membresia> mem = new Negocios.Nmembresia().ListarMembresia(item.id); //guardar la asistencia en la base de datos try { //insertamos en la base de datos string cs = ConfigurationManager.ConnectionStrings["saffron.GYM.GYM2"].ConnectionString; SqlConnection conexion = new SqlConnection(cs); conexion.Open(); SqlCommand query = new SqlCommand("INSERT INTO GYM.asistencias VALUES (" + item.id + ", GETDATE())", conexion); query.ExecuteNonQuery(); conexion.Close(); } catch (Exception err) { MessageBox.Show(err.Message); } if (mem.Count > 0) { string membresia = ""; DateTime fecha_i = DateTime.Now; DateTime fecha_f = DateTime.Now; foreach (var m in mem) { //sacamos el tipo de membresia switch (m.tipo_membresia) { case "G": membresia = "Gimnasio"; break; case "Z": membresia = "Zumba"; break; case "C": membresia = "Crossfit"; break; } //sacamos la fecha inicial } // Difference in days, hours, and minutes. TimeSpan ts = fecha_f - DateTime.Now; // Difference in days. int differenceInDays = ts.Days; SendMessage("Cliente identificado: ", item.Nombre, membresia, fecha_i.ToShortDateString(), fecha_f.ToShortDateString(), differenceInDays.ToString()); } else { SendMessage("Cliente identificado: ", item.Nombre, "Sin Membresia Activa", "", "", ""); } Thread.Sleep(10000); SendMessage("Coloque el dedo en el checador...", "", "", "", "", ""); menuPrincipal.Dispatcher.BeginInvoke(new Action(delegate() { menuPrincipal.lblMembresia.Content = ""; menuPrincipal.lbl_inicio.Content = ""; menuPrincipal.lbl_fin.Content = ""; menuPrincipal.lbl_resto.Content = ""; })); break; } /*else * { * SendMessage("No se encuentra registrada la huella capturada", "", "", "","",""); * Thread.Sleep(2000); * SendMessage("Coloque el dedo en el checador...", "", "", "", "",""); * break; * }*/ } catch (Exception error) { MessageBox.Show(error.Message); } } } if (objReader != null) { objReader.Dispose(); } }
private void IdentifyThread() { while (!reset) { Fid fid = null; if (!CaptureFinger(ref fid)) { //break; } if (objReader == null) { objReader = objDeviceReader.IndexDevice(); objDeviceReader.InitializeDevice(ref objReader); } if (fid == null) { continue; } DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(fid, Constants.Formats.Fmd.ANSI); if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS) { //break; if (objReader != null) { objReader.Dispose(); objReader = null; } return; } int thresholdScore = DPFJ_PROBABILITY_ONE * 1 / 100000; Fmd aux = resultConversion.Data; Fmd temp; foreach (Clases.Persona item in listPersons) { temp = Fmd.DeserializeXml(item.huella); CompareResult identifyResult = Comparison.Compare(aux, 0, temp, 0); if (identifyResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { break; } if (identifyResult.Score < thresholdScore) { SendMessage("Identificado"); MessageBox.Show("Identificado"); Thread.Sleep(3000); SendMessage("Buscando..."); break; } } } if (objReader != null) { objReader.Dispose(); } }
public bool CaptureFinger(ref Fid fid) { try { Constants.ResultCode result = objReader.GetStatus(); if ((result != Constants.ResultCode.DP_SUCCESS)) { //MessageBox.Show("Get Status Error: " + result); if (objReader != null) { objReader.Dispose(); objReader = null; } return(false); } if ((objReader.Status.Status == Constants.ReaderStatuses.DP_STATUS_BUSY)) { Thread.Sleep(50); return(true); } else if ((objReader.Status.Status == Constants.ReaderStatuses.DP_STATUS_NEED_CALIBRATION)) { objReader.Calibrate(); } else if ((objReader.Status.Status != Constants.ReaderStatuses.DP_STATUS_READY)) { //MessageBox.Show("Get Status: " + Lector.Status.Status); if (objReader != null) { objReader.Dispose(); objReader = null; } return(false); } CaptureResult captureResult = objReader.Capture(Constants.Formats.Fid.ANSI, Constants.CaptureProcessing.DP_IMG_PROC_DEFAULT, 5000, objReader.Capabilities.Resolutions[0]); if (captureResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { //MessageBox.Show("Error: " + captureResult.ResultCode); if (objReader != null) { objReader.Dispose(); objReader = null; } return(false); } if (captureResult.Quality == Constants.CaptureQuality.DP_QUALITY_CANCELED) { return(false); } if ((captureResult.Quality == Constants.CaptureQuality.DP_QUALITY_NO_FINGER || captureResult.Quality == Constants.CaptureQuality.DP_QUALITY_TIMED_OUT)) { return(true); } if ((captureResult.Quality == Constants.CaptureQuality.DP_QUALITY_FAKE_FINGER)) { //MessageBox.Show("Quality Error: " + captureResult.Quality); return(true); } fid = captureResult.Data; return(true); } catch { //MessageBox.Show("An error has occurred."); if (objReader != null) { objReader.Dispose(); objReader = null; } return(false); } }
public FingerImageDP(Fid fid) { this.fid = fid; }
/// <summary> /// Open a reader and capture three fingers to identify with. /// </summary> private void IdentifyThread() { Constants.ResultCode result = Constants.ResultCode.DP_DEVICE_FAILURE; result = Sender.CurrentReader.Open(Constants.CapturePriority.DP_PRIORITY_COOPERATIVE); if (result != Constants.ResultCode.DP_SUCCESS) { MessageBox.Show("Error: " + result); if (Sender.CurrentReader != null) { Sender.CurrentReader.Dispose(); Sender.CurrentReader = null; } return; } Fmd fmd1 = null; Fmd fmd2 = null; Fmd fmd3 = null; SendMessage("Place your right index finger on the reader."); var count = 0; while (!reset) { Fid fid = null; if (!Sender.CaptureFinger(ref fid)) { break; } if (fid == null) { continue; } SendMessage("A finger was captured."); DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(fid, Constants.Formats.Fmd.ANSI); if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS) { break; } if (count == 0) { fmd1 = resultConversion.Data; count += 1; SendMessage("Now place your right thumb on the reader."); } else if (count == 1) { fmd2 = resultConversion.Data; count += 1; SendMessage("Now place any finger on the reader."); } else if (count == 2) { fmd3 = resultConversion.Data; Fmd[] fmds = new Fmd[2]; fmds[0] = fmd1; fmds[1] = fmd2; // See the SDK documentation for an explanation on threshold scores. int thresholdScore = DPFJ_PROBABILITY_ONE * 1 / 100000; IdentifyResult identifyResult = Comparison.Identify(fmd3, 0, fmds, thresholdScore, 2); if (identifyResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { break; } SendMessage("Identification resulted in the following number of matches: " + identifyResult.Indexes.Length.ToString()); SendMessage("Place your right index finger on the reader."); count = 0; } } if (Sender.CurrentReader != null) { Sender.CurrentReader.Dispose(); } }
void reader_On_Captured(CaptureResult result) { if (result.ResultCode != Constants.ResultCode.DP_SUCCESS) { MessageBox.Show("Capture failed."); return; } Fid fid = result.Data; //Display captured image if (this.InvokeRequired) { this.BeginInvoke(new Function(delegate { pbImage.Image = new Bitmap(Fid2Bitmap.CreateBitmap(result.Data.Views[0].Bytes, fid.Views[0].Width, fid.Views[0].Height), pbImage.Size); })); } //Extract pre-registration features DataResult <Fmd> fmdResult = FeatureExtraction.CreateFmdFromFid(result.Data, Constants.Formats.Fmd.DP_VERIFICATION); if (fmdResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { MessageBox.Show("Error extracting features from image. Please try again"); return; } else { fmd = fmdResult.Data; } // Lets identify the print // Perform indentification of fmd of captured sample against enrolledFmds for userid IdentifyResult iResult1 = Comparison.Identify(fmd, 0, HelperFunctions.GetAllFmd1s, 21474, 1); // If Identify was successful if (iResult1.ResultCode == Constants.ResultCode.DP_SUCCESS) { //If number of matches were greater than 0 if (iResult1.Indexes.Length == 1) { string[] usernames = HelperFunctions.GetAllPrisonerIds; string prisonerId = usernames[iResult1.Indexes[0][0]]; string ip = (_serverIP == "(local)" ? "localhost" : _serverIP); string url = string.Format("http://{0}/PMIS/Prisoner/Details?PrisonerId={1}", ip, prisonerId); //if(browser == null) // browser = new WebBrowser(); //browser.Navigate(url, "_prs"); //browser.Document.Window.Open(url, "_prs", null, true); //window.Open(url, "_prs", null, true); System.Diagnostics.Process.Start(url); } else if (iResult1.Indexes.Length > 1) { string ids = ""; string[] usernames = HelperFunctions.GetAllPrisonerIds; for (int i = 0; i < iResult1.Indexes.Length; i++) { ids += usernames[iResult1.Indexes[i][0]] + ", "; } MessageBox.Show("Error: Multiple matches found. Prisoner IDs : {0}", ids); } else { MessageBox.Show("Prisoner NOT found! Try again or enroll prisoner!"); } } else { MessageBox.Show("Error : " + iResult1.ResultCode.ToString()); } pbImage.Image = null; }