public void InitializeGrFinger(AxGrFingerXLib.AxGrFingerXCtrl grfingerxFormAuth)
        {
            grfingerx = grfingerxFormAuth;
            grfingerx.Initialize();
            grfingerx.CapInitialize();

            template = new TTemplate();
        }
 public FingerprintOPFormUserMgt(AxGrFingerXLib.AxGrFingerXCtrl grfingerxFormAuth, EnrollFingerprints f, TextBox txtLog, string personId)
 {
     grfingerx      = grfingerxFormAuth;
     this.txtLog    = txtLog;
     this.personId  = personId;
     template1      = new TTemplate();
     template2      = new TTemplate();
     template3      = new TTemplate();
     templateSearch = new TTemplate();
     frm            = f;
     connection     = DBHelper.GetConnection();
 }
        public bool authenticate(System.Byte[] temp1, System.Byte[] temp2, System.Byte[] temp3)
        {
            //instantiating the new templates
            TTemplate t1 = new TTemplate();
            TTemplate t2 = new TTemplate();
            TTemplate t3 = new TTemplate();

            int score = 0;
            int result;


            System.Byte[] temp = temp1;
            System.Array.Copy(temp, 0, t1.tpt, 0, temp.Length);
            t1.size = temp.Length;

            temp = temp2;
            System.Array.Copy(temp, 0, t2.tpt, 0, temp.Length);
            t2.size = temp.Length;

            temp = temp3;
            System.Array.Copy(temp, 0, t3.tpt, 0, temp.Length);
            t3.size = temp.Length;

            //now we try to match with at least one of the user's fingerprint
            result = (int)grfingerx.Verify(ref t1.tpt, ref template.tpt,
                                           ref score, (int)GRConstants.GR_DEFAULT_CONTEXT);

            if ((GRConstants)result == GRConstants.GR_MATCH)
            {
                return(true);
            }

            result = (int)grfingerx.Verify(ref t2.tpt, ref template.tpt,
                                           ref score, (int)GRConstants.GR_DEFAULT_CONTEXT);

            if ((GRConstants)result == GRConstants.GR_MATCH)
            {
                return(true);
            }

            result = (int)grfingerx.Verify(ref t3.tpt, ref template.tpt,
                                           ref score, (int)GRConstants.GR_DEFAULT_CONTEXT);

            if ((GRConstants)result == GRConstants.GR_MATCH)
            {
                return(true);
            }

            return(false);
        }
        private void insert()
        {
            switch (templateCounter)
            {
            case 0:
                template1 = extractTemplate(template1);
                txtLog.AppendText("   Template 1 Extracted \r\n");
                break;

            case 1:
                template2 = extractTemplate(template2);
                txtLog.AppendText("   Template 2 Extracted\r\n");
                break;

            case 2:
                template3 = extractTemplate(template3);
                txtLog.AppendText("   Template 3 Extracted\r\n");
                break;
            }

            templateCounter++;

            if (templateCounter == 3)
            {
                templateCounter = 0;
                function        = -1;

                System.Byte[] temp1 = new System.Byte[template1.size + 1];
                System.Byte[] temp2 = new System.Byte[template1.size + 1];
                System.Byte[] temp3 = new System.Byte[template1.size + 1];

                System.Byte[] temp = new System.Byte[template1.size + 1];
                System.Array.Copy(template1.tpt, 0, temp, 0, template1.size);
                temp1 = temp;

                temp = new System.Byte[template2.size + 1];
                System.Array.Copy(template2.tpt, 0, temp, 0, template2.size);
                temp2 = temp;

                temp = new System.Byte[template3.size + 1];
                System.Array.Copy(template3.tpt, 0, temp, 0, template3.size);
                temp3 = temp;

                saveTemplates(temp1, temp2, temp3);
                frm.Close();
            }
        }
        private TTemplate extractTemplate(TTemplate template)
        {
            int result;

            template.size = (int)GRConstants.GR_MAX_SIZE_TEMPLATE;
            result        = grfingerx.Extract(ref rawImage.img, rawImage.width, rawImage.height,
                                              rawImage.Res, ref template.tpt, ref template.size,
                                              (int)GRConstants.GR_DEFAULT_CONTEXT);

            if (result < 0)
            {
                template.size = 0;
                template      = null;
            }

            return(template);
        }