コード例 #1
0
        void ISendApplicationsCommand.SendApplication(InternalApplication application, IEnumerable <ApplicationAnswer> answers)
        {
            var jobAd = _jobAdsQuery.GetJobAd <JobAdEntry>(application.PositionId);

            // Look for a member first.

            var member = _membersQuery.GetMember(application.ApplicantId);

            if (member != null)
            {
                // Send.

                if (application.ResumeFileId != null)
                {
                    SendResumeFile(application, member, jobAd, answers);
                }
                else
                {
                    SendResume(application, member, jobAd, answers);
                }
            }
            else
            {
                var user = _anonymousUsersQuery.GetContact(application.ApplicantId);
                if (user != null && application.ResumeFileId != null)
                {
                    SendResumeFile(application, user, jobAd, answers);
                }
            }
        }
コード例 #2
0
ファイル: AnonymousTests.cs プロジェクト: formist/LinkMe
        public void TestAnonymously()
        {
            var employer = CreateEmployer();
            var jobAd    = CreateJobAd(employer);

            Get(HomeUrl);
            var anonymousId = GetAnonymousId();

            AssertNoView(jobAd.Id, anonymousId);
            AssertNoApplication(anonymousId, jobAd.Id);

            // Try to apply.

            var fileReference = GetResumeFile();

            View(jobAd.Id, () => AssertNotLoggedInView(false));
            var applicationId = AssertApply(ApplyAnonymously(employer, jobAd, fileReference.Id, EmailAddress, FirstName, LastName));

            // Assert application saved.

            var contact = _anonymousUsersQuery.GetContact(new AnonymousUser {
                Id = anonymousId
            }, new ContactDetails {
                EmailAddress = EmailAddress, FirstName = FirstName, LastName = LastName
            });

            AssertView(jobAd.Id, anonymousId);
            AssertApplication(applicationId, jobAd, contact.Id, null);
            _emailServer.AssertNoEmailSent();
            AssertRedirectToExternal(false, applicationId, jobAd);
        }
コード例 #3
0
        public ActionResult PostDeleteSearch(Guid searchId)
        {
            // Used to 'unsubscribe' from an anonymous user's alert.

            var model = new DeleteSearchModel();

            try
            {
                model.Search = GetSearch(searchId);

                // Given that an anonymous user could be responding to an email alert on different devices
                // and that they don't have to sign in get the owner directly from the search itself.

                var owner = _anonymousUsersQuery.GetContact(model.Search.OwnerId);
                if (owner == null)
                {
                    throw new ValidationErrorsException(new NotFoundValidationError("alert id", searchId));
                }

                // Delete it.

                _jobAdSearchAlertsCommand.DeleteJobAdSearch(owner.Id, searchId);
                model.HasDeleted = true;

                ModelState.AddModelConfirmation("You have now been unsubscribed from this job alert.");
                return(View(model));
            }
            catch (UserException ex)
            {
                ModelState.AddModelError(ex, new StandardErrorHandler());
            }

            return(View(model));
        }
コード例 #4
0
        private AnonymousContact GetAnonymousContact(Guid applicationId)
        {
            var application = _memberApplicationsQuery.GetInternalApplication(applicationId);

            return(application == null
                ? null
                : _anonymousUsersQuery.GetContact(application.ApplicantId));
        }
コード例 #5
0
ファイル: IntegrationTests.cs プロジェクト: formist/LinkMe
        public void TestAnonymously()
        {
            var integratorUser = _integrationCommand.CreateTestIntegratorUser();
            var employer       = CreateEmployer();
            var jobAd          = CreateJobAd(employer, integratorUser);

            Get(HomeUrl);
            var anonymousId = GetAnonymousId();

            // Apply.

            var fileReference = GetResumeFile(TestResume.Complete);

            View(jobAd.Id, () => AssertNotLoggedInView(false));
            var applicationId = AssertApply(ApplyAnonymously(employer, jobAd, fileReference.Id, EmailAddress, FirstName, LastName));

            // Check the application.

            var contact = _anonymousUsersQuery.GetContact(new AnonymousUser {
                Id = anonymousId
            }, new ContactDetails {
                EmailAddress = EmailAddress, FirstName = FirstName, LastName = LastName
            });

            AssertView(jobAd.Id, anonymousId);
            AssertApplication(applicationId, jobAd, contact.Id, null);

            // Get the application.

            var member = new Member
            {
                FirstName      = FirstName,
                LastName       = LastName,
                EmailAddresses = new List <EmailAddress> {
                    new EmailAddress {
                        Address = EmailAddress
                    }
                }
            };

            LogOut();
            var resumeUrl = AssertSuccess(GetJobApplication(integratorUser, applicationId), member, null, fileReference);

            AssertApplication(applicationId, jobAd, contact.Id, null);

            // Get the resume file.

            var resumeFileData = GetResumeFileData(resumeUrl, integratorUser);

            Assert.IsTrue(TestResume.Complete.GetData().SequenceEqual(resumeFileData));
            AssertApplication(applicationId, jobAd, contact.Id, null);

            // Set status.

            AssertSuccess(SetJobApplicationsStatus(integratorUser, applicationId), 1, 0);
            AssertSubmittedApplication(applicationId, jobAd, contact.Id, null);
        }
コード例 #6
0
        public void TestCreateContact()
        {
            var user           = new AnonymousUser();
            var contactDetails = CreateContactDetails(0);

            var contact = _anonymousUsersCommand.CreateContact(user, contactDetails);

            Assert.AreNotEqual(Guid.Empty, user.Id);
            Assert.AreNotEqual(Guid.Empty, contact.Id);
            AssertContact(contact.Id, contactDetails, contact);
            AssertContact(contact.Id, contactDetails, _anonymousUsersQuery.GetContact(contact.Id));
        }
コード例 #7
0
        private ICommunicationUser GetUser(Guid ownerId)
        {
            // Look for member first.

            var member = _membersQuery.GetMember(ownerId);

            if (member != null)
            {
                return(member.IsEnabled && member.IsActivated && member.GetBestEmailAddress().IsVerified ? member : null);
            }

            // Anonymous user.

            return(_anonymousUsersQuery.GetContact(ownerId));
        }
コード例 #8
0
        public void TestAnonymously()
        {
            var jobAd = CreateJobAd(CreateEmployer());

            Get(HomeUrl);
            var anonymousId = GetAnonymousId();

            AssertNoView(jobAd.Id, anonymousId);
            AssertNoApplication(anonymousId, jobAd.Id);

            // Try to apply.

            var fileReference = GetResumeFile();

            View(jobAd.Id, () => AssertNotLoggedInView(true));
            var applicationId = AssertApply(ApiApply(jobAd.Id, fileReference.Id, EmailAddress, FirstName, LastName));

            // Assert application saved.

            var contact = _anonymousUsersQuery.GetContact(new AnonymousUser {
                Id = anonymousId
            }, new ContactDetails {
                EmailAddress = EmailAddress, FirstName = FirstName, LastName = LastName
            });

            AssertView(jobAd.Id, anonymousId);
            AssertApplication(applicationId, jobAd, contact.Id, null);
            _emailServer.AssertNoEmailSent();
            AssertNoJobG8Request();

            Get(GetQuestionsUrl(jobAd.Id, applicationId));
            AnswerQuestions(CoverLetterText);
            AssertAppliedUrl(jobAd, applicationId, EmailAddress);

            AssertView(jobAd.Id, anonymousId);
            var application = AssertApplication(applicationId, jobAd, contact.Id, CoverLetterText);

            _emailServer.AssertNoEmailSent();
            AssertJobG8Request(contact, jobAd, application, fileReference);
        }
コード例 #9
0
        string IJobAdApplicationsManager.GetJobApplication(IntegratorUser integratorUser, Guid applicationId, List <string> errors)
        {
            var application = _memberApplicationsQuery.GetInternalApplication(applicationId);

            if (application == null)
            {
                errors.Add("There is no job application with ID '" + applicationId + "'.");
                return(null);
            }

            var jobAd = _jobAdsCommand.GetJobAd <JobAdEntry>(application.PositionId);

            if (jobAd.Integration.IntegratorUserId != integratorUser.Id)
            {
                errors.Add(string.Format("Job application {0:b} is for a job not posted by the current integrator user, '{1}'.", application.Id, integratorUser.LoginId));
                return(null);
            }

            // Determine whether it is a member or anonymous user application.

            var member = _membersQuery.GetMember(application.ApplicantId);

            if (member != null)
            {
                return(GetJobApplication(application, member));
            }

            var contact = _anonymousUsersQuery.GetContact(application.ApplicantId);

            if (contact != null)
            {
                return(GetJobApplication(application, contact));
            }

            errors.Add("There is no job application with ID '" + applicationId + "'.");
            return(null);
        }