Exemple #1
0
        void VerificationControl_OnComplete(object control, FeatureSet featureSet, ref DPFP.Gui.EventHandlerStatus eventHandlerStatus)
        {
            // Verify Here
            var ver             = new DPFP.Verification.Verification();
            var res             = new DPFP.Verification.Verification.Result();
            var fingerTemplates = new BeneficiaryRepository().GetFingerTemplates();

            // Compare feature set with all stored templates.


            foreach (var template in fingerTemplates)
            {
                // Get template from storage.
                if (template != null)
                {
                    // Compare feature set with particular template.
                    ver.Verify(featureSet, template, ref res);
                    //_data.IsFeatureSetMatched = res.Verified;
                    //_data.FalseAcceptRate = res.FARAchieved;
                    if (res.Verified)
                    {
                        break; // success
                    }
                }
            }

            if (!res.Verified)
            {
                eventHandlerStatus = DPFP.Gui.EventHandlerStatus.Failure;
            }

            //_data.Update();
        }
Exemple #2
0
        private void OnComplete(object Control, DPFP.FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus Status)
        {
            DPFP.Verification.Verification        ver = new DPFP.Verification.Verification();
            DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();

            //save to the db
            const string filename = "biometricverification.sqlite";
            var          conn     = new SQLiteConnection("Data Source=" + filename + ";");

            try
            {
                conn.Open();
                using (var command = new SQLiteCommand("SELECT * FROM fingerprint WHERE fingerprint = @finger_print", conn))
                {
                    command.Parameters.Add("@finger_print", DbType.Binary).Value = FeatureSet.Bytes;
                    //command.Parameters.Add("@fingerD", DbType.Int16).Value = Finger;
                    SQLiteDataReader dataR = command.ExecuteReader();
                    if (dataR.HasRows)
                    {
                        verification_status_lbl.ForeColor = Color.Green;
                        verification_status_lbl.Text      = "VALID";
                    }
                    else
                    {
                        Status = DPFP.Gui.EventHandlerStatus.Failure;
                        verification_status_lbl.ForeColor = Color.Red;
                        verification_status_lbl.Text      = "INVALID";
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            // Compare feature set with all stored templates.
            //foreach (DPFP.Template template in Data.Templates)
            //{
            //    // Get template from storage.
            //    if (template != null)
            //    {
            //        // Compare feature set with particular template.
            //        ver.Verify(FeatureSet, template, ref res);
            //        Data.IsFeatureSetMatched = res.Verified;
            //        Data.FalseAcceptRate = res.FARAchieved;
            //        if (res.Verified)
            //            verification_status_lbl.ForeColor = Color.Green;
            //            verification_status_lbl.Text = "VALID";
            //            break; // success
            //    }
            //}
            //if (!res.Verified)
            //{
            //    Status = DPFP.Gui.EventHandlerStatus.Failure;
            //    verification_status_lbl.ForeColor = Color.Red;
            //    verification_status_lbl.Text = "INVALID";
            //}
            Thread.Sleep(TimeSpan.FromSeconds(3));
            verification_status_lbl.Text = "";
        }
Exemple #3
0
 public void OnComplete(object Control, DPFP.FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus Status)
 {
     DPFP.Verification.Verification        ver = new DPFP.Verification.Verification();
     DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();
     // Compare feature set with all stored templates.
     foreach (DPFP.Template template in Data.Templates)
     {
         // Get template from storage.
         if (template != null)
         {
             // Compare feature set with particular template.
             ver.Verify(FeatureSet, template, ref res);
             Data.IsFeatureSetMatched = res.Verified;
             Data.FalseAcceptRate     = res.FARAchieved;
             if (res.Verified)
             {
                 break; // success
             }
         }
     }
     if (!res.Verified)
     {
         Status = DPFP.Gui.EventHandlerStatus.Failure;
     }
     Data.Update();
 }
Exemple #4
0
        public void OnComplete(object Control, DPFP.FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus Status)
        {
            DPFP.Verification.Verification        ver = new DPFP.Verification.Verification();
            DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();

            foreach (Staff dt in tempstorage.TempStaffs)
            {
                // Compare feature set with all stored templates.
                foreach (DPFP.Template template in dt.Templates)
                {
                    // Get template from storage.
                    if (template != null)
                    {
                        // Compare feature set with particular template.
                        ver.Verify(FeatureSet, template, ref res);
                        //dt.IsFeatureSetMatched = res.Verified;
                        //dt.FalseAcceptRate = res.FARAchieved;
                        if (res.Verified)
                        {
                            //search for the staff attendance that day
                            Attendance attdance = tempstorage.TempAttendance.Find(x => x.AdminId == tempstorage.TempStaffs.IndexOf(dt).ToString() && x.AttendanceDate == DateTime.Today.Date.ToShortDateString());

                            if (attdance != null)
                            {
                                MessageBox.Show("Attendance already taken for the day.");
                            }
                            else
                            {
                                //keep a spot for attendance
                                Attendance attd = new Attendance();
                                attd.AdminName      = dt.FirstName + " " + dt.LastName;
                                attd.AdminId        = tempstorage.TempStaffs.IndexOf(dt).ToString();
                                attd.AttendanceDate = DateTime.Today.Date.ToShortDateString();
                                attd.TimeIn         = DateTime.Now.TimeOfDay.ToString();
                                tempstorage.TempAttendance.Add(attd);
                                ListEvents.Items.Insert(0, String.Format("Attendance taken for staff: {0}, Time In: {1}, Date: {2}", attd.AdminName, attd.TimeIn, attd.AttendanceDate));
                            }

                            break; // success
                        }
                    }
                }
                if (res.Verified)
                {
                    break; // success
                }
            }



            if (!res.Verified)
            {
                Status = DPFP.Gui.EventHandlerStatus.Failure;
            }
        }
        public void OnComplete(object Control, DPFP.FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus Status)
        {
            DPFP.Verification.Verification        ver = new DPFP.Verification.Verification();
            DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();

            try
            {
                string mem = null;
                con.Open();
                SqlCommand    cmd      = new SqlCommand("select memName,finger from familyMembers where CardNo='" + CardNo + "'", con);
                SqlDataReader dr       = cmd.ExecuteReader();
                DPFP.Template template = new DPFP.Template();
                while (dr.Read())
                {
                    mem = dr["memName"].ToString();
                    byte[] tmp = (byte[])dr["finger"];
                    template.DeSerialize(tmp);

                    if (template != null)
                    {
                        ver.Verify(FeatureSet, template, ref res);
                        Data.IsFeatureSetMatched = res.Verified;
                        Data.FalseAcceptRate     = res.FARAchieved;
                        string rate = Data.FalseAcceptRate.ToString() + "00";
                        string sp   = rate.Remove(2);
                        label1.Text = sp + " %";
                        if (sp == "00")
                        {
                            label1.Text = "100 %";
                        }

                        if (res.Verified)
                        {
                            MessageBox.Show("Verification Success");
                            con.Close();
                            UserLogin.member = mem;
                            return;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                con.Close();
            }

            //if (!res.Verified)
            //    Status = DPFP.Gui.EventHandlerStatus.Failure;
            //MessageBox.Show("Unauthorized User");
            Data.Update();
        }
 public void OnEnroll(Object Control, int Finger, DPFP.Template Template, ref DPFP.Gui.EventHandlerStatus Status)
 {
     if (Data.IsEventHandlerSucceeds)
     {
         Data.Templates[Finger - 1] = Template;                              // store a finger template
         ExchangeData(true);                                                 // update other data
     }
     else
     {
         Status = DPFP.Gui.EventHandlerStatus.Failure;                   // force a "failure" status
     }
 }
 public void OnDelete(Object Control, int Finger, ref DPFP.Gui.EventHandlerStatus Status)
 {
     if (Data.IsEventHandlerSucceeds)
     {
         Data.Templates[Finger - 1] = null;                            // clear the finger template
         ExchangeData(true);                                           // update other data
     }
     else
     {
         Status = DPFP.Gui.EventHandlerStatus.Failure;                   // force a "failure" status
     }
 }
Exemple #8
0
 public void EnrollmentControl_OnDelete(Object Control, int Finger, ref DPFP.Gui.EventHandlerStatus Status)
 {
     if (Data.IsEventHandlerSucceeds)
     {
         Data.Templates[Finger - 1] = null;                          // clear the finger template
         Data.EnrolledFingersMask   = EnrollmentControl.EnrolledFingerMask;
         ListEvents.Items.Insert(0, String.Format("OnDelete: finger {0}", Finger));
     }
     else
     {
         Status = DPFP.Gui.EventHandlerStatus.Failure;   // force a "failure" status
     }
 }
 public void OnDelete(Object Control, int Finger, ref DPFP.Gui.EventHandlerStatus Status)
 {
     if (Data.IsEventHandlerSucceeds)
     {
         Data.Templates[Finger - 1] = null;                            // clear the finger template
         FileInfo fi = new FileInfo("C:\\FingerTemplate\\" + getName + ".fpt");
         fi.Delete();
         ExchangeData(true);                                                                             // update other data
     }
     else
     {
         Status = DPFP.Gui.EventHandlerStatus.Failure;                   // force a "failure" status
     }
 }
Exemple #10
0
        public void EnrollmentControl_OnDelete(Object Control, int Finger, ref DPFP.Gui.EventHandlerStatus Status)
        {
            if (_data.IsEventHandlerSucceeds)
            {
                _data.Templates[Finger - 1] = null;                         // clear the finger template
                ExchangeData(true);                                         // update other data

                ListEvents.Items.Insert(0, String.Format("OnDelete: finger {0}", Finger));
            }
            else
            {
                Status = DPFP.Gui.EventHandlerStatus.Failure;   // force a "failure" status
            }
        }
        // event handling
        public void EnrollmentControl_OnEnroll(Object Control, int Finger, DPFP.Template Template, ref DPFP.Gui.EventHandlerStatus Status)
        {
            if (Data.IsEventHandlerSucceeds)
            {
                Data.Templates[Finger - 1] = Template;      // store a finger template
                ExchangeData(true);                         // update other data

                ListEvents.Items.Insert(0, String.Format("OnEnroll: finger {0}", Finger));
            }
            else
            {
                Status = DPFP.Gui.EventHandlerStatus.Failure; // force a "failure" status
            }
        }
Exemple #12
0
        // event handling
        public void EnrollmentControl_OnEnroll(Object control, int finger, Template template, ref DPFP.Gui.EventHandlerStatus status)
        {
            #region Without DataExchange

            var fingerprintData = new MemoryStream();

            #region Adding Templates of Byte Array to List

            //_enrollmentControl.Capture;
            //_enrollmentControl.
            template.Serialize(fingerprintData);
            Utils.RightThumbPrintTemplateFile = template;
            Utils.BiometricInfo.RightThumbPrintTemplateFile         = template;
            Utils.BiometricInfo.RightThumbPrintTemplate             = fingerprintData.ToArray();
            Utils.BeneficiaryRegObj.RightThumbPrintTemplate         = fingerprintData.ToArray();
            Utils.BeneficiaryRegObj.FingerPrintTemplate[finger - 1] = fingerprintData.ToArray();
            //Utils.BeneficiaryRegObj.FingerPrintTemplate.Add(fingerprintData.ToArray());

            #endregion

            #endregion


            //if (_data.IsEventHandlerSucceeds)
            //{

            //var fingerprintData = new MemoryStream();

            //#region Adding Templates of Byte Array to List

            //template.Serialize(fingerprintData);
            //Utils.RightThumbPrintTemplateFile = template;
            //Utils.BiometricInfo.RightThumbPrintTemplateFile = template;
            //Utils.BiometricInfo.RightThumbPrintTemplate = fingerprintData.ToArray();
            //Utils.BeneficiaryRegObj.RightThumbPrintTemplate = fingerprintData.ToArray();
            //Utils.BeneficiaryRegObj.FingerPrintTemplate.Add(fingerprintData.ToArray());

            //#endregion

            #region Storing Each Finger Templates

            //switch (finger)
            //{
            //    case 1:

            //        template.Serialize(fingerprintData);
            //        Utils.RightThumbPrintTemplateFile = template;
            //        Utils.BiometricInfo.RightThumbPrintTemplateFile = template;
            //        Utils.BiometricInfo.RightThumbPrintTemplate = fingerprintData.ToArray();
            //        Utils.BeneficiaryRegObj.RightThumbPrintTemplate = fingerprintData.ToArray();
            //        Utils.BeneficiaryRegObj.FingerPrintTemplate.Add(fingerprintData.ToArray());



            //        #region Image

            //        //using (var ms = new MemoryStream(Utils.BiometricInfo.RightThumbPrintTemplate.ToArray()))
            //        //{
            //        //    // new Bitmap(Image.FromStream(new MemoryStream(bytes)
            //        //    using (var img = new Bitmap(Image.FromStream(ms, true)))
            //        //    {
            //        //        picFinger.Image = img;
            //        //    }
            //        //}

            //        //using (var ms = GetImageFromByteArray(Utils.BiometricInfo.RightThumbPrintTemplate))
            //        //{
            //        //    picFinger.Image = ms;
            //        //}

            //        //var img = EnrollmentControl.OnSampleQuality;
            //        #endregion


            //        // For Verification Purpose Later
            //        var dataStream = new MemoryStream(Utils.BiometricInfo.RightThumbPrintTemplate.ToArray());
            //        var rightThumbTemp = new Template();
            //        rightThumbTemp.DeSerialize(dataStream);

            //        break;

            //    case 2:

            //        template.Serialize(fingerprintData);
            //        Utils.RightIndexPrintTemplateFile = template;
            //        Utils.BiometricInfo.RightIndexPrintTemplateFile = template;
            //        Utils.BiometricInfo.RightIndexPrintTemplate = fingerprintData.ToArray();
            //        Utils.BeneficiaryRegObj.RightIndexPrintTemplate = fingerprintData.ToArray();
            //        break;
            //}


            //Init();
            //Start();	// Start capture operation.


            #endregion

            //_data.Templates[finger - 1] = template;		    // store a finger template
            //ExchangeData(true);								// update other data

            //ListEvents.Items.Insert(0, String.Format("OnEnroll: finger {0}", finger));
            // }
            //else
            //    status = DPFP.Gui.EventHandlerStatus.Failure;	// force a "failure" status
        }
Exemple #13
0
        //private void EnrollmentControl_OnSampleQuality(object Control, string ReaderSerialNumber,
        //    int Finger, DPFP.Capture.CaptureFeedback CaptureFeedback)
        //{
        //    //
        //}

        //private void EnrollmentControl_OnComplete(object Control, string ReaderSerialNumber, int Finger)
        //{
        //    //
        //}

        private void EnrollmentControl_OnEnroll(object Control, int FingerMask,
                                                DPFP.Template Template, ref DPFP.Gui.EventHandlerStatus EventHandlerStatus)
        {
            capturedTemplates[FingerMask - 1] = Template;
        }
Exemple #14
0
        // event handling
        public void EnrollmentControl_OnEnroll(Object Control, int Finger, DPFP.Template Template, ref DPFP.Gui.EventHandlerStatus Status)
        {
            if (Data.IsEventHandlerSucceeds)
            {
                Data.Templates[Finger - 1] = Template;          // store a finger template
                ExchangeData(true);                             // update other data
                ListEvents.Items.Insert(0, String.Format("OnEnroll: finger {0}", Finger));


                Template.Serialize(ms);           //Serialze contents of the Template into a memorystream
                Data.Datum = ms.ToArray();        //Save the Serialized data to Storage
            }
            else
            {
                Status = DPFP.Gui.EventHandlerStatus.Failure;   // force a "failure" status
            }
        }
        private void xVerificationControl_OnComplete(object Control, FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus EventHandlerStatus)
        {
            //DPFP.Template TemplateBD = new DPFP.Template();
            RN_Personal   obj       = new RN_Personal();
            RN_Asistencia objas     = new RN_Asistencia();
            DataTable     datospers = new DataTable();
            DataTable     dataasis  = new DataTable();

            string NroIDPersona = "";
            int    xint         = 1;

            byte[] finguerByte;
            string rutaFoto;
            bool   TerminarBucle = false;
            int    TotalFila     = 0;


            Frm_Filtro fil = new Frm_Filtro();

            int HoLimite = Dtp_Hora_Limite.Value.Hour;
            int MiLimite = Dtp_Hora_Limite.Value.Minute;

            int horaCaptu   = DateTime.Now.Hour;
            int minutoCaptu = DateTime.Now.Minute;

            try
            {
                datospers = obj.RN_Leer_todoPersona();
                TotalFila = datospers.Rows.Count;

                if (datospers.Rows.Count <= 0)
                {
                    return;
                }

                var DatoPe = datospers.Rows[0];
                foreach (DataRow xitem in datospers.Rows)
                {
                    if (TerminarBucle == true)
                    {
                        return;
                    }

                    finguerByte  = (byte[])xitem["FinguerPrint"];
                    NroIDPersona = Convert.ToString(xitem["Id_Pernl"]);


                    DPFP.Template TemplateBD = new DPFP.Template();

                    TemplateBD.DeSerialize(finguerByte);

                    verificar.Verify(FeatureSet, TemplateBD, ref resultado);

                    if (resultado.Verified == true)
                    {
                        rutaFoto             = Convert.ToString(xitem["Foto"]);
                        lbl_nombresocio.Text = Convert.ToString(xitem["Nombre_Completo"]);
                        Lbl_Idperso.Text     = Convert.ToString(xitem["Id_Pernl"]);
                        lbl_Dni.Text         = Convert.ToString(xitem["DNIPR"]);

                        if (File.Exists(rutaFoto) == true)
                        {
                            picSocio.Load(rutaFoto.Trim());
                        }
                        else
                        {
                            picSocio.Load(Application.StartupPath + @"\user.png");
                        }


                        if (objas.RN_Checar_SiPersonal_YaMarco_Asistencia(Lbl_Idperso.Text.Trim()) == true)
                        {
                            lbl_msm.BackColor = Color.MistyRose;
                            lbl_msm.ForeColor = Color.Red;
                            lbl_msm.Text      = "El Sistema Verifico, Marco Asistencia";
                            tocar_timbre();
                            lbl_Cont.Text = "10";
                            xVerificationControl.Enabled = true;
                            pnl_Msm.Visible   = true;
                            tmr_Conta.Enabled = true;
                            return;
                        }


                        if (objas.RN_Checar_SiPersonal_YaMarco_suEntrada(Lbl_Idperso.Text.Trim()) == true)
                        {
                            Frm_sinox sinox = new Frm_sinox();
                            TerminarBucle = true;
                            fil.Show();
                            sinox.Lbl_msm1.Text = "El Usuario ya tiene registro de Entrada, ¿Quieres Marcar su Salida?";
                            sinox.ShowDialog();
                            fil.Hide();

                            if (Convert.ToString(sinox.Tag) == "Si")
                            {
                                dataasis = objas.RN_Buscar_Asistencia_deEntrada(Lbl_Idperso.Text);
                                if (dataasis.Rows.Count < 1)
                                {
                                    return;
                                }
                                lbl_IdAsis.Text = Convert.ToString(dataasis.Rows[0]["Id_asis"]);
                                objas.RN_Registrar_Salida_Personal(lbl_IdAsis.Text, Lbl_Idperso.Text, lbl_hora.Text, 8);

                                if (BD_Asistencia.Salida == true)
                                {
                                    lbl_msm.BackColor = Color.YellowGreen;
                                    lbl_msm.ForeColor = Color.White;
                                    lbl_msm.Text      = "La Salida del Personal fue Registrada";
                                    tocar_timbreok();
                                    xVerificationControl.Enabled = false;
                                    pnl_Msm.Visible   = true;
                                    lbl_Cont.Text     = "10";
                                    tmr_Conta.Enabled = true;

                                    TerminarBucle = true;
                                }
                            }
                        }
                        else
                        {
                            // marcar su entrada:
                            if (horaCaptu >= HoLimite)
                            {
                                lbl_msm.BackColor = Color.MistyRose;
                                lbl_msm.ForeColor = Color.Red;
                                lbl_msm.Text      = "Estimado Usuario, Su Hora de Entrada ya caduco";
                                tocar_timbre();
                                pnl_Msm.Visible              = true;
                                tmr_Conta.Enabled            = true;
                                lbl_Cont.Text                = "10";
                                xVerificationControl.Enabled = false;
                                return;
                            }

                            Calcular_Minutos_Tardanza();
                            lbl_IdAsis.Text = RN_Utilitario.RN_NroDoc(3);
                            objas.RN_Registrar_Entrada_Personal(lbl_IdAsis.Text, Lbl_Idperso.Text, lbl_hora.Text, Convert.ToDouble(lbl_totaltarde.Text), Convert.ToInt32(lbl_TotalHotrabajda.Text), lbl_justifi.Text);
                            if (BD_Asistencia.Entrada == true)
                            {
                                RN_Utilitario.RN_Actualizar_Tipo_Doc(3);
                                lbl_msm.BackColor = Color.YellowGreen;
                                lbl_msm.ForeColor = Color.White;
                                lbl_msm.Text      = "La Entrada del Personal fue Registrada";
                                tocar_timbreok();
                                pnl_Msm.Visible              = true;
                                tmr_Conta.Enabled            = true;
                                xVerificationControl.Enabled = false;
                                lbl_Cont.Text = "10";
                                TerminarBucle = true;
                            }
                        }
                    }// todo es true
                    else
                    {
                        if (xint == TotalFila)
                        {
                            if (TerminarBucle == false)
                            {
                                lbl_msm.Text      = "La Huella no se encuentra registrada";
                                lbl_msm.BackColor = Color.MistyRose;
                                lbl_msm.ForeColor = Color.Red;
                                tocar_timbre();
                                lbl_Cont.Text = "10";
                                xVerificationControl.Enabled = false;
                                pnl_Msm.Visible   = true;
                                tmr_Conta.Enabled = true;
                            }
                        }
                    }
                    xint += 1;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Algo Salio Mal: " + ex.Message, "Advertencia del Sistema", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemple #16
0
        private void xVerificationControl_OnComplete(object Control, FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus EventHandlerStatus)
        {
            //DPFP.Template TemplateBD = new DPFP.Template();
            RN_Personal   obj          = new RN_Personal();
            RN_Asistencia objas        = new RN_Asistencia();
            DataTable     datosPersona = new DataTable();
            DataTable     dataAsis     = new DataTable();

            //byte[] finguerByte;
            string NroIDPersona = "";
            int    xitn         = 1;

            byte[]     fingerByte;
            string     rutaFoto;
            bool       TerminarBucle = false;
            int        totalFila     = 0;
            Frm_Filtro fil           = new Frm_Filtro();

            int HoLimite = Dtp_Hora_Limite.Value.Hour;
            int MiLimite = Dtp_Hora_Limite.Value.Minute;

            int horaCaptu   = DateTime.Now.Hour;
            int minutoCaptu = DateTime.Now.Minute;

            try
            {
                datosPersona = obj.RN_Leer_todoPersona();
                totalFila    = datosPersona.Rows.Count;
                if (datosPersona.Rows.Count <= 0)
                {
                    return;
                }

                var datoPer = datosPersona.Rows[0];
                foreach (DataRow xitem in datosPersona.Rows)
                {
                    if (TerminarBucle == true)
                    {
                        return;
                    }

                    fingerByte   = (byte[])xitem["FinguerPrint"];
                    NroIDPersona = Convert.ToString(xitem["Id_Pernl"]);

                    DPFP.Template TemplateBD = new DPFP.Template();

                    TemplateBD.DeSerialize(fingerByte);

                    Verificar.Verify(FeatureSet, TemplateBD, ref Resultado);

                    if (Resultado.Verified == true)
                    {
                        rutaFoto             = Convert.ToString(xitem["Foto"]);
                        lbl_nombresocio.Text = Convert.ToString(xitem["Nombre_Completo"]);
                        Lbl_Idperso.Text     = Convert.ToString(xitem["Id_Pernl"]);
                        lbl_Dni.Text         = Convert.ToString(xitem["DNIPR"]);

                        if (File.Exists(rutaFoto) == true)
                        {
                            picSocio.Load(rutaFoto.Trim());
                        }
                        else
                        {
                            picSocio.Load(Application.StartupPath + @"\user.png");
                        }

                        if (objas.RN_Checar_SiPersonal_YaMarco_Asistencia(Lbl_Idperso.Text.Trim()) == true)
                        {
                            lbl_msm.BackColor = Color.MistyRose;
                            lbl_msm.ForeColor = Color.Red;
                            lbl_msm.Text      = "El sistema verificó que el personal ya marcó su asistencia";
                            tocar_timbre();
                            lbl_Cont.Text = "10";
                            xVerificationControl.Enabled = true;
                            pnl_Msm.Visible   = true;
                            tmr_Conta.Enabled = true;
                            return;
                        }

                        if (objas.RN_Checar_SiPersonal_YaMarco_Entrada(Lbl_Idperso.Text.Trim()) == true)
                        {
                            Frm_Sinox sino = new Frm_Sinox();
                            TerminarBucle = true;
                            fil.Show();
                            sino.Lbl_msm1.Text = "El usuario ya tiene registrada su entrada, ¿Te gustarìa marcar su salida?";
                            sino.ShowDialog();
                            fil.Hide();

                            if (Convert.ToString(sino.Tag) == "Si")
                            {
                                dataAsis = objas.RN_Buscar_Asistencia_deEntrada(Lbl_Idperso.Text);
                                if (dataAsis.Rows.Count < 1)
                                {
                                    return;
                                }
                                lbl_IdAsis.Text = Convert.ToString(dataAsis.Rows[0]["Id_asis"]);
                                objas.RN_Registrar_Salida_Personal(lbl_IdAsis.Text, Lbl_Idperso.Text, lbl_hora.Text, 8);
                                if (BD_Asistencia.salida == true)
                                {
                                    lbl_msm.BackColor = Color.YellowGreen;
                                    lbl_msm.ForeColor = Color.White;
                                    lbl_msm.Text      = "La salida del personal fue registrada exitosamente";
                                    tocar_timbreOK();
                                    xVerificationControl.Enabled = false;
                                    pnl_Msm.Visible = true;

                                    lbl_Cont.Text     = "10";
                                    tmr_Conta.Enabled = true;

                                    TerminarBucle = true;
                                }
                            }
                            else
                            {
                                LimpiarFormulario();
                                sec = 10;
                                tmr_Conta.Stop();
                                pnl_Msm.Visible = false;
                                xVerificationControl.Enabled = true;
                                lbl_Cont.Text = "10";
                            }
                        }
                        else
                        {
                            //entonces marcar entrada
                            if (horaCaptu >= HoLimite)
                            {
                                lbl_msm.BackColor = Color.MistyRose;
                                lbl_msm.ForeColor = Color.Red;
                                lbl_msm.Text      = "Estimado usuario, su hora de entrada ya caducó. Vuelve a casa y regresa mañana";
                                tocar_timbre();
                                pnl_Msm.Visible   = true;
                                tmr_Conta.Enabled = true;

                                lbl_Cont.Text = "10";
                                xVerificationControl.Enabled = false;
                                return;
                            }

                            calcular_Minutos_Tardanza();
                            lbl_IdAsis.Text = RN_Utilitario.RN_NroDoc(3);
                            objas.RN_Registrar_Entrada_Personal(lbl_IdAsis.Text, Lbl_Idperso.Text, lbl_hora.Text, Convert.ToDouble(lbl_totaltarde.Text), Convert.ToInt32(lbl_TotalHotrabajda.Text), lbl_justifi.Text);
                            if (BD_Asistencia.entrada == true)
                            {
                                RN_Utilitario.RN_Actualiza_Tipo_Doc(3);
                                lbl_msm.BackColor = Color.YellowGreen;
                                lbl_msm.ForeColor = Color.White;
                                lbl_msm.Text      = "La entrada del personal fue registrada exitosamente";
                                tocar_timbreOK();
                                pnl_Msm.Visible              = true;
                                tmr_Conta.Enabled            = true;
                                xVerificationControl.Enabled = false;
                                lbl_Cont.Text = "10";
                                TerminarBucle = true;
                            }
                        }
                    }
                    else
                    {
                        if (xitn == totalFila)
                        {
                            if (TerminarBucle == false)
                            {
                                lbl_msm.BackColor = Color.MistyRose;
                                lbl_msm.ForeColor = Color.Red;
                                lbl_msm.Text      = "La Huella Dactilar no existe en la base de datos";
                                tocar_timbre();
                                lbl_Cont.Text                = "10";
                                pnl_Msm.Visible              = true;
                                tmr_Conta.Enabled            = true;
                                xVerificationControl.Enabled = false;
                            }
                        }
                    }
                    xitn += 1;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Algo malo pasó: " + ex.Message, "Advertencia de Seguridad", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemple #17
0
 private void enrollControl_OnDelete(object Control, int finger, ref DPFP.Gui.EventHandlerStatus EventHandlerStatus)
 {
     DeleteTemplateImage(finger);
 }
Exemple #18
0
        private void EnrollmentControl_OnEnroll(object Control, int FingerMask, DPFP.Template Template, ref DPFP.Gui.EventHandlerStatus EventHandlerStatus)
        {
            byte[]      bytes = null;
            RN_Personal obj   = new RN_Personal();

            if (Template is null)
            {
                Template.Serialize(ref bytes);
                MessageBox.Show("No se puede Realizar la Operacion", "Aviso del Sistema", MessageBoxButtons.OK, MessageBoxIcon.Error);
                lbl_idperso.Text    = "";
                lbl_nomPersona.Text = "";
                lbl_nroDni.Text     = "";
                picFoto.Image       = null;
                this.Tag            = "";
                this.Close();
            }
            else
            {
                Template.Serialize(ref bytes);
                obj.RN_Registrar_Huella_Personal(lbl_idperso.Text, bytes);
                lbl_idperso.Text    = "";
                lbl_nomPersona.Text = "";
                lbl_nroDni.Text     = "";
                picFoto.Image       = null;

                if (BD_Personal.Huella == true)
                {
                    MessageBox.Show("la Huella Dactilar del Personal, Fue Registrada con Exito", "Aviso del Sistema", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    this.Tag = "A";
                    this.Close();
                }
            }
        }
Exemple #19
0
        private void VerificationControl_OnComplete(object Control, DPFP.FeatureSet FeatureSet,
                                                    ref DPFP.Gui.EventHandlerStatus EventHandlerStatus)
        {
            FoundPerson     = null;
            picBox.Image    = null;
            btnCard.Visible = false;
            lblName.ResetText();
            lblAge.ResetText();
            lblGender.ResetText();
            lblMaritalStatus.ResetText();
            lblState.ResetText();
            lblLGA.ResetText();

            IdpDb db         = new IdpDb();
            bool  breakOuter = false;
            var   persons    = db.GetPersons();

            foreach (Idp person in persons)
            {
                int finger = 0;
                foreach (var template in person.FingerTemplates)
                {
                    finger++;
                    if (template != null)
                    {
                        matcher     = new DPFP.Verification.Verification();
                        matchResult = new DPFP.Verification.Verification.Result();
                        matcher.Verify(FeatureSet, template, ref matchResult);
                        if (matchResult.Verified)
                        {
                            //MessageBox.Show(person.FirstName + ", finger: " + finger);

                            FoundPerson = person;

                            //pic
                            if (person.Photo != null)
                            {
                                picBox.Image = new Bitmap(person.Photo, picBox.Size);
                            }

                            btnCard.Visible = true;

                            string nm = (!string.IsNullOrEmpty(person.FirstName) ? person.FirstName + " " : "") +
                                        (!string.IsNullOrEmpty(person.LastName) ? person.LastName + " " : "") +
                                        (!string.IsNullOrEmpty(person.OtherNames) ? person.OtherNames + " " : "");
                            lblName.Text = nm;
                            if (person.YoB > 0)
                            {
                                int age = DateTime.Now.Year - person.YoB;
                                lblAge.Text = "About " + age + " year(s) old";
                            }
                            else
                            {
                                int age = DateTime.Now.Year - person.DoB.Year;
                                lblAge.Text = person.DoB.Day + "/" + person.DoB.Month + "/" + person.DoB.Year +
                                              " (" + age + " year(s) old)";
                            }
                            lblGender.Text        = person.Gender;
                            lblMaritalStatus.Text = person.MaritalStatus;
                            lblState.Text         = person.State;
                            lblLGA.Text           = person.LGA;
                            breakOuter            = true;
                            break;
                        }
                    }
                }
                if (breakOuter)
                {
                    break;
                }
            }
            if (!breakOuter)
            {
                MessageBox.Show("Could not identify user!");
            }
        }
Exemple #20
0
 private void enrollControl_OnEnroll(object Control, int finger, DPFP.Template template, ref DPFP.Gui.EventHandlerStatus EventHandlerStatus)
 {
     SaveTemplateImage(template, finger);
 }
Exemple #21
0
 void OnComplete(object control, DPFP.FeatureSet featureSet, ref DPFP.Gui.EventHandlerStatus eventHandlerStatus)
 {
     _featureSet = featureSet;
     Verification();
 }
Exemple #22
0
        private void VerificationControl_OnComplete(object Control, DPFP.FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus Status)
        {
            lblStatus.Text = "Checking ...";
            // TODO: get templates and compare
            DPFP.Verification.Verification        ver = new DPFP.Verification.Verification();
            DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();
            FingerData last_tested = StaticFarm.lastFinger;

            foreach (FingerData fd in fdx)
            {
                DPFP.Template template = convertTemplate(fd.finger);
                if (fd.finger == String.Empty)
                {
                    template = null;
                }

                // Get template from storage.
                if (template != null)
                {
                    // Compare feature set with particular template.
                    ver.Verify(FeatureSet, template, ref res);
                    last_tested = fd;
                    if (res.Verified)
                    {
                        break; // success
                    }
                }
            }
            if (!res.Verified)
            {
                Status         = DPFP.Gui.EventHandlerStatus.Failure;
                lblStatus.Text = "Authorization Failed Try again ...";
            }
            else
            {
                lblStatus.Text = "Successfully Verified.";
                Status         = DPFP.Gui.EventHandlerStatus.Success;


                StaticFarm.SignInPage.GotoHome();
                this.Close();
            }
        }
Exemple #23
0
 private void EnrollmentControl_OnEnroll(object Control, int FingerMask, DPFP.Template Template, ref DPFP.Gui.EventHandlerStatus EventHandlerStatus)
 {
     StaticFarm.NewFingerTemplate     = Template;
     StaticFarm.NewFingerBase64String = StaticFarm.ConvertM(Template.Bytes);
 }
Exemple #24
0
        private void verifyControl_OnComplete(object Control, DPFP.FeatureSet featureSet, ref DPFP.Gui.EventHandlerStatus EventHandlerStatus)
        {
            if (!chkTimeInAM.Checked && !chkTimeOutAM.Checked && !chkTimeInPM.Checked && !chkTimeOutPM.Checked && !chkTimeOutEvening.Checked && !chkTimeInEvening.Checked)
            {
                lblTimeLog.Text = "Toggle event first.";
                return;
            }

            var ver = new Verification();
            var res = new Verification.Result();
            //ClearProfile();
            var stat = 0;

            // Compare feature set with all stored templates.

            foreach (var ft in fingerTemplateList.Where(ft => ft.FPTemplateFile != null))
            {
                // Compare feature set with particular template.
                ver.Verify(featureSet, ft.FPTemplateFile, ref res);

                if (!res.Verified)
                {
                    continue;
                }
                GetProfile(ft.EmpID);
                stat = 1;
                break; // success
            }

            ShowNotFound(stat);
        }
Exemple #25
0
        // event handling
        public void EnrollmentControl_OnEnroll(Object Control, int Finger, DPFP.Template Template, ref DPFP.Gui.EventHandlerStatus Status)
        {
            if (Data.IsEventHandlerSucceeds)
            {
                Data.Templates[Finger - 1] = Template;      // store a finger template
                ExchangeData(true);                         // update other data

                //save to the db
                const string filename = "biometricverification.sqlite";
                var          conn     = new SQLiteConnection("Data Source=" + filename + ";");

                try
                {
                    conn.Open();
                    using (var command = new SQLiteCommand("UPDATE fingerprint SET fingerprint = @finger_print WHERE finger = @fingerD", conn))
                    {
                        command.Parameters.Add("@finger_print", DbType.Binary).Value = Template.Bytes;
                        command.Parameters.Add("@fingerD", DbType.Int16).Value       = Finger;
                        command.ExecuteNonQuery();
                        MessageBox.Show("successfully updated to db");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                ListEvents.Items.Insert(0, String.Format("OnEnroll: finger {0}", Finger));
            }
            else
            {
                Status = DPFP.Gui.EventHandlerStatus.Failure; // force a "failure" status
            }
        }