Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
0
        private void fingerPrint_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie)
        {
            rawImage = ie.RawImage;
            SetImage(ie.RawImage.Image);

            ExtractTemplate();
        }
Ejemplo n.º 3
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();
                }
            }
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 8
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();
                }
            }
        }
Ejemplo n.º 9
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);
            }
        }