/// <summary> /// Called on each finger to begin Enrollment process for that finger /// </summary> private void StartEnrollment() { if (_currentOperation != null) { _currentOperation.Dispose(); _currentOperation = null; } _currentOperation = new FutronicEnrollment { FFDControl = true, FARN = 166, Version = VersionCompatible.ftr_version_current }; // Set properties ((FutronicEnrollment)_currentOperation).MaxModels = 3; _currentOperation.MinMinuitaeLevel = 2; _currentOperation.MinOverlappedLevel = 4; // register events _currentOperation.OnPutOn += OnPutOn; _currentOperation.OnTakeOff += OnTakeOff; _currentOperation.UpdateScreenImage += UpdateScreenImage; ((FutronicEnrollment)_currentOperation).OnEnrollmentComplete += OnEnrollmentComplete; //start enrollment process ((FutronicEnrollment)_currentOperation).Enrollment(); }
private void OnEnrollmentComplete(bool bSuccess, int nResult) { StringBuilder szMessage = new StringBuilder(); if (bSuccess) { // set status string szMessage.Append("Enrollment process finished successfully."); szMessage.Append("Quality: "); szMessage.Append(_futronicEnrollment.Quality.ToString()); Console.WriteLine(szMessage); _currentUser.RightThumbFingerprint = _futronicEnrollment.Template; UpdateNote("Your fingerprint was scanned successfully!", Color.Blue); this.Invoke((Action)(() => btnSave.Enabled = true)); } else { UpdateNote(FutronicSdkBase.SdkRetCode2Message(nResult), Color.Red); } // unregister events _futronicEnrollment.OnPutOn -= OnPutOn; _futronicEnrollment.OnTakeOff -= OnTakeOff; //m_Operation.UpdateScreenImage -= new UpdateScreenImageHandler(this.UpdateScreenImage); _futronicEnrollment.OnFakeSource -= OnFakeSource; _futronicEnrollment.OnEnrollmentComplete -= OnEnrollmentComplete; _futronicEnrollment = null; }
private void OnGetBaseTemplateComplete(bool bSuccess, int nRetCode) { StringBuilder szMessage = new StringBuilder(); if (bSuccess) { this.SetStatusText("Starting identification..."); List <DbRecord> Users = (List <DbRecord>)m_OperationObj; int iRecords = 0; int nResult; FtrIdentifyRecord[] rgRecords = new FtrIdentifyRecord[Users.Count]; foreach (DbRecord item in Users) { rgRecords[iRecords] = item.GetRecord(); iRecords++; } nResult = ((FutronicIdentification)m_Operation).Identification(rgRecords, ref iRecords); if (nResult == FutronicSdkBase.RETCODE_OK) { szMessage.Append("Identification process complete. User: "******"not found"); } } else { szMessage.Append("Identification failed."); szMessage.Append(FutronicSdkBase.SdkRetCode2Message(nResult)); } this.SetIdentificationLimit(m_Operation.IdentificationsLeft); } else { szMessage.Append("Can not retrieve base template."); szMessage.Append("Error description: "); szMessage.Append(FutronicSdkBase.SdkRetCode2Message(nRetCode)); } this.SetStatusText(szMessage.ToString()); // unregister events m_Operation.OnPutOn -= new OnPutOnHandler(this.OnPutOn); m_Operation.OnTakeOff -= new OnTakeOffHandler(this.OnTakeOff); //m_Operation.UpdateScreenImage -= new UpdateScreenImageHandler(this.UpdateScreenImage); m_Operation.OnFakeSource -= new OnFakeSourceHandler(this.OnFakeSource); ((FutronicIdentification)m_Operation).OnGetBaseTemplateComplete -= new OnGetBaseTemplateCompleteHandler(this.OnGetBaseTemplateComplete); m_OperationObj = null; EnableControls(true); }
/// <summary> /// Called on the completion of each finger enrollment /// </summary> /// <param name="enrollmentSuccessful"></param> /// <param name="nRetCode"></param> private void OnEnrollmentComplete(bool enrollmentSuccessful, int nRetCode) { // Instance of string builder to hold enrollment message StringBuilder enrolmentMsg = new StringBuilder(); if (enrollmentSuccessful) { // The percentage of template quality gotten from fingerprint enrollment string enrlPercentage = ((FutronicEnrollment)_currentOperation).Quality.ConvertToPercentage(); // set status string enrolmentMsg.Append("Enrollment process finished successfully."); enrolmentMsg.Append(" Quality: "); enrolmentMsg.Append(enrlPercentage); SetStatusText(enrolmentMsg.ToString()); //Set fingerprint enrollment percentage label SetEnrolPercentage(enrlPercentage); // Set Active label foreground color SetLblForegroundColor(_activeTextBlock, "SoftOffWhiteBrush"); // Set gotten template into active user's information and then save it to ext file if (!SaveFingerprint(((FutronicEnrollment)_currentOperation)?.Template)) { MessageBox.Show("Could not save fingerprint template!"); } // todo : Write code to save user information } else { enrolmentMsg.Append("Enrollment process failed."); enrolmentMsg.Append("Error description: "); enrolmentMsg.Append(FutronicSdkBase.SdkRetCode2Message(nRetCode)); SetStatusText(enrolmentMsg.ToString()); } // unregister events and enable thumnails if (_currentOperation != null) { _currentOperation.OnPutOn -= OnPutOn; _currentOperation.OnTakeOff -= OnTakeOff; _currentOperation.UpdateScreenImage -= UpdateScreenImage; ((FutronicEnrollment)_currentOperation).OnEnrollmentComplete -= OnEnrollmentComplete; EnableThumbnails(); } }
private void OnEnrollmentComplete(bool bSuccess, int nRetCode) { StringBuilder szMessage = new StringBuilder(); if (bSuccess) { // set status string szMessage.Append("Enrollment process finished successfully."); szMessage.Append("Quality: "); szMessage.Append(((FutronicEnrollment)m_Operation).Quality.ToString()); this.SetStatusText(szMessage.ToString()); // Set template into user's information and save it DbRecord User = (DbRecord)m_OperationObj; User.Template = ((FutronicEnrollment)m_Operation).Template; String szFileName = Path.Combine(m_DatabaseDir, User.UserName); if (!User.Save(szFileName)) { //MessageBox.Show("Can not save users's information to file " + szFileName, // "C# example for Futronic SDK", // MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { szMessage.Append("Enrollment process failed."); szMessage.Append("Error description: "); szMessage.Append(FutronicSdkBase.SdkRetCode2Message(nRetCode)); this.SetStatusText(szMessage.ToString()); } // unregister events m_Operation.OnPutOn -= new OnPutOnHandler(this.OnPutOn); m_Operation.OnTakeOff -= new OnTakeOffHandler(this.OnTakeOff); //m_Operation.UpdateScreenImage -= new UpdateScreenImageHandler(this.UpdateScreenImage); m_Operation.OnFakeSource -= new OnFakeSourceHandler(this.OnFakeSource); ((FutronicEnrollment)m_Operation).OnEnrollmentComplete -= new OnEnrollmentCompleteHandler(this.OnEnrollmentComplete); m_OperationObj = null; EnableControls(true); }
private void IdentityApp() { SetStatusText("El programa está cargando la base de datos, espere..."); List <DbRecord> Users = DbRecord.ReadRecords(m_DatabaseDir); SetStatusText(String.Empty); if (Users.Count == 0) { MessageBox.Show("Usuarios no encontrados. Por favor, ejecute el proceso de inscripción primero.", "KallpaBox Security", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } m_OperationObj = Users; FutronicSdkBase dummy = new FutronicIdentification(); if (m_Operation != null) { //m_Operation.Dispose(); m_Operation = null; } m_Operation = dummy; // Set control property m_Operation.FakeDetection = true; m_Operation.FFDControl = true; m_Operation.FARN = 116; m_Operation.Version = (VersionCompatible)2; m_Operation.FastMode = false; // register events m_Operation.OnPutOn += new OnPutOnHandler(this.OnPutOn); m_Operation.OnTakeOff += new OnTakeOffHandler(this.OnTakeOff); m_Operation.UpdateScreenImage += new UpdateScreenImageHandler(this.UpdateScreenImage); m_Operation.OnFakeSource += new OnFakeSourceHandler(this.OnFakeSource); ((FutronicIdentification)m_Operation).OnGetBaseTemplateComplete += new OnGetBaseTemplateCompleteHandler(this.OnGetBaseTemplateComplete); // start identification process ((FutronicIdentification)m_Operation).GetBaseTemplate(); }
private void OnVerificationComplete(bool bSuccess, int nRetCode, bool bVerificationSuccess) { StringBuilder szResult = new StringBuilder(); if (bSuccess) { if (bVerificationSuccess) { szResult.Append("Verification is successful."); szResult.Append("User Name: "); szResult.Append(((DbRecord)m_OperationObj).UserName); } else { szResult.Append("Verification failed."); } } else { szResult.Append("Verification process failed."); szResult.Append("Error description: "); szResult.Append(FutronicSdkBase.SdkRetCode2Message(nRetCode)); } this.SetStatusText(szResult.ToString()); this.SetIdentificationLimit(m_Operation.IdentificationsLeft); // unregister events m_Operation.OnPutOn -= new OnPutOnHandler(this.OnPutOn); m_Operation.OnTakeOff -= new OnTakeOffHandler(this.OnTakeOff); //m_Operation.UpdateScreenImage -= new UpdateScreenImageHandler(this.UpdateScreenImage); m_Operation.OnFakeSource -= new OnFakeSourceHandler(this.OnFakeSource); ((FutronicVerification)m_Operation).OnVerificationComplete -= new OnVerificationCompleteHandler(this.OnVerificationComplete); m_OperationObj = null; EnableControls(true); }
private void OnEnrollmentComplete(bool bSuccess, int nRetCode) { StringBuilder szMessage = new StringBuilder(); if (bSuccess) { // set status string szMessage.Append("El proceso de inscripción finalizó con éxito. "); szMessage.Append($"Calidad de registro huella : {((FutronicEnrollment)m_Operation).Quality.ToString()} "); this.SetStatusText(szMessage.ToString()); // Set template into user's information and save it DbRecord User = (DbRecord)m_OperationObj; User.Template = ((FutronicEnrollment)m_Operation).Template; String szFileName = Path.Combine(m_DatabaseDir, User.UserName); var client = _clientRepository.GetClientViewModelById(_idClient); client.IdentityGuid = User.UserName; var clientViewModel = new ClientViewModel() { Id = client.Id, Identification = client.Identification, IdentityGuid = User.UserName, Name = client.Name, MiddleName = client.MiddleName, LastName = client.LastName, SecondSurName = client.SecondSurName, Address = client.Address, Age = client.Age, Phone = client.Phone }; _clientRepository.UpateClient(_idClient, clientViewModel); SetStatusMessageSnackBar("Huella registrado con exito"); this.SetLimpiarCombo(); if (!User.Save(szFileName)) { MessageBox.Show("No se puede guardar la información de los usuarios en el archivo." + szFileName, "KallpaBox Security.", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } else { szMessage.Append("El proceso de inscripción falló "); szMessage.Append("Error descripción: "); szMessage.Append(FutronicSdkBase.SdkRetCode2Message(nRetCode)); this.SetStatusText(szMessage.ToString()); } // unregister events m_Operation.OnPutOn -= new OnPutOnHandler(this.OnPutOn); m_Operation.OnTakeOff -= new OnTakeOffHandler(this.OnTakeOff); m_Operation.UpdateScreenImage -= new UpdateScreenImageHandler(this.UpdateScreenImage); m_Operation.OnFakeSource -= new OnFakeSourceHandler(this.OnFakeSource); ((FutronicEnrollment)m_Operation).OnEnrollmentComplete -= new OnEnrollmentCompleteHandler(this.OnEnrollmentComplete); m_OperationObj = null; }
#pragma warning restore CS0414 // El campo 'FingerPrintsCreate.m_bInitializationSuccess' está asignado pero su valor nunca se usa private void InsertFingerPrintClient_Click(object sender, RoutedEventArgs e) { DbRecord User = new DbRecord(); if (string.IsNullOrEmpty(Identificacion.Text)) { MessageBox.Show("Debe ingresar un nombre de usuario.", "KallpaBox Security", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } // Try creat the file for user's information if (IsUserExists(Identificacion.Text)) { MessageBoxResult nResponse; nResponse = MessageBox.Show("El usuario ya existe. ¿Quieres reemplazarlo?", "KallpaBox Security.", MessageBoxButton.YesNo, MessageBoxImage.Question); if (nResponse == MessageBoxResult.No) { return; } } else { try { CreateFile(Identificacion.Text); } catch (DirectoryNotFoundException) { MessageBox.Show("No se puede crear un archivo para guardar la información de un usuario.", "KallpaBox Security", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } catch (IOException) { MessageBox.Show(string.Format("Nombre de usuario incorrecto '{0}'.", Identificacion.Text), "KallpaBox Security" , MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } } User.UserName = Identificacion.Text; m_OperationObj = User; FutronicSdkBase dummy = new FutronicEnrollment(); if (m_Operation != null) { m_Operation.Dispose(); m_Operation = null; } m_Operation = dummy; // Set control properties m_Operation.FakeDetection = true; m_Operation.FFDControl = true; m_Operation.FARN = 116; m_Operation.Version = (VersionCompatible)2; m_Operation.FastMode = false; ((FutronicEnrollment)m_Operation).MIOTControlOff = true; ((FutronicEnrollment)m_Operation).MaxModels = 3; // register events m_Operation.OnPutOn += new OnPutOnHandler(this.OnPutOn); m_Operation.OnTakeOff += new OnTakeOffHandler(this.OnTakeOff); m_Operation.UpdateScreenImage += new UpdateScreenImageHandler(this.UpdateScreenImage); m_Operation.OnFakeSource += new OnFakeSourceHandler(this.OnFakeSource); ((FutronicEnrollment)m_Operation).OnEnrollmentComplete += new OnEnrollmentCompleteHandler(this.OnEnrollmentComplete); // start enrollment process ((FutronicEnrollment)m_Operation).Enrollment(); }
public void Enroll(string name, int max_models = 2) { DbRecord _user = new DbRecord(); if (name == null) { //_logger.LogWarning("Error se esperaba el paramentro nombre"); return; } if (name.Length == 0) { //_logger.LogWarning("Error el paranombre deberia tener caracteres"); return; } if (IsUserExists(name)) { //_logger.LogInformation("El usuario existe en la base de datos"); } else { try { CreateFile(name); } catch (DirectoryNotFoundException dnfException) { //_logger.LogWarning(string.Format("Error el directorio no existe, {0}", dnfException)); return; } catch (IOException ioException) { //_logger.LogWarning(string.Format("Error de lectura y escritura, {0}",ioException)); return; } } _user.UserName = name; m_OperationObj = _user; FutronicSdkBase dummy = new FutronicEnrollment(); if (m_Operation != null) { m_Operation.Dispose(); m_Operation = null; } m_Operation = dummy; // Set control properties m_Operation.FakeDetection = true; m_Operation.FFDControl = true; m_Operation.FARN = 2; m_Operation.Version = VersionCompatible.ftr_version_current; m_Operation.FastMode = true; ((FutronicEnrollment)m_Operation).MIOTControlOff = false; ((FutronicEnrollment)m_Operation).MaxModels = max_models; // register events m_Operation.OnPutOn += new OnPutOnHandler(this.OnPutOn); m_Operation.OnTakeOff += new OnTakeOffHandler(this.OnTakeOff); //m_Operation.UpdateScreenImage += new UpdateScreenImageHandler(this.UpdateScreenImage); m_Operation.OnFakeSource += new OnFakeSourceHandler(this.OnFakeSource); ((FutronicEnrollment)m_Operation).OnEnrollmentComplete += new OnEnrollmentCompleteHandler(this.OnEnrollmentComplete); // start enrollment process ((FutronicEnrollment)m_Operation).Enrollment(); }
#pragma warning restore CS0414 // El campo 'AccessPage.m_bInitializationSuccess' está asignado pero su valor nunca se usa private void OnGetBaseTemplateComplete(bool bSuccess, int nRetCode) { SetIdentificationText(""); SetNameText(""); SetMiddleNameText(""); SetLastNameText(""); SetSecondSurNameText(""); SetStatusClientRedText(""); SetCelebrateContract(""); SetExpirationContract(""); StringBuilder szMessage = new StringBuilder(); if (bSuccess) { this.SetStatusText("Identificación de inicio..."); List <DbRecord> Users = (List <DbRecord>)m_OperationObj; int iRecords = 0; int nResult; FtrIdentifyRecord[] rgRecords = new FtrIdentifyRecord[Users.Count]; foreach (DbRecord item in Users) { rgRecords[iRecords] = item.GetRecord(); iRecords++; } nResult = ((FutronicIdentification)m_Operation).Identification(rgRecords, ref iRecords); if (nResult == FutronicSdkBase.RETCODE_OK) { szMessage.Append("Proceso de identificación completo. Usuario: "); if (iRecords != -1) { szMessage.Append(Users[iRecords].UserName); if (!string.IsNullOrEmpty(Users[iRecords].UserName)) { var clientViewModel = _clientRepository.GetClientViewModelByIdentityGuid(Users[iRecords].UserName); var contract = _serviceGymContractRepository.GetServiceGymContractServiceViewModelByClientId(clientViewModel.Id);; if (contract == null) { SetMessageQueueSnackBar("Cliente no tiene un contrato registrado."); ((FutronicIdentification)m_Operation).GetBaseTemplate(); return; } if (clientViewModel != null) { SetIdentificationText(clientViewModel.Identification); SetNameText(clientViewModel.Name); SetMiddleNameText(clientViewModel.MiddleName); SetLastNameText(clientViewModel.LastName); SetSecondSurNameText(clientViewModel.SecondSurName); SetCelebrateContract(contract.DateCelebrate.ToString()); SetExpirationContract(contract.DateExpiration.ToString()); if (contract != null) { if (contract.DateExpiration < DateTime.Now) { SetStatusClientGreenText("Cliente verificado"); SetMessageQueueSnackBar("Cliente Verificado pero con contrato vencido"); var contractUpdate = new ServiceGymContractViewModel() { State = false, Client = contract.Client, ClientId = contract.ClientId, DateExpiration = contract.DateExpiration, DateCelebrate = contract.DateCelebrate, Quantity = contract.Quantity, TypeQuantity = contract.TypeQuantity, Price = contract.Price, ServiceGym = contract.ServiceGym, ServiceGymId = contract.ServiceGymId, Id = contract.Id }; _serviceGymContractRepository.UpateServiceGymContractView(contract.Id, contractUpdate); } else { SetStatusClientGreenText("Cliente verificado Bienvenido."); SetMessageQueueSnackBar("Cliente verificado y con contrato vigente"); } } else { SetStatusClientRedText("Tu tienes un contrato ??? "); SetMessageQueueSnackBar("El cliente no presenta contrato"); } } else { SetIdentificationText(""); SetNameText(""); SetMiddleNameText(""); SetLastNameText(""); SetSecondSurNameText(""); SetCelebrateContract(""); SetExpirationContract(""); SetStatusClientRedText("Tu tienes un contrato ??? "); SetMessageQueueSnackBar("Cliente no tiene contrato."); } } else { SetIdentificationText(""); SetNameText(""); SetMiddleNameText(""); SetLastNameText(""); SetSecondSurNameText(""); SetCelebrateContract(""); SetExpirationContract(""); SetStatusClientRedText("¿Tienes huella digital registrada ? ???"); SetMessageQueueSnackBar("Cliente no tiene huella registrada o no esta registrado."); } } else { SetMessageQueueSnackBar("Cliente no encontrado o no presenta huella registrada."); szMessage.Append("No encontrado"); } } else { szMessage.Append("Identificación fallido."); szMessage.Append(FutronicSdkBase.SdkRetCode2Message(nResult)); } this.SetIdentificationLimit(m_Operation.IdentificationsLeft); } else { szMessage.Append("No se puede recuperar la plantilla base."); szMessage.Append("Error descripción: "); szMessage.Append(FutronicSdkBase.SdkRetCode2Message(nRetCode)); } this.SetStatusText(szMessage.ToString()); // start identification process ((FutronicIdentification)m_Operation).GetBaseTemplate(); }