Exemplo n.º 1
0
        public void SaveWSQImage(int id, byte[] buffer)
        {
            var bioProcessor = new BioProcessor.BioProcessor();
            Dictionary<string, byte[]> templates = bioProcessor.GetTemplatesFromWSQImage(id, buffer);

            var client = new ConfigurationServiceClient();

            Dictionary<string, string> settings = new Dictionary<string, string>();
            foreach (KeyValuePair<string, string> kvp in client.AppSettings())
            {
                settings.Add(kvp.Key, kvp.Value);
            }

            foreach (var kvp in client.ConnectionStrings())
            {
                settings.Add(kvp.Key, kvp.Value);
            }

            var db = new Database(settings);
            db.SaveWSQTemplate(id, templates);
        }
Exemplo n.º 2
0
        private void saveWsqInDatabase(int id, byte[] buffer)
        {
            //FileStream fs = null;

            try
            {
                //  fs = new FileStream("lindex.wsq", FileMode.Open);
                //  BinaryReader br = new BinaryReader(fs);
                //  byte[] buffer = br.ReadBytes((int)fs.Length);

                if (System.Configuration.ConfigurationManager.AppSettings["Enroll"] == "service")
                {
                    DBUtil db = new DBUtil();
                    db.UploadImage(IMAGE_TYPE.wsq, id, ref buffer);
                }
                else
                {
                    var bioProcessor = new BioProcessor.BioProcessor();
                    Dictionary<string, byte[]> templates = bioProcessor.GetTemplatesFromWSQImage(id, buffer);
                    Dictionary<string, string> settings = new Dictionary<string, string>();
                    foreach (var key in ConfigurationManager.AppSettings.AllKeys)
                    {
                        settings.Add(key, ConfigurationManager.AppSettings[key]);
                    }

                    foreach (ConnectionStringSettings cs in ConfigurationManager.ConnectionStrings)
                    {
                        settings.Add(cs.Name, cs.ConnectionString);
                    }

                    var db = new DAO.Database(settings);
                    db.SaveWSQTemplate(id, templates);
                    this.InvokeOnClick(buttonReadFingers, new MyEventArgs(0));
                }

                //db.SaveTemplate(id, buffer);
            }
            catch (Exception ex)
            {
                toolStripStatusLabelError.ForeColor = Color.Red;
                toolStripStatusLabelError.Text = ex.Message;
            }
            finally
            {
                //fs.Dispose();
            }
        }