コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: FingerprintReaderUtil.cs プロジェクト: tuga1975/SSK
        private void OnGetBaseTemplateComplete(bool bSuccess, int nRetCode)
        {
            // returnValue
            bool success = false;

            // bSuccess = true: get user fingerprint success
            if (bSuccess)
            {
                Debug.WriteLine("Starting identification...");

                // remove null fingerprints
                _lstFingerprint_Templates.RemoveAll(item => item == null);

                // if _lstFingerprint_Templates == null, return
                if (_lstFingerprint_Templates == null)
                {
                    Debug.WriteLine("_lstFingerprint_Templates can not be null");
                    //_identificationCompleted(false);
                }
                else
                {
                    // intitialize base templates
                    int iRecords = 0;
                    FtrIdentifyRecord[] rgRecords = new FtrIdentifyRecord[_lstFingerprint_Templates.Count];

                    foreach (var item in _lstFingerprint_Templates)
                    {
                        rgRecords[iRecords].KeyValue = new byte[10];
                        rgRecords[iRecords].Template = item;
                        iRecords++;
                    }

                    // start identify
                    int nResult = _futronicIdentification.Identification(rgRecords, ref iRecords);

                    if (nResult == FutronicSdkBase.RETCODE_OK)
                    {
                        // iRecords != 1: base templates contain user fingerprint
                        if (iRecords != -1)
                        {
                            Debug.WriteLine("OK");
                            // callback
                            success = true;
                            //_identificationCompleted(true);
                        }
                        else
                        {
                            // not found
                            // Not enough overlap minutiae.
                            Debug.WriteLine("not found");
                            //_identificationCompleted(false);
                        }
                    }
                    else
                    {
                        // Identification failed.
                        Debug.WriteLine("Identification failed");
                        //_identificationCompleted(false);
                    }
                }
            }
            else
            {
                // Can not retrieve user template
                // Error description: FutronicSdkBase.SdkRetCode2Message(nRetCode)
                Debug.WriteLine("Can not retrieve user template");
                //_identificationCompleted(false);
            }

            // unregister events
            _futronicIdentification.OnPutOn   -= OnPutOn;
            _futronicIdentification.OnTakeOff -= OnTakeOff;
            //_futronicIdentification.UpdateScreenImage += new UpdateScreenImageHandler(this.UpdateScreenImage);
            _futronicIdentification.OnFakeSource -= OnFakeSource;
            _futronicIdentification.OnGetBaseTemplateComplete -= OnGetBaseTemplateComplete;

            _lstFingerprint_Templates = null;

            // callback
            _identificationCompleted(success);
        }
コード例 #3
0
#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();
        }