Exemplo n.º 1
0
        // ncrunch: no coverage end

        protected void OnBuildExecuted()
        {
            Logger.Info("Build Request sent");
            MessagesListViewModel.ClearMessages();
            SendBuildRequestToServer(UserSolutionPath, SelectedCodeProject.Name, SelectedPlatform,
                                     IsRebuildForced);
        }
Exemplo n.º 2
0
        public ActionResult GetMessages(int pageNumber = 1)
        {
            int pageSize           = 10;
            var messages           = MessageService.GetMessagesList(service, "me");
            var totalMessagesCount = messages.Count;

            messages = messages
                       .Skip((pageSize - 1) * pageNumber)
                       .Take(pageSize)
                       .ToList();

            var viewModel = new MessagesListViewModel()
            {
                Messages   = new List <MessageInfoViewModel>(),
                Pagination = new Pagination()
                {
                    PageSize        = pageSize,
                    PageNumber      = pageNumber,
                    TotalItemsCount = totalMessagesCount
                }
            };

            foreach (var mes in messages)
            {
                Message message = MessageService.GetMessage(service, "me", mes.Id);
                viewModel.Messages.Add(new MessageInfoViewModel
                {
                    Id    = message.Id,
                    Title = message.Snippet
                });
            }

            return(View(viewModel));
        }
Exemplo n.º 3
0
 public ChatMessagesPage(MessagesListViewModel chat)
 {
     InitializeComponent();
     this.BindingContext = new MessagesListViewModel(this);
     ViewModel           = chat;
     this.BindingContext = ViewModel;
 }
        public async Task <IActionResult> Unread()
        {
            var user = await this.userManager.GetUserAsync(this.User);

            var unreadMessagesViewModel = new MessagesListViewModel()
            {
                Messages = this.messagesService.GetUnreadMessages(user.Id)
            };

            return(this.View(unreadMessagesViewModel));
        }
Exemplo n.º 5
0
 private void OnAppBuildMessageRecieved(AppBuildMessage receivedMessage)
 {
     if (receivedMessage.Type == AppBuildMessageType.BuildInfo)
     {
         Logger.Info(receivedMessage.Text);
         return;
     }
     Logger.Warning(receivedMessage.Text);
     MessagesListViewModel.AddMessage(receivedMessage);
     if (receivedMessage.Type == AppBuildMessageType.BuildError)
     {
         AllowBuildingAppsAgain();
     }
 }
Exemplo n.º 6
0
        public async Task <IActionResult> Index(MessagesQuery query, CancellationToken cancellationToken)
        {
            var senders = await MailAppDbContext.Accounts
                          .ToArrayAsync(cancellationToken);

            var owner = await AccountProvider.GetAccountForCurrentUser(cancellationToken);

            var messages = await MailAppDbContext.Messages
                           .Include(x => x.MessagePersons)
                           .ThenInclude(x => x.Account)
                           .ToArrayAsync(cancellationToken);

            messages = messages
                       .Where(x => query.SenderId == null || x.Sender.Id == query.SenderId)
                       .Where(x => x.MessagePersons.Any(y => y.Type != MessagePersonType.Sender && y.Account == owner))
                       .ToArray();

            if (!String.IsNullOrEmpty(query.Search))
            {
                foreach (var part in query.Search.Split(" "))
                {
                    messages = messages.Where(x => (x.Subject + x.Text).Contains(part)).ToArray();
                }
            }

            messages = query.Sort switch
            {
                MessagesQuery.SortingOptions.Subject => messages.OrderBy(x => x.Subject).ToArray(),
                MessagesQuery.SortingOptions.Date => messages.OrderBy(x => x.SentDate).ToArray(),
                MessagesQuery.SortingOptions.Nick => messages.OrderBy(x => x.Sender.Nick).ToArray(),
                _ => messages.OrderBy(x => x.SentDate).ToArray()
            };

            var viewModel = new MessagesListViewModel
            {
                SenderId = query.SenderId,
                Senders  = senders
                           .Select(x => new AccountViewModel(x))
                           .ToArray(),
                MessageList = new MessageListViewModel
                {
                    Messages = messages
                               .Select(x => new MessageViewModel(x, owner))
                               .ToArray(),
                }
            };

            return(View(viewModel));
        }
Exemplo n.º 7
0
        public ActionResult MessagesList(string chatId)
        {
            if (chatId != null)
            {
                //TODO return real chat list
                return(PartialView("_MessagesList"));
            }
            var fakemessages = new MessagesListViewModel()
            {
                Messages = new List <Message>()
                {
                    //new Message() { Content = "lets test",User=new ApplicationUser() { FirstName="john" , LastName= "Smith"} }
                    //,   //new Message() { Content = "second messagw test",User=new ApplicationUser() { FirstName="Dimitris" , LastName= "Bjorlingh"} }
                }
            };

            return(PartialView("_MessagesList", fakemessages));
        }
        public IActionResult Create(MessagesListViewModel vm)
        {
            if (ModelState.IsValid)
            {
                var message = new Message
                {
                    Text      = vm.Text,
                    Created   = DateTime.UtcNow,
                    AuthorId  = GetCurrentUserId().Result,
                    MeetingId = vm.MeetingId
                };
                TempData["SuccessMessage"] = Constants.GeneralSuccessMessage;
                _messageRepository.SaveMessage(message);
            }

            var appLink = Url.Action(nameof(List), "Message", new { id = vm.MeetingId }, HttpContext.Request.Scheme);
            var content = $"{vm.Text}";
            var users   = _invitedUserRepository.GetUsersEmailsForNotification(vm.MeetingId, GetCurrentUserId().Result);

            foreach (var email in users)
            {
                _templateSender.SendGeneralEmailAsync(new SendEmailDetails
                {
                    IsHTML  = true,
                    ToEmail = email,
                    Subject = Constants.SubjectNewMessageEmail
                }, Constants.TitleNewMessageEmail, $"{Constants.ContentNewMessageEmail}: {content}",
                                                      Constants.ButtonCheckMeeting,
                                                      appLink)
                .ContinueWith(t =>
                {
                    if (t.Result.Successful)
                    {
                        return;
                    }
                    foreach (var error in t.Result.Errors)
                    {
                        _logger.LogError(error);
                    }
                }, TaskScheduler.Default);
            }

            return(RedirectToAction(nameof(List), new { id = vm.MeetingId }));
        }
Exemplo n.º 9
0
        public MessagesListViewModel GetMessagesList()
        {
            var model = new MessagesListViewModel();

            List <Message> messages = (List <Message>)TempData["Message"];

            if (messages != null)
            {
                List <MessageModel> messageModels = messages.Select(m => new MessageModel
                {
                    Title    = EnumsHelper.GetResourceDisplayEnum(m.MessageType),
                    Body     = m.MessageText,
                    CssClass = EnumsHelper.GetEnumCssClass(m.MessageType)
                }).ToList();

                model.Messages = messageModels;
            }

            return(model);
        }
Exemplo n.º 10
0
        public ActionResult ShowAllMessages(int type)
        {
            var                   username = Session["Username"] as string;
            BussinesLayer         bl       = new BussinesLayer(new FinalDB());
            MessagesListViewModel messagesListViewModel = new MessagesListViewModel();
            List <Messages>       messagesModel         = bl.GetMessagesByUser(username, (Utilities.MessageFilter)type);

            messagesListViewModel.List = Services.ConverterService.ToMessagesViewModel(messagesModel);
            if ((Utilities.MessageFilter)type == Utilities.MessageFilter.To)
            {
                return(View("ShowInMessages", messagesListViewModel));
            }
            else if ((Utilities.MessageFilter)type == Utilities.MessageFilter.From)
            {
                return(View("ShowOutMessages", messagesListViewModel));
            }
            else
            {
                return(new EmptyResult());
            }
        }