public ContractServiceCrossSite(IContractsRepository contractRepository, IRecentActivityService recentActivityService,
                                 IGroupUserService groupUserService)
 {
     _contractRepository    = contractRepository;
     _recentActivityService = recentActivityService;
     _groupUserService      = groupUserService;
 }
 public EmailRequestController(ISecurityTokenService securityTokenService, IGroupUserService groupUserService, ISupportService supportService, IGroupInvitationService groupInvitationService)
 {
     this.securityTokenService   = securityTokenService;
     this.groupUserService       = groupUserService;
     this.supportService         = supportService;
     this.groupInvitationService = groupInvitationService;
 }
Beispiel #3
0
        public void SetUp()
        {
            securityTokenRepository   = new Mock <ISecurityTokenRepository>();
            supportRepository         = new Mock <ISupportRepository>();
            groupInvitationRepository = new Mock <IGroupInvitationRepository>();
            groupUserRepository       = new Mock <IGroupUserRepository>();
            userRepository            = new Mock <IUserRepository>();
            followUserRepository      = new Mock <IFollowUserRepository>();
            //userProfileRepository=new Mock<UserProfileRepository>();

            unitOfWork = new Mock <IUnitOfWork>();

            tempData          = new Mock <TempDataDictionary>();
            controllerContext = new Mock <ControllerContext>();
            contextBase       = new Mock <HttpContextBase>();
            principal         = new Mock <IPrincipal>();
            identity          = new Mock <IIdentity>();
            httpRequest       = new Mock <HttpRequestBase>();
            httpResponse      = new Mock <HttpResponseBase>();
            genericPrincipal  = new Mock <GenericPrincipal>();

            securityTokenService   = new SecurityTokenService(securityTokenRepository.Object, unitOfWork.Object);
            groupInvitationService = new GroupInvitationService(groupInvitationRepository.Object, unitOfWork.Object);
            groupUserService       = new GroupUserService(groupUserRepository.Object, userRepository.Object, unitOfWork.Object);
            supportService         = new SupportService(supportRepository.Object, followUserRepository.Object, unitOfWork.Object);
            // userService = new UserService(userRepository.Object, unitOfWork.Object, userProfileRepository.Object);
        }
 public EmailRequestController(ISecurityTokenService securityTokenService, IGroupUserService groupUserService, ISupportService supportService, IGroupInvitationService groupInvitationService)
 {
     this.securityTokenService = securityTokenService;
     this.groupUserService = groupUserService;
     this.supportService = supportService;
     this.groupInvitationService = groupInvitationService;
 }
 public GroupController(IGroupService groupService, IGroupUserService groupUserService, IUserService userService, IResourceAttributeValueService resourceAttributeValueService)
 {
     _groupService     = groupService;
     _groupUserService = groupUserService;
     _userService      = userService;
     _resourceAttributeValueService = resourceAttributeValueService;
 }
        public void SetUp()
        {
            securityTokenRepository = new Mock<ISecurityTokenRepository>();
            supportRepository = new Mock<ISupportRepository>();
            groupInvitationRepository = new Mock<IGroupInvitationRepository>();
            groupUserRepository = new Mock<IGroupUserRepository>();
            userRepository = new Mock<IUserRepository>();
            followUserRepository = new Mock<IFollowUserRepository>();
            //userProfileRepository=new Mock<UserProfileRepository>();

            unitOfWork = new Mock<IUnitOfWork>();

            tempData = new Mock<TempDataDictionary>();
            controllerContext = new Mock<ControllerContext>();
            contextBase = new Mock<HttpContextBase>();
            principal = new Mock<IPrincipal>();
            identity = new Mock<IIdentity>();
            httpRequest = new Mock<HttpRequestBase>();
            httpResponse = new Mock<HttpResponseBase>();
            genericPrincipal = new Mock<GenericPrincipal>();

            securityTokenService = new SecurityTokenService(securityTokenRepository.Object, unitOfWork.Object);
            groupInvitationService = new GroupInvitationService(groupInvitationRepository.Object, unitOfWork.Object);
            groupUserService = new GroupUserService(groupUserRepository.Object, userRepository.Object, unitOfWork.Object);
            supportService = new SupportService(supportRepository.Object, followUserRepository.Object, unitOfWork.Object);
            // userService = new UserService(userRepository.Object, unitOfWork.Object, userProfileRepository.Object);
        }
Beispiel #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GroupController"/> class.
 /// </summary>
 /// <param name="loggerService">the logger service</param>
 /// <param name="groupService">the group service</param>
 /// <param name="groupModuleAccessService">the group module access service</param>
 /// <param name="groupUserService">the group user service</param>
 public GroupController(ILoggerService loggerService, IGroupService groupService, IGroupModuleAccessService groupModuleAccessService, IGroupUserService groupUserService)
     : base(loggerService)
 {
     this.groupService             = groupService;
     this.groupModuleAccessService = groupModuleAccessService;
     this.groupUserService         = groupUserService;
 }
Beispiel #8
0
 public AccountController(
     IGroupUserService groupUserService,
     IUserService userService
     )
 {
     _groupUserService = groupUserService;
     _userService      = userService;
 }
 public ADGroupSyncService(IGroupService groupService, IManagerUserService managerUserService, IUserService userService, IGroupUserService groupUserService, ISyncStatusService syncStatusService)
 {
     _groupService       = groupService;
     _syncStatusService  = syncStatusService;
     _userService        = userService;
     _managerUserService = managerUserService;
     _groupUserService   = groupUserService;
 }
Beispiel #10
0
 protected GroupUserFacade(
     IUnitOfWorkProvider unitOfWorkProvider,
     CrudQueryServiceBase <GroupUser, GroupUserDto, GroupUserFilterDto> service,
     IGroupUserService groupUserService
     ) : base(unitOfWorkProvider, service)
 {
     _groupUserService = groupUserService;
 }
Beispiel #11
0
 public UserRole(IUserService userService, IGroupService groupService, IGroupPermissionService groupPermissionService,
                 IGroupUserService groupUserService, IResourceService resourceService)
 {
     _userService            = userService;
     _groupService           = groupService;
     _groupPermissionService = groupPermissionService;
     _groupUserService       = groupUserService;
     _resourceService        = resourceService;
 }
 public GroupsController(
     IMapper mapper,
     IGroupService groupService,
     IGroupUserService groupUserService)
 {
     _mapper           = mapper;
     _groupService     = groupService;
     _groupUserService = groupUserService;
 }
Beispiel #13
0
 public EmployeeDirectoryController(IUserService userService,
                                    IManagerUserService managerUserService,
                                    IResourceAttributeValueService resourceAttributeValueService,
                                    IGroupService groupService,
                                    IGroupUserService groupUserService
                                    )
 {
     _userService = userService;
     _resourceAttributeValueService = resourceAttributeValueService;
     _managerUserService            = managerUserService;
     _groupUserService = groupUserService;
     _groupService     = groupService;
 }
 public MessageController(
     IMapper mapper,
     IMessageService messageService,
     IUserService userService,
     IGroupService groupService,
     IGroupUserService groupUserService)
 {
     _mapper           = mapper;
     _messageService   = messageService;
     _userService      = userService;
     _groupService     = groupService;
     _groupUserService = groupUserService;
 }
Beispiel #15
0
 public GroupGenericFacade(
     IUnitOfWorkProvider unitOfWorkProvider,
     CrudQueryServiceBase <Group, GroupDto, GroupFilterDto> service,
     IGroupService groupService,
     IGroupUserService groupUserService,
     IGetGroupUsersService getGroupUsersService,
     IPostService postService
     ) : base(unitOfWorkProvider, service)
 {
     _groupService         = groupService;
     _groupUserService     = groupUserService;
     _getGroupUsersService = getGroupUsersService;
     _postService          = postService;
 }
Beispiel #16
0
 public UserController(IHostingEnvironment hostingEnvironment,
                       IUserService userService, IResourceService resourceService,
                       IGroupUserService groupUserService, IManagerUserService managerUserService,
                       IGroupService groupService,
                       IResourceAttributeValueService resourceAttributeValueService)
 {
     _hostingEnvironment            = hostingEnvironment;
     _userService                   = userService;
     _resourceService               = resourceService;
     _resourceAttributeValueService = resourceAttributeValueService;
     _groupUserService              = groupUserService;
     _managerUserService            = managerUserService;
     _groupService                  = groupService;
 }
        private async void AsyncUpdateGroupUserInformation()
        {
            IsModelInformationBeingUpdated = true;

            ModelInformationUpdateProgress = "Loading user and group information...";

            GroupUserData = await Task.Run(() =>
            {
                IServiceFactory sf = ServiceFactoryProducer.GetServiceFactory();

                IGroupUserService iguf = sf.CreateGroupUserService();

                return(iguf.GetGroupUserDictionary());
            });

            IsModelInformationBeingUpdated = false;
        }
Beispiel #18
0
        public GroupRegistrationService(
            IBaseDAO <RoleEntity> roleDAO,
            IGroupService groupService,
            IGroupUserService groupUserService,
            IAddUserService addUserService,
            IValidator <RegisterGroupModel> registerGroupValidator,
            ILogger <GroupRegistrationService> logger)
        {
            _roleDAO = roleDAO;

            _groupService     = groupService;
            _groupUserService = groupUserService;
            _addUserService   = addUserService;

            _registerGroupValidator = registerGroupValidator;

            _logger = logger;
        }
Beispiel #19
0
 public GroupProfileFacade(IUnitOfWorkProvider unitOfWorkProvider,
                           IGroupProfileService groupProfileService,
                           IGroupUserService groupUserService,
                           IGetGroupUsersService getGroupUsersService,
                           IGroupProfilePostsService postService,
                           IGroupProfileUserService groupProfileUserService,
                           IBasicUsersService basicUsersService,
                           ICommentService commentService)
     : base(unitOfWorkProvider)
 {
     _groupProfileService     = groupProfileService;
     _groupUserService        = groupUserService;
     _getGroupUsersService    = getGroupUsersService;
     _postService             = postService;
     _groupProfileUserService = groupProfileUserService;
     _commentService          = commentService;
     _basicUsersService       = basicUsersService;
 }
 public GroupController(IGroupService groupService, IGroupUserService groupUserService, IUserService userService, IMetricService metricService, IFocusService focusService, IGroupGoalService groupgoalService, IGroupInvitationService groupInvitationService, ISecurityTokenService securityTokenService, IGroupUpdateService groupUpdateService, IGroupCommentService groupCommentService, IGoalStatusService goalStatusService, IGroupRequestService groupRequestService, IFollowUserService followUserService, IGroupCommentUserService groupCommentUserService, IGroupUpdateSupportService groupUpdateSupportService, IGroupUpdateUserService groupUpdateUserService)
 {
     this.groupService = groupService;
     this.groupInvitationService = groupInvitationService;
     this.userService = userService;
     this.groupUserService = groupUserService;
     this.metricService = metricService;
     this.focusService = focusService;
     this.groupGoalService = groupgoalService; ;
     this.securityTokenService = securityTokenService;
     this.groupUpdateService = groupUpdateService;
     this.groupCommentService = groupCommentService;
     this.goalStatusService = goalStatusService;
     this.groupRequestService = groupRequestService;
     this.followUserService = followUserService;
     this.groupCommentUserService = groupCommentUserService;
     this.groupUpdateSupportService = groupUpdateSupportService;
     this.groupUpdateUserService = groupUpdateUserService;
 }
Beispiel #21
0
 public GroupController(IGroupService groupService, IGroupUserService groupUserService, IUserService userService, IMetricService metricService, IFocusService focusService, IGroupGoalService groupgoalService, IGroupInvitationService groupInvitationService, ISecurityTokenService securityTokenService, IGroupUpdateService groupUpdateService, IGroupCommentService groupCommentService, IGoalStatusService goalStatusService, IGroupRequestService groupRequestService, IFollowUserService followUserService, IGroupCommentUserService groupCommentUserService, IGroupUpdateSupportService groupUpdateSupportService, IGroupUpdateUserService groupUpdateUserService)
 {
     this.groupService              = groupService;
     this.groupInvitationService    = groupInvitationService;
     this.userService               = userService;
     this.groupUserService          = groupUserService;
     this.metricService             = metricService;
     this.focusService              = focusService;
     this.groupGoalService          = groupgoalService;;
     this.securityTokenService      = securityTokenService;
     this.groupUpdateService        = groupUpdateService;
     this.groupCommentService       = groupCommentService;
     this.goalStatusService         = goalStatusService;
     this.groupRequestService       = groupRequestService;
     this.followUserService         = followUserService;
     this.groupCommentUserService   = groupCommentUserService;
     this.groupUpdateSupportService = groupUpdateSupportService;
     this.groupUpdateUserService    = groupUpdateUserService;
 }
Beispiel #22
0
 public HomeController(IMetricService metricService, IFocusService focusService, IGoalService goalService, ICommentService commentService, IUpdateService updateService, ISupportService supportService, IUserService userService, IGroupUserService groupUserService, IGroupService groupService, IGroupGoalService groupGoalService, IGroupUpdateService groupupdateService, IGroupCommentService groupcommentService, IFollowUserService followUserService, IGroupUpdateUserService groupUpdateUserService, IGroupCommentUserService groupCommentUserService, ICommentUserService commentUserService)
 {
     this.metricService = metricService;
     this.focusService = focusService;
     this.goalService = goalService;
     this.commentService = commentService;
     this.updateService = updateService;
     this.supportService = supportService;
     this.userService = userService;
     this.groupService = groupService;
     this.groupUserService = groupUserService;
     this.groupGoalService = groupGoalService;
     this.groupupdateService = groupupdateService;
     this.groupcommentService = groupcommentService;
     this.followUserService = followUserService;
     this.groupCommentUserService = groupCommentUserService;
     this.groupUpdateUserService = groupUpdateUserService;
     this.commentUserService = commentUserService;
 }
Beispiel #23
0
 public HomeController(IMetricService metricService, IFocusService focusService, IGoalService goalService, ICommentService commentService, IUpdateService updateService, ISupportService supportService, IUserService userService, IGroupUserService groupUserService, IGroupService groupService, IGroupGoalService groupGoalService, IGroupUpdateService groupupdateService, IGroupCommentService groupcommentService, IFollowUserService followUserService, IGroupUpdateUserService groupUpdateUserService, IGroupCommentUserService groupCommentUserService, ICommentUserService commentUserService)
 {
     this.metricService           = metricService;
     this.focusService            = focusService;
     this.goalService             = goalService;
     this.commentService          = commentService;
     this.updateService           = updateService;
     this.supportService          = supportService;
     this.userService             = userService;
     this.groupService            = groupService;
     this.groupUserService        = groupUserService;
     this.groupGoalService        = groupGoalService;
     this.groupupdateService      = groupupdateService;
     this.groupcommentService     = groupcommentService;
     this.followUserService       = followUserService;
     this.groupCommentUserService = groupCommentUserService;
     this.groupUpdateUserService  = groupUpdateUserService;
     this.commentUserService      = commentUserService;
 }
Beispiel #24
0
        public AddUserService(
            UserManager <AppUserEntity> userManager,
            SignInManager <AppUserEntity> signInManager,
            IEmailConfirmationService emailService,
            IGroupUserService groupUserService,
            IAddUserFilter addUserFilter,
            IBaseDAO <AppUserEntity> userDAO,
            IBaseDAO <InviteEntity> inviteDAO,
            IBaseDAO <RoleEntity> roleDAO,
            IOptions <IdentityUIEndpoints> identityUIEndpoints,
            IValidator <NewUserRequest> newUserValidator,
            IValidator <RegisterRequest> registerValidator,
            IValidator <AcceptInviteRequest> acceptInviteValidator,
            IValidator <ExternalLoginRegisterRequest> externalLoginRequsterRequestValidator,
            IValidator <GroupBaseUserRegisterRequest> groupBaseUserRegisterRequestValidator,
            IValidator <BaseRegisterRequest> baseRegisterValidator,
            IValidator <IUserAttributeRequest> userAttributeRequestValidator,
            ILogger <AddUserService> logger)
        {
            _userManager   = userManager;
            _signInManager = signInManager;

            _userDAO   = userDAO;
            _inviteDAO = inviteDAO;
            _roleDAO   = roleDAO;

            _emailService     = emailService;
            _groupUserService = groupUserService;
            _addUserFilter    = addUserFilter;

            _newUserValidator      = newUserValidator;
            _registerValidator     = registerValidator;
            _acceptInviteValidator = acceptInviteValidator;
            _externalLoginRequsterRequestValidator = externalLoginRequsterRequestValidator;
            _groupBaseUserRegisterRequestValidator = groupBaseUserRegisterRequestValidator;
            _userAttributeRequestValidator         = userAttributeRequestValidator;
            _baseRegisterValidator = baseRegisterValidator;

            _identityUIEndpoints = identityUIEndpoints.Value;

            _logger = logger;
        }
Beispiel #25
0
        public UserController(
            IGroupUserDataService groupUserDataService,
            IGroupUserService groupUserService,
            IManageUserService manageUserService,
            IImpersonateService impersonateService,
            IGroupAdminUserDataService groupAdminUserDataService,
            IOptions <IdentityUIClaimOptions> identityUICalimOptions,
            IOptions <IdentityUIEndpoints> identityUIEndpoints)
        {
            _groupUserDataService = groupUserDataService;
            _groupUserService     = groupUserService;

            _manageUserService  = manageUserService;
            _impersonateService = impersonateService;

            _groupAdminUserDataService = groupAdminUserDataService;

            _identityUIClaimOptions = identityUICalimOptions.Value;
            _identityUIEndpoints    = identityUIEndpoints.Value;
        }
 public GroupUserController(IGroupUserService groupUserService, IGroupUserDataService groupUserDataService)
 {
     _groupUserService     = groupUserService;
     _groupUserDataService = groupUserDataService;
 }
        public void SetUp()
        {
            groupRepository = new Mock<IGroupRepository>();
            followUserRepository = new Mock<IFollowUserRepository>();
            groupUserRepository = new Mock<IGroupUserRepository>();
            focusRepository = new Mock<IFocusRepository>();
            commentRepository = new Mock<ICommentRepository>();
            groupGoalRepository = new Mock<IGroupGoalRepository>();
            metricRepository = new Mock<IMetricRepository>();
            userRepository = new Mock<IUserRepository>();
            groupUdateRepository = new Mock<IGroupUpdateRepository>();
            updateUserRepository = new Mock<IGroupUpdateUserRepository>();
            groupCommentRepository = new Mock<IGroupCommentRepository>();
            groupCommentUserRepository = new Mock<IGroupCommentUserRepository>();
            groupInvitationRepository = new Mock<IGroupInvitationRepository>();
            groupRequestRepository = new Mock<IGroupRequestRepository>();
            goalStatusRepository = new Mock<IGoalStatusRepository>();
            userProfileRepository = new Mock<IUserProfileRepository>();
            groupUpdateSupportRepository = new Mock<IGroupUpdateSupportRepository>();
            groupUpdateUserRepository = new Mock<IGroupUpdateUserRepository>();

            unitOfWork = new Mock<IUnitOfWork>();
            controllerContext = new Mock<ControllerContext>();
            contextBase = new Mock<HttpContextBase>();
            // httpContext = new Mock<HttpContext>();
            httpRequest = new Mock<HttpRequestBase>();
            httpResponse = new Mock<HttpResponseBase>();
            genericPrincipal = new Mock<GenericPrincipal>();


            identity = new Mock<IIdentity>();
            principal = new Mock<IPrincipal>();



            groupService = new GroupService(groupRepository.Object, followUserRepository.Object, groupUserRepository.Object, unitOfWork.Object);
            focusService = new FocusService(focusRepository.Object, unitOfWork.Object);
            metricService = new MetricService(metricRepository.Object, unitOfWork.Object);
            groupgoalService = new GroupGoalService(groupGoalRepository.Object, unitOfWork.Object);
            groupUserService = new GroupUserService(groupUserRepository.Object, userRepository.Object, unitOfWork.Object);
            groupUpdateService = new GroupUpdateService(groupUdateRepository.Object, updateUserRepository.Object, groupGoalRepository.Object, unitOfWork.Object);
            groupCommentService = new GroupCommentService(groupCommentRepository.Object, groupCommentUserRepository.Object, groupUdateRepository.Object, unitOfWork.Object);
            userService = new UserService(userRepository.Object, unitOfWork.Object, userProfileRepository.Object);
            groupInvitationService = new GroupInvitationService(groupInvitationRepository.Object, unitOfWork.Object);
            groupRequestService = new GroupRequestService(groupRequestRepository.Object, unitOfWork.Object);
            groupCommentUserService = new GroupCommentUserService(groupCommentUserRepository.Object, unitOfWork.Object, userRepository.Object);
            goalStatusService = new GoalStatusService(goalStatusRepository.Object, unitOfWork.Object);
            userProfileService = new UserProfileService(userProfileRepository.Object, unitOfWork.Object);
            groupUpdateSupportService = new GroupUpdateSupportService(groupUpdateSupportRepository.Object, unitOfWork.Object);
            groupUpdateUserService = new GroupUpdateUserService(groupUpdateUserRepository.Object, unitOfWork.Object, userRepository.Object);
        }
        public IEnumerable <ApplicationUser> GetSupportersOfUpdate(int id, IUserService userService, IGroupUserService groupUserService)
        {
            var users    = new List <int>();
            var supports = _groupUpdateSupportRepository.GetMany(f => f.GroupUpdateId == id);

            foreach (var item in supports)
            {
                var user = item.GroupUserId;
                users.Add(user);
            }
            var userids  = groupUserService.GetUserIdByGroupUserId(users);
            var userlist = userService.GetUserByUserId(userids);

            return(userlist);
        }
 public bool IsUpdateSupported(int updateid, string userid, IGroupUserService groupUserService)
 {
     var groupuserid = groupUserService.GetGroupUserByuserId(userid).GroupUserId;
     return GroupUpdateSupportRepository.Get(g => g.GroupUpdateId == updateid && g.GroupUserId == groupuserid) != null;
 }
Beispiel #30
0
 public GroupService(UnitOfWork _uow, IMapper _mapper, IGroupUserService _groupUserService)
     : base(_uow, _mapper)
 {
     this.groupUserService = _groupUserService;
 }
 //public IEnumerable<GroupComment> GetCommentsOfPublicGoals()
 //{
 //    var comment = groupCommentRepository.GetMany(c => c.Goal.GoalType == false).ToList();
 //    return comment;
 //}
 //public IEnumerable<GroupComment> GetCommentsByUser(int userid)
 //{
 //    var comment = groupCommentRepository.GetMany(c => (c.UserId == userid && c.Update.Goal.GoalType == false)).OrderByDescending(c => c.CommentDate).ToList();
 //    return comment;
 //}
 public IEnumerable<GroupComment> GetTop20CommentsOfPublicGoals(string userid, IGroupUserService groupUserService)
 {
      var comment = from u in groupCommentRepository.GetAll() where (from g in groupUserService.GetGroupUsers() where g.UserId == userid select g.GroupId).ToList().Contains(u.GroupUpdate.GroupGoal.GroupUser.GroupId) select u;
   
     return comment;
 }
        public IEnumerable <GroupGoal> GetTop20GroupsGoals(string userid, IGroupUserService groupUserService)
        {
            var goals = from g in GroupGoalRepository.GetAll() where (from gu in groupUserService.GetGroupUsers() where gu.UserId == userid select gu.GroupId).ToList().Contains(g.GroupUser.GroupId) select g;

            return(goals);
        }
        //public IEnumerable<GroupUpdate> GetUpdatesForaUser(int userid)
        //{
        //    var updates = groupUpdateRepository.GetMany(u => (u.GroupGoal.UserId == userid && u.GroupGoal.GoalType == false)).OrderByDescending(u => u.UpdateDate).ToList(); ;
        //    return updates;
        //}

        public IEnumerable<GroupUpdate> GetTop20Updates(string userid, IGroupUserService groupUserService)
        {
            var updates = from u in groupUpdateRepository.GetAll() where (from g in groupUserService.GetGroupUsers() where g.UserId == userid select g.GroupId).ToList().Contains(u.GroupGoal.GroupUser.GroupId) select u;
            return updates;
        }
        internal IEnumerable<NotificationsViewModel> GetNotifications(string userId, IGoalService goalService, ICommentService commentService, IUpdateService updateService, ISupportService supportService, IUserService userService, IGroupService groupService, IGroupUserService groupUserSevice, IGroupGoalService groupGoalService, IGroupCommentService groupcommentService, IGroupUpdateService groupupdateService, IFollowUserService followUserService, IGroupCommentUserService groupCommentUserService, ICommentUserService commentUserService, IGroupUpdateUserService groupUpdateUserService)
        {
            var goals = goalService.GetTop20GoalsofFollowing(userId);
            var comments = commentService.GetTop20CommentsOfPublicGoalFollwing(userId);
            var updates = updateService.GetTop20UpdatesOfFollowing(userId);
            var groupusers = groupUserSevice.GetTop20GroupsUsers(userId);
            var supports = supportService.GetTop20SupportsOfFollowings(userId);
            var groupgoals = groupGoalService.GetTop20GroupsGoals(userId, groupUserSevice);
            var groupupdates = groupupdateService.GetTop20Updates(userId, groupUserSevice);
            var groupComments = groupcommentService.GetTop20CommentsOfPublicGoals(userId, groupUserSevice);
            var followers = followUserService.GetTop20Followers(userId);
            // var groups = groupService.GetTop20Groups(groupids);

            return (from g in goals
                    select new NotificationsViewModel()
                    {
                        GoalId = g.GoalId,
                        UserId = g.UserId,
                        CreatedDate = g.CreatedDate,
                        UserName = g.User.UserName,
                        GoalName = g.GoalName,
                        Desc = g.Desc,
                        ProfilePicUrl = g.User.ProfilePicUrl,
                        Goal = g,
                        NotificationDate = DateCalculation(g.CreatedDate),
                        NotificationType = (int)NotificationType.createdGoal
                    })
                    .Concat(from c in comments
                            select new NotificationsViewModel()
                            {
                                CommentId = c.CommentId,
                                CreatedDate = c.CommentDate,
                                CommentText = c.CommentText,
                                UpdateId = c.UpdateId,
                                GoalName = c.Update.Goal.GoalName,
                                GoalId = c.Update.GoalId,
                                NumberOfComments = commentService.GetCommentsByUpdate(c.UpdateId).Count(),
                                Updatemsg = updateService.GetUpdate(c.UpdateId).Updatemsg,
                                NotificationDate = DateCalculation(c.CommentDate),
                                UserName = commentUserService.GetUser(c.CommentId).UserName,
                                UserId = commentUserService.GetUser(c.CommentId).Id,
                                ProfilePicUrl = commentUserService.GetUser(c.CommentId).ProfilePicUrl,

                                NotificationType = (int)NotificationType.commentedOnUpdate
                            })
                    .Concat(from u in updates
                            select new NotificationsViewModel()
                            {
                                Update = u,
                                UpdateId = u.UpdateId,
                                GoalId = u.GoalId,
                                ProfilePicUrl = u.Goal.User.ProfilePicUrl,
                                GoalName = u.Goal.GoalName,
                                Updatemsg = u.Updatemsg,
                                UserId = u.Goal.UserId,
                                UserName = u.Goal.User.UserName,
                                NumberOfComments = commentService.GetCommentsByUpdate(u.UpdateId).Count(),
                                CreatedDate = u.UpdateDate,
                                NotificationDate = DateCalculation(u.UpdateDate),
                                NotificationType = (int)NotificationType.updatedGoal
                            })
                    .Concat(from gr in groupgoals
                            select new NotificationsViewModel()
                            {

                                GroupGoalId = gr.GroupGoalId,
                                CreatedDate = gr.CreatedDate,

                                UserId = gr.GroupUser.UserId,
                                UserName = userService.GetUser(gr.GroupUser.UserId).UserName,
                                ProfilePicUrl = userService.GetUser(gr.GroupUser.UserId).ProfilePicUrl,

                                GroupName = gr.Group.GroupName,
                                GroupGoalName = gr.GoalName,
                                GroupId = gr.GroupId,
                                NotificationDate = DateCalculation(gr.CreatedDate),
                                NotificationType = (int)NotificationType.createGroup

                            })
                    .Concat(from gu in groupusers
                            select new NotificationsViewModel()
                            {
                                GroupUser = gu,
                                GroupUserId = gu.GroupUserId,

                                UserId = gu.UserId,
                                UserName = userService.GetUser(gu.UserId).UserName,
                                ProfilePicUrl = userService.GetUser(gu.UserId).ProfilePicUrl,

                                GroupName = groupService.GetGroup(gu.GroupId).GroupName,
                                GroupId = gu.GroupId,
                                CreatedDate = gu.AddedDate,
                                NotificationDate = DateCalculation(gu.AddedDate),
                                NotificationType = (int)NotificationType.joinGroup
                            })
                    .Concat(from s in supports
                            select new NotificationsViewModel()
                            {
                                Support = s,
                                SupportId = s.SupportId,
                                GoalName = s.Goal.GoalName,

                                ProfilePicUrl = userService.GetUser(s.UserId).ProfilePicUrl,
                                UserName = userService.GetUser(s.UserId).UserName,
                                UserId = s.UserId,
                                CreatedDate = s.SupportedDate,
                                GoalId = s.GoalId,
                                NotificationDate = DateCalculation(s.SupportedDate),
                                NotificationType = (int)NotificationType.supportGoal
                            })
                    .Concat(from gu in groupupdates
                            select new NotificationsViewModel()
                            {
                                GroupUpdate = gu,
                                GroupUpdateId = gu.GroupUpdateId,
                                GroupUpdatemsg = gu.Updatemsg,

                                UserId = groupUpdateUserService.GetGroupUpdateUser(gu.GroupUpdateId).Id,
                                ProfilePicUrl = groupUpdateUserService.GetGroupUpdateUser(gu.GroupUpdateId).ProfilePicUrl,
                                UserName = groupUpdateUserService.GetGroupUpdateUser(gu.GroupUpdateId).UserName,
                                NotificationDate = DateCalculation(gu.UpdateDate),
                                CreatedDate = gu.UpdateDate,
                                GroupGoalId = gu.GroupGoalId,
                                GroupId = gu.GroupGoal.GroupId,
                                GroupGoalName = gu.GroupGoal.GoalName,
                                GroupName = gu.GroupGoal.Group.GroupName,
                                NotificationType = (int)NotificationType.updatedGroupgoal

                            })
                    .Concat(from gc in groupComments
                            select new NotificationsViewModel()
                            {

                                GroupCommentId = gc.GroupCommentId,
                                GroupCommentText = gc.CommentText,
                                GroupUpdateId = gc.GroupUpdateId,

                                GroupGoalId = gc.GroupUpdate.GroupGoalId,
                                GroupGoalName = gc.GroupUpdate.GroupGoal.GoalName,

                                UserId = groupCommentUserService.GetGroupCommentUser(gc.GroupCommentId).Id,
                                UserName = groupCommentUserService.GetGroupCommentUser(gc.GroupCommentId).UserName,
                                ProfilePicUrl = groupCommentUserService.GetGroupCommentUser(gc.GroupCommentId).ProfilePicUrl,

                                GroupUpdatemsg = gc.GroupUpdate.Updatemsg,
                                GroupId = gc.GroupUpdate.GroupGoal.GroupUser.GroupId,
                                GroupName = gc.GroupUpdate.GroupGoal.Group.GroupName,
                                NotificationDate = DateCalculation(gc.CommentDate),
                                CreatedDate = gc.CommentDate,
                                NotificationType = (int)NotificationType.commentedonGroupUdate
                            })
                    .Concat(from f in followers
                            select new NotificationsViewModel()
                            {
                                FollowUserId = f.FollowUserId,
                                FromUser = f.FromUser,
                                ToUser = f.ToUser,
                                ProfilePicUrl = f.FromUser.ProfilePicUrl,
                                FromUserId = f.FromUserId,
                                ToUserId = f.ToUserId,
                                CreatedDate = f.AddedDate,
                                NotificationDate = DateCalculation(f.AddedDate),
                                NotificationType = (int)NotificationType.followUser
                            }).OrderByDescending(n => n.CreatedDate);
        }
        public IEnumerable<ApplicationUser> GetSupportersOfUpdate(int id, IUserService userService, IGroupUserService groupUserService)
        {

            List<int> users = new List<int> { };
            var supports = GroupUpdateSupportRepository.GetMany(f => f.GroupUpdateId == id);
            foreach (var item in supports)
            {
                var user = item.GroupUserId;
                users.Add(user);
            }
            var userids= groupUserService.GetUserIdByGroupUserId(users);
            var userlist = userService.GetUserByUserId(userids);
            return userlist;
               
        }
        //public IEnumerable<GroupUpdate> GetUpdatesForaUser(int userid)
        //{
        //    var updates = groupUpdateRepository.GetMany(u => (u.GroupGoal.UserId == userid && u.GroupGoal.GoalType == false)).OrderByDescending(u => u.UpdateDate).ToList(); ;
        //    return updates;
        //}

        public IEnumerable <GroupUpdate> GetTop20Updates(string userid, IGroupUserService groupUserService)
        {
            var updates = from u in groupUpdateRepository.GetAll() where (from g in groupUserService.GetGroupUsers() where g.UserId == userid select g.GroupId).ToList().Contains(u.GroupGoal.GroupUser.GroupId) select u;

            return(updates);
        }
Beispiel #37
0
 public ConnectedUsersService(IUnitOfWork unitOfWork, IGroupService groupService, IGroupUserService groupUserService)
 {
     _database             = unitOfWork;
     this.groupService     = groupService;
     this.groupUserService = groupUserService;
 }
        internal IEnumerable<NotificationsViewModel> GetProfileNotifications(string userid, IGoalService goalService, ICommentService commentService, IUpdateService updateService, ISupportService supportService, IUserService userService, IGroupService groupService, IGroupUserService groupUserSevice, IGroupGoalService groupGoalService, IGroupCommentService groupcommentService, IGroupUpdateService groupupdateService, ICommentUserService commentUserService)
        {
            var goals = goalService.GetTop20Goals(userid);
            var comments = commentService.GetTop20CommentsOfPublicGoals(userid);
            var updates = updateService.GetTop20Updates(userid);
            var groupusers = groupUserSevice.GetTop20GroupsUsersForProfile(userid);
            var supports = supportService.GetTop20Support(userid);

            return (from g in goals
                    select new NotificationsViewModel()
                    {
                        GoalId = g.GoalId,
                        UserId = g.UserId,
                        CreatedDate = g.CreatedDate,
                        UserName = g.User.UserName,
                        GoalName = g.GoalName,
                        Desc = g.Desc,
                        ProfilePicUrl = g.User.ProfilePicUrl,
                        Goal = g,
                        NotificationDate = DateCalculation(g.CreatedDate),
                        NotificationType = (int)NotificationType.createdGoal
                    })
                    .Concat(from c in comments
                            select new NotificationsViewModel()
                            {
                                CommentId = c.CommentId,
                                CreatedDate = c.CommentDate,

                                UserName = commentUserService.GetUser(c.CommentId).UserName,
                                UserId = commentUserService.GetUser(c.CommentId).Id,
                                ProfilePicUrl = commentUserService.GetUser(c.CommentId).ProfilePicUrl,

                                CommentText = c.CommentText,
                                UpdateId = c.UpdateId,
                                GoalName = c.Update.Goal.GoalName,
                                GoalId = c.Update.GoalId,
                                NumberOfComments = commentService.GetCommentsByUpdate(c.UpdateId).Count(),
                                Updatemsg = updateService.GetUpdate(c.UpdateId).Updatemsg,
                                NotificationDate = DateCalculation(c.CommentDate),
                                NotificationType = (int)NotificationType.commentedOnUpdate
                            })
                    .Concat(from u in updates
                            select new NotificationsViewModel()
                            {
                                Update = u,
                                UpdateId = u.UpdateId,
                                GoalId = u.GoalId,
                                ProfilePicUrl = u.Goal.User.ProfilePicUrl,
                                GoalName = u.Goal.GoalName,
                                Updatemsg = u.Updatemsg,
                                UserId = u.Goal.UserId,
                                UserName = u.Goal.User.UserName,
                                NumberOfComments = commentService.GetCommentsByUpdate(u.UpdateId).Count(),
                                CreatedDate = u.UpdateDate,
                                NotificationDate = DateCalculation(u.UpdateDate),
                                NotificationType = (int)NotificationType.updatedGoal
                            })
                    .Concat(from s in supports
                            select new NotificationsViewModel()
                            {
                                Support = s,
                                SupportId = s.SupportId,
                                GoalName = s.Goal.GoalName,

                                ProfilePicUrl = userService.GetUser(s.UserId).ProfilePicUrl,
                                UserName = userService.GetUser(s.UserId).UserName,
                                UserId = s.UserId,

                                CreatedDate = s.SupportedDate,
                                GoalId = s.GoalId,
                                NotificationType = (int)NotificationType.supportGoal
                            })
                    .Concat(from gu in groupusers
                            select new NotificationsViewModel()
                            {
                                GroupUser = gu,

                                GroupUserId = gu.GroupUserId,

                                UserName = userService.GetUser(gu.UserId).UserName,
                                ProfilePicUrl = userService.GetUser(gu.UserId).ProfilePicUrl,
                                UserId = gu.UserId,

                                GroupName = groupService.GetGroup(gu.GroupId).GroupName,
                                GroupId = gu.GroupId,
                                CreatedDate = gu.AddedDate,
                                NotificationDate = DateCalculation(gu.AddedDate),
                                NotificationType = (int)NotificationType.joinGroup
                            })
                                                        .OrderByDescending(n => n.CreatedDate);
        }
        public bool IsUpdateSupported(int updateid, string userid, IGroupUserService groupUserService)
        {
            var groupuserid = groupUserService.GetGroupUserByuserId(userid).GroupUserId;

            return(_groupUpdateSupportRepository.Get(g => g.GroupUpdateId == updateid && g.GroupUserId == groupuserid) != null);
        }
Beispiel #40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GroupUserController"/> class.
 /// </summary>
 /// <param name="loggerService">the logger service</param>
 /// <param name="groupUserService">the group user service</param>
 public GroupUserController(ILoggerService loggerService, IGroupUserService groupUserService)
     : base(loggerService)
 {
     this.groupUserService = groupUserService;
 }
        //public IEnumerable<GroupComment> GetCommentsOfPublicGoals()
        //{
        //    var comment = groupCommentRepository.GetMany(c => c.Goal.GoalType == false).ToList();
        //    return comment;
        //}
        //public IEnumerable<GroupComment> GetCommentsByUser(int userid)
        //{
        //    var comment = groupCommentRepository.GetMany(c => (c.UserId == userid && c.Update.Goal.GoalType == false)).OrderByDescending(c => c.CommentDate).ToList();
        //    return comment;
        //}
        public IEnumerable <GroupComment> GetTop20CommentsOfPublicGoals(string userid, IGroupUserService groupUserService)
        {
            var comment = from u in groupCommentRepository.GetAll() where (from g in groupUserService.GetGroupUsers() where g.UserId == userid select g.GroupId).ToList().Contains(u.GroupUpdate.GroupGoal.GroupUser.GroupId) select u;

            return(comment);
        }
 public IEnumerable<GroupGoal> GetTop20GroupsGoals(string userid, IGroupUserService groupUserService)
 {
     var goals = from g in GroupGoalRepository.GetAll() where (from gu in groupUserService.GetGroupUsers() where gu.UserId == userid select gu.GroupId).ToList().Contains(g.GroupUser.GroupId) select g;
     return goals;
 }