Example #1
0
 public static Profile VerifyBiometricsData(byte[] data)
 {
     try
     {
         string          _result = string.Empty;
         string          _Finger = string.Empty;
         Profile         _info   = new Profile();
         dcProfile_OleDb _dc     = new dcProfile_OleDb();
         //DPFP.Template _template = null;
         Stream      _msSample = new MemoryStream(data);
         DPFP.Sample _sample   = new DPFP.Sample();
         //deserialize
         _sample.DeSerialize(_msSample);
         OleDbCommand _cmd = new OleDbCommand("select * from Profiles", _dc.DBConn);
         _dc.DBConn.Open();
         OleDbDataReader _dr     = _cmd.ExecuteReader();
         bool            IsFound = false;
         if (_dr.HasRows)
         {
             while (_dr.Read())
             {
                 if (_dr[2] != DBNull.Value)
                 {
                     IsFound = Verify(_dr, _sample);
                 }
                 if (IsFound == true)
                 {
                     _info.ProfileId = Convert.ToInt64(_dr["ProfileId"]);
                     _info.FullName  = Convert.ToString(_dr["FullName"]);
                     _info.FrontImg  = (byte[])_dr["ProfileImg"];
                     if (_info.FrontImg == null)
                     {
                         _info.FrontImg = Util.ImageToByte(zsi.PhotoFingCapture.Util.GetNoPhoto());
                     }
                     _info.ClientEmployeeId = Convert.ToInt32(_dr["ClientEmployeeId"]);
                     if (_dr["EmployeeNo"] != DBNull.Value)
                     {
                         _info.EmployeeNo = _dr["EmployeeNo"].ToString();
                     }
                     _info.ShiftId = Convert.ToInt32(_dr["ShiftId"]);
                     break;
                 }
             }
         }
         else
         {
             _info.ProfileId = 0;
             _info.FullName  = "";
         }
         return(_info);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #2
0
        public static Profile VerifyBiometricsData(int FingNo, byte[] data)
        {
            try
            {
                string          _result   = string.Empty;
                string          _Finger   = string.Empty;
                Profile         _info     = new Profile();
                dcProfile_OleDb _dc       = new dcProfile_OleDb();
                DPFP.Template   _template = null;
                Stream          _msSample = new MemoryStream(data);
                DPFP.Sample     _sample   = new DPFP.Sample();
                //deserialize
                _sample.DeSerialize(_msSample);
                // _list = _dc.GetDataSource();
                switch (FingNo)
                {
                case 9: _Finger = "LeftSF"; break;

                case 8: _Finger = "LeftRF"; break;

                case 7: _Finger = "LeftMF"; break;

                case 6: _Finger = "LeftIF"; break;

                case 5: _Finger = "LeftTF"; break;

                case 4: _Finger = "RightSF"; break;

                case 3: _Finger = "RightRF"; break;

                case 2: _Finger = "RightMF"; break;

                case 1: _Finger = "RightIF"; break;

                case 0: _Finger = "RightTF"; break;

                default: break;
                }
                OleDbCommand _cmd = new OleDbCommand("select * from Profiles", _dc.DBConn);
                _dc.DBConn.Open();
                OleDbDataReader _dr     = _cmd.ExecuteReader();
                bool            IsFound = false;
                if (_dr.HasRows)
                {
                    while (_dr.Read())
                    {
                        if (_dr[2] != DBNull.Value)
                        {
                            _template = ProcessDBTemplate((byte[])_dr[_Finger]);
                            IsFound   = Verify(_sample, _template);
                        }
                        if (IsFound == true)
                        {
                            _info.ProfileId        = Convert.ToInt64(_dr["ProfileId"]);
                            _info.FullName         = Convert.ToString(_dr["FullName"]);
                            _info.FrontImg         = (byte[])_dr["ProfileImg"];
                            _info.ClientEmployeeId = Convert.ToInt32(_dr["ClientEmployeeId"]);
                            _info.EmployeeNo       = Convert.ToString(_dr["EmployeeNo"]);
                            _info.ShiftId          = Convert.ToInt32(_dr["ShiftId"]);
                            _info.UserId           = (_dr["UserId"] == DBNull.Value ? 0 : Convert.ToInt32(_dr["UserId"]));

                            break;
                        }
                    }
                }
                else
                {
                    _info.ProfileId = 0;
                    _info.FullName  = "";
                }
                return(_info);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }