Beispiel #1
0
        public bool Refrescar(Dictionary <Guid, Tuple <TipoHuella, string> > huellaTable)
        {
            if (!connected)
            {
                return(false);
            }

            Dictionary <int, string> FPTable_new = new Dictionary <int, string>();

            foreach (var huella in huellaTable.Values)
            {
                int FPID = (int)huella.Item1 + 1;

#if (!DEBUG || !DESACTIVAHUELLERO)
                if (FPTable.ContainsKey(FPID))
                {
                    string value = FPTable[FPID];
                    if (value.Equals(huella.Item2))
                    {
                        FPTable_new[FPID] = huella.Item2;
                        continue;
                    }
                    if (ZKFPEng.RemoveRegTemplateFromFPCacheDB(FPCache, FPID) != 1)
                    {
                        Disconnect();
                        return(false);
                    }
                }

                if (ZKFPEng.AddRegTemplateStrToFPCacheDB(FPCache, FPID, huella.Item2) != 1)
                {
                    Disconnect();
                    return(false);
                }
                else
                {
                    FPTable_new[FPID] = huella.Item2;
                }
#else
                FPTable_new[FPID] = huella.Item2;
#endif
            }

#if (!DEBUG || !DESACTIVAHUELLERO)
            foreach (int key in FPTable.Keys)
            {
                if (!FPTable_new.ContainsKey(key) && ZKFPEng.RemoveRegTemplateFromFPCacheDB(FPCache, key) != 1)
                {
                    Disconnect();
                    return(false);
                }
            }
#endif
            FPTable = FPTable_new;
            return(true);
        }