Пример #1
0
        public bool Save(T model)
        {
            if (Get() != null)
            {
                oAuthTypedClient.DeleteById(keyAuth);
            }

            oAuthTypedClient.Store(model);

            return(true);
        }
Пример #2
0
 private void btnBorrar_Click(object sender, EventArgs e)
 {
     try
     {
         if (MetroFramework.MetroMessageBox.Show(this, "Estas seguro de que vas a borrar el " +
                                                 "registro!", "Mensaje", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
             DialogResult.Yes)
         {
             Empleado em = empleadoBindingSource.Current as Empleado;
             if (em != null)
             {
                 using (RedisClient cliente = new RedisClient("192.168.99.100", 6379))
                 {
                     IRedisTypedClient <Empleado> empleado = cliente.As <Empleado>();
                     empleado.DeleteById(em.ID);
                     empleadoBindingSource.RemoveCurrent();
                     Limpiar();
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #3
0
 /// <summary>
 /// Delete product by id
 /// </summary>
 /// <param name="id"></param>
 public void Delete(string id)
 {
     if (!string.IsNullOrEmpty(id))
     {
         redisProducts.DeleteById(id);
     }
 }
Пример #4
0
 /// <summary>
 /// 根据Ids删除
 /// 2016-03-28 23:48:18
 /// </summary>
 /// <param name="id"></param>
 /// <typeparam name="T"></typeparam>
 public void DeleteById <T>(int id)
 {
     using (IRedisClient client = RedisManager.GetRedisWriteClient())
     {
         IRedisTypedClient <T> typedClient = client.As <T>();
         typedClient.DeleteById(id);
     }
 }
Пример #5
0
 static void Logout(string sessionId)
 {
     using (IRedisClient redisClient = new RedisClient())
     {
         IRedisTypedClient <SessionInfo> sessionClient = redisClient.As <SessionInfo>();
         sessionClient.DeleteById(sessionId);
     }
 }
Пример #6
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (MetroFramework.MetroMessageBox.Show(this, "Are you sure want to delete this record ?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Phone p = phoneBindingSource.Current as Phone;//Get current object
         if (p != null)
         {
             //Connect to your redis cache
             using (RedisClient client = new RedisClient("localhost", 6379)) {
                 IRedisTypedClient <Phone> phone = client.As <Phone>();
                 phone.DeleteById(p.ID);//Delete data by id
                 phoneBindingSource.RemoveCurrent();
             }
         }
     }
 }
Пример #7
0
 private void BtnDelete_Click(object sender, EventArgs e)
 {
     if (MetroMessageBox.Show(this, "Are you sure want to delete this record ?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Phone p = phoneBindingSource.Current as Phone;
         if (p != null)
         {
             using (RedisClient client = new RedisClient("localhost", 6379))
             {
                 IRedisTypedClient <Phone> phone = client.As <Phone>();
                 phone.DeleteById(p.ID);
                 phoneBindingSource.RemoveCurrent();
                 ClearText();
             }
         }
     }
 }
Пример #8
0
 public bool Delete(string name)
 {
     try
     {
         var Hash = redisClient.GetHash <string>(HashId);
         if (redisClient.HashContainsEntry(Hash, name))
         {
             redisClient.DeleteById(name);
         }
         else
         {
             return(false);
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #9
0
 public void DeleteById(string id)
 {
     redisTypedClient.DeleteById(id);
 }
Пример #10
0
 public void DeleteKey(string id)
 {
     _entity.DeleteById(id);
 }
Пример #11
0
        /* public Session Set(Session session)
         * {
         *  Type sessionType = typeof(Session);
         *  PropertyInfo[] properties = sessionType.GetProperties();
         *
         *
         *  foreach (PropertyInfo property in properties)
         *  {
         *      if (property.Name == "Id")
         *      {
         *          continue;
         *      }
         *
         *      _redisTypedClient.SetValue(property.Name, session);
         *  }
         *
         *  return Get(session.Id);
         * }*/

        public bool Delete(Guid sessionId, Session session)
        {
            _redisTypedClient.DeleteById(sessionId);

            return(Get(sessionId) == null);
        }