Esempio n. 1
0
        public void OnComplete(object Capture, string ReaderSerialNumber, Sample Sample)
        {
            // Draw fingerprint sample image.
            DrawPicture(ConvertSampleToBitmap(Sample));

            DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();
            // Process the sample and create a feature set for the enrollment purpose.
            DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification);

            using (YouthEmpowermentEntities context = new YouthEmpowermentEntities())
            {
                var table = (from a in context.tblPersonalDetails
                             select a).ToList();


                if (features != null)
                {
                    foreach (var row in table)
                    {
                        Template tem = new Template();
                        tem.DeSerialize(row.tblFingerprint.fingerTemplate);

                        if (tem != null)
                        {
                            // Compare feature set with particular template.
                            Verificator.Verify(features, tem, ref res);

                            if (res.Verified)
                            {
                                SetStatus("Verified)");
                                fullNames(row.FirstName + row.LastName);
                                DateOfBirth(row.DOB.Value.ToShortDateString());
                                contactTown(row.tblContact.Town);
                                contactWard(row.tblContact.Ward);
                                contactNumber(row.tblContact.ContactNum1 + ", " + row.tblContact.ContactNum2);
                                contactAddress(row.tblContact.PartyAddress);
                                businessType(row.tblBusiness.BusinessType);
                                BiznessAmount(row.tblBusiness.Amount);
                                pictureBox5.Image = ByteArrayToImage(row.Picture);

                                //using (SaveFileDialog dlg = new SaveFileDialog() { Filter = "JPG |*.jpg", ValidateNames = true })
                                //{
                                //    Zen.Barcode.Code128BarcodeDraw Encorder = Zen.Barcode.BarcodeDrawFactory.Code128WithChecksum;

                                //    pictureBox4.Image = Encorder.Draw(String.Format("Name: {0} Phone Number: {1} ", label61.Text + Environment.NewLine, label53.Text), 250);

                                //}

                                using (SaveFileDialog dlg = new SaveFileDialog()
                                {
                                    Filter = "JPG |*.jpg", ValidateNames = true
                                })
                                {
                                    MessagingToolkit.QRCode.Codec.QRCodeEncoder Encorder = new MessagingToolkit.QRCode.Codec.QRCodeEncoder();
                                    Encorder.QRCodeScale = 4;
                                    Bitmap bitmap = Encorder.Encode(String.Format("Name: {0} ContactNumber {1} ", label61.Text + Environment.NewLine, label53.Text));
                                    pictureBox4.Image = bitmap;
                                }

                                Capturer.StopCapture();
                                break; // success
                            }
                        }

                        if (!res.Verified)
                        {
                            SetStatus("Not Registered !!!");
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        private async void bunifuThinButton26_ClickAsync(object sender, EventArgs e)
        {
            try
            {
                using (YouthEmpowermentEntities context = new YouthEmpowermentEntities())
                {
                    // Set stream for array of bytes
                    MemoryStream ms = new MemoryStream();
                    //save Details and template in the Database
                    context.Database.Connection.Open();

                    byte[]       pic;
                    MemoryStream stream = new MemoryStream();
                    pictureBox1.Image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
                    pic = stream.ToArray();


                    tblFingerprint fingers = new tblFingerprint
                    {
                        fingerTemplate = Data.Datum
                    };


                    tblBusiness bizness = new tblBusiness()
                    {
                        Training         = (checkBoxTraining.Checked == true) ? "Training & Vocational Skills" : "Skills Acquisition Programmes",
                        IntroducedBy     = txtIntroducedBy.Text,
                        BusinessType     = (checkBoxTraining.Checked == true) ? dropBizType1.selectedValue : dropBizType2.selectedValue,
                        Amount           = (checkBoxTraining.Checked == true) ? txtGrant1.Text : txtGrant2.Text,
                        NatureofBusiness = txtNatureBusiness.Text
                    };

                    tblContact contact = new tblContact()
                    {
                        Town         = dropTown.selectedValue,
                        Ward         = txtWard.Text,
                        LGA          = dropLGA.selectedValue,
                        ContactNum1  = txtContact1.Text,
                        ContactNum2  = txtContact2.Text,
                        PartyAddress = txtPartyAddress.Text,
                    };

                    var dat = dateTimePicker1.Value.ToShortDateString();
                    tblPersonalDetail personalDetail = new tblPersonalDetail()
                    {
                        FirstName  = txtFirstName.Text,
                        LastName   = txtLastName.Text,
                        Occupation = txtOccupation.Text,
                        Picture    = pic,

                        ContactID  = contact.ID,
                        BusinessID = bizness.ID,
                        //AccountID = account.ID,
                        FingerID = fingers.ID,

                        DOB = DateTime.ParseExact(dat, "dd/MM/yyyy", null)
                    };

                    context.Configuration.AutoDetectChangesEnabled = true;
                    //context.tblAccounts.Add(account);
                    context.tblBusinesses.Add(bizness);
                    context.tblContacts.Add(contact);
                    context.tblFingerprints.Add(fingers);
                    context.tblPersonalDetails.Add(personalDetail);

                    int x = await context.SaveChangesAsync();

                    if (context.ChangeTracker.HasChanges() || x > 0)
                    {
                        MessageBox.Show("Information saved successfully");
                        //ClearBoxes(); //This clear all controls
                        ResetFingers(); //This will reset fingerMasks
                    }
                }

                tabControl1.SelectedIndex = (tabControl1.SelectedIndex + 1 < tabControl1.TabCount) ?
                                            tabControl1.SelectedIndex + 1 : tabControl1.SelectedIndex;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }