public string GetInfo() { Entities.People.User user = _currentUser.Get(); return(user != null ? string.Format(" by <a href=\"/Admin/User/Edit/{1}\">{0}</a>", user.Name, user.Id) : string.Empty); }
protected override bool AuthorizeCore(System.Web.HttpContextBase httpContext) { Entities.People.User currentUser = CurrentRequestData.CurrentUser; return(base.AuthorizeCore(httpContext) && currentUser != null && currentUser.IsActive && currentUser.Email != null && currentUser.Email.Equals(httpContext.User.Identity.Name, StringComparison.OrdinalIgnoreCase) && currentUser.CanAccess <AdminAccessACL>(AdminAccessACL.Allowed)); }
public int GetNotificationCount() { Entities.People.User user = CurrentRequestData.CurrentUser; IQueryOver <Notification, Notification> queryOver = _session.QueryOver <Notification>(); if (user.LastNotificationReadDate.HasValue) { queryOver = queryOver.Where(notification => notification.CreatedOn >= user.LastNotificationReadDate); } return(queryOver.RowCount()); }
public IList <NotificationModel> GetNotifications() { Entities.People.User user = CurrentRequestData.CurrentUser; IQueryOver <Notification, Notification> queryOver = _session.QueryOver <Notification>(); if (user.LastNotificationReadDate.HasValue) { queryOver = queryOver.Where(notification => notification.CreatedOn >= user.LastNotificationReadDate); } NotificationModel notificationModelAlias = null; return(queryOver.SelectList( builder => builder.Select(notification => notification.Message) .WithAlias(() => notificationModelAlias.Message) .Select(notification => notification.CreatedOn) .WithAlias(() => notificationModelAlias.DateValue)) .OrderBy(notification => notification.CreatedOn).Desc .TransformUsing(Transformers.AliasToBean <NotificationModel>()) .Take(15) .List <NotificationModel>()); }
public void MarkAllAsRead() { Entities.People.User user = _userService.GetCurrentUser(CurrentRequestData.CurrentContext); user.LastNotificationReadDate = CurrentRequestData.Now; _session.Transact(session => session.Update(user)); }