// 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

                byte[] FingerPrintData = new byte[0];

                Template.Serialize(ref FingerPrintData);

                string conStr = "Data Source=.; Initial Catalog=Registration; Integrated Security=true";

                SqlConnection con = new SqlConnection(conStr);
                SqlCommand cmd = new SqlCommand("Insert into FingerPrints([FingerPrintData]) values(@fingerData)", con);
                cmd.Parameters.Add("@fingerData", SqlDbType.VarBinary);
                cmd.Parameters["@fingerData"].Value = FingerPrintData;

                con.Open();

                using (con)
                {
                    cmd.ExecuteNonQuery();
                }

                ListEvents.Items.Insert(0, String.Format("OnEnroll: finger {0}", Finger));
      } else
        Status = DPFP.Gui.EventHandlerStatus.Failure;	// force a "failure" status
    }
        // 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

                byte[] FingerPrintData = new byte[0];

                Template.Serialize(ref FingerPrintData);

                //string conStr = "Data Source=.; Initial Catalog=Registration; Integrated Security=true";

                //SqlConnection con = new SqlConnection(conStr);
                //SqlCommand cmd = new SqlCommand("Insert into FingerPrints([FingerPrintData]) values(@fingerData)", con);
                //cmd.Parameters.Add("@fingerData", SqlDbType.VarBinary);
                //cmd.Parameters["@fingerData"].Value = FingerPrintData;

                //con.Open();

                //using (con)
                //{
                //    cmd.ExecuteNonQuery();
                //}

                //bool updateStudent = new StudentDAC().UpdateFingerCode(studentId, FingerPrintData);

                if (type == "Student")
                {
                    addStudentForm.student.FingerCode = FingerPrintData;
                }
                else if (type == "Guardian")
                {
                    addGuardianForm.guardian.FingerCode = FingerPrintData;

                }

                
                this.Close();

                ListEvents.Items.Insert(0, String.Format("OnEnroll: finger {0}", Finger));
            }
            else
                Status = DPFP.Gui.EventHandlerStatus.Failure;   // force a "failure" status
        }
        public override void Process(DPFP.Sample Sample)
        {
            try
            {

                    base.Process(Sample);
                    frmMain _frm = this._ParentForm;
                    byte[] _byte = null;
                    Sample.Serialize(ref _byte);

                    //Wait Start

                    this.Invoke(new Function(delegate()
                    {
                        this.lblPlsWait.Visible = true;
                    }));

                    Profile info = zsi.PhotoFingCapture.Models.DataControllers.dcProfile_SQL.VerifyBiometricsData(GetFingNo(), _byte);

                    //WaitStop
                    this.Invoke(new Function(delegate()
                    {
                        this.lblPlsWait.Visible = false;
                    }));

                    if (info.ProfileId > 0)
                    {
                        ProcessProfile(info);
                    }
                    else
                    {
                        MessageBox.Show("Finger not identified");
                    }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #4
0
        public override void Process(DPFP.Sample Sample)
        {
            try
            {

                    base.Process(Sample);
                    frmMain _frm = this._ParentForm;
                    byte[] _byte = null;
                    Sample.Serialize(ref _byte);

                    //Wait Start

                    this.Invoke(new Function(delegate()
                    {
                        this.lblPlsWait.Visible = true;
                    }));

                    //Profile info = zsi.PhotoFingCapture.Models.DataControllers.dcProfile_SQL.VerifyBiometricsData(0, _byte);
                    //Profile info = zsi.dtrs.Models.DataControllers.dcProfile_SQL.VerifyBiometricsData(_byte);

                    //WaitStop
                    this.Invoke(new Function(delegate()
                    {
                        this.lblPlsWait.Visible = false;
                    }));

                /*
                    if (info.ProfileId > 0)
                    {
                        ProcessProfile(info);
                    }
                    else
                    {
                        this.Invoke(new Function(delegate()
                        {
                            txtName.Text = "Finger not identified";
                            pbProfileImage.Image = zsi.PhotoFingCapture.Util.GetNoPhoto();
                        }));

                    }
                */
                //base.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public void UpdateTemplates(int FingerPosition, DPFP.Template Template)
        {
            this.Templates[FingerPosition] = Template;
            MemoryStream _MemoryStream = new MemoryStream();
            byte[] bTemplate = null;
            if (Template!=null) Template.Serialize(ref bTemplate);
            if (this.ByteTemplate == null) this.ByteTemplate = new ByteTemplate();
            switch (FingerPosition) {
                case 0: this.ByteTemplate.RTF = bTemplate; break;
                case 1: this.ByteTemplate.RIF = bTemplate; break;
                case 2: this.ByteTemplate.RMF = bTemplate; break;
                case 3: this.ByteTemplate.RRF = bTemplate; break;
                case 4: this.ByteTemplate.RSF = bTemplate; break;
                case 5: this.ByteTemplate.LTF = bTemplate; break;
                case 6: this.ByteTemplate.LIF = bTemplate; break;
                case 7: this.ByteTemplate.LMF = bTemplate; break;
                case 8: this.ByteTemplate.LRF = bTemplate; break;
                case 9: this.ByteTemplate.LSF = bTemplate; break;
                default: break;
            }
            this.RecordCount = CountRecord();
            SetTSI(FingerPosition);

            if (DataChanged != null)this.DataChanged();
        }