Ejemplo n.º 1
0
 //刷新教室信息
 private void RefreshSite()
 {
     lstSite.Items.Clear();
     if (cboFloor2.SelectedIndex < 0)
     {
         return;
     }
     if (cboFloor2.Text.Equals("全部"))
     {
         DataSet ds = new SqlFile.clsSql().sqlSelect1(sSqlKey, "Site");
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             lstSite.Items.Add(ds.Tables[0].Rows[i][1].ToString() + "                                              @" + ds.Tables[0].Rows[i][0].ToString());
         }
     }
     else
     {
         DataSet ds = new SqlFile.clsSql().sqlSelect3(sSqlKey, "Site", "Floor_ID", cboFloor2.Text);
         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
         {
             lstSite.Items.Add(ds.Tables[0].Rows[i][1].ToString() + "                                              @" + ds.Tables[0].Rows[i][0].ToString());
         }
     }
     lstSite.SelectedIndex = -1;
     txtName4.Text         = "";
     txtRoom4.Text         = "";
     txtRoomC4.Text        = "";
 }
Ejemplo n.º 2
0
        //单击楼层移除按钮
        private void btnFloorDelete_Click(object sender, EventArgs e)
        {
            DataSet ds = new SqlFile.clsSql().sqlSelect3(sSqlKey, "Site", "Floor_ID", numericUpDown1.Value.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                MessageBox.Show("移除失败,请先移除该楼层内教室!");
                return;
            }
            DialogResult dr = MessageBox.Show("是否删除?", "提示", MessageBoxButtons.OKCancel);

            if (dr != DialogResult.OK)
            {
                return;
            }
            if (new SqlFile.clsSql().sql2(sSqlKey, "delete from Floor where Floor_ID='" + numericUpDown1.Value.ToString() + "'"))
            {
                MessageBox.Show("删除成功!", "提示!");
                RefreshFloor();
            }
            else
            {
                MessageBox.Show("删除失败!", "错误!");
            }
        }
Ejemplo n.º 3
0
        //单击更新按钮
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            SqlParameter xuehao = new SqlParameter("@xuehao", txtNumber.Text);
            DataSet      chauxn = new SqlFile.clsSql().RunProcedure(sSqlTouch, "chaxunxueshengxinxi", new IDataParameter[] { xuehao }, "a");

            if (chauxn.Tables[0].Rows.Count <= 0)
            {
                MessageBox.Show("数据库中无该学生信息请联系管理员!", "提示");
                return;
            }
            DialogResult dr = MessageBox.Show("确认更新吗?", "提示", MessageBoxButtons.OKCancel);

            if (dr != DialogResult.OK)
            {
                return;
            }
            string picName = "MyPhoto" + "\\" + "Photo" + ".jpg";

            byte[] mbBuf = new byte[345];
            mbBuf = File.ReadAllBytes(picName);
            SqlParameter sp1 = new SqlParameter("@xuehao", txtNumber.Text);
            SqlParameter sp2 = new SqlParameter("@zhaopian", mbBuf);

            new SqlFile.clsSql().RunProcedure(sSqlTouch, "baocunzhaopian", new IDataParameter[] { sp1, sp2 }, "a");
            MessageBox.Show("更新成功!", "提示");
            clsPhoto();
        }
Ejemplo n.º 4
0
        //刷新楼层显示
        private void RefreshFloor()
        {
            cboFloor.Items.Add("全部");
            cboFloor.Items.Clear();
            DataSet ds = new SqlFile.clsSql().sqlSelect1(sSqlKey, "Floor");

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                cboFloor.Items.Add(ds.Tables[0].Rows[i][0]);
            }
            cboFloor.SelectedIndex = 0;
        }
Ejemplo n.º 5
0
 //数据库修改指令,返回是否修改成功
 //适用于两列数据
 //输入表名,ID列,列名,旧别名,新别名
 public bool sqlUpdate(String sServer, String strTable, String strList1, String strList2, String strName1, String strName2)
 {
     if (sqlSelect2(sServer, strTable, strList2, strName1) == true)
     {
         DataSet ds    = new clsSql().sql1(sServer, "select * from " + strTable + " where " + strList2 + " = '" + strName1 + "' ");
         String  strId = ds.Tables[0].Rows[0][0].ToString();
         return(sql2(sServer, "update " + strTable + " set " + strList2 + " = '" + strName2 + "' where " + strList1 + " = '" + strId + "'"));
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 6
0
        //刷新楼层信息
        private void RefreshFloor()
        {
            cboFloor2.Items.Clear();
            cboFloor3.Items.Clear();
            cboFloor4.Items.Clear();
            cboFloor2.Items.Add("全部");
            DataSet ds = new SqlFile.clsSql().sqlSelect1(sSqlKey, "Floor");

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                cboFloor2.Items.Add(ds.Tables[0].Rows[i][0].ToString());
                cboFloor3.Items.Add(ds.Tables[0].Rows[i][0].ToString());
                cboFloor4.Items.Add(ds.Tables[0].Rows[i][0].ToString());
            }
        }
Ejemplo n.º 7
0
        //选择教室时触发
        private void lstSite_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstSite.SelectedIndex < 0)
            {
                txtKey.Text = null;
                return;
            }
            string  str = lstSite.Text.Substring(lstSite.Text.IndexOf("@") + 1, lstSite.Text.Length - lstSite.Text.IndexOf("@") - 1);
            DataSet ds  = new SqlFile.clsSql().sqlSelect3(sSqlKey, "Site", "Site_ID", str);

            sKey = ds.Tables[0].Rows[0][4].ToString();
            if (sKey == "")
            {
                sKey = "0";
            }
            txtKey.Text = sKey;
        }
Ejemplo n.º 8
0
 /// <summary>
 /// 关闭窗体
 /// </summary>
 private bool FormClose()
 {
     if (b)
     {
         threadLoading = new Thread(new ThreadStart(s));
         threadLoading.IsBackground = true;
         threadLoading.Start();
         String str = new SqlFile.clsSql().sqlOpen1(sSqlTouch);
         if (frmLoading1.InvokeRequired)                  //判断是否有其他线程想访问
         {
             Action act = () => { frmLoading1.Close(); }; //封装一个窗体关闭的方法
             frmLoading1.Invoke(act);                     //在拥有该控件的线程上执行该方法
         }
         if (threadLoading != null)
         {
             threadLoading.Abort();
         }
         if (str == "")
         {
             b = false;
         }
         else
         {
             MessageBox.Show(str);
             return(false);
         }
     }
     if (clsFormStatic.frmInfo1 != null)
     {
         clsFormStatic.frmInfo1.Close();
         clsFormStatic.frmInfo1 = null;
     }
     if (clsFormStatic.frmPhoto1 != null)
     {
         clsFormStatic.frmPhoto1.Close();
         clsFormStatic.frmPhoto1 = null;
     }
     if (clsFormStatic.frmTouch1 != null)
     {
         clsFormStatic.frmTouch1.Close();
         clsFormStatic.frmTouch1 = null;
     }
     return(true);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// 刷新‘groupBox3’中内容
        /// </summary>
        /// <param name="sNumber">输入学号</param>
        private void group3Refresh(string sNumber)
        {
            pictureBox1.Image = null;
            DataSet ds = new SqlFile.clsSql().sqlSelect3(sSqlTouch, "XueSheng", "XueHao", sNumber);

            if (ds.Tables[0].Rows.Count <= 0)
            {
                return;
            }
            txtNumber.Text  = ds.Tables[0].Rows[0][0].ToString(); //显示学号
            txtName.Text    = ds.Tables[0].Rows[0][7].ToString(); //显示名字
            rdoMale.Checked = false;
            rdoLady.Checked = false;
            if (ds.Tables[0].Rows[0][9].ToString() == "男")
            {
                rdoMale.Checked = true;
            }
            else if (ds.Tables[0].Rows[0][9].ToString() == "女")
            {
                rdoLady.Checked = true;
            }
            DataSet ds1 = new clsSql().sql1(sSqlTouch, "select * from BanJi where BanJiID = '" + ds.Tables[0].Rows[0][6].ToString() + "'");      //查询班级
            DataSet ds2 = new clsSql().sql1(sSqlTouch, "select * from ZhuanYe where ZhuanYeID = '" + ds1.Tables[0].Rows[0][2].ToString() + "'"); //查询专业
            DataSet ds3 = new clsSql().sql1(sSqlTouch, "select * from XueBu where XueBuID = '" + ds2.Tables[0].Rows[0][2].ToString() + "'");     //查询学部
            DataSet ds4 = new clsSql().sql1(sSqlTouch, "select * from NianJi where NianJiID = '" + ds1.Tables[0].Rows[0][3].ToString() + "'");   //查询年级

            txtYear.Text       = ds4.Tables[0].Rows[0][1].ToString();                                                                            //显示年级
            txtDepartment.Text = ds3.Tables[0].Rows[0][1].ToString();                                                                            //显示学部
            txtMajor.Text      = ds2.Tables[0].Rows[0][1].ToString();                                                                            //显示专业
            txtClass.Text      = ds1.Tables[0].Rows[0][1].ToString();                                                                            //显示班级
            txtTel.Text        = ds.Tables[0].Rows[0][10].ToString();                                                                            //显示手机号
            checkBox2.Checked  = false;
            sIdCard            = ds.Tables[0].Rows[0][8].ToString();
            txtIdCard.Text     = sIdCard.Substring(0, 6) + "********" + sIdCard.Substring(14);//显示身份证号码
            if (ds.Tables[0].Rows[0][1].ToString() != "")
            {
                pictureBox1.Image = new Bitmap(new MemoryStream((byte[])ds.Tables[0].Rows[0][1]));//显示照片
            }
            lbl1.Text = null;
            if (0 >= new clsSql().sql1(sSqlRecord, "select * from Record where Record_Number = '" + sNumber + "'").Tables[0].Rows.Count)
            {
                new clsSql().sql2(sSqlRecord, "insert into Record (Record_Number,Record_Name,Record_ClassId,Record_Class,Record_Time) values ('" + sNumber + "','" + ds.Tables[0].Rows[0][7].ToString() + "','" + ds.Tables[0].Rows[0][6].ToString() + "','" + ds1.Tables[0].Rows[0][1].ToString() + "',getdate())");
            }
        }
Ejemplo n.º 10
0
        //加载学生信息
        private void loding()
        {
            DataSet ds = new SqlFile.clsSql().sqlSelect3(sSqlTouch, "XueSheng", "XueHao", sNumber);

            if (ds.Tables[0].Rows.Count < 0)
            {
                return;
            }
            txtNumber.Text = ds.Tables[0].Rows[0][0].ToString();
            txtName.Text   = ds.Tables[0].Rows[0][7].ToString();
            String sIDCard = ds.Tables[0].Rows[0][8].ToString();

            if (sIDCard.Length == 18)
            {
                sIDCard = sIDCard.Substring(0, 6) + "********" + sIDCard.Substring(14, 4);
            }
            txtIDCard.Text = sIDCard;
            String  sClass = ds.Tables[0].Rows[0][6].ToString();
            DataSet ds1    = new SqlFile.clsSql().sqlSelect3(sSqlTouch, "BanJi", "BanJiID", sClass);

            if (ds1.Tables[0].Rows.Count > 0)
            {
                sClass = ds1.Tables[0].Rows[0][1].ToString();
            }
            txtClass.Text     = sClass;
            txtTel.Text       = ds.Tables[0].Rows[0][10].ToString();
            pictureBox1.Image = new Bitmap(new MemoryStream((byte[])ds.Tables[0].Rows[0][1]));
            if (ds.Tables[0].Rows[0][9].ToString() == rdoMale.Text)
            {
                rdoMale.Checked   = true;
                rdoFamale.Checked = false;
            }
            else if (ds.Tables[0].Rows[0][9].ToString() == rdoFamale.Text)
            {
                rdoMale.Checked   = false;
                rdoFamale.Checked = true;
            }
            else
            {
                rdoMale.Checked   = false;
                rdoFamale.Checked = false;
            }
        }
Ejemplo n.º 11
0
        private bool sqlOpen()
        {
            threadLoading = new Thread(new ThreadStart(s));
            threadLoading.IsBackground = true;
            threadLoading.Start();
            String str = new SqlFile.clsSql().sqlOpen1(sSqlTouch);

            if (frmLoading1.InvokeRequired)                  //判断是否有其他线程想访问
            {
                Action act = () => { frmLoading1.Close(); }; //封装一个窗体关闭的方法
                frmLoading1.Invoke(act);                     //在拥有该控件的线程上执行该方法
            }
            if (threadLoading != null)
            {
                threadLoading.Abort();
            }
            if (str != "")
            {
                MessageBox.Show("与指纹服务器连接失败!失败原因!\n" + str, "服务器异常");
                return(false);
            }
            threadLoading = new Thread(new ThreadStart(s1));
            threadLoading.IsBackground = true;
            threadLoading.Start();
            String str1 = new SqlFile.clsSql().sqlOpen1(sSqlRecord);

            if (frmLoading1.InvokeRequired)                  //判断是否有其他线程想访问
            {
                Action act = () => { frmLoading1.Close(); }; //封装一个窗体关闭的方法
                frmLoading1.Invoke(act);                     //在拥有该控件的线程上执行该方法
            }
            if (threadLoading != null)
            {
                threadLoading.Abort();
            }
            if (str1 != "")
            {
                MessageBox.Show("与记录服务器连接失败!失败原因!\n" + str1, "服务器异常");
                return(false);
            }
            return(true);
        }
Ejemplo n.º 12
0
        //指定目标查询,返回是否查询到结果
        //输入表名,列名,目标名称
        public bool sqlSelect2(String sServer, String strTable, String strList, String strName)
        {
            DataSet ds = new clsSql().sql1(sServer, "select * from " + strTable + " where " + strList + " = '" + strName + "' ");

            if (ds != null)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 13
0
        //刷新纪录
        private void Refresh123()
        {
            DataSet ds = new SqlFile.clsSql().sql1(sSqlKey, "select *from Record order by Record_Time desc");

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                DataRow dr       = dt.NewRow();
                String  sSite    = ds.Tables[0].Rows[i][2].ToString();
                String  sUser    = ds.Tables[0].Rows[i][3].ToString();
                String  sUserID  = ds.Tables[0].Rows[i][4].ToString();
                String  sContent = ds.Tables[0].Rows[i][5].ToString();
                dr[0] = ds.Tables[0].Rows[i][1];
                dr[1] = sSite;
                dr[2] = sUser;
                dr[3] = sUserID;
                dr[4] = sContent;
                dt.Rows.Add(dr);
            }
            dataGridView1.DataSource       = dt;
            dataGridView1.Columns[0].Width = 238;
        }
Ejemplo n.º 14
0
        //选择教室时触发
        private void lstSite_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lstSite.SelectedIndex < 0)
            {
                cboFloor4.SelectedIndex = -1;
                txtName4.Text           = null;
                txtRoom4.Text           = null;
                return;
            }
            string  str = lstSite.Text.Substring(lstSite.Text.IndexOf("@") + 1, lstSite.Text.Length - lstSite.Text.IndexOf("@") - 1);
            DataSet ds  = new SqlFile.clsSql().sqlSelect3(sSqlKey, "Site", "Site_ID", str);

            sRoom4         = ds.Tables[0].Rows[0][3].ToString();
            sRoomC4        = ds.Tables[0].Rows[0][5].ToString();
            sName4         = ds.Tables[0].Rows[0][1].ToString();
            txtName4.Text  = sName4;
            txtRoom4.Text  = sRoom4;
            txtRoomC4.Text = sRoomC4;
            String s = ds.Tables[0].Rows[0][2].ToString();

            cboFloor4.SelectedItem = s;
        }
Ejemplo n.º 15
0
        //通过学号查询班级和照片
        private void SelectImage(String sNumber)
        {
            DataSet ds = new SqlFile.clsSql().sqlSelect3(sSqlTouch, "XueSheng", "XueHao", sNumber);

            if (ds.Tables[0].Rows.Count < 0)
            {
                return;
            }
            if (ds.Tables[0].Rows[0][1].ToString() != "")
            {
                pictureBox2.Image = new Bitmap(new MemoryStream((byte[])ds.Tables[0].Rows[0][1]));//显示照片
                lblImage.Visible  = false;
            }
            else
            {
                pictureBox1.Image = null;
                lblImage.Visible  = true;
            }
            DataSet ds1 = new clsSql().sql1(sSqlTouch, "select * from BanJi where BanJiID = '" + ds.Tables[0].Rows[0][6].ToString() + "'");//查询班级

            lblClass.Text = ds1.Tables[0].Rows[0][1].ToString();
        }
Ejemplo n.º 16
0
        private void VerifyFinger_Thread()
        {
            while (true)
            {
                int    lRV         = 0;
                byte[] FingerBuf   = new byte[304 * 256]; //图像缓冲区
                byte[] tzBuf       = new byte[345];
                byte[] mbBuf       = new byte[345];
                string strFileName = "";
                try
                {
                    lRV = OpticalDriver.mxGetImage(0, FingerBuf, 5000, 1);
                    if (lRV != 0)
                    {
                        // label1.Text = GetErrorInfo(lRV);
                    }
                    else
                    {
                        strFileName += "image1.bmp";
                        //图像数据流保存成bmp
                        OpticalDriver.mxSaveBMP(strFileName, FingerBuf, 256, 304);
                        //显示图像
                        // this.pictureBox1.Image = Image.FromFile(strFileName);
                        lRV = OpticalDriver.mxGetTzBase64(FingerBuf, tzBuf);
                        if (lRV != 0)
                        {
                            label1.Text = "获取指纹特征失败";
                            // return;
                        }
                        DataSet XiangMu4 = null;
                        if (!clsFormStatic.frmTouch1.sBanji.Equals(""))
                        {
                            threadT = new Thread(new ThreadStart(threadA));
                            threadT.Start();
                            SqlParameter jj = new SqlParameter("@BanjiID", clsFormStatic.frmTouch1.sBanji);
                            XiangMu4 = new SqlFile.clsSql().RunProcedure(sSqlTouch, "chaxunyundongyuanzhiwenxinxipipeibanji", new IDataParameter[] { jj }, "db");
                            if (frmLoading1.InvokeRequired)                  //判断是否有其他线程想访问
                            {
                                Action act = () => { frmLoading1.Close(); }; //封装一个窗体关闭的方法
                                frmLoading1.Invoke(act);                     //在拥有该控件的线程上执行该方法
                            }
                            if (threadT != null)
                            {
                                threadT.Abort();//关闭进程释
                            }
                            threadT1 = new Thread(new ThreadStart(threadB));
                            threadT1.Start();
                        }

                        int i;
                        if (XiangMu4 != null)
                        {
                            for (i = 0; i < XiangMu4.Tables[0].Rows.Count; i++)
                            {
                                if (XiangMu4.Tables[0].Rows[i][2].ToString().Equals("") == false)
                                {
                                    mbBuf = (byte[])XiangMu4.Tables[0].Rows[i][2];
                                    //验证指纹
                                    lRV = OpticalDriver.mxFingerMatchBase64(mbBuf, tzBuf, 3);
                                    if (lRV == 0)
                                    {
                                        label1.Text       = "  指纹比对成功!";
                                        lblNumber.Text    = XiangMu4.Tables[0].Rows[i][0].ToString();
                                        lblName.Text      = XiangMu4.Tables[0].Rows[i][1].ToString();
                                        pictureBox1.Image = Image.FromFile(strFileName);
                                        SelectImage(XiangMu4.Tables[0].Rows[i][0].ToString());
                                        goto gg;
                                    }
                                }
                                if (XiangMu4.Tables[0].Rows[i][3].ToString().Equals("") == false)
                                {
                                    mbBuf = (byte[])XiangMu4.Tables[0].Rows[i][3];
                                    //验证指纹
                                    lRV = OpticalDriver.mxFingerMatchBase64(mbBuf, tzBuf, 3);
                                    if (lRV == 0)
                                    {
                                        label1.Text       = "  指纹比对成功!";
                                        lblNumber.Text    = XiangMu4.Tables[0].Rows[i][0].ToString();
                                        lblName.Text      = XiangMu4.Tables[0].Rows[i][1].ToString();
                                        pictureBox1.Image = Image.FromFile(strFileName);
                                        SelectImage(XiangMu4.Tables[0].Rows[i][0].ToString());
                                        goto gg;
                                    }
                                }
                                if (XiangMu4.Tables[0].Rows[i][4].ToString().Equals("") == false)
                                {
                                    mbBuf = (byte[])XiangMu4.Tables[0].Rows[i][4];
                                    //验证指纹
                                    lRV = OpticalDriver.mxFingerMatchBase64(mbBuf, tzBuf, 3);
                                    if (lRV == 0)
                                    {
                                        label1.Text       = "  指纹比对成功!";
                                        lblNumber.Text    = XiangMu4.Tables[0].Rows[i][0].ToString();
                                        lblName.Text      = XiangMu4.Tables[0].Rows[i][1].ToString();
                                        pictureBox1.Image = Image.FromFile(strFileName);
                                        SelectImage(XiangMu4.Tables[0].Rows[i][0].ToString());
                                        goto gg;
                                    }
                                }
                                if (XiangMu4.Tables[0].Rows[i][5].ToString().Equals("") == false)
                                {
                                    mbBuf = (byte[])XiangMu4.Tables[0].Rows[i][5];
                                    //验证指纹
                                    lRV = OpticalDriver.mxFingerMatchBase64(mbBuf, tzBuf, 3);
                                    if (lRV == 0)
                                    {
                                        label1.Text       = "  指纹比对成功!";
                                        lblNumber.Text    = XiangMu4.Tables[0].Rows[i][0].ToString();
                                        lblName.Text      = XiangMu4.Tables[0].Rows[i][1].ToString();
                                        pictureBox1.Image = Image.FromFile(strFileName);
                                        SelectImage(XiangMu4.Tables[0].Rows[i][0].ToString());
                                        goto gg;
                                    }
                                }
                            }
                        }
                        if (frmLoading1.InvokeRequired)                  //判断是否有其他线程想访问
                        {
                            Action act = () => { frmLoading1.Close(); }; //封装一个窗体关闭的方法
                            frmLoading1.Invoke(act);                     //在拥有该控件的线程上执行该方法
                        }
                        if (threadT1 != null)
                        {
                            threadT1.Abort();//关闭进程释
                        }
                        threadT = new Thread(new ThreadStart(threadA));
                        threadT.Start();
                        DataSet XiangMu2 = new SqlFile.clsSql().RunProcedure(sSqlTouch, "chaxunyundongyuanzhiwenxinxipipei", new IDataParameter[] { }, "db");
                        if (frmLoading1.InvokeRequired)                  //判断是否有其他线程想访问
                        {
                            Action act = () => { frmLoading1.Close(); }; //封装一个窗体关闭的方法
                            frmLoading1.Invoke(act);                     //在拥有该控件的线程上执行该方法
                        }
                        if (threadT != null)
                        {
                            threadT.Abort();//关闭进程释
                        }
                        threadT = new Thread(new ThreadStart(threadB));
                        threadT.Start();
                        for (i = 0; i < XiangMu2.Tables[0].Rows.Count; i++)
                        {
                            if (XiangMu2.Tables[0].Rows[i][2].ToString().Equals("") == false)
                            {
                                mbBuf = (byte[])XiangMu2.Tables[0].Rows[i][2];
                                //验证指纹
                                lRV = OpticalDriver.mxFingerMatchBase64(mbBuf, tzBuf, 3);
                                if (lRV == 0)
                                {
                                    label1.Text       = "  指纹比对成功!";
                                    lblNumber.Text    = XiangMu2.Tables[0].Rows[i][0].ToString();
                                    lblName.Text      = XiangMu2.Tables[0].Rows[i][1].ToString();
                                    pictureBox1.Image = Image.FromFile(strFileName);
                                    SelectImage(XiangMu2.Tables[0].Rows[i][0].ToString());
                                    break;
                                }
                            }
                            if (XiangMu2.Tables[0].Rows[i][3].ToString().Equals("") == false)
                            {
                                mbBuf = (byte[])XiangMu2.Tables[0].Rows[i][3];
                                //验证指纹
                                lRV = OpticalDriver.mxFingerMatchBase64(mbBuf, tzBuf, 3);
                                if (lRV == 0)
                                {
                                    label1.Text       = "  指纹比对成功!";
                                    lblNumber.Text    = XiangMu2.Tables[0].Rows[i][0].ToString();
                                    lblName.Text      = XiangMu2.Tables[0].Rows[i][1].ToString();
                                    pictureBox1.Image = Image.FromFile(strFileName);
                                    SelectImage(XiangMu2.Tables[0].Rows[i][0].ToString());
                                    break;
                                }
                            }
                            if (XiangMu2.Tables[0].Rows[i][4].ToString().Equals("") == false)
                            {
                                mbBuf = (byte[])XiangMu2.Tables[0].Rows[i][4];
                                //验证指纹
                                lRV = OpticalDriver.mxFingerMatchBase64(mbBuf, tzBuf, 3);
                                if (lRV == 0)
                                {
                                    label1.Text       = "  指纹比对成功!";
                                    lblNumber.Text    = XiangMu2.Tables[0].Rows[i][0].ToString();
                                    lblName.Text      = XiangMu2.Tables[0].Rows[i][1].ToString();
                                    pictureBox1.Image = Image.FromFile(strFileName);
                                    SelectImage(XiangMu2.Tables[0].Rows[i][0].ToString());
                                    break;
                                }
                            }
                            if (XiangMu2.Tables[0].Rows[i][5].ToString().Equals("") == false)
                            {
                                mbBuf = (byte[])XiangMu2.Tables[0].Rows[i][5];
                                //验证指纹
                                lRV = OpticalDriver.mxFingerMatchBase64(mbBuf, tzBuf, 3);
                                if (lRV == 0)
                                {
                                    label1.Text       = "  指纹比对成功!";
                                    lblNumber.Text    = XiangMu2.Tables[0].Rows[i][0].ToString();
                                    lblName.Text      = XiangMu2.Tables[0].Rows[i][1].ToString();
                                    pictureBox1.Image = Image.FromFile(strFileName);
                                    SelectImage(XiangMu2.Tables[0].Rows[i][0].ToString());
                                    break;
                                }
                            }
                        }

                        if (i == XiangMu2.Tables[0].Rows.Count)
                        {
                            label1.Text            = "指纹比对失败";
                            this.pictureBox1.Image = Image.FromFile(strFileName);
                            lblNumber.Text         = "Null";
                            lblName.Text           = "Null";
                            lblClass.Text          = "Null";
                            lblImage.Visible       = true;
                            pictureBox2.Image      = null;
                        }
                        else
                        {
                            pictureBox1.Image = Image.FromFile(strFileName);
                        }
                        gg :;
                        if (frmLoading1.InvokeRequired)                  //判断是否有其他线程想访问
                        {
                            Action act = () => { frmLoading1.Close(); }; //封装一个窗体关闭的方法
                            frmLoading1.Invoke(act);                     //在拥有该控件的线程上执行该方法
                        }
                        if (threadT1 != null)
                        {
                            threadT1.Abort();//关闭进程释
                        }
                    }
                }
                catch (Exception e)
                {
                    //  MessageBox.Show(this, e.Message, "异常");
                }
                finally
                {
                    lRV = OpticalDriver.mxCancelGetImage(0);
                    btnSelect.Enabled = true;
                    fThread.Abort();
                    // EnabledButton(true); ;
                }
            }
        }
Ejemplo n.º 17
0
 /// <summary>
 /// 指纹信息匹配
 /// </summary>
 private void VerifyFinger_Thread()
 {
     while (true)
     {
         int    lRV         = 0;
         byte[] FingerBuf   = new byte[304 * 256]; //图像缓冲区
         byte[] tzBuf       = new byte[345];
         byte[] mbBuf       = new byte[345];
         string strFileName = "";
         string strNumber   = "";
         try
         {
             lRV = OpticalDriver.mxGetImage(0, FingerBuf, 5000, 1);
             if (lRV != 0)
             {
                 lbl1.Text = GetErrorInfo(lRV);
             }
             else
             {
                 strFileName += "image1.bmp";
                 //图像数据流保存成bmp
                 OpticalDriver.mxSaveBMP(strFileName, FingerBuf, 256, 304);
                 //显示图像
                 // this.pictureBox1.Image = Image.FromFile(strFileName);
                 lRV     = OpticalDriver.mxGetTzBase64(FingerBuf, tzBuf);
                 threadT = new Thread(new ThreadStart(threadA));
                 threadT.Start();
                 DataSet XiangMu2 = new SqlFile.clsSql().RunProcedure(sSqlTouch, "chaxunyundongyuanzhiwenxinxipipei", new IDataParameter[] { }, "db");
                 if (frmLoading1.InvokeRequired)                  //判断是否有其他线程想访问
                 {
                     Action act = () => { frmLoading1.Close(); }; //封装一个窗体关闭的方法
                     frmLoading1.Invoke(act);                     //在拥有该控件的线程上执行该方法
                 }
                 if (threadT != null)
                 {
                     threadT.Abort();//关闭进程释
                 }
                 threadT1 = new Thread(new ThreadStart(threadB));
                 threadT1.Start();
                 int i;
                 for (i = 0; i < XiangMu2.Tables[0].Rows.Count; i++)
                 {
                     if (XiangMu2.Tables[0].Rows[i][2].ToString().Equals("") == false)
                     {
                         mbBuf = (byte[])XiangMu2.Tables[0].Rows[i][2];
                         //验证指纹
                         lRV = OpticalDriver.mxFingerMatchBase64(mbBuf, tzBuf, 3);
                         if (lRV == 0)
                         {
                             strNumber = XiangMu2.Tables[0].Rows[i][0].ToString();
                             lbl1.Text = "指纹比对成功";
                             group3Refresh(strNumber);
                             group4Refresh();
                             break;
                         }
                     }
                     if (XiangMu2.Tables[0].Rows[i][3].ToString().Equals("") == false)
                     {
                         mbBuf = (byte[])XiangMu2.Tables[0].Rows[i][3];
                         //验证指纹
                         lRV = OpticalDriver.mxFingerMatchBase64(mbBuf, tzBuf, 3);
                         if (lRV == 0)
                         {
                             strNumber = XiangMu2.Tables[0].Rows[i][0].ToString();
                             lbl1.Text = "指纹比对成功";
                             group3Refresh(strNumber);
                             group4Refresh();
                             break;
                         }
                     }
                     if (XiangMu2.Tables[0].Rows[i][4].ToString().Equals("") == false)
                     {
                         mbBuf = (byte[])XiangMu2.Tables[0].Rows[i][4];
                         //验证指纹
                         lRV = OpticalDriver.mxFingerMatchBase64(mbBuf, tzBuf, 3);
                         if (lRV == 0)
                         {
                             strNumber = XiangMu2.Tables[0].Rows[i][0].ToString();
                             lbl1.Text = "指纹比对成功";
                             group3Refresh(strNumber);
                             group4Refresh();
                             break;
                         }
                     }
                     if (XiangMu2.Tables[0].Rows[i][5].ToString().Equals("") == false)
                     {
                         mbBuf = (byte[])XiangMu2.Tables[0].Rows[i][5];
                         //验证指纹
                         lRV = OpticalDriver.mxFingerMatchBase64(mbBuf, tzBuf, 3);
                         if (lRV == 0)
                         {
                             strNumber = XiangMu2.Tables[0].Rows[i][0].ToString();
                             lbl1.Text = "指纹比对成功";
                             group3Refresh(strNumber);
                             group4Refresh();
                             break;
                         }
                     }
                 }
                 if (i == XiangMu2.Tables[0].Rows.Count)
                 {
                     lbl1.Text = "指纹比对失败";
                     strNumber = "";
                 }
                 //pictureBox1.Image = Image.FromFile(strFileName);
                 if (frmLoading1.InvokeRequired)                  //判断是否有其他线程想访问
                 {
                     Action act = () => { frmLoading1.Close(); }; //封装一个窗体关闭的方法
                     frmLoading1.Invoke(act);                     //在拥有该控件的线程上执行该方法
                 }
                 if (threadT1 != null)
                 {
                     threadT1.Abort();//关闭进程释
                 }
             }
         }
         catch (Exception e)
         {
             //MessageBox.Show(this, e.Message, "异常");
         }
         finally
         {
             fThread.Abort();
         }
     }
 }
Ejemplo n.º 18
0
        //指定目标查询,返回查询结果
        //输入表名,列名,目标名称
        public DataSet sqlSelect3(String sServer, String strTable, String strList, String strName)
        {
            DataSet ds = new clsSql().sql1(sServer, "select * from " + strTable + " where " + strList + " = '" + strName + "' ");

            return(ds);
        }
Ejemplo n.º 19
0
 //关闭子窗体
 private bool FormClose()
 {
     if (bFlag)
     {
         threadLoading = new Thread(new ThreadStart(s));
         threadLoading.IsBackground = true;
         threadLoading.Start();
         String str = new SqlFile.clsSql().sqlOpen1(sSqlTouch);
         if (frmLoading1.InvokeRequired)                  //判断是否有其他线程想访问
         {
             Action act = () => { frmLoading1.Close(); }; //封装一个窗体关闭的方法
             frmLoading1.Invoke(act);                     //在拥有该控件的线程上执行该方法
         }
         if (threadLoading != null)
         {
             threadLoading.Abort();
         }
         if (str != "")
         {
             MessageBox.Show(str);
             return(false);
         }
         threadLoading = new Thread(new ThreadStart(s1));
         threadLoading.IsBackground = true;
         threadLoading.Start();
         String str1 = new SqlFile.clsSql().sqlOpen1(sSqlKey);
         if (frmLoading1.InvokeRequired)                  //判断是否有其他线程想访问
         {
             Action act = () => { frmLoading1.Close(); }; //封装一个窗体关闭的方法
             frmLoading1.Invoke(act);                     //在拥有该控件的线程上执行该方法
         }
         if (threadLoading != null)
         {
             threadLoading.Abort();
         }
         if (str1 != "")
         {
             MessageBox.Show(str1);
             return(false);
         }
         bFlag = false;
     }
     if (clsFormStatic.frmOutKey1 != null)
     {
         clsFormStatic.frmOutKey1.Close();
         clsFormStatic.frmOutKey1 = null;
     }
     if (clsFormStatic.frmPutKey1 != null)
     {
         clsFormStatic.frmPutKey1.Close();
         clsFormStatic.frmPutKey1 = null;
     }
     if (clsFormStatic.frmRecord1 != null)
     {
         clsFormStatic.frmRecord1.Close();
         clsFormStatic.frmRecord1 = null;
     }
     if (clsFormStatic.frmManageSite1 != null)
     {
         clsFormStatic.frmManageSite1.Close();
         clsFormStatic.frmManageSite1 = null;
     }
     if (clsFormStatic.frmMananeKey1 != null)
     {
         clsFormStatic.frmMananeKey1.Close();
         clsFormStatic.frmMananeKey1 = null;
     }
     return(true);
 }
Ejemplo n.º 20
0
        /// <summary>
        /// 加载学生信息
        /// </summary>
        /// <param name="sNumber">学生学号</param>
        private void Student1(string strNumber)
        {
            DataSet ds = new SqlFile.clsSql().sqlSelect3(sSqlTouch, "XueSheng", "XueHao", strNumber);

            if (ds.Tables[0].Rows.Count <= 0)
            {
                return;
            }
            txtNumber.Text  = ds.Tables[0].Rows[0][0].ToString(); //显示学号
            txtName.Text    = ds.Tables[0].Rows[0][7].ToString(); //显示名字
            rdoMale.Checked = false;
            rdoLady.Checked = false;
            if (ds.Tables[0].Rows[0][9].ToString() == "男")
            {
                rdoMale.Checked = true;
            }
            else if (ds.Tables[0].Rows[0][9].ToString() == "女")
            {
                rdoLady.Checked = true;
            }
            DataSet ds1 = new clsSql().sql1(sSqlTouch, "select * from BanJi where BanJiID = '" + ds.Tables[0].Rows[0][6].ToString() + "'");      //查询班级
            DataSet ds2 = new clsSql().sql1(sSqlTouch, "select * from ZhuanYe where ZhuanYeID = '" + ds1.Tables[0].Rows[0][2].ToString() + "'"); //查询专业
            DataSet ds3 = new clsSql().sql1(sSqlTouch, "select * from XueBu where XueBuID = '" + ds2.Tables[0].Rows[0][2].ToString() + "'");     //查询学部
            DataSet ds4 = new clsSql().sql1(sSqlTouch, "select * from NianJi where NianJiID = '" + ds1.Tables[0].Rows[0][3].ToString() + "'");   //查询年级

            txtYear.Text       = ds4.Tables[0].Rows[0][1].ToString();                                                                            //显示年级
            txtDepartment.Text = ds3.Tables[0].Rows[0][1].ToString();                                                                            //显示学部
            txtMajor.Text      = ds2.Tables[0].Rows[0][1].ToString();                                                                            //显示专业
            txtClass.Text      = ds1.Tables[0].Rows[0][1].ToString();                                                                            //显示班级
            txtTel.Text        = ds.Tables[0].Rows[0][10].ToString();                                                                            //显示手机号
            checkBox2.Checked  = false;
            sIdCard            = ds.Tables[0].Rows[0][8].ToString();
            txtIdCard.Text     = sIdCard.Substring(0, 6) + "********" + sIdCard.Substring(14);//显示身份证号码
            if (ds.Tables[0].Rows[0][1].ToString() != "")
            {
                pictureBox1.Image = new Bitmap(new MemoryStream((byte[])ds.Tables[0].Rows[0][1]));//显示照片
            }
            if (ds.Tables[0].Rows[0][2].ToString() != "")
            {
                txtTouch1.Text = "存在";
            }
            else
            {
                txtTouch1.Text = "null";
            }
            if (ds.Tables[0].Rows[0][3].ToString() != "")
            {
                txtTouch2.Text = "存在";
            }
            else
            {
                txtTouch2.Text = "null";
            }
            if (ds.Tables[0].Rows[0][4].ToString() != "")
            {
                txtTouch3.Text = "存在";
            }
            else
            {
                txtTouch3.Text = "null";
            }
            if (ds.Tables[0].Rows[0][5].ToString() != "")
            {
                txtTouch4.Text = "存在";
            }
            else
            {
                txtTouch4.Text = "null";
            }
        }