Beispiel #1
0
        /// <summary>
        /// Save new ticket comment to redis cache.
        /// </summary>
        /// <param name="data">The ticket information.</param>
        private void SaveRedisCacheTicketTransection(TicketTransection data)
        {
            var ticketList = RedisCacheHandler.GetValue(ConstantValue.TicketTransectionKey + data.TicketId.ToString(), () =>
            {
                return(this.FuncGetValue(data.TicketId.Value).ToList());
            });

            ticketList.Add(data);
            RedisCacheHandler.SetValue(ConstantValue.TicketTransectionKey + data.TicketId.ToString(), ticketList);
        }
Beispiel #2
0
        /// <summary>
        /// Update ticket to redis cache.
        /// </summary>
        /// <param name="data">The ticket information.</param>
        private void UpdateRedisCacheTicketTransection(TicketTransection model)
        {
            var ticketList = RedisCacheHandler.GetValue(ConstantValue.TicketTransectionKey + model.TicketId.ToString(), () =>
            {
                return(this.FuncGetValue(model.TicketId.Value).ToList());
            });
            var item = ticketList.FirstOrDefault(x => x.Id == model.Id);

            item.EndDate = model.EndDate;
            RedisCacheHandler.SetValue(ConstantValue.TicketTransectionKey + model.TicketId.ToString(), ticketList);
        }
Beispiel #3
0
        /// <summary>
        /// Insert new ticket transection to table.
        /// </summary>
        /// <param name="ticketId">The identity ticket.</param>
        /// <param name="status">The ticket status in transection.</param>
        /// <returns></returns>
        public ResultViewModel SaveTicketTransection(int ticketId, string status)
        {
            var result = new ResultViewModel();
            var data   = new TicketTransection
            {
                TicketId  = ticketId,
                Status    = status,
                StartDate = DateTime.Now
            };

            _unitOfWork.GetRepository <TicketTransection>().Add(data);
            _unitOfWork.Complete();
            this.SaveRedisCacheTicketTransection(data);
            return(result);
        }