Exemplo n.º 1
0
        protected override void DefWndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case MESSAGE_CAPTURED_OK:
                MemoryStream ms = new MemoryStream();
                ////BitmapFormat.GetBitmap(FPBuffer, mfpWidth, mfpHeight, ref ms);
                //Bitmap bmp = new Bitmap(ms);
                //this.pic.Image = bmp;
                {
                    bool verify = false;
                    int  ret = zkfp.ZKFP_ERR_OK;
                    int  fid = 0, score = 0;
                    ret = zkfp2.DBIdentify(mDBHandle, CapTmp, ref fid, ref score);
                    if (zkfp.ZKFP_ERR_OK == ret)
                    {
                        label1.Text = "指纹识别成功,匹配度=" + score + "%";

                        BLL.T_Staff t_Staff = new T_Staff();
                        DataTable   user    = t_Staff.GetUserID(fid.ToString());
                        for (int i = 0; i < user.Rows.Count; i++)
                        {
                            string        zIDs = user.Rows[i]["ZhiWenID"].ToString();
                            List <string> list = zIDs.ToString().Split(',').ToList();

                            if (list.Contains(fid.ToString()))
                            {
                                string userId = user.Rows[i]["StaffID"].ToString();
                                verify = t_Staff.GetRoleID(userId);
                            }
                        }

                        if (verify)
                        {
                            DialogResult = DialogResult.OK;
                            CloseDevice();
                            this.Close();
                        }
                        else
                        {
                            label1.Text = "无班长权限,请重新输入!";
                        }

                        //Bll.User.UserID = userId;
                        //zkfp2.Terminate();
                        //cbRegTmp = 0;
                        //if (captureThread != null)
                        //{
                        //    captureThread.Abort();
                        //}


                        //MangJianFrm f = new MangJianFrm();
                        //f.Owner = this;
                        //this.Hide();
                        //f.ShowDialog();
                        //Application.ExitThread();
                    }
                    else
                    {
                        label1.Text = "指纹识别失败,状态码=" + ret;
                        return;
                    }
                }
                break;

            default:
                base.DefWndProc(ref m);
                break;
            }
        }
Exemplo n.º 2
0
        protected override void DefWndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case MESSAGE_CAPTURED_OK:
                MemoryStream ms = new MemoryStream();
                BitmapFormat.GetBitmap(FPBuffer, mfpWidth, mfpHeight, ref ms);
                Bitmap bmp = new Bitmap(ms);
                this.pic.Image = bmp;
                {
                    int ret = zkfp.ZKFP_ERR_OK;
                    int fid = 0, score = 0;
                    ret = zkfp2.DBIdentify(mDBHandle, CapTmp, ref fid, ref score);
                    if (zkfp.ZKFP_ERR_OK == ret)
                    {
                        try
                        {
                            lb_msg.Text = "指纹识别成功,匹配度=" + score + "%";

                            Bll.T_Staff t_Staff = new T_Staff();
                            DataTable   user    = t_Staff.GetUserID(fid.ToString());
                            string      userId  = user.Rows[0]["StaffID"].ToString();
                            Bll.User.UserID = userId;
                            bool result = t_Staff.GetRoleID(userId);
                            //MessageBox.Show(result.ToString());
                            if (result)
                            {
                                this.DialogResult = DialogResult.OK;
                                zkfp2.Terminate();
                                cbRegTmp = 0;
                                if (captureThread != null)
                                {
                                    captureThread.Abort();
                                }
                                this.Close();
                            }
                            else
                            {
                                //MessageBox.Show("请班长输入指纹!");

                                lb_msg.BackColor = Color.Red;
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.ToString());
                        }
                    }
                    else
                    {
                        lb_msg.Text = "指纹识别失败,状态码=" + ret;
                        return;
                    }
                }
                break;

            default:
                base.DefWndProc(ref m);
                break;
            }
        }