Esempio n. 1
0
        //
        private void ZKFPEngX1_OnEnroll(object sender, AxZKFPEngXControl.IZKFPEngXEvents_OnEnrollEvent e)
        {
            if (e.actionResult)
            {
                try
                {
                    e.aTemplate = ZKFPEngX1.GetTemplate();
                    if (lblMessage.Text == "To Confirm Again Put finger on the Device")
                    {
                        if (ZKFPEngX1.VerFinger(ref e.aTemplate, oldEmptemplate, true, ref step2))
                        {
                            fpstatus = true;

                            this.Close();
                            return;
                        }
                        else
                        {
                            fpstatus = false;
                            MessageBox.Show("Fingerprint Not Matched ", "", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                            this.Close();
                            return;
                        }
                        //Emptemplate = (byte[])e.aTemplate;
                        ZKFPEngX1.EndEngine();
                        MessageBox.Show("Fingerprint Added Successfully ");
                        this.Close();
                    }

                    else
                    {
                        string        database = "Database=SIVASHAKTHI;Server=202.63.115.34\\SBPL;User ID=sbpl;Password=sbpl123";
                        SqlConnection con      = new SqlConnection(database);
                        con.Open();
                        string Query = "";
                        Query = "select HAFP_FINGER_FP1,HAFP_FINGER_FP4 from HR_APPL_FINGER_PRINTS ";

                        //SqlCommand cmd = new SqlCommand(Query, con);

                        SqlCommand cmd = new SqlCommand();
                        cmd.Connection  = con;
                        cmd.CommandText = "GetEmpFingerPrintsFromBranch";
                        cmd.CommandType = CommandType.StoredProcedure;
                        SqlParameter param = new SqlParameter();

                        param.ParameterName = "@xBranchCode";
                        param.DbType        = DbType.String;
                        param.Value         = Branch;
                        param.Direction     = ParameterDirection.Input;
                        cmd.Parameters.Add(param);

                        SqlDataAdapter da = new SqlDataAdapter(cmd);
                        DataSet        ds = new DataSet();
                        da.Fill(ds);
                        //DataSet ds = null;

                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            DataTable dt = ds.Tables[0];
                            foreach (DataRow row in dt.Rows)
                            {
                                byte[] fptemp2 = (byte[])row["HAFP_FINGER_FP1"];


                                if (ZKFPEngX1.VerFinger(ref e.aTemplate, fptemp2, true, ref step2))
                                {
                                    fpstatus = true;
                                    // sEcode  = (int)row["ECODE"];
                                    sEcode = Convert.ToInt32(row["ECODE"].ToString());
                                    this.Close();
                                    return;
                                }
                                else
                                {
                                    fpstatus = false;
                                    sEcode   = Convert.ToInt32(row["ECODE"].ToString());
                                    this.Close();
                                }

                                if (!DBNull.Value.Equals(row["HAFP_FINGER_FP4"]))
                                {
                                    fptemp2 = (byte[])row["HAFP_FINGER_FP4"];


                                    if (ZKFPEngX1.VerFinger(ref e.aTemplate, fptemp2, true, ref step2))
                                    {
                                        fpstatus = true;
                                        //sEcode = (int)row["ECODE"];
                                        sEcode = Convert.ToInt32(row["ECODE"].ToString());
                                        this.Close();
                                        return;
                                    }
                                    else
                                    {
                                        fpstatus = false;
                                        //sEcode = (int)row["ECODE"];
                                        sEcode = Convert.ToInt32(row["ECODE"].ToString());
                                        this.Close();
                                    }
                                }
                            }
                        }
                        Emptemplate = (byte[])e.aTemplate;
                        ZKFPEngX1.EndEngine();


                        //MessageBox.Show("Updated");
                        //PictureBox1.Image = null;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    PictureBox1.Image = null;
                }
            }
            else
            {
                //ShowHintInfo("Fingerprint register failed");
                MessageBox.Show("Fingerprint register failed ", "提示! ", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
                this.Close();
            }
        }
Esempio n. 2
0
 //断开
 private void button1_Click(object sender, EventArgs e)
 {
     ZKFPEngX1.EndEngine();
     btnInit.Enabled = true;
     button1.Enabled = false;
 }
Esempio n. 3
0
        //
        private void ZKFPEngX1_OnEnroll(object sender, AxZKFPEngXControl.IZKFPEngXEvents_OnEnrollEvent e)
        {
            if (e.actionResult)
            {
                try
                {
                    e.aTemplate = ZKFPEngX1.GetTemplate();

                    //string database = "Database=SIVASHAKTHI;Server=202.63.115.34\\SBPL;User ID=sbpl;Password=sbpl123";
                    //SqlConnection con = new SqlConnection(database);
                    //con.Open();
                    //string Query = "";
                    //Query = "select HAFP_FINGER_FP1,HAFP_FINGER_FP4 from HR_APPL_FINGER_PRINTS  where HAFP_APPL_NUMBER='" + emp_appl_number + "' ";
                    //SqlCommand cmd = new SqlCommand(Query, con);
                    //SqlDataAdapter da = new SqlDataAdapter(cmd);
                    //DataSet ds = new DataSet();
                    //da.Fill(ds);
                    //if (ds.Tables[0].Rows.Count > 0)
                    if (dtVerif.Rows.Count > 0)
                    {
                        try
                        {
                            //DataTable dt = ds.Tables[0];
                            DataTable dt = dtVerif;
                            foreach (DataRow row in dt.Rows)
                            {
                                byte[] fptemp2 = (byte[])row["HAFP_FINGER_FP1"];


                                if (ZKFPEngX1.VerFinger(ref e.aTemplate, fptemp2, true, ref step2))
                                {
                                    fpstatus = true;

                                    this.Close();
                                    return;
                                }
                                else
                                {
                                    fpstatus = false;

                                    this.Close();
                                }


                                if (!DBNull.Value.Equals(row["HAFP_FINGER_FP4"]))
                                {
                                    fptemp2 = (byte[])row["HAFP_FINGER_FP4"];


                                    if (ZKFPEngX1.VerFinger(ref e.aTemplate, fptemp2, true, ref step2))
                                    {
                                        fpstatus = true;
                                        this.Close();
                                        return;
                                    }
                                    else
                                    {
                                        fpstatus = false;

                                        this.Close();
                                    }
                                }
                            }
                            ZKFPEngX1.EndEngine();
                        }
                        catch (Exception EX)
                        {
                            MessageBox.Show(EX.Message);
                            PictureBox1.Image = null;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                //ShowHintInfo("Fingerprint register failed");
                MessageBox.Show("Fingerprint register failed ", "提示! ", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);
            }
        }