public ActionResult Reengagement(CommunicationsContext context) { var member = _membersQuery.GetMember(context.UserId); if (member == null) { return(HttpNotFound()); } var candidate = _candidatesQuery.GetCandidate(context.UserId); var resume = candidate.ResumeId == null ? null : _resumesQuery.GetResume(candidate.ResumeId.Value); var model = CreateModel <ReengagementModel>(context); model.Member = member; model.Candidate = candidate; if (!member.IsActivated) { // Create a new activation if needed. var emailAddress = member.GetBestEmailAddress().Address; var emailVerification = _emailVerificationsQuery.GetEmailVerification(member.Id, emailAddress); if (emailVerification == null) { emailVerification = new EmailVerification { EmailAddress = emailAddress, UserId = member.Id }; _emailVerificationsCommand.CreateEmailVerification(emailVerification); } model.ActivationCode = emailVerification.VerificationCode; } 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(); model.JobSearch = GetJobSearchModel(member, candidate); var lastWeek = new DateTimeRange(DateTime.Today.AddDays(-7), DateTime.Today); model.TotalContactsLastWeek = _employerMemberAccessReportsQuery.GetMemberAccesses(lastWeek); var lastMonth = new DateTimeRange(DateTime.Today.AddMonths(-1), DateTime.Today); model.TotalContactsLastMonth = _employerMemberAccessReportsQuery.GetMemberAccesses(lastMonth); model.TotalViewed = _employerMemberAccessReportsQuery.GetMemberViewings(context.UserId, lastMonth); return(View(model)); }
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) }); }
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); }