Ejemplo n.º 1
0
        private void button22_Click(object sender, EventArgs e)
        {
            var redis = new RedisClient(ConfigRedis.Host, ConfigRedis.Port);
            var keys = redis.SearchKeys(string.Format(RedisKey.BDSKey, "*"));
            var sql = new SqlDb();
            sql.OpenDb();
            var dt = sql.GetAllLandProjects();
            var i = 0;
            foreach (var key in keys)
            {
                //ceo:ceocode:{0}:Object
                var t = key.Replace("tiendoBDS:tiendocode:", "").Replace(":Object", "");
                if (dt.Select("MaTienDo = '" + t + "'").Length == 0)
                {
                    redis.Remove(key);
                    i++;
                }
            }
            sql.CloseDb();

            MessageBox.Show(i.ToString("#,##0"));
        }