예제 #1
0
        private void btnGetById_Click(object sender, EventArgs e)
        {
            RedisServiceStackHelper redis = new RedisServiceStackHelper();
            var model = redis.GetByKey <Notification>(txtId.Text.Trim());

            if (model != null)
            {
                var dataSource = notificationList.Where(x => x.ID == int.Parse(txtId.Text.Trim())).ToList();
                dataGridView1.DataSource = dataSource;
            }
        }
예제 #2
0
        private void GetAll()
        {
            RedisServiceStackHelper redis = new RedisServiceStackHelper();

            notificationList = redis.GetAll <Notification>().ToList();
            if (notificationList.Count == 0)
            {
                notificationList = notificationRepository.GetAll();
            }

            dataGridView1.DataSource = notificationList;
        }
예제 #3
0
        private void btnCacheAll_Click(object sender, EventArgs e)
        {
            RedisServiceStackHelper redis = new RedisServiceStackHelper();

            redis.DeleteAll <Notification>();
            foreach (var item in notificationList)
            {
                redis.SetObject <Notification>(item);
            }

            MessageBox.Show("Cached successful!");
        }