예제 #1
0
        private void btInfo_Click(object sender, EventArgs e)
        {
            DAO.DBEngine dbe = new DAO.DBEngine();

            DAO.Database myDB = dbe.OpenDatabase(path);
            lstInfo.Items.Add("the database: " + myDB.Name);

            //loop to display the tables
            for (int t = 0; t < myDB.TableDefs.Count; t++)
            {
                if (myDB.TableDefs[t].Attributes == 0)
                {
                    lstInfo.Items.Add("- table :" + myDB.TableDefs[t].Name);

                    //loop to display the fields of each table
                    for (int f = 0; f < myDB.TableDefs[t].Fields.Count; f++)
                    {
                        lstInfo.Items.Add("\t - Fields: " + myDB.TableDefs[t].Fields[f].Name);
                    }
                    //loop to display inedexes
                    for (int g = 0; g < myDB.TableDefs[t].Indexes.Count; g++)
                    {
                        lstInfo.Items.Add("\t - Fields: " + myDB.TableDefs[t].Indexes[g].Name);


                        for (int f = 0; f < ((DAO.IndexFields)(myDB.TableDefs[t].Indexes[g].Fields)).Count; f++)
                        {
                            lstInfo.Items.Add("\t\t Index Fields : " + ((Field)(((IndexFields)(myDB.TableDefs[t].Indexes[g].Fields))[f])).Name);
                        }
                    }
                }
            }

            //loop to display the relation
            for (int r = 0; r < myDB.Relations.Count; r++)
            {
                if (myDB.Relations[r].Attributes == 0)
                {
                    lstInfo.Items.Add("- Relation: " + myDB.Relations[r].Name);

                    lstInfo.Items.Add("\t Primary Table: " + myDB.Relations[r].Table);

                    lstInfo.Items.Add("\t Foreign Table: " + myDB.Relations[r].ForeignTable);


                    //loop to display fields of relation
                    for (int f = 0; f < myDB.Relations[r].Fields.Count; f++)
                    {
                        lstInfo.Items.Add("\t\t Primary Field: " + myDB.Relations[r].Fields[f].Name);


                        lstInfo.Items.Add("\t\t Foreign field: " + myDB.Relations[r].Fields[f].ForeignName);
                    }
                }
            }

            myDB.Close();
        }
예제 #2
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);
            }
        }
예제 #3
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);
        }
예제 #4
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];
        }
예제 #5
0
        private bool lFile(DataSet ds)
        {
            bool            result = false;
            string          strMes = "";
            OleDbConnection conn;

            ADODB.Connection adodbCon = new ADODB.Connection();
            adodbCon.ConnectionString = connString;
            ADOX.Catalog cat = new ADOX.Catalog();
            ADOX.Table   tab;
            DAO.DBEngine dbEngine = new DAO.DBEngine();

            try
            {
                //внесение данных
                txtLog.AppendLine("Внесение данных");
                Application.DoEvents();
                string postFix = "";
                if (rbTypeTo.Checked)
                {
                    postFix = "rokb";
                }
                DAO.Database  db = dbEngine.OpenDatabase(pathToDb);
                DAO.Recordset rs = db.OpenRecordset($"ZGLV{postFix}");
                foreach (DataRow dr in ds.Tables["ZGLV"].Rows)
                {
                    rs.AddNew();
                    rs.Fields["H"].Value = "L";
                    foreach (DataColumn dc in ds.Tables["ZGLV"].Columns)
                    {
                        rs.Fields[dc.ColumnName].Value = dr[dc.ColumnName].ToString();
                    }
                    rs.Update();
                }
                rs.Close();
                //
                //PERS
                //
                if (ds.Tables.Contains("PERS"))
                {
                    txtLog.AppendLine("Таблица PERS");
                    Application.DoEvents();
                    System.Threading.Thread.Sleep(10000);
                    pb.Minimum = 0;
                    pb.Maximum = ds.Tables["PERS"].Rows.Count;
                    pb.Value   = 0;
                    Application.DoEvents();
                    rs = db.OpenRecordset($"PERS{postFix}");
                    int counter = 0;
                    foreach (DataRow drSchet in ds.Tables["PERS"].Rows)
                    {
                        pb.Value = counter++;
                        Application.DoEvents();
                        rs.AddNew();
                        rs.Fields["PLAT"].Value = _PLAT;
                        foreach (DataColumn dc in ds.Tables["PERS"].Columns)
                        {
                            rs.Fields[dc.ColumnName].Value = drSchet[dc.ColumnName].ToString();
                        }
                        rs.Update();
                    }
                    rs.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                txtLog.AppendLine(ex.Message);
            }
            finally
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(dbEngine);
                dbEngine = null;
            }
            cat = null;
            return(result);
        }
예제 #6
0
        private bool hFile(DataSet ds)
        {
            bool            result = false;
            string          strMes = "";
            OleDbConnection conn;

            ADODB.Connection adodbCon = new ADODB.Connection();
            adodbCon.ConnectionString = connString;
            ADOX.Catalog cat = new ADOX.Catalog();
            ADOX.Table   tab;
            //int SLUCH_ID = 0;
            DAO.DBEngine dbEngine = new DAO.DBEngine();
            try
            {
                string postFix = "";
                if (rbTypeTo.Checked)
                {
                    postFix = "rokb";
                }
                txtLog.AppendLine("Внесение данных");
                Application.DoEvents();
                //внесение данных
                string _CODE = "", _NSCHET = "", _N_ZAP = "", _IDCASE = "", _USL_TIP = "2";
                txtLog.AppendLine("Таблица ZGLV");
                Application.DoEvents();
                DAO.Database  db = dbEngine.OpenDatabase(pathToDb);
                DAO.Recordset rs = db.OpenRecordset($"ZGLV{postFix}");
                foreach (DataRow dr in ds.Tables["ZGLV"].Rows)
                {
                    rs.AddNew();
                    rs.Fields["H"].Value = "H";
                    foreach (DataColumn dc in ds.Tables["ZGLV"].Columns)
                    {
                        rs.Fields[dc.ColumnName].Value = dr[dc.ColumnName].ToString();
                    }
                    rs.Update();
                }
                rs.Close();
                //
                //SCHET
                //
                txtLog.AppendLine("Таблица SCHET");
                Application.DoEvents();
                rs = db.OpenRecordset($"SCHET{postFix}");
                DataRow drSchet = ds.Tables["SCHET"].Rows[0];
                _CODE   = drSchet["CODE"].ToString();
                _NSCHET = drSchet["NSCHET"].ToString();
                rs.AddNew();
                foreach (DataColumn dc in ds.Tables["SCHET"].Columns)
                {
                    rs.Fields[dc.ColumnName].Value = drSchet[dc.ColumnName].ToString();
                }
                rs.Update();
                rs.Close();
                //
                //ZAP
                //
                txtLog.AppendLine("Таблица ZAP");
                Application.DoEvents();
                pb.Minimum = 0;
                pb.Maximum = ds.Tables["ZAP"].Rows.Count;
                pb.Value   = 0;
                int counter = 0;
                rs = db.OpenRecordset($"ZAP{postFix}");
                foreach (DataRow dr in ds.Tables["ZAP"].Rows)
                {
                    pb.Value = counter++;
                    Application.DoEvents();
                    rs.AddNew();
                    _N_ZAP = dr["N_ZAP"].ToString();
                    int ZAP_Id = int.Parse(dr["ZAP_Id"].ToString());
                    rs.Fields["CODE"].Value   = _CODE;
                    rs.Fields["PLAT"].Value   = _PLAT;
                    rs.Fields["NSCHET"].Value = _NSCHET;
                    foreach (DataColumn dc in ds.Tables["ZAP"].Columns)
                    {
                        rs.Fields[dc.ColumnName].Value = dr[dc.ColumnName].ToString();
                    }
                    rs.Update();
                    //
                    //PACIENT
                    //
                    DAO.Recordset rsPacient = db.OpenRecordset($"PACIENT{postFix}");
                    if (ds.Tables.Contains("PACIENT"))
                    {
                        List <DataRow> pacList = ds.Tables["PACIENT"].AsEnumerable().Where(m => m.Field <Int32>("ZAP_Id") == ZAP_Id).ToList <DataRow>();
                        foreach (DataRow drPac in pacList)
                        {
                            rsPacient.AddNew();
                            rsPacient.Fields["N_ZAP"].Value = _N_ZAP;
                            rsPacient.Fields["PLAT"].Value  = _PLAT;
                            foreach (DataColumn dc in ds.Tables["PACIENT"].Columns)
                            {
                                rsPacient.Fields[dc.ColumnName].Value = drPac[dc.Ordinal].ToString();
                            }
                            rsPacient.Update();
                        }
                        rsPacient.Close();
                    }
                    //
                    //SLUCH
                    //
                    if (!ds.Tables.Contains("SLUCH"))
                    {
                        continue;
                    }
                    DAO.Recordset  rsSLUCH   = db.OpenRecordset($"SLUCH{postFix}");
                    List <DataRow> sluchList = ds.Tables["SLUCH"].AsEnumerable().Where(m => m.Field <Int32>("ZAP_Id") == ZAP_Id).ToList <DataRow>();
                    foreach (DataRow drSluch in sluchList)
                    {
                        _IDCASE = drSluch[ds.Tables["SLUCH"].Columns["IDCASE"].Ordinal].ToString();
                        //SLUCH_ID = int.Parse(drSluch["SLUCH_Id"].ToString());
                        //if (SLUCH_ID == 1098)
                        //{
                        //    int zz = 0;
                        //}
                        int SLUCH_Id = int.Parse(drSluch[ds.Tables["SLUCH"].Columns["SLUCH_Id"].Ordinal].ToString());
                        rsSLUCH.AddNew();
                        rsSLUCH.Fields["N_ZAP"].Value = _N_ZAP;
                        rsSLUCH.Fields["PLAT"].Value  = _PLAT;
                        foreach (DataColumn dc in ds.Tables["SLUCH"].Columns)
                        {
                            rsSLUCH.Fields[dc.ColumnName].Value = drSluch[dc.Ordinal].ToString();
                        }
                        rsSLUCH.Update();
                        //
                        //HMP
                        //
                        if (ds.Tables.Contains("HMP"))
                        {
                            DAO.Recordset  rsHMP   = db.OpenRecordset($"HMP{postFix}");
                            List <DataRow> hmpList = ds.Tables["HMP"].AsEnumerable().Where(m => m.Field <Int32>("SLUCH_Id") == SLUCH_Id).ToList <DataRow>();
                            if (hmpList != null && hmpList.Count > 0)
                            {
                                foreach (DataRow drHMP in hmpList)
                                {
                                    rsHMP.AddNew();
                                    rsHMP.Fields["IDCASE"].Value = _IDCASE;
                                    foreach (DataColumn dc in ds.Tables["HMP"].Columns)
                                    {
                                        rsHMP.Fields[dc.ColumnName].Value = drHMP[dc.Ordinal].ToString();
                                    }
                                    rsHMP.Update();
                                }
                            }
                            rsHMP.Close();
                        }
                        //
                        //NAPR_FROM
                        //
                        if (ds.Tables.Contains("NAPR_FROM"))
                        {
                            DAO.Recordset  rsNaprFrom   = db.OpenRecordset($"NAPR_FROM{postFix}");
                            List <DataRow> naprFromList = ds.Tables["NAPR_FROM"].AsEnumerable().Where(m => m.Field <Int32>("SLUCH_Id") == SLUCH_Id).ToList <DataRow>();
                            if (naprFromList != null && naprFromList.Count > 0)
                            {
                                foreach (DataRow drNaprFrom in naprFromList)
                                {
                                    rsNaprFrom.AddNew();
                                    rsNaprFrom.Fields["IDCASE"].Value = _IDCASE;
                                    foreach (DataColumn dc in ds.Tables["NAPR_FROM"].Columns)
                                    {
                                        rsNaprFrom.Fields[dc.ColumnName].Value = drNaprFrom[dc.Ordinal].ToString();
                                    }
                                    rsNaprFrom.Update();
                                }
                            }
                            rsNaprFrom.Close();
                        }
                        //
                        //CONS
                        //
                        if (ds.Tables.Contains("CONS"))
                        {
                            DAO.Recordset  rsCons   = db.OpenRecordset($"CONS{postFix}");
                            List <DataRow> consList = ds.Tables["CONS"].AsEnumerable().Where(m => m.Field <Int32>("SLUCH_Id") == SLUCH_Id).ToList <DataRow>();
                            if (consList != null && consList.Count > 0)
                            {
                                foreach (DataRow drCons in consList)
                                {
                                    rsCons.AddNew();
                                    rsCons.Fields["IDCASE"].Value = _IDCASE;
                                    foreach (DataColumn dc in ds.Tables["CONS"].Columns)
                                    {
                                        rsCons.Fields[dc.ColumnName].Value = drCons[dc.Ordinal].ToString();
                                    }
                                    rsCons.Update();
                                }
                            }
                            rsCons.Close();
                        }
                        //
                        //ONK_SL
                        //
                        if (ds.Tables.Contains("ONK_SL"))
                        {
                            DAO.Recordset  rsOnkSl   = db.OpenRecordset($"ONK_SL{postFix}");
                            List <DataRow> onkSlList = ds.Tables["ONK_SL"].AsEnumerable().Where(m => m.Field <Int32>("SLUCH_Id") == SLUCH_Id).ToList <DataRow>();
                            if (onkSlList != null && onkSlList.Count > 0)
                            {
                                foreach (DataRow drOnkSl in onkSlList)
                                {
                                    int OnkSl_Id = int.Parse(drOnkSl[ds.Tables["ONK_SL"].Columns["ONK_SL_Id"].Ordinal].ToString());
                                    rsOnkSl.AddNew();
                                    rsOnkSl.Fields["IDCASE"].Value = _IDCASE;
                                    foreach (DataColumn dc in ds.Tables["ONK_SL"].Columns)
                                    {
                                        rsOnkSl.Fields[dc.ColumnName].Value = drOnkSl[dc.Ordinal].ToString();
                                    }
                                    rsOnkSl.Update();
                                    //
                                    //B_DIAG
                                    //
                                    if (ds.Tables.Contains("B_DIAG"))
                                    {
                                        DAO.Recordset  rsBDiag   = db.OpenRecordset($"B_DIAG{postFix}");
                                        List <DataRow> bDiagList = ds.Tables["B_DIAG"].AsEnumerable().Where(m => m.Field <Int32>("ONK_SL_Id") == OnkSl_Id).ToList <DataRow>();
                                        if (bDiagList != null && bDiagList.Count > 0)
                                        {
                                            foreach (DataRow drBDiag in bDiagList)
                                            {
                                                rsBDiag.AddNew();
                                                rsBDiag.Fields["IDCASE"].Value = _IDCASE;
                                                foreach (DataColumn dc in ds.Tables["B_DIAG"].Columns)
                                                {
                                                    rsBDiag.Fields[dc.ColumnName].Value = drBDiag[dc.Ordinal].ToString();
                                                }
                                                rsBDiag.Update();
                                            }
                                        }
                                        rsBDiag.Close();
                                    }
                                    //
                                    //ONK_USL
                                    //
                                    if (ds.Tables.Contains("ONK_USL"))
                                    {
                                        DAO.Recordset  rsOnkUsl   = db.OpenRecordset($"ONK_USL{postFix}");
                                        List <DataRow> onkUslList = ds.Tables["ONK_USL"].AsEnumerable().Where(m => m.Field <Int32>("ONK_SL_Id") == OnkSl_Id).ToList <DataRow>();
                                        if (onkUslList != null && onkUslList.Count > 0)
                                        {
                                            foreach (DataRow drOnkUsl in onkUslList)
                                            {
                                                rsOnkUsl.AddNew();
                                                rsOnkUsl.Fields["IDCASE"].Value = _IDCASE;
                                                int ONK_USL_Id = int.Parse(drOnkUsl["ONK_USL_Id"].ToString());
                                                foreach (DataColumn dc in ds.Tables["ONK_USL"].Columns)
                                                {
                                                    rsOnkUsl.Fields[dc.ColumnName].Value = drOnkUsl[dc.Ordinal].ToString();
                                                }
                                                rsOnkUsl.Update();
                                                //
                                                //LEK_PR
                                                //
                                                if (ds.Tables.Contains("LEK_PR"))
                                                {
                                                    DAO.Recordset  rsLekPr   = db.OpenRecordset($"LEK_PR{postFix}");
                                                    List <DataRow> lekPrList = ds.Tables["LEK_PR"].AsEnumerable().Where(m => m.Field <Int32>("ONK_USL_Id") == ONK_USL_Id).ToList <DataRow>();
                                                    if (lekPrList != null && lekPrList.Count > 0)
                                                    {
                                                        foreach (DataRow drLekPr in lekPrList)
                                                        {
                                                            int            LEK_PR_Id   = int.Parse(drLekPr["LEK_PR_Id"].ToString());
                                                            List <DataRow> dateInjList = ds.Tables["DATE_INJ"].AsEnumerable().Where(m => m.Field <Int32>("LEK_PR_Id") == LEK_PR_Id).ToList <DataRow>();
                                                            if (dateInjList != null && dateInjList.Count > 0)
                                                            {
                                                                foreach (DataRow drDateInj in dateInjList)
                                                                {
                                                                    rsLekPr.AddNew();
                                                                    foreach (DataColumn dc in ds.Tables["LEK_PR"].Columns)
                                                                    {
                                                                        rsLekPr.Fields[dc.ColumnName].Value = drLekPr[dc.Ordinal].ToString();
                                                                    }
                                                                    rsLekPr.Fields["IDCASE"].Value   = _IDCASE;
                                                                    rsLekPr.Fields["USL_TIP"].Value  = "2";
                                                                    rsLekPr.Fields["DATE_INJ"].Value = drDateInj["DATE_INJ_Text"].ToString();
                                                                    rsLekPr.Update();
                                                                }
                                                            }
                                                            else
                                                            {
                                                                rsLekPr.AddNew();
                                                                rsLekPr.Fields["IDCASE"].Value  = _IDCASE;
                                                                rsLekPr.Fields["USL_TIP"].Value = "2";
                                                                rsLekPr.Update();
                                                            }
                                                        }
                                                    }
                                                    rsLekPr.Close();
                                                }
                                            }
                                        }
                                        rsOnkUsl.Close();
                                    }
                                }
                            }
                            rsOnkSl.Close();
                        }
                        //
                        //USL
                        //
                        if (ds.Tables.Contains("USL"))
                        {
                            DAO.Recordset  rsUSL   = db.OpenRecordset($"USL{postFix}");
                            List <DataRow> uslList = ds.Tables["USL"].AsEnumerable().Where(m => m.Field <Int32>("SLUCH_Id") == SLUCH_Id).ToList <DataRow>();
                            if (uslList != null && uslList.Count > 0)
                            {
                                foreach (DataRow drUSL in uslList)
                                {
                                    int USL_Id = int.Parse(drUSL["USL_Id"].ToString());
                                    rsUSL.AddNew();
                                    rsUSL.Fields["IDCASE"].Value = _IDCASE;
                                    rsUSL.Fields["N_ZAP"].Value  = _N_ZAP;
                                    rsUSL.Fields["PLAT"].Value   = _PLAT;
                                    foreach (DataColumn dc in ds.Tables["USL"].Columns)
                                    {
                                        rsUSL.Fields[dc.ColumnName].Value = drUSL[dc.Ordinal].ToString();
                                    }
                                    rsUSL.Update();
                                    //
                                    //SL_KOEF
                                    //
                                    if (ds.Tables.Contains("SL_KOEF"))
                                    {
                                        DAO.Recordset  rsSlKoef   = db.OpenRecordset($"SL_KOEF{postFix}");
                                        List <DataRow> slKoefList = ds.Tables["SL_KOEF"].AsEnumerable().Where(m => m.Field <Int32>("USL_Id") == USL_Id).ToList <DataRow>();
                                        if (slKoefList != null && slKoefList.Count > 0)
                                        {
                                            foreach (DataRow drSlKoef in slKoefList)
                                            {
                                                rsSlKoef.AddNew();
                                                rsSlKoef.Fields["IDCASE"].Value = _IDCASE;
                                                foreach (DataColumn dc in ds.Tables["SL_KOEF"].Columns)
                                                {
                                                    rsSlKoef.Fields[dc.ColumnName].Value = drSlKoef[dc.Ordinal].ToString();
                                                }
                                                rsSlKoef.Update();
                                            }
                                        }
                                        rsSlKoef.Close();
                                    }
                                    //
                                    //SL_KOEF
                                    //
                                    if (ds.Tables.Contains("KSG_KPG"))
                                    {
                                        DAO.Recordset  rsKSGKPG = db.OpenRecordset($"KSG_KPG{postFix}");
                                        List <DataRow> KSGKPG   = ds.Tables["KSG_KPG"].AsEnumerable().Where(m => m.Field <Int32>("USL_Id") == USL_Id).ToList <DataRow>();
                                        if (KSGKPG != null && KSGKPG.Count > 0)
                                        {
                                            foreach (DataRow drKSGKPG in KSGKPG)
                                            {
                                                rsKSGKPG.AddNew();
                                                rsKSGKPG.Fields["IDCASE"].Value = _IDCASE;
                                                foreach (DataColumn dc in ds.Tables["KSG_KPG"].Columns)
                                                {
                                                    rsKSGKPG.Fields[dc.ColumnName].Value = drKSGKPG[dc.Ordinal].ToString();
                                                }
                                                rsKSGKPG.Update();
                                            }
                                        }
                                        rsKSGKPG.Close();
                                    }
                                }
                            }
                            rsUSL.Close();
                        }
                    }
                    rsSLUCH.Close();
                }
                rs.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                txtLog.AppendLine(ex.Message);
            }
            finally
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(dbEngine);
                dbEngine = null;
            }

            cat = null;
            return(result);
        }
        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];
            }
        }