public FingerPrintInfo CapturePrint(int fingerPosition) { FingerPrintFacade fingerPrintFacade = new FingerPrintFacade(); var data = fingerPrintFacade.Capture(fingerPosition, out string err, false); if (string.IsNullOrEmpty(err)) { var db = new DataAccess(); var previously = db.GetPatientBiometricinfo(); var matchedPatientId = fingerPrintFacade.Verify(new FingerPrintMatchInputModel { FingerPrintTemplate = data.Template, FingerPrintTemplateListToMatch = new List <FingerPrintInfo>(previously) }); if (matchedPatientId != 0) { string info = db.RetrievePatientNameByPatientId(matchedPatientId); string name = info.Split('|')[0]; string UniqueId = info.Split('|')[1]; data.ErrorMessage = string.Format("Finger print record already exist for this patient {0} Name : {1} {2} Patient Identifier : {3}", Environment.NewLine, name, Environment.NewLine, UniqueId); } } else { data = new FingerPrintInfo(); data.ErrorMessage = err; } return(data); }
private void BtnCapturePrint_Click(object sender, RoutedEventArgs e) { if (patientId != txtPatientId.Text) { patientId = txtPatientId.Text; var db = new DataAccess(); patient_name = db.RetrievePatientNameByUniqueId(patientId); lblPatientName.Content = patient_name.Split('|')[0]; var previously = db.GetPatientBiometricinfo(); } if (string.IsNullOrEmpty(patient_name)) { MessageBox.Show("No patient information found for Id " + patientId); return; } string button_name = ((Button)sender).Name; int position = Array.FindIndex(fingerPosition, x => x.ToUpper() == button_name.ToUpper()); var pictureBox = (System.Windows.Controls.Image)FindName("pictureBoxR" + position); FingerPrintInfo fingerPrintInfo = CapturePrint(position); if (fingerPrintInfo != null && string.IsNullOrEmpty(fingerPrintInfo.ErrorMessage)) { DrawImage(fingerPrintInfo.ImageByte, pictureBox, fingerPrintInfo.ImageWidth, fingerPrintInfo.ImageHeight); Int32.TryParse(patient_name.Split('|')[1], out int pid); fingerPrintInfo.PatienId = pid; fingerPrintList.Add(fingerPrintInfo); if (fingerPrintList.Count > 5) { btnSave.IsEnabled = true; } } else { MessageBox.Show(fingerPrintInfo.ErrorMessage, "Attention!", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.DefaultDesktopOnly); } }