private void modStdSaveBtn_Click(object sender, EventArgs e)
        {
            //Guardian gur = new Guardian();
            guardian.Name = newStdGuarName.Text;
            guardian.CNIC = newStdGuarCnic.Text;
            guardian.Relation = newStdGuarRel.Text;
            guardian.Gender = newStdGuardianGen.SelectedText;
            guardian.GuardianNo = newStdGurNo.Text;
            guardian.Email = newStdGuardEmailTxt.Text;
            guardian.Address = newStdGuardAddressTxt.Text;

            this.type = "Guardian";

            EnrollmentForm enrollForm = new EnrollmentForm(this);
            enrollForm.ShowDialog();

            Guardian addedGuardian = new GuardianDAC().AddGuardian(guardian);
            if (addedGuardian.Id != 0)
            {
                StudentGardians studentGuardian = new StudentGardians() { GuardianId = addedGuardian.Id, StudentId = addStudentForm.student.Id };
                new StudentGuardianDAC().AddStudentGuardian(studentGuardian);
                addedGuardian.FingerCode = new byte[0];
                addStudentForm.guardians.Add(addedGuardian);
                MessageBox.Show("Guardian is added");
                
            }
            else
            {
                MessageBox.Show("Please Enter Correct Information");
            }

            this.Close();

        }
        private void newStdGuardSearchBtn_Click(object sender, EventArgs e)
        {
            Guardian guardian = new GuardianDAC().SelectGuardianByCNIC(newStdGuarSeachCNIC.Text);

            if (guardian != null)
            {
                newStdGuarName.Text = guardian.Name;
                newStdGuarCnic.Text = guardian.CNIC;
                newStdGuarRel.Text = guardian.Relation;
                newStdGurNo.Text = guardian.GuardianNo;
                newStdGuardEmailTxt.Text = guardian.Email;
                newStdGuardAddressTxt.Text = guardian.Address;
            }
        }
        private void newStdGuardUpdateBtn_Click(object sender, EventArgs e)
        {
            Guardian guardian = new GuardianDAC().SelectGuardianByCNIC(newStdGuarSeachCNIC.Text);

            //guardian.Name = newStdGuarName.Text;
            //guardian.Relation = newStdGuarRel.Text;
            //guardian.Gender = newStdGuardianGen.SelectedText;
            //guardian.GuardianNo = newStdGurNo.Text;
            //guardian.Email = newStdGuardEmailTxt.Text;
            //guardian.Address = newStdGuardAddressTxt.Text;

            StudentGardians studentGuardian = new StudentGardians() { GuardianId = guardian.Id, StudentId = addStudentForm.student.Id };
            new StudentGuardianDAC().AddStudentGuardian(studentGuardian);
            addStudentForm.guardians.Add(guardian);
            MessageBox.Show("Guardian is added");
            this.Close();
        }
        public void OnComplete(object Control, DPFP.FeatureSet FeatureSet, ref DPFP.Gui.EventHandlerStatus Status)
        {
            DPFP.Verification.Verification ver = new DPFP.Verification.Verification();
            DPFP.Verification.Verification.Result res = new DPFP.Verification.Verification.Result();

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

            //SqlConnection con = new SqlConnection(conStr);
            //SqlCommand cmd = new SqlCommand("Select FingerPrintData from FingerPrints where Id = 11", con);

            //con.Open();

            //byte[] userFingerPrintData = new byte[0];

            //using (con)
            //{
            //    userFingerPrintData = cmd.ExecuteScalar() as byte[];
            //}

            //byte[] fingerPrintCode = new StudentDAC().GetFingerCodeById(2);

            List<Guardian> guardians = new GuardianDAC().SelectAllGuardians();
           
            if (guardians != null && guardians.Count > 0)
            {
                foreach (var item in guardians)
                {
                    ver = new DPFP.Verification.Verification();
                    res = new DPFP.Verification.Verification.Result();
                    DPFP.Template temp = new DPFP.Template();

                    if (item.FingerCode != null)
                    {
                        temp.DeSerialize(item.FingerCode);

                        if (temp != null)
                        {
                            // Compare feature set with particular template.

                            ver.Verify(FeatureSet, temp, ref res);

                            if (res.Verified)
                            {
                                guardiansTakeAwayForm.guardian = item;

                                this.Close();
                                break;
                            }
                        }
                    }
                    
                }
            }

            
            
            if (!res.Verified)
                Status = DPFP.Gui.EventHandlerStatus.Failure;

        }