コード例 #1
0
        public string Identificar(string Digital)
        {
            NBioAPI m_NBioAPI = new NBioAPI();

            NBioAPI.Type.FIR_TEXTENCODE m_textFIR = new NBioAPI.Type.FIR_TEXTENCODE();
            //NBioAPI.Type.HFIR NewFIR;
            NBioAPI.IndexSearch           m_IndexSearch = new NBioAPI.IndexSearch(m_NBioAPI);
            NBioAPI.Type.HFIR             hCapturedFIR;
            NBioAPI.IndexSearch.FP_INFO[] fpInfo;


            NBioAPI.Type.WINDOW_OPTION m_WinOption = new NBioAPI.Type.WINDOW_OPTION();
            m_WinOption.WindowStyle = (uint)NBioAPI.Type.WINDOW_STYLE.NO_WELCOME;

            uint ID = 1;

            m_textFIR.TextFIR = Digital;
            m_IndexSearch.AddFIR(m_textFIR, ID, out fpInfo);

            uint dataCount;

            m_IndexSearch.GetDataCount(out dataCount);

            m_NBioAPI.OpenDevice(NBioAPI.Type.DEVICE_ID.AUTO);
            uint ret = m_NBioAPI.Capture(out hCapturedFIR);

            if (ret != NBioAPI.Error.NONE)
            {
                //DisplayErrorMsg(ret);
                m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);
                m_NBioAPI.GetTextFIRFromHandle(hCapturedFIR, out m_textFIR, true);
            }

            m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);


            NBioAPI.IndexSearch.FP_INFO         fpInfo2;
            NBioAPI.IndexSearch.CALLBACK_INFO_0 cbInfo0 = new NBioAPI.IndexSearch.CALLBACK_INFO_0();
            cbInfo0.CallBackFunction = new NBioAPI.IndexSearch.INDEXSEARCH_CALLBACK(myCallback);

            // Identify FIR to IndexSearch DB
            ret = m_IndexSearch.IdentifyData(hCapturedFIR, NBioAPI.Type.FIR_SECURITY_LEVEL.NORMAL, out fpInfo2, cbInfo0);
            if (ret != NBioAPI.Error.NONE)
            {
                //DisplayErrorMsg(ret);
                //return fpInfo2.ID.ToString();
                return(m_textFIR.TextFIR);
            }

            return("");
        }
コード例 #2
0
        private void btnIdentify_Click(object sender, System.EventArgs e)
        {
            NBioAPI.Type.HFIR hCapturedFIR;

            listResult.Items.Clear();

            // Get FIR data
            m_NBioAPI.OpenDevice(NBioAPI.Type.DEVICE_ID.AUTO);
            uint ret = m_NBioAPI.Capture(out hCapturedFIR);

            if (ret != NBioAPI.Error.NONE)
            {
                DisplayErrorMsg(ret);
                m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);
                return;
            }

            m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);


            uint nMax;

            m_IndexSearch.GetDataCount(out nMax);
            progressIdentify.Minimum = 0;
            progressIdentify.Maximum = Convert.ToInt32(nMax);

            NBioAPI.IndexSearch.CALLBACK_INFO_0 cbInfo0 = new NBioAPI.IndexSearch.CALLBACK_INFO_0();
            cbInfo0.CallBackFunction = new NBioAPI.IndexSearch.INDEXSEARCH_CALLBACK(myCallback);

            // Identify FIR to IndexSearch DB
            NBioAPI.IndexSearch.FP_INFO fpInfo;
            ret = m_IndexSearch.IdentifyData(hCapturedFIR, NBioAPI.Type.FIR_SECURITY_LEVEL.NORMAL, out fpInfo, cbInfo0);
            if (ret != NBioAPI.Error.NONE)
            {
                DisplayErrorMsg(ret);
                return;
            }

            // Add item to list of result
            ListViewItem listItem = new ListViewItem();

            listItem.Text = fpInfo.ID.ToString();
            listItem.SubItems.Add(fpInfo.FingerID.ToString());
            listItem.SubItems.Add(fpInfo.SampleNumber.ToString());
            listResult.Items.Add(listItem);
        }
コード例 #3
0
    public void Identify_user()
    {
        NBioAPI.Type.HFIR hCapturedFIR;
        // Get FIR data
        m_NBioAPI.OpenDevice(NBioAPI.Type.DEVICE_ID.AUTO);
        uint ret = m_NBioAPI.Capture(out hCapturedFIR);

        if (ret != NBioAPI.Error.NONE)
        {
            Response.Write("" + ret);
            m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);
            return;
        }

        m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);


        uint nMax;

        m_IndexSearch.GetDataCount(out nMax);


        NBioAPI.IndexSearch.CALLBACK_INFO_0 cbInfo0 = new NBioAPI.IndexSearch.CALLBACK_INFO_0();
        cbInfo0.CallBackFunction = new NBioAPI.IndexSearch.INDEXSEARCH_CALLBACK(myCallback);

        // Identify FIR to IndexSearch DB
        NBioAPI.IndexSearch.FP_INFO fpInfo;
        ret = m_IndexSearch.IdentifyData(hCapturedFIR, NBioAPI.Type.FIR_SECURITY_LEVEL.NORMAL, out fpInfo, cbInfo0);
        if (ret != NBioAPI.Error.NONE)
        {
            //Response.Write("" + ret);
            lbldest.Text = "The FingerPrint does not match!!";
            return;
        }

        // Add item to list of result
        String    sell = "select * from tbl_userreg where user_username='******'";
        DataTable dt2  = obj.GetDataTable(sell);



        string selq = " select * from tbl_aadhar where userdb_aadharno='" + dt2.Rows[0]["user_aadharno"] + "' ";

        DataTable dtt1  = obj.GetDataTable(selq);
        string    selID = "select max(punch_id) as pid from tbl_punch where punch_aadharno='" + dt2.Rows[0]["user_aadharno"] + "'";
        DataTable dt1   = obj.GetDataTable(selID);
        string    selI  = "select * from tbl_punch where punch_id='" + dt1.Rows[0]["pid"] + "'";
        DataTable dt11  = obj.GetDataTable(selI);

        Session["valid"]    = Convert.ToInt32(dt1.Rows[0]["pid"]);
        Session["aadharno"] = Convert.ToInt32(dtt1.Rows[0]["userdb_aadharno"]);
        String up = "update tbl_punch set punch_dname='" + drpdest.SelectedValue + "' where punch_id='" + Session["valid"] + "'";

        obj.ExecuteCommand(up);

        String    se = "select * from tbl_station where station_no='" + drpdest.SelectedValue + "'";
        DataTable st = obj.GetDataTable(se);

        String    see = "select * from tbl_station where station_no='" + dt11.Rows[0]["punch_sname"] + "'";
        DataTable stt = obj.GetDataTable(see);
        String    sel = "select * from tbl_route where route_from='" + stt.Rows[0]["station_name"] + "' and route_to='" + st.Rows[0]["station_name"] + "'";
        DataTable dt  = obj.GetDataTable(sel);
        Double    r   = Convert.ToDouble(dt.Rows[0]["route_distance"]);

        String    sele = "select * from tbl_rate where distance=" + dt.Rows[0]["route_distance"] + "";
        DataTable dtt  = obj.GetDataTable(sele);
        Double    amt  = Convert.ToInt32(dtt.Rows[0]["rate"]) * Convert.ToInt32(dt11.Rows[0]["punch_tickets"]);

        String    ss  = "select * from tbl_vallet where useradhar_no='" + Session["aadharno"] + "'";
        DataTable val = obj.GetDataTable(ss);
        double    rr  = Convert.ToInt32(val.Rows[0]["val_amount"]);

        rr = rr - amt;

        String upp = "update tbl_punch set punch_dist='" + dt.Rows[0]["route_distance"] + "',punch_amt='" + amt + "' where punch_aadharno='" + Session["aadharno"] + "' and punch_id='" + Session["valid"] + "'";

        obj.ExecuteCommand(upp);
        string    selI2 = "select train_vcapacity from tbl_train where train_id='" + dt11.Rows[0]["punch_trainid"] + "'";
        DataTable dt112 = obj.GetDataTable(selI2);
        Double    a2    = Convert.ToInt32(dt112.Rows[0]["train_vcapacity"]) + Convert.ToInt32(dt11.Rows[0]["punch_tickets"]);
        String    sep   = "update tbl_train set train_vcapacity='" + a2 + "' where train_id='" + dt11.Rows[0]["punch_trainid"] + "'";

        obj.ExecuteCommand(sep);


        if (rr > 0)
        {
            String str = "update tbl_vallet set val_amount='" + rr + "' where useradhar_no='" + Session["aadharno"] + "'";
            obj.ExecuteCommand(str);
            Mail();

            Response.Redirect("thanks.aspx");
            //Response.Write("success");
        }
        else
        {
            Response.Write("<script>alert('Insufficient Balance')</script>");
        }
    }
コード例 #4
0
    public void Identify_user()
    {
        NBioAPI.Type.HFIR hCapturedFIR;
        // Get FIR data
        m_NBioAPI.OpenDevice(NBioAPI.Type.DEVICE_ID.AUTO);
        uint ret = m_NBioAPI.Capture(out hCapturedFIR);

        if (ret != NBioAPI.Error.NONE)
        {
            Response.Write("" + ret);
            m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);
            return;
        }

        m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);


        uint nMax;

        m_IndexSearch.GetDataCount(out nMax);


        NBioAPI.IndexSearch.CALLBACK_INFO_0 cbInfo0 = new NBioAPI.IndexSearch.CALLBACK_INFO_0();
        cbInfo0.CallBackFunction = new NBioAPI.IndexSearch.INDEXSEARCH_CALLBACK(myCallback);

        // Identify FIR to IndexSearch DB
        NBioAPI.IndexSearch.FP_INFO fpInfo;
        ret = m_IndexSearch.IdentifyData(hCapturedFIR, NBioAPI.Type.FIR_SECURITY_LEVEL.NORMAL, out fpInfo, cbInfo0);
        if (ret != NBioAPI.Error.NONE)
        {
            //Response.Write("" + ret);
            lblsource.Text = "The FingerPrint does not match!!";
            return;
        }

        // Add item to list of result

        String ins = "insert into tbl_punch(punch_trainid,punch_sname,punch_dname,punch_aadharno,punch_dist,punch_tickets,punch_amt,punch_date)values('" + drptrain.SelectedValue + "','" + drpsource.SelectedValue + "','0','" + Session["aadharno"] + "','0','" + txttickets.Text + "','0','" + DateTime.Now.ToShortDateString() + "')";

        obj.ExecuteCommand(ins);
        string    selID = "select max(punch_id) as pid from tbl_punch where punch_aadharno='" + Session["aadharno"] + "'";
        DataTable dt1   = obj.GetDataTable(selID);
        string    sel   = "select * from tbl_punch where punch_aadharno='" + Session["aadharno"] + "' and punch_id='" + dt1.Rows[0]["pid"] + "'";
        DataTable dt    = obj.GetDataTable(sel);
        string    selI  = "select train_vcapacity from tbl_train where train_id='" + dt.Rows[0]["punch_trainid"] + "'";
        DataTable dt11  = obj.GetDataTable(selI);

        if (Convert.ToInt32(dt11.Rows[0]["train_vcapacity"]) > 0)
        {
            Double a  = Convert.ToInt32(dt11.Rows[0]["train_vcapacity"]) - Convert.ToInt32(dt.Rows[0]["punch_tickets"]);
            String se = "update tbl_train set train_vcapacity='" + a + "' where train_id='" + dt.Rows[0]["punch_trainid"] + "'";
            obj.ExecuteCommand(se);
            Session["valid"]  = Convert.ToInt32(dt1.Rows[0]["pid"]);
            Session["source"] = drpsource.SelectedValue;
            Response.Write("success");
            //Label1.Text = Convert.ToString(Session["source"]);
            Response.Redirect("welcome.aspx");
        }
        else
        {
            Response.Write("<script>alert('Insufficient Seats')</script>");
        }
    }
コード例 #5
0
        private void btnIdentify_Click(object sender, System.EventArgs e)
        {
            NBioAPI.Type.HFIR hCapturedFIR;

            // Get FIR data
            m_NBioAPI.OpenDevice(NBioAPI.Type.DEVICE_ID.AUTO);
            uint ret = m_NBioAPI.Capture(out hCapturedFIR);

            if (ret != NBioAPI.Error.NONE)
            {
                DisplayErrorMsg(ret);
                m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);
                return;
            }

            m_NBioAPI.CloseDevice(NBioAPI.Type.DEVICE_ID.AUTO);


            uint nMax;

            m_IndexSearch.GetDataCount(out nMax);

            NBioAPI.IndexSearch.CALLBACK_INFO_0 cbInfo0 = new NBioAPI.IndexSearch.CALLBACK_INFO_0();
            // Identify FIR to IndexSearch DB
            NBioAPI.IndexSearch.FP_INFO fpInfo;
            ret = m_IndexSearch.IdentifyData(hCapturedFIR, NBioAPI.Type.FIR_SECURITY_LEVEL.NORMAL, out fpInfo, cbInfo0);
            if (ret != NBioAPI.Error.NONE)
            {
                DialogResult confirm = MessageBox.Show("Digital não encontrada, tente novamente!",
                                                       "Usuário não identificado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
                                                       MessageBoxDefaultButton.Button2);
                if (confirm.ToString().ToUpper() == "OK")
                {
                    btnIdentify_Click(sender, e);
                }

                //DisplayErrorMsg(ret);
                return;
            }

            //instância da conexão
            string          config  = "server=localhost; database=lanche;  userid=root; password=vertrigo;";
            MySqlConnection conexao = new MySqlConnection(config);
            string          query   = "SELECT apelido FROM users where id =" + fpInfo.ID;
            //instância do comando onde passo
            //a query e a conexão
            MySqlCommand cmd = new MySqlCommand(query, conexao);

            //Abro conexão
            conexao.Open();
            //instância do leitor que recebe
            //o comando
            MySqlDataReader leitor = cmd.ExecuteReader();

            leitor.Read();
            //atribuo os valores do bd
            // Add item to list of result
            ListViewItem listItem = new ListViewItem();

            listItem.Text = fpInfo.ID.ToString();
            listItem.SubItems.Add(fpInfo.FingerID.ToString());
            listItem.SubItems.Add(leitor["apelido"].ToString());
            listResult.Items.Add(listItem);

            ////fecho conexão
            conexao.Close();
            Form2 newForm2 = new Form2(fpInfo.ID.ToString());

            newForm2.ShowDialog();

            btnIdentify_Click(sender, e);
        }