public async Task <IHttpActionResult> GetNotifications(int UserId, int SignInType) { try { using (SkriblContext ctx = new SkriblContext()) { NotificationsViewModel notificationsViewModel = new NotificationsViewModel(); if (SignInType == (int)RoleTypes.User) { notificationsViewModel.Notifications = ctx.Notifications.Where(x => x.User_ID.HasValue && x.User_ID.Value == UserId && x.Status == 0).ToList(); } else if (SignInType == (int)RoleTypes.Deliverer) { notificationsViewModel.Notifications = ctx.Notifications.Where(x => x.DeliveryMan_ID.HasValue && x.DeliveryMan_ID.Value == UserId && x.Status == 0).ToList(); } CustomResponse <NotificationsViewModel> response = new CustomResponse <NotificationsViewModel> { Message = Global.ResponseMessages.Success, StatusCode = (int)HttpStatusCode.OK, Result = notificationsViewModel }; return(Ok(response)); } } catch (Exception ex) { return(StatusCode(Utility.LogError(ex))); } }
public async Task <IActionResult> Index() { var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier); var userNotifications = await _context.UsersNotifications.Where(u => u.ReceptorTeamId == userId).ToListAsync(); List <NotificationsViewModel> notificationViews = new List <NotificationsViewModel>(); foreach (UsersNotifications userNotification in userNotifications) { var notification = _context.Notifications.Where(n => n.Id == userNotification.NotificationId).First(); var teamDeliver = _authDbContext.Users.Where(u => u.Id == userNotification.DeliverTeamId).First(); var notificationView = new NotificationsViewModel { Content = notification.Content, TeamName = teamDeliver.TeamName, Id = userNotification.Id }; notificationViews.Add(notificationView); } ViewBag.Notifications = notificationViews; return(View(await _context.UsersNotifications.Where(u => u.ReceptorTeamId == userId).ToListAsync())); }
public TeamNotifications() { InitializeComponent(); teamNotifications = new NotificationsViewModel(this.Navigation); teamNotifications.PropertyChanged += NotificationsViewModel_PropertyChanged; this.BindingContext = teamNotifications; }
public void SetReferenceToViewModel(NotificationsViewModel notificationsViewModel) { this.vm = notificationsViewModel; this.vm.Notifications = Repository.Instance.NotificationsMessages; this.vm.NotifyOfPropertyChange(() => this.vm.Notifications); }
public NotificationsViewModel GetNotificationssPreparedPage(string userId) { var model = new NotificationsViewModel(); var returnModel = this.GetNotificationssChangePage(model, userId); return(returnModel); }
public async Task <IActionResult> Notifications(NotificationsViewModel model) { var user = await _userManager.GetUserAsync(User); if (!ModelState.IsValid) { return(RedirectToAction(nameof(Notifications))); } if (user.EmailConfirmed) { user.EmailNotificationsEnabled = model.EmailNotEnabled; } else if (!user.EmailConfirmed && model.EmailNotEnabled) { ModelState.AddModelError("EmailNotEnabled", "Confirm Email first to recieve notifications"); model.EmailNotEnabled = false; user.EmailNotificationsEnabled = false; } if (user.PhoneNumberConfirmed) { user.SmsNotificationsEnabled = model.SmsNotEnabled; } else if (!user.PhoneNumberConfirmed && model.SmsNotEnabled) { ModelState.AddModelError("EmailNotEnabled", "Confirm phone number first to recieve SMS-notifications"); model.SmsNotEnabled = false; user.SmsNotificationsEnabled = false; } await _userManager.UpdateAsync(user); return(View(model)); }
private DesktopApplication(DesktopApplicationController applicationController, IApplicationOptions applicationOptions, ISettingsManager settingsManager, NotificationsViewModel notifications) : base(applicationController, applicationOptions, settingsManager) { ApplicationController = applicationController; ApplicationOptions = applicationOptions; Notifications = notifications; }
private void Deny_Click(object sender, RoutedEventArgs e) { Button btn = (Button)e.OriginalSource; Notification not = (Notification)btn.CommandParameter; NotificationsViewModel vm = DataContext as NotificationsViewModel; vm.DenyNotification(not); }
public IViewComponentResult Invoke() { var model = new NotificationsViewModel(); model.IsInventoryLow = _inventoryUsesData.IsInventoryLow().Result; model.IsDistributable = _inventoryUsesData.IsDistributable().Result; return(View("Notifications", model)); }
public IActionResult NotificationsChangePage(NotificationsViewModel model, int id) { this.StartUp(); var returnModel = this.notificationService.GetNotificationsChangePage(model, this.userId, id); this.StartUp(); return(this.View("Index", returnModel)); }
public IActionResult Index(string UserId) { NotificationsViewModel notificationsViewModel = new NotificationsViewModel() { Notifications = _notificationRepository.GetAllNotifications(UserId) }; return(View(notificationsViewModel)); }
public NotificationsViewModel GetNotificationsChangePage(NotificationsViewModel model, string userId, int pageIndex) { var notifications = this.context.Notifications .Where(m => m.DeletedOn == null && m.UserId == userId) .OrderBy(m => m.SeenOn) .ThenByDescending(m => m.CreatedOn) .Select(m => new NotificationViewModel() { Id = m.Id, CreatedOn = m.CreatedOn, TextOfNotification = m.TextOfNotification, SeenOn = m.SeenOn, }) .ToList(); var seenChacker = notifications.FirstOrDefault(m => m.SeenOn == null); if (seenChacker != null) { notifications = notifications.OrderBy(m => m.SeenOn) .ThenByDescending(m => m.CreatedOn).ToList(); } else { notifications = notifications.OrderByDescending(m => m.CreatedOn).ToList(); } int countBooksOfPage = model.CountNotificationsOfPage; int currentPage = pageIndex; int maxCountPage = notifications.Count() / countBooksOfPage; if (notifications.Count() % countBooksOfPage != 0) { maxCountPage++; } var viewNotifications = notifications.Skip((currentPage - 1) * countBooksOfPage) .Take(countBooksOfPage).ToList(); foreach (var notification in viewNotifications) { var notificationContext = this.context.Notifications.FirstOrDefault(m => m.Id == notification.Id); notificationContext.SeenOn = DateTime.UtcNow; this.context.SaveChanges(); } var result = new NotificationsViewModel() { Notifications = viewNotifications, CountNotificationsOfPage = countBooksOfPage, MaxCountPage = maxCountPage, }; return(result); }
public async Task SendNotificationsToUser(NotificationsViewModel notification) { var user = await UserManager.FindByIdAsync(notification.UserId); //string userid = Context.UserIdentifier; //var claims = new Claim(ClaimTypes.NameIdentifier, userid).Value; var claimss = new Claim(ClaimTypes.NameIdentifier, user.Id).Value; //await Clients.User(claims).SendAsync("ReceiveMessage", message.UserName, message); await Clients.User(claimss).SendAsync("RecieveNotification", notification); }
public NotificationsViewModel GetAllNotifications(Guid userProfileId) { var result = new NotificationsViewModel() { Notifications = _notificationService.GetNewNotifications(userProfileId), NotificationCount = _notificationService.GetUnseenNotificationsCount(userProfileId) }; return(result); }
public NotificationsPage() { BindingContext = App.Locator.Notification; _viewModel = BindingContext as NotificationsViewModel; _notificationSearchBar = new SearchBar() { }; _notificationSearchBar.SetBinding(SearchBar.TextProperty,"TEXT"); _notificationSearchBar.SetBinding(SearchBar.SearchCommandProperty,"SearchCommand" ); }
private async void LoadData() { await(BindingContext as TopicosViewModel).GetAllTopicos(); listView.ItemsSource = (BindingContext as TopicosViewModel).Topicos; // Agora vou preencher a lista de notificações - ela é estática // está localizada no NotificationRepository, mas é chamada a partir // da View Model (NotificationsViewModel.cs) var notificationsVM = new NotificationsViewModel(); await notificationsVM.GetAllNotifications(); }
public NotificationsViewModel GetNotificationsCounter() { var notifications = notificationRepository.GetNotificationsCounter(); NotificationsViewModel counts = new NotificationsViewModel(); if (notifications != null && notifications.Tables.Count > 0) { counts.NewAddedUsersCount = Convert.ToInt32(notifications.Tables[0].Rows[0]["TotalNewUsers"]); } return(counts); }
public async Task <IActionResult> Notifications() { var user = await _userManager.GetUserAsync(User); var model = new NotificationsViewModel() { SmsNotEnabled = user.SmsNotificationsEnabled, EmailNotEnabled = user.EmailNotificationsEnabled }; return(View(model)); }
public PartialViewResult Notifications() { //Currently logged in userID string userID = User.Identity.GetUserId(); //Call me old school, but I love me a good ol fashioned sql query. This one will generate the list of notifications for a given userID. List <NotificationsViewModel> notifylist = NotificationsViewModel.GetNotifications(userID); //db.Notifications.SqlQuery("SELECT * FROM Notifications WHERE UserID=@p0", userID).ToList() return(PartialView("_Notifications", notifylist)); }
//GET Notifications public ActionResult Notification() { NotificationsViewModel notification = new NotificationsViewModel(); if (User.Identity.IsAuthenticated) { var userId = User.Identity.GetUserId(); notification.Notifs = db.TicketNotifications.Where(t => t.RecipientUserId == userId).Where(r => r.HasBeenRead == false).ToList(); } return(View(notification)); }
public static DesktopApplication Create(string applicatonName) { var controller = new DesktopApplicationController(applicatonName, new DependencyContainer()); controller.RegisterType <IDialogController, DialogController>(); var options = new ApplicationOptionsViewModel(controller); var settingsManager = new DesktopSettingsManager(controller); var notifications = new NotificationsViewModel(controller); controller.RegisterInstance(notifications); return(new DesktopApplication(controller, options, settingsManager, notifications)); }
public async Task <IActionResult> Index() { var notificationsResponse = await _relogifyActorModel.NotificationActor .Ask <GetNotificationsResponse>(new GetNotificationsMessage()); var notificationsViewModel = new NotificationsViewModel { Notifications = notificationsResponse.Notifications }; return(View(notificationsViewModel)); }
public async Task <IActionResult> Notifications() { // Retrieves the user User user = await _repository.GetUserAsync(User); // Creates model and returns view NotificationsViewModel model = new NotificationsViewModel() { Notifications = user.Notifications.OrderByDescending(x => x.DateCreated) }; return(View(model)); }
public static void Init(IKernel kernel) { AutoVersionsDBSettings setting = new AutoVersionsDBSettings(@"[CommonApplicationData]\AutoVersionsDB.IntegrationTests"); kernel.Bind <AutoVersionsDBSettings>().ToConstant(setting); MockConsoleError = new Mock <IStandardStreamWriter>(); MockConsoleOut = new Mock <IStandardStreamWriter>(); MockConsole = new Mock <IConsoleExtended>(); MockConsole.Setup(m => m.Error).Returns(MockConsoleError.Object); MockConsole.Setup(m => m.Out).Returns(MockConsoleOut.Object); kernel.Bind <IConsoleExtended>().ToConstant(MockConsole.Object); ConsoleProcessMessages internalConsoleProcessMessages = kernel.Get <ConsoleProcessMessages>(); MockConsoleProcessMessages = new Mock <ConsoleProcessMessagesForTests>(MockBehavior.Strict, internalConsoleProcessMessages); kernel.Rebind <IConsoleProcessMessages>().ToConstant(MockConsoleProcessMessages.Object); NotificationsViewModel internalNotificationsViewModel = kernel.Get <NotificationsViewModel>(); MockNotificationsViewModel = new Mock <NotificationsViewModelForTests>(MockBehavior.Strict, internalNotificationsViewModel); kernel.Rebind <INotificationsViewModel>().ToConstant(MockNotificationsViewModel.Object); DBVersionsViewSateManager internalDBVersionsViewSateManager = kernel.Get <DBVersionsViewSateManager>(); MockDBVersionsViewSateManagerFotTests = new Mock <DBVersionsViewSateManagerForTests>(MockBehavior.Strict, internalDBVersionsViewSateManager); kernel.Rebind <IDBVersionsViewSateManager>().ToConstant(MockDBVersionsViewSateManagerFotTests.Object); EditProjectViewSateManager internalEditProjectViewSateManager = kernel.Get <EditProjectViewSateManager>(); MockEditProjectViewSateManagerFotTests = new Mock <EditProjectViewSateManagerForTests>(MockBehavior.Strict, internalEditProjectViewSateManager); kernel.Rebind <IEditProjectViewSateManager>().ToConstant(MockEditProjectViewSateManagerFotTests.Object); MockOsProcessUtils = new Mock <OsProcessUtils>(); kernel.Bind <OsProcessUtils>().ToConstant(MockOsProcessUtils.Object); MockOsProcessUtils .Setup(m => m.StartOsProcess(It.IsAny <string>())) .Callback <string>((filename) => { //Do nothing }); UIGeneralEvents.OnException += UIGeneralEvents_OnException; }
public NotificationsViewController() { SearchPlaceholder = "Search Notifications".t(); NoItemsText = "No Notifications".t(); Title = "Notifications".t(); ViewModel = new NotificationsViewModel(); _viewSegment = new UISegmentedControl(new string[] { "Unread".t(), "Participating".t(), "All".t() }); _viewSegment.ControlStyle = UISegmentedControlStyle.Bar; _segmentBarButton = new UIBarButtonItem(_viewSegment); BindCollection(ViewModel.Notifications, CreateElement); ViewModel.Bind(x => x.IsLoading, Loading); }
// GET: Notifications public async Task <IActionResult> Index() { var user = await _userManager.GetUserAsync(User); if (user == null) { return(RedirectToAction(nameof(AccountController.Login), "Account")); } var model = new NotificationsViewModel(); model.Notificaciones = _empleadosData.GetNotifications(); return(View(model)); }
public async Task <IViewComponentResult> InvokeAsync() { var user = await _userManager.GetUserAsync(HttpContext.User); var userId = user.Id; var items = await this.notificationService.GetItemsAsync(userId); var model = new NotificationsViewModel() { NotificationsViewModels = items.Select(n => new NotificationViewModel(n)) }; return(View(model)); }
public async Task <IActionResult> Notifications() { var userId = User.GetClaim <int>(ClaimType.Id); var notificationSettings = await _userService.GetNotificationSettings(userId); var vapid = _configuration.GetValue <string>("VAPID_PUBLIC"); var model = new NotificationsViewModel { NotificationSettings = notificationSettings, VapidPublic = vapid }; return(View(model)); }
void NotifyWhenUserHasAnswered() { NotificationsViewModel PinkNotifier = new NotificationsViewModel(PinkUser, ClassificationPanelViewModelTests.MockClassificationPanel()); PinkUser.Active = true; _viewModel.OnSubjectStatusChange(true); _viewModel.ReceivedNewSubject(PanoptesServiceMockData.TableSubject()); _viewModel.NotifyUser.Execute(PinkUser); PinkNotifier.AcceptGalaxy.Execute(null); PinkNotifier.HandleAnswer(PanoptesServiceMockData.CompletedClassification()); Assert.NotNull(_viewModel.Overlay); Assert.Equal("Check it out,", _viewModel.Overlay.MessageOne); Assert.Equal("made a classification!", _viewModel.Overlay.MessageTwo); Assert.NotNull(_viewModel.NotificationPanel); Assert.Equal(NotificationPanelStatus.ShowAnswer, _viewModel.NotificationPanel.Status); }
/********************************* added by Tarek Alaaddin - to set up the notification profile ******************/ // GET: /Manage/ManageNotifications public async Task <ActionResult> ManageNotifications() { var user = await UserManager.FindByIdAsync(User.Identity.GetUserId()); var viewModel = new NotificationsViewModel() { ReceiveEmailReminders = user.ReceiveEmailReminders, ReceiveInspirationalReminders = user.ReceiveInspirationalReminders, ReceiveNewsletter = user.ReceiveNewsletter, ReceiveTextMessagesReminders = user.ReceiveTextMessagesReminders }; //return View("CustomerForm", viewModel); return(View("ManageNotifications", viewModel)); }
public GithubTask(TasksViewModel tasks, NotificationsViewModel notifications, SettingsViewModel settings) { this.Tasks = tasks; this.Notifications = notifications; this.Settings = settings; }
public NotificationsView(NotificationsViewModel viewModel) { InitializeComponent(); Model = viewModel; }