Beispiel #1
0
        public List <WhisperDTO> SelectPage(int pageIndex, int pageSize, WhisperCondition condition = null)
        {
            Expression <Func <Whisper, object> > orderBy = s => s.CreateTime;
            List <Whisper>              whispers         = _whisperRepoistory.SelectByPage(pageIndex, pageSize, null, orderBy).ToList();
            List <WhisperDTO>           whisperDTOs      = new List <WhisperDTO>();
            Dictionary <string, string> accountWithName  = _userRepository.AccountWithName(whispers.Select(s => s.Account));

            foreach (var item in whispers)
            {
                WhisperDTO whisperDTO = new WhisperDTO();
                whisperDTO.Id          = item.Id.ToString();
                whisperDTO.Account     = item.Account;
                whisperDTO.AccountName = accountWithName[item.Account];
                whisperDTO.Content     = item.Content;
                whisperDTO.CreateDate  = item.CreateTime.ToString("yyyy-MM-dd HH:mm");
                whisperDTOs.Add(whisperDTO);
            }
            return(whisperDTOs);
        }
Beispiel #2
0
        public void Handler(DeleteWhisperEvent eventData)
        {
            _cacheClient.Remove(ConstantKey.CACHE_SQUARE_WHISPER);
            IList <Whisper> whispers = _whisperRepository.SelectByPage(1, 12).ToList();

            foreach (var item in whispers)
            {
                _cacheClient.AddListTail(ConstantKey.CACHE_SQUARE_WHISPER, item);
            }
            whispers = whispers.Take(6).ToList();
            Message message = new Message();

            //首页微语
            message.Data = whispers;
            _singalrContent.SendAllClientsMessage(message);
        }
Beispiel #3
0
        public IList <WhisperModel> SelectByPage(int pageIndex, int pageSize, WhisperConditionModel condiiton = null)
        {
            IEnumerable <Whisper> whispers = _whisperRepository.SelectByPage(pageIndex, pageSize, ConvertCondition(condiiton));

            return(ConvertToModel(whispers));
        }