Пример #1
0
        public void SetWSQImages(int id, ref byte[] buffer)
        {
            if (_settings["enroll"] == "db")
            {
                DataSource ds = null;

                if (_settings["dbProvider"] == "dedicatedServer")
                    ds = new DAO.Database(_settings);
                else if (_settings["dbProvider"] == "cloudServer")
                    ds = new DAO.CloudDatabase(_settings);
                else
                    throw new Exception("Wrong database provider settings");

                ds.SendImage(IMAGE_TYPE.wsq, Convert.ToInt32(id), ref buffer);
            }
        }
Пример #2
0
        public byte[] GetWSQImages(string id)
        {
            //byte[] buffer = new byte[1];
            byte[][] buffer = new byte[11][];
            //ArrayList fingersCollection = null;

            //if (getAppSetting("Enroll") == "db")
            if (_settings["enroll"] == "db")
            {
                //var ds = new Database(_settings);
                DataSource ds = null;
                if (_settings["dbProvider"] == "dedicatedServer")
                    ds = new DAO.Database(_settings);
                else if (_settings["dbProvider"] == "cloudServer")
                    ds = new DAO.CloudDatabase(_settings);
                else
                    throw new Exception("Wrong database provider settings");

                buffer = ds.GetImage(IMAGE_TYPE.wsq, Convert.ToInt32(id));
            }

            return buffer[0];
        }
        public byte[][] GetImage(IMAGE_TYPE imageType, int id)
        {
            byte[][] buffer = new byte[11][];
            //byte[] buffer = new byte[1];
            //ArrayList fingersCollection = null;

            if (_settings["enroll"] == "db")
            {
                DataSource ds = null;

                if (_settings["dbProvider"] == "dedicatedServer")
                    ds = new DAO.Database(_settings);
                else if (_settings["dbProvider"] == "cloudServer")
                    ds = new DAO.CloudDatabase(_settings);
                else
                    throw new Exception("Wrong database provider settings");

                buffer = ds.GetImage(imageType, Convert.ToInt32(id));

                //if (imageType == IMAGE_TYPE.wsq)
                //{
                //    buffer = ds.GetImage(IMAGE_TYPE.wsq, Convert.ToInt32(id));

                //    //var bioProcessor = new BioProcessor.BioProcessor();
                //    //bioProcessor.processEnrolledData(buffer, out fingersCollection);

                //}
                //else if (imageType == IMAGE_TYPE.picture)
                //{
                //    buffer = ds.GetImage(IMAGE_TYPE.picture, Convert.ToInt32(id));
                //}

            }

            return buffer;
        }
        //public ArrayList GetRawFingerCollection(string id)
        //{
        //    //byte[] buffer = new byte[1];
        //    byte[][] buffer = new byte[11][];
        //    //ArrayList fingersCollection = null;
        //    //if (getAppSetting("Enroll") == "db")
        //    if (_settings["enroll"] == "db")
        //    {
        //        //var ds = new Database(_settings);
        //        DataSource ds = null;
        //        if (_settings["dbProvider"] == "dedicatedServer")
        //            ds = new DAO.Database(_settings);
        //        else if (_settings["dbProvider"] == "cloudServer")
        //            ds = new DAO.CloudDatabase(_settings);
        //        else
        //            throw new Exception("Wrong database provider settings");
        //        buffer = ds.GetImage(IMAGE_TYPE.wsq, Convert.ToInt32(id));
        //        var biometricService = new WSQImageServiceClient();
        //        //byte[] buffer2 = buffer[0];
        //        try
        //        {
        //            //_fingersCollection = biometricService.DeserializeWSQArray(buffer);
        //            _fingersCollection = biometricService.processRawData(buffer);
        //        } catch(Exception ex)
        //        {
        //            throw new Exception(ex.Message);
        //        }
        //        //var bioProcessor = new BioProcessor.BioProcessor();
        //        //bioProcessor.DeserializeWSQArray(buffer, out fingersCollection);
        //    }
        //    return _fingersCollection;
        //    //return buffer[0];
        //}
        public ArrayList GetQualityFingerCollection(string id)
        {
            if (IsDirty(id))
            {
                _fingersCollection = null;
                MemoryCache.Default["dirty"] = "true";

                //byte[] buffer = new byte[1];
                byte[][] buffer = new byte[11][];

                //ArrayList fingersCollection = null;

                //if (getAppSetting("Enroll") == "db")
                if (_settings["enroll"] == "db")
                {
                    DataSource ds = null;
                    if (_settings["dbProvider"] == "dedicatedServer")
                        ds = new DAO.Database(_settings);
                    else if (_settings["dbProvider"] == "cloudServer")
                        ds = new DAO.CloudDatabase(_settings);
                    else
                        throw new Exception("Wrong database provider settings");

                    //if (getAppSetting("provider") == "directDb")
                    //ds = new Database(_settings);
                    //else if (getAppSetting("provider") == "directWebService")
                    //    ds = new CloudDatabase();

                    //if (getAppSetting("fingerTemplates") == "yes")
                    //buffer = ds.GetImage(IMAGE_TYPE.fingerTemplates, Convert.ToInt32(id));
                    //else
                    buffer = ds.GetImage(IMAGE_TYPE.wsq, Convert.ToInt32(id));

                    if (buffer[0] != null)
                    {
                        var biometricService = new WSQImageServiceClient();
                        _fingersCollection = biometricService.processEnrolledData(buffer);

                        //var bioProcessor = new BioProcessor.BioProcessor();
                        //bioProcessor.processEnrolledData(buffer, out fingersCollection);
                        MemoryCache.Default["id"] = id;
                        if (_fingersCollection != null)
                        {
                            MemoryCache.Default["fingersCollection"] = _fingersCollection;
                            MemoryCache.Default["dirty"] = "false";
                        }
                    }
                }

                return _fingersCollection;
            }
            else
                return MemoryCache.Default["fingersCollection"] as ArrayList;
        }
        public byte[] GetPicture(string id)
        {
            //if (getAppSetting("Enroll") == "db")
            if (_settings["enroll"] == "db")
            {
                //var ds = new Database(_settings);

                DataSource ds = null;
                if (_settings["dbProvider"] == "dedicatedServer")
                    ds = new DAO.Database(_settings);
                else if (_settings["dbProvider"] == "cloudServer")
                    ds = new DAO.CloudDatabase(_settings);
                else
                    throw new Exception("Wrong database provider settings");

                return ds.GetImage(IMAGE_TYPE.picture, Convert.ToInt32(id))[0];
            }
            else
            {
                return new byte[0];
            }
        }