Esempio n. 1
0
        //加载本地指纹库到内存中
        private int LocalDbToMemory()
        {
            string          _sql   = "select * from template where 1=1";
            OleDbDataReader reader = ldb.ReadList(_sql);

            while (reader.Read())
            {
                //判断template_9,base64字符串是否为空,如果为空就跳过
                if (reader[4] is DBNull)
                {
                    continue;
                }
                string t0 = reader[0].ToString(); //1305531011,1508335369,autoid
                string t1 = reader[1].ToString(); //122 ,userid //登记的ID
                string t2 = reader[2].ToString(); //6 ,fingerindex,哪根手指
                string t3 = reader[3].ToString(); //空 template_10,算法10得到的指纹图片
                string t4 = reader[4].ToString(); //base64字符串  template_9 算法9得到的指纹图片

                //转换成可读
                int    autoid = (int)reader[0];
                byte[] tmp    = Convert.FromBase64String(t4);
                //axZKFPEngX1.AddRegTemplateToFPCacheDB(fpcHandle, autoid, tmp);
                zkfp2.DBAdd(mDBHandle, autoid, tmp);//将本地数据库的指纹,添加进内存中识别
                cbRegTmp++;
                //MessageBox.Show(t0 + "," + t1 + "," + t2 + "," + t3 + "," + t4 + "," + tmp, "提示");
            }

            ldb.Close();

            return(cbRegTmp);
        }
Esempio n. 2
0
        private void GetList()
        {
            //构建表头
            this.listView1.Clear();
            this.listView1.Columns.Add("指纹编号", 120, HorizontalAlignment.Left);
            this.listView1.Columns.Add("用户编号", 100, HorizontalAlignment.Left);
            this.listView1.Columns.Add("真实姓名", 100, HorizontalAlignment.Left);
            this.listView1.Columns.Add("手指编号", 100, HorizontalAlignment.Left);
            this.listView1.Columns.Add("template_10", 80, HorizontalAlignment.Left);
            this.listView1.Columns.Add("template_9", 80, HorizontalAlignment.Left);

            /*
             * // The View property must be set to Details for the
             * // subitems to be visible.
             * myListView.View = View.Details;
             * 加了下面这句,才能够看到
             */
            this.listView1.View = System.Windows.Forms.View.Details; //SmallIcon

            this.listView1.LabelEdit     = true;                     //允许用户编辑文本项。
            this.listView1.GridLines     = true;                     //显示行列的网格线。
            this.listView1.FullRowSelect = true;                     //选择一整行,请将ListView 的 FullRowSelect 属性设置为true

            string          _sql   = "select * from template where 1=1";
            OleDbDataReader reader = ldb.ReadList(_sql);


            //解析出图片,存入ImageList中
            //ImageList imageListSmall = new ImageList();   //产生图像对象
            //imageListSmall.ImageSize = new Size(200, 200);
            //imageListSmall.Images.Clear();


            int i = 0;

            while (reader.Read())
            {
                //判断template_9,base64字符串是否为空,如果为空就跳过
                if (reader[4] is DBNull)
                {
                    continue;
                }
                string t0 = reader[0].ToString(); //1305531011,1508335369,autoid
                string t1 = reader[1].ToString(); //122 ,userid //登记的ID,reader["code"].ToString();
                string t2 = reader[2].ToString(); //6 ,fingerindex,哪根手指
                string t3 = reader[3].ToString(); //空 template_10,算法10得到的指纹图片
                string t4 = reader[4].ToString(); //base64字符串  template_9 算法9得到的指纹图片
                string t5 = reader[5].ToString(); //真实姓名
                //转换成可读
                int autoid = (int)reader[0];



                switch (t2.Trim())
                {
                case "0": t2 = "左手小拇指"; break;

                case "1": t2 = "左手无名指"; break;

                case "2": t2 = "左手中指"; break;

                case "3": t2 = "左手食指"; break;

                case "4": t2 = "左手大拇指"; break;

                case "5": t2 = "右手大拇指"; break;

                case "6": t2 = "右手食指"; break;

                case "7": t2 = "右手中指"; break;

                case "8": t2 = "右手无名指"; break;

                case "9": t2 = "右手小拇指"; break;

                default: t2 = "左手小拇指"; break;
                }



                //listView中的ImageList追加成图片

                /*byte[] tmp = Convert.FromBase64String(t4);
                 * //byte[] tmp = zkfp2.Base64ToBlob(t4);
                 * MemoryStream ms = new MemoryStream();
                 * BitmapFormat.GetBitmap(tmp, 100, 100, ref ms);
                 * Bitmap bmp = new Bitmap(ms);
                 * this.imageList1.Images.Add(bmp);*/



                //构建一个ListView的数据,存入数据库数据,以便添加到listView1的行数据中
                ListViewItem lt = new ListViewItem(); //一行数据
                lt.ImageIndex = 0;                    //0就是imagelist的第一个图片,以此类推
                lt.Text       = t0;
                lt.SubItems.Add(t1);                  //lvi.SubItems.Add("第2列,第"+i+"行");
                lt.SubItems.Add(t5);
                lt.SubItems.Add(t2);
                lt.SubItems.Add(t3);
                lt.SubItems.Add(t4);
                this.listView1.Items.Add(lt);



                i++;
            }

            this.listView1.EndUpdate();  //结束数据处理,UI界面一次性绘制。

            ldb.Close();
        }