Exemplo n.º 1
0
 public FingerTemplate(string FingerId, enFingerName FingerName,
                       byte[] TemplateValue)
 {
     this.FingerId      = FingerId;
     this.FingerName    = FingerName;
     this.TemplateValue = TemplateValue;
 }
Exemplo n.º 2
0
        /// <summary>
        /// DataRow Field Must be : KeyField, Finger1,...Finger10
        /// </summary>
        /// <param name="dt"></param>
        /// <param name="FingerTemplate"></param>
        /// <param name="KeyValue"></param>
        /// <param name="Score"></param>
        /// <returns></returns>
        public bool SearchAllFinger(DataTable dt, byte[] FingerTemplate,
                                    out string KeyValue, out int Score, out enFingerName FingerName)
        {
            Array TmpArry = FingerTemplate;

            fgr.IdentifyPrepare(ref TmpArry, 0);

            Score = 0;
            foreach (DataRow dr in dt.Rows)
            {
                for (int i = 1; i <= 10; i++)
                {
                    TmpArry = (Array)dr[i];
                    if (TmpArry == null)
                    {
                        continue;
                    }

                    int Result = fgr.Identify(ref TmpArry, ref Score, 0);

                    if (Result == (int)GRConstants.GR_MATCH)
                    {
                        KeyValue   = (string)dr[0];
                        FingerName = (enFingerName)i;
                        return(true);
                    }
                }
            }
            KeyValue   = string.Empty;
            FingerName = enFingerName.Undefined;
            return(false);
        }
Exemplo n.º 3
0
        public bool SearchAllFinger(ICollection <AllFingerTemplate> ListFinger,
                                    byte[] FingerTemplate, out AllFingerTemplate FoundFinger,
                                    out int Score, out enFingerName FingerName)
        {
            Array TmpArry = FingerTemplate;

            fgr.IdentifyPrepare(ref TmpArry, 0);

            Score = 0;
            foreach (AllFingerTemplate fgs in ListFinger)
            {
                int i = 1;
                foreach (Array Arry in fgs.TemplateValues)
                {
                    if (Arry == null)
                    {
                        continue;
                    }

                    TmpArry = Arry;
                    int Result = fgr.Identify(ref TmpArry, ref Score, 0);
                    if (Result == (int)GRConstants.GR_MATCH)
                    {
                        FoundFinger = fgs;
                        FingerName  = (enFingerName)i;
                        return(true);
                    }
                    i++;
                }
            }
            FoundFinger = null;
            FingerName  = enFingerName.Undefined;
            return(false);
        }
Exemplo n.º 4
0
        public bool SearchAllFinger(IDbConnection Connection, string KeyField,
                                    string FingerTemplateFields, string TableName, string DataFilter,
                                    byte[] FingerTemplate, out string KeyValue, out int Score,
                                    out enFingerName FingerName)
        {
            Array TmpArry = FingerTemplate;

            fgr.IdentifyPrepare(ref TmpArry, 0);

            bool MustClose;

            if (Connection.State != ConnectionState.Open)
            {
                Connection.Open();
                MustClose = true;
            }
            else
            {
                MustClose = false;
            }

            try
            {
                IDbCommand Cmd = Connection.CreateCommand();
                if (DataFilter.Length > 0)
                {
                    DataFilter = " WHERE " + DataFilter;
                }

                Cmd.CommandText = string.Concat("SELECT ", KeyField, ",",
                                                FingerTemplateFields, " FROM ", TableName, DataFilter);
                Cmd.CommandType    = CommandType.Text;
                Cmd.CommandTimeout = 1000;

                IDataReader rdr = Cmd.ExecuteReader();
                try
                {
                    Score = 0;
                    while (rdr.Read())
                    {
                        for (int i = 1; i <= 10; i++)
                        {
                            TmpArry = (Array)rdr[i];
                            if (TmpArry == null)
                            {
                                continue;
                            }

                            int Result = fgr.Identify(ref TmpArry, ref Score, 0);

                            if (Result == (int)GRConstants.GR_MATCH)
                            {
                                KeyValue   = rdr.GetString(0);
                                FingerName = (enFingerName)i;
                                return(true);
                            }
                        }
                    }
                }
                finally
                {
                    rdr.Close();
                }
                KeyValue   = string.Empty;
                FingerName = enFingerName.Undefined;
                return(false);
            }
            finally
            {
                if (MustClose)
                {
                    Connection.Close();
                }
            }
        }