public RecordCollection(Database Owner, string FingerTable, bool _UseIdentityProcess = false, bool AutoLoadData = true, string LoadSql = "") : base(new List <Record>())
            {
                SqlCommand    cmd;
                SqlDataReader reader;

                UseIdentityProcess = _UseIdentityProcess;
                try
                {
                    FTable = FingerTable;
                    if (AutoLoadData)
                    {
                        if (!UseIdentityProcess)
                        {
                            itmG       = new List <Record>(255);
                            this.owner = Owner;
                            if (LoadSql == "")
                            {
                                LoadSql = "select  Features, FingerID  from " + FingerTable + "  order by fingerID";
                            }
                            cmd = new SqlCommand(LoadSql, Owner.Connection);
                            cmd.CommandTimeout = 0;
                            reader             = cmd.ExecuteReader(CommandBehavior.Default);
                            string id;
                            Record record;
                            while (reader.Read())
                            {
                                id = reader["FingerID"].ToString();
                                MemoryStream  memStreamTemplate = new MemoryStream((byte[])reader["Features"]);
                                DPFP.Template template          = new DPFP.Template();
                                template.DeSerialize(memStreamTemplate);

                                record = new Record(id, template);
                                Items.Add(record);
                            }
                        }
                        else
                        {
                            // -----------------------------------------------'-----------------------------------------------
                            if (LoadSql == "")
                            {
                                LoadSql = "select  Features, FingerID  from " + FingerTable + "  order by fingerID";
                            }

                            if (!LoadSql.ToLower().Contains(" order "))
                            {
                                LoadSql += " order by fingerID";
                            }

                            cmd = new SqlCommand(LoadSql, Owner.Connection);

                            cmd.CommandTimeout = 0;
                            string CurrentID  = "";
                            string PreviousID = "";
                            reader = cmd.ExecuteReader(CommandBehavior.Default);
                            DPFP.ID.User  Usr            = new User("");
                            Int16         Fingerposition = 0;
                            DPFP.Template template       = new DPFP.Template();
                            string        id;

                            while (reader.Read())
                            {
                                id = reader["FingerID"].ToString();
                                if (string.IsNullOrEmpty(id.Trim()))
                                {
                                    continue;
                                }
                                CurrentID = id;

                                MemoryStream memStreamTemplate = new MemoryStream((byte[])reader["Features"]);
                                template.DeSerialize(memStreamTemplate);

                                if (PreviousID != CurrentID & PreviousID != "")
                                {
                                    UserCollection.AddUser(ref Usr);
                                    Fingerposition = 0;
                                }

                                if (PreviousID != CurrentID)
                                {
                                    Usr = new DPFP.ID.User(id);
                                }

                                Usr.AddTemplate(template, (FingerPosition)Fingerposition);

                                PreviousID      = id;
                                Fingerposition += 1;
                            }
                            if (Usr != null)
                            {
                                UserCollection.AddUser(ref Usr);
                            }
                        }
                        cmd.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    logger.WriteLog(ex);
                }
            }
            public void GetAllFingerprintsAgain(string FingerTable)
            {
                Items.Clear();
                SqlConnection sqlcon = new SqlConnection(DPData.Database.ConnectionString);
                SqlCommand    cmd;

                sqlcon.Open();
                try
                {
                    SqlDataReader reader;
                    if (!UseIdentityProcess)
                    {
                        cmd = new SqlCommand("Select Features, FingerID from " + FingerTable + " " + " ", sqlcon);

                        cmd.CommandTimeout = 0;
                        reader             = cmd.ExecuteReader(CommandBehavior.Default);
                        while (reader.Read())
                        {
                            string        id                = reader["FingerID"].ToString();
                            DPFP.Template template          = new DPFP.Template();
                            MemoryStream  memStreamTemplate = new MemoryStream((byte[])reader["Features"]);
                            template.DeSerialize(memStreamTemplate);

                            Record record = new Record(id, template);
                            Items.Add(record);
                        }
                    }
                    else
                    {
                        // -----------------------------------------------'-----------------------------------------------
                        cmd = new SqlCommand("select  Features, FingerID  from fingerprints " + "  order by fingerID", sqlcon);

                        cmd.CommandTimeout = 0;
                        string CurrentID  = "";
                        string PreviousID = "";
                        reader = cmd.ExecuteReader(CommandBehavior.Default);
                        DPFP.ID.User  Usr;
                        Int16         Fingerposition = 0;
                        DPFP.Template template       = new DPFP.Template();
                        string        id;

                        while (reader.Read())
                        {
                            id        = reader["FingerID"].ToString();
                            CurrentID = id;

                            MemoryStream memStreamTemplate = new MemoryStream((byte[])reader["Features"]);
                            template.DeSerialize(memStreamTemplate);

                            if (PreviousID != CurrentID & PreviousID != "")
                            {
                                UserCollection.AddUser(ref Usr);
                                Fingerposition = 0;
                            }

                            if (PreviousID != CurrentID)
                            {
                                Usr = new DPFP.ID.User(id);
                            }

                            Usr.AddTemplate(template, (FingerPosition)Fingerposition);

                            PreviousID      = id;
                            Fingerposition += 1;
                        }
                        if (Usr != null)
                        {
                            UserCollection.AddUser(ref Usr);
                        }

                        cmd.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    logger.WriteLog(ex);
                }
            }
            public RecordCollection(Database Owner, DataTable dt, bool _UseIdentityProcess = false) : base(new List <Record>())
            {
                UseIdentityProcess = _UseIdentityProcess;
                try
                {
                    if (!UseIdentityProcess)
                    {
                        itmG = new List <Record>(255);
                        string id;
                        Record record;
                        foreach (DataRow reader in dt.Rows)
                        {
                            id = reader["FingerID"].ToString();
                            MemoryStream  memStreamTemplate = new MemoryStream((byte[])reader["Features"]);
                            DPFP.Template template          = new DPFP.Template();
                            template.DeSerialize(memStreamTemplate);

                            record = new Record(id, template);
                            Items.Add(record);
                        }
                    }
                    else
                    {
                        string        CurrentID  = "";
                        string        PreviousID = "";
                        DPFP.ID.User  Usr;
                        Int16         Fingerposition = 0;
                        DPFP.Template template       = new DPFP.Template();
                        string        id;

                        foreach (DataRow reader in dt.Rows)
                        {
                            id = reader["FingerID"].ToString();
                            if (string.IsNullOrEmpty(id.Trim()))
                            {
                                continue;
                            }
                            CurrentID = id;

                            MemoryStream memStreamTemplate = new MemoryStream((byte[])reader["Features"]);
                            template.DeSerialize(memStreamTemplate);

                            if (PreviousID != CurrentID & PreviousID != "")
                            {
                                Usr = new User(CurrentID);
                                UserCollection.AddUser(ref Usr);
                                Fingerposition = 0;
                            }

                            if (PreviousID != CurrentID)
                            {
                                Usr = new DPFP.ID.User(id);
                            }

                            Usr.AddTemplate(template, (FingerPosition)Fingerposition);

                            PreviousID      = id;
                            Fingerposition += 1;
                        }

                        if (Usr != null)
                        {
                            UserCollection.AddUser(ref Usr);
                        }
                    }
                }
                catch (Exception ex)
                {
                    try
                    {
                        logger.WriteLog(ex);
                    }
                    catch (Exception exx)
                    {
                    }
                }

                finally
                {
                }
            }