Exemple #1
0
        private void fingerPrint_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie)
        {
            rawImage = ie.RawImage;
            SetImage(ie.RawImage.Image);

            ExtractTemplate();
        }
Exemple #2
0
        void core_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie)
        {
            try
            {
                huella = ie.RawImage;
                core.Extract(huella, ref template);

                pictureBox1.Image = huella.Image;

                switch (template.Quality)
                {
                case 0:
                    MessageBox.Show("Huella de mala calidad favor de volver a poner el dedo", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;

                case 1:
                    MessageBox.Show("La huella es de una calidad media, intente nuevamente", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;

                case 2:
                    MessageBox.Show("Huella con buena calidad", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    HuellaOK = true;
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        void refFingercore_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie)
        {
            rawImage = ie.RawImage;
            SetImage(ie.RawImage.Image);
            stepCount++;
            //ExtractTemplate();

            try
            {
                _template = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate();
                int ret = (int)refFingercore.Enroll(ie.RawImage, ref _template, GrTemplateFormat.GR_FORMAT_DEFAULT, FingerprintConstants.GR_DEFAULT_CONTEXT);
                if (ret >= FingerprintConstants.GR_ENROLL_SUFFICIENT)
                {
                    //IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal);
                    //dl.SaveTemplate(template);

                    if (ret == FingerprintConstants.GR_ENROLL_SUFFICIENT)
                    {
                        SetStatusMessage("Sufficient quality value.");
                        PerformStep(QualityTemplate.SUF, Color.YellowGreen);
                    }
                    else if (ret == FingerprintConstants.GR_ENROLL_GOOD)
                    {
                        SetStatusMessage("Good quality value.");
                        PerformStep(QualityTemplate.GOOD, Color.MediumSeaGreen);
                    }
                    else if (ret == FingerprintConstants.GR_ENROLL_VERY_GOOD)
                    {
                        IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal);
                        dl.SaveTemplate(_template);

                        PerformStep(QualityTemplate.VERYGOOD, Color.SeaGreen);

                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                    else if (ret == FingerprintConstants.GR_ENROLL_MAX_LIMIT_REACHED)
                    {
                        IGRDal dl = DalFactory.GetDal(GrConnector.AccessDal);
                        dl.SaveTemplate(_template);

                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }

                    EnableOk();
                }
                else
                {
                    // WriteLog("The Template does not reach a good quality value");
                    SetStatusMessage("Please put your finger again");
                    PerformStep(QualityTemplate.INSF, Color.LightCoral);
                }
            }
            catch { }


            System.Threading.Thread.Sleep(100);
        }
Exemple #4
0
 void FPCore_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie)
 {
     try
     {
         if (ie.RawImage != null)
         {
             SetImage(ie.RawImage.Image);
             template = new FingerprintTemplate();
             int ret = (int)FPCore.Enroll(ie.RawImage, ref template, (GrTemplateFormat)Controller.DefaultTemplateFormat, FingerprintConstants.GR_DEFAULT_CONTEXT);
             if (ret >= FingerprintConstants.GR_ENROLL_SUFFICIENT)
             {
                 DisplayImage(template, ie.RawImage);
                 EnableCaptureButton(true);
                 if (ret == FingerprintConstants.GR_ENROLL_SUFFICIENT)
                 {
                     ShowQuality(EnrollQuality.Sufficient);
                     SetFingerLabel("Place finger again to improve quality", true);
                 }
                 else if (ret == FingerprintConstants.GR_ENROLL_GOOD)
                 {
                     ShowQuality(EnrollQuality.Good);
                     SetFingerLabel("Click 'Capture' to record template", true);
                 }
                 else if (ret == FingerprintConstants.GR_ENROLL_VERY_GOOD)
                 {
                     ShowQuality(EnrollQuality.VeryGood);
                     SetFingerLabel("Click 'Capture' to record template", true);
                 }
                 else if (ret == FingerprintConstants.GR_ENROLL_MAX_LIMIT_REACHED)
                 {
                     SetFingerLabel("Enrollment limit reached", true);
                 }
             }
             else
             {
                 SetFingerLabel("Place finger again", true);
                 ShowQuality(EnrollQuality.Poor);
             }
             Thread.Sleep(100);
         }
     }
     catch (FingerprintException ex)
     {
         ShowFPError(ex);
     }
     catch (Exception e)
     {
         ShowError(e);
     }
 }
Exemple #5
0
        private void fingerPrint_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie)
        {
            SetFingerStatus(ie.Source, 2);
            rawImage = ie.RawImage;
            SetImage(ie.RawImage.Image);
            if (autoExtractToolStripMenuItem.Checked)
            {
                // buttonClick(button1);
                ExtractTemplate();

                if (autoIdentifyToolStripMenuItem.Checked)
                {
                    System.Threading.Thread.Sleep(100);
                    // buttonClick(button3);
                    Identify();
                }
            }
        }
Exemple #6
0
        void core_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie)
        {
            try
            {
                WriteLog("Obteniendo Huella.");
                huella = ie.RawImage;
                core.Extract(huella, ref template);
                string consulta;
                byte[] dataTemp;
                GriauleFingerprintLibrary.DataTypes.FingerprintTemplate templateTemp;
                int precision, calidad;

                // selecciono
                consulta = "select id, id as no_empleado, telefono, rfc, rol, concat_ws(' ', nombre, apellidoPaterno, apellidoMaterno) as nombreCompleto, template, calidad_template, foto from usuarios where template is not null and 1 = 1";

                MySqlDataReader reader = this.EjecutarQuery(consulta);
                core.IdentifyPrepare(template);

                while (reader.Read())
                {
                    dataTemp             = (byte[])reader["template"];
                    calidad              = (int)reader["calidad_template"];
                    templateTemp         = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate();
                    templateTemp.Buffer  = dataTemp;
                    templateTemp.Size    = dataTemp.Length;
                    templateTemp.Quality = calidad;

                    int result = core.Identify(templateTemp, out precision);
                    WriteLog("Resultado: " + result.ToString() + " Precision: " + precision.ToString());


                    if (result == 1)
                    {
                        //
                        Usuario = reader["id"].ToString();
                        string no_Empleado    = reader["no_empleado"].ToString();
                        string nombreCompleto = reader["nombreCompleto"].ToString();
                        string rfc            = reader["rfc"].ToString();
                        string telefono       = reader["telefono"].ToString();
                        string rol            = reader["rol"].ToString();
                        string foto           = reader["foto"].ToString();
                        Rol = rol;

                        WriteLog("Huella encontrada.");
                        WriteLog("Empleado: " + no_Empleado);

                        string inout = new Rules().isInOut(Usuario);
                        if (inout == "In")
                        {
                            if (new Rules().registrarEntrada(Usuario))
                            {
                                this.no_personal.Text     = no_Empleado;
                                this.nombre_completo.Text = nombreCompleto;
                                this.rfc.Text             = rfc;
                                this.telefono.Text        = telefono;
                                label1.Text = "Entrada";

                                if (!String.IsNullOrEmpty(foto))
                                {
                                    fotoGrafia.ImageLocation = @RutaFotos + foto;
                                }

                                this.WindowState = FormWindowState.Normal;
                                WriteLog("Entrada Registrada. " + no_Empleado);
                            }
                            else
                            {
                                MessageBox.Show("No hemos podido registrar su entrada");
                                WriteLog("No hemos podido registrar su entrada" + no_Empleado);
                            }
                        }
                        else
                        {
                            if (new Rules().registrarSalida(Usuario))
                            {
                                this.no_personal.Text     = no_Empleado;
                                this.nombre_completo.Text = nombreCompleto;
                                this.rfc.Text             = rfc;
                                this.telefono.Text        = telefono;

                                if (!String.IsNullOrEmpty(foto))
                                {
                                    fotoGrafia.ImageLocation = @RutaFotos + foto;
                                }

                                this.no_personal.Text     = no_Empleado;
                                this.nombre_completo.Text = nombreCompleto;
                                this.rfc.Text             = rfc;
                                this.telefono.Text        = telefono;
                                label1.Text = "Salida";

                                if (!String.IsNullOrEmpty(foto))
                                {
                                    fotoGrafia.ImageLocation = @RutaFotos + foto;
                                }

                                this.WindowState = FormWindowState.Normal;
                                WriteLog("Salida Registrada. " + no_Empleado);
                            }
                        }

                        break;
                    }
                    else
                    {
                        WriteLog("No concuerda");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #7
0
        void core_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie)
        {
            try
            {
                huella = ie.RawImage;
                core.Extract(huella, ref template);
                label4.Text = "";//"Espere, identificando...";
                bool   haveHorarios = false;
                string consulta;
                byte[] dataTemp;
                GriauleFingerprintLibrary.DataTypes.FingerprintTemplate templateTemp;
                int precision, calidad;

                // selecciono
                consulta = "select id, rol, concat_ws(' ', nombre, apellidoPaterno, apellidoMaterno) as nombreCompleto, template, calidad_template, foto from usuarios where template is not null and 1 = 1";

                MySqlDataReader reader = this.EjecutarQuery(consulta);

                core.IdentifyPrepare(template);
                bool match = false;

                while (reader.Read())
                {
                    Log.WriteLog("Recorriendo usuarios.");
                    dataTemp             = (byte[])reader["template"];
                    calidad              = (int)reader["calidad_template"];
                    templateTemp         = new GriauleFingerprintLibrary.DataTypes.FingerprintTemplate();
                    templateTemp.Buffer  = dataTemp;
                    templateTemp.Size    = dataTemp.Length;
                    templateTemp.Quality = calidad;

                    int result = core.Identify(templateTemp, out precision);

                    if (result == 1)
                    {
                        Usuario = reader["id"].ToString();
                        string nombreCompleto = reader["nombreCompleto"].ToString();
                        string rol            = reader["rol"].ToString();
                        string foto           = reader["foto"].ToString();
                        Rol = rol;

                        Log.WriteLog("Encontre al Usuario - " + reader["nombreCompleto"].ToString());
                        string inout = new Rules().isInOut(Usuario);
                        if (inout == "In")
                        {
                            Log.WriteLog(inout);
                            if (Rol == "Cliente")
                            {
                                List <Horario> horarios = this.getHorarios(Usuario);

                                if (horarios.Count > 0)
                                {
                                    haveHorarios = true;
                                }
                                else
                                {
                                    Log.WriteLog("No hay horarios disponibles.");
                                    MessageBox.Show("Lo sentimos no contamos con horarios disponibles");
                                    //clean();
                                }

                                if (haveHorarios)
                                {
                                    label4.Text = "";
                                    dataGridView1.DataSource = horarios;
                                    label2.Text      = "Bienvenido " + nombreCompleto;
                                    mensualidad.Text = new Rules().ProximoPago(Usuario);
                                    Log.WriteLog("Encontre horarios para - " + nombreCompleto);
                                    if (!String.IsNullOrEmpty(foto))
                                    {
                                        fotoGrafia.ImageLocation = @"c:\wamp\www\gym\fotos\" + foto;
                                    }
                                    this.WindowState = FormWindowState.Normal;
                                }
                            }
                            else if (Rol == "Instructor")
                            {
                                label4.Text = "";
                                dataGridView1.DataSource = null;
                                label2.Text = "Bienvenido " + nombreCompleto;

                                if (!String.IsNullOrEmpty(foto))
                                {
                                    fotoGrafia.ImageLocation = @"c:\wamp\www\gym\fotos\" + foto;
                                }
                                this.WindowState = FormWindowState.Normal;
                                Log.WriteLog("Bienvenido Instructor - " + nombreCompleto);
                            }
                        }
                        else
                        {
                            if (new Rules().registrarSalida(Usuario))
                            {
                                Log.WriteLog("Se registro la salida - " + nombreCompleto);
                                label2.Text = "Hasta pronto " + nombreCompleto;

                                if (!String.IsNullOrEmpty(foto))
                                {
                                    fotoGrafia.ImageLocation = @"c:\wamp\www\gym\fotos\" + foto;
                                }
                                this.WindowState     = FormWindowState.Normal;
                                this.button2.Visible = true;
                            }
                        }
                        match = true;

                        break;
                    }
                }

                if (!match)
                {
                    label4.Text = "Usuario no registrado, te invitamos a darte de alta";
                    Log.WriteLog("No se encontro ni un usuario");
                    //clean();
                    this.WindowState = FormWindowState.Normal;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                Log.WriteLog(ex.Message);
            }
        }