Exemple #1
0
        public ActionResult Settings()
        {
            var employer = CurrentEmployer;

            var credentials = _loginCredentialsQuery.GetCredentials(employer.Id);

            var jobPoster = _jobPostersQuery.GetJobPoster(employer.Id) ?? new JobPoster {
                Id = employer.Id
            };
            var nonMemberSettings = _nonMemberSettingsQuery.GetNonMemberSettings(employer.EmailAddress.Address);

            var settings = _settingsQuery.GetSettings(employer.Id);
            var employerUpdateCategory = (from c in _settingsQuery.GetCategories(UserType.Employer) where c.Name == "EmployerUpdate" select c).Single();
            var campaignCategory       = (from c in _settingsQuery.GetCategories(UserType.Employer) where c.Name == "Campaign" select c).Single();

            var model = new SettingsModel
            {
                FirstName               = employer.FirstName,
                LastName                = employer.LastName,
                OrganisationName        = employer.Organisation.Name,
                CanEditOrganisationName = !employer.Organisation.IsVerified,
                Role                       = employer.SubRole,
                JobTitle                   = employer.JobTitle,
                EmailAddress               = employer.EmailAddress.Address,
                PhoneNumber                = employer.PhoneNumber == null ? null : employer.PhoneNumber.Number,
                IndustryIds                = employer.Industries == null ? new List <Guid>() : employer.Industries.Select(i => i.Id).ToList(),
                Industries                 = _industriesQuery.GetIndustries(),
                HasLoginCredentials        = credentials != null,
                LoginId                    = credentials == null ? null : credentials.LoginId,
                UseLinkedInProfile         = _linkedInQuery.GetProfile(employer.Id) != null,
                Allocations                = GetAllocations(employer),
                ShowSuggestedCandidates    = jobPoster.ShowSuggestedCandidates,
                SendSuggestedCandidates    = jobPoster.SendSuggestedCandidates,
                ReceiveSuggestedCandidates = nonMemberSettings == null || !nonMemberSettings.SuppressSuggestedCandidatesEmails,
                EmailEmployerUpdate        = EmailCategory(employerUpdateCategory, settings),
                EmailCampaign              = EmailCategory(campaignCategory, settings),
            };

            return(View(model));
        }
Exemple #2
0
        private ActionResult Publish(IEmployer employer, JobAd jobAd, Guid?orderId)
        {
            _employerAllocationsCommand.EnsureJobAdCredits(employer);

            // Open it.

            _employerJobAdsCommand.OpenJobAd(employer, jobAd, true);

            if (orderId == null)
            {
                // Redirect based upon preference.

                var jobPoster = _jobPostersQuery.GetJobPoster(employer.Id);
                var url       = jobPoster.ShowSuggestedCandidates
                    ? JobAdsRoutes.SuggestedCandidates.GenerateUrl(new { jobAdId = jobAd.Id })
                    : JobAdsRoutes.JobAd.GenerateUrl();
                var message = "<p>\'" + HtmlUtil.HtmlToText(jobAd.Title) + "\' was successfully published.</p><p>It will expire on <b>" + jobAd.ExpiryTime.Value.ToShortDateString() + "</b>.</p>";
                return(RedirectToUrlWithConfirmation(url, message));
            }

            return(RedirectToRoute(JobAdsRoutes.Receipt, new { jobAdId = jobAd.Id, orderId = orderId.Value }));
        }