Exemplo n.º 1
0
        public object Execute(object request)
        {
            object[] arrData = (object[])request;
            int      userId  = (int)arrData[0];
            Song     song    = (Song)arrData[1];

            List <User> users   = userService.getAllRegisterUser();
            Message     message = new Message(string.Format("Song with name {0} , type {1} was added", song.Name, song.Type), userId, DateTime.Now);

            foreach (User u in users)
            {
                UserMessage           userMessage           = new UserMessage();
                MessageConclusionTime messageConclusionTime = messageConclusionTimeService.findByUsersIds(userId, u.Id);
                if (messageConclusionTime == null)
                {
                    messageConclusionTime = new MessageConclusionTime(userId, u.Id, DateTime.Now, DateTime.Now);
                    messageConclusionTimeService.create(messageConclusionTime);
                }
                message = messageService.createAndReturn(message);
                userMessage.MessageId    = message.Id;
                userMessage.UserGetterId = u.Id;
                useMessageService.create(userMessage);
            }
            return(null);
        }
Exemplo n.º 2
0
 public object Execute(object request)
 {
     userMessageService.create((UserMessage)request);
     return(null);
 }