コード例 #1
0
ファイル: MembersController.cs プロジェクト: formist/LinkMe
        public ActionResult Newsletter(CommunicationsContext context)
        {
            var member = _membersQuery.GetMember(context.UserId);

            if (member == null || !member.IsEnabled || !member.IsActivated)
            {
                return(HttpNotFound());
            }

            var candidate = _candidatesQuery.GetCandidate(context.UserId);
            var resume    = candidate.ResumeId == null ? null : _resumesQuery.GetResume(candidate.ResumeId.Value);

            var model = CreateModel <NewsletterModel>(context);

            model.Member    = member;
            model.Candidate = candidate;
            model.Resume    = resume;

            var lastMonth = new DateTimeRange(DateTime.Today.AddMonths(-1), DateTime.Today);

            model.TotalJobAds            = _jobAdReportsQuery.GetCreatedJobAds(lastMonth);
            model.TotalViewed            = _employerMemberAccessReportsQuery.GetMemberViewings(context.UserId, lastMonth);
            model.ProfilePercentComplete = _memberStatusQuery.GetPercentComplete(member, candidate, resume);
            var execution = _executeJobAdSearchCommand.SearchSuggested(member, null, new Range(0, MaxSuggestedJobCount));

            var jobAds = _jobAdsQuery.GetJobAds <JobAd>(execution.Results.JobAdIds).ToDictionary(j => j.Id, j => j);

            model.SuggestedJobs = (from i in execution.Results.JobAdIds
                                   where jobAds.ContainsKey(i)
                                   select jobAds[i]).ToList();

            return(View(model));
        }
コード例 #2
0
ファイル: DataTests.cs プロジェクト: formist/LinkMe
        private FeaturedStatistics GetFeaturedStatistics()
        {
            var today     = DateTime.Today;
            var dateRange = new DateRange(today.AddDays(-7), today);

            return(new FeaturedStatistics
            {
                CreatedJobAds = _jobAdReportsQuery.GetCreatedJobAds(dateRange),
                Members = _accountReportsQuery.GetUsers(UserType.Member, DateTime.Now),
                MemberSearches = _searchReportsQuery.GetAllMemberSearches(dateRange),
                MemberAccesses = _employerMemberAccessReportsQuery.GetMemberAccesses(dateRange)
            });
        }
コード例 #3
0
        private void UpdateFeaturedStatistics(int days)
        {
            var today     = DateTime.Today;
            var dateRange = new DateRange(today.AddDays(-1 * days), today);

            var statistics = new FeaturedStatistics
            {
                CreatedJobAds  = _jobAdReportsQuery.GetCreatedJobAds(dateRange),
                Members        = _accountReportsQuery.GetUsers(UserType.Member, DateTime.Now),
                MemberSearches = _memberSearchReportsQuery.GetAllMemberSearches(dateRange),
                MemberAccesses = _employerMemberAccessReportsQuery.GetMemberAccesses(dateRange)
            };

            _featuredCommand.UpdateFeaturedStatistics(statistics);
        }