public void GuardarRegistroAsync()
        {
            using (FileStream fs = File.Open(@"C:\Registro\Registro.fpt", FileMode.Create, FileAccess.Write))
            {
                Stream templateStream = Template.Serialize(fs);
                //var ipfs = new IpfsClient();

                //const string filename = @"C:\Registro\Registro.fpt";
                //string text = await ipfs.FileSystem.ReadAllTextAsync(filename);
                //Console.WriteLine("HHooaooa "+text);
            }
        }
Exemple #2
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
            }
        }
Exemple #3
0
        void CaptureForm_OnTemplate(DPFP.Template template)
        {
            // Este evento es llamado automaticamente por el SDK una vez que se escanea la huella 4 veces.
            // Y nos envia la "template" por parametro, que usamos para convertir a binario y subir al a base de datos.

            // Invoke es necesario siempre que queramos hacer cambios a objetos/elementos de nuestro formulario
            // esto se debe a que el proceso de Captura del escaner se realiza en un proceso por separado.
            this.Invoke(new MethodInvoker(delegate {
                // Si todo sale bien, la variable global "plantilla" se coloca como la plantilla generada por el escaner
                plantilla = template;
                // La convertimos a un arreglo de bytes
                MemoryStream fingerprintData = new MemoryStream();
                template.Serialize(fingerprintData);
                fingerprintData.Position = 0;
                BinaryReader br          = new BinaryReader(fingerprintData);
                Byte[] bytes             = br.ReadBytes((Int32)fingerprintData.Length);
            }));
        }
Exemple #4
0
        private void Submit_Click(object sender, EventArgs e)
        {
            try
            {
                OnTemplateCollect(Template);

                MemoryStream ms = new MemoryStream();

                Template.Serialize(ms);
                this.imgs = ms.ToArray();



                sqlcon.Open();
                OpenFileDialog Open            = new OpenFileDialog();
                string         CorrectFileName = System.IO.Path.GetFileName(Open.FileName);



                String query = "INSERT INTO Student_db (Student_Fullname, Student_RegNo, Student_Level, Student_Mobile, Student_Email, Student_DOB, Student_Gender, Student_Address, Sponsor_Name, Sponsor_Email, Sponsor_Mobile, DOR, SImagePath, Student_Fingerprint_RTB) VALUES ('" + txtFullname.Text + "', '" + txtRegNo.Text + "', '" + cmbLevel.Text + "',  '" + txtMobile.Text + "', '" + txtEmail.Text + "', '" + txtDOB.Text + "','" + Gender + "', '" + txtAddress.Text + "', '" + txtSponsor.Text + "', '" + txtSponsorE.Text + "', '" + txtSponsorM.Text + "', '" + DOR.Text + "', '\\Images\\" + CorrectFileName + "', @imgs)";

                String query2 = "INSERT INTO Total_Attendance_db (Student_Fullname, Student_RegNo, Student_Fingerprint_RTB) VALUES ( '" + txtFullname.Text + "', '" + txtRegNo.Text + "', @imgs)";



                cmd = new SqlCommand(query, sqlcon);
                cmd.Parameters.Add(new SqlParameter("@imgs", imgs));

                cmd2 = new SqlCommand(query2, sqlcon);
                //cmd.Parameters.Add(new SqlParameter("@images", images));
                cmd2.Parameters.Add(new SqlParameter("@imgs", imgs));
                int N = cmd.ExecuteNonQuery();
                int M = cmd2.ExecuteNonQuery();

                sqlcon.Close();
                MessageBox.Show("Student Succesfully Registered");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                MessageBox.Show("Student already registered!");
            }
        }
        private void OnTemplate(DPFP.Template template)
        {
            Template = template;
            if (Template != null)
            {
                MemoryStream fingerprintData = new MemoryStream();
                Template.Serialize(fingerprintData);
                fingerprintData.Position = 0;
                BinaryReader br    = new BinaryReader(fingerprintData);
                Byte[]       bytes = br.ReadBytes((Int32)fingerprintData.Length);

                Biometric.FingerID            = Guid.NewGuid();
                Biometric.FingerPrintTemplate = bytes;

                Stop();
            }
            else
            {
                //Faile case, repeat.
            }
        }
Exemple #6
0
        private void OnTemplateCollect(DPFP.Template template)
        {
            this.Invoke(new Function(delegate()
            {
                try
                {
                    Template = template;

                    MemoryStream ms = new MemoryStream();
                    byte[] imgs     = template.Bytes;
                    Template.Serialize(ms);
                    this.imgs = ms.ToArray();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                    MessageBox.Show("The fingerprint template is not valid. Repeat fingerprint enrollment!");
                }
            }
                                     ));
        }
Exemple #7
0
        protected void OnTemplate(DPFP.Template template)
        {
            this.Invoke(new Function(delegate()
            {
                Template = template;
                //VerifyButton.Enabled = SaveButton.Enabled = (Template != null);
                if (Template != null)
                {
                    MessageBox.Show("Huellas registradas.", "Sporting Gym");

                    byte[] bytes = new byte[1632];
                    Template.Serialize(ref bytes);

                    //int valor = Convert.ToInt32(Clientes_comboBox.SelectedValue);

                    if (persona == true)
                    {
                        var huellas = (from x in contexto.Catalogo_Clientes where x.id_cliente == id_cliente select x).Single();

                        huellas.huella = bytes;
                        contexto.SaveChanges();
                    }
                    else if (persona == false)
                    {
                        var huellas = (from x in contexto.Catalogo_Instructores where x.id_instructor == id_cliente select x).Single();

                        huellas.huella = bytes;
                        contexto.SaveChanges();
                    }

                    contexto.sp_Actualizar_Huella(id_cliente, bytes, persona);

                    this.Close();
                }
                else
                {
                    MessageBox.Show("The fingerprint template is not valid. Repeat fingerprint enrollment.", "Fingerprint Enrollment");
                }
            }));
        }