예제 #1
0
        public void TestResultsSalary()
        {
            // Create an employer and search.

            var employer = CreateEmployer(0, true);
            var criteria = new MemberSearchCriteria {
                JobTitle = JobTitle
            };
            var search = new MemberSearch {
                OwnerId = employer.Id, Criteria = criteria
            };

            // Lower and upper bound.

            var member    = CreateMember();
            var candidate = _candidatesCommand.GetCandidate(member.Id);

            _candidateResumesCommand.AddTestResume(candidate);
            candidate.DesiredSalary = new Salary {
                LowerBound = 100000, UpperBound = 200000, Rate = SalaryRate.Year, Currency = Currency.AUD
            };
            var results = new MemberSearchResults {
                MemberIds = new[] { member.Id }, TotalMatches = 1
            };

            // Send.

            var email = SendAlertEmail(employer, search, results);

            // Check.

            AssertMail(email, employer, search, results, 0, 0, false);

            // Lower bound.

            candidate.DesiredSalary = new Salary {
                LowerBound = 100000, Rate = SalaryRate.Year, Currency = Currency.AUD
            };
            _candidatesCommand.UpdateCandidate(candidate);
            email = SendAlertEmail(employer, search, results);
            AssertMail(email, employer, search, results, 0, 0, false);

            // Upper bound.

            candidate.DesiredSalary = new Salary {
                UpperBound = 200000, Rate = SalaryRate.Year, Currency = Currency.AUD
            };
            _candidatesCommand.UpdateCandidate(candidate);
            email = SendAlertEmail(employer, search, results);
            AssertMail(email, employer, search, results, 0, 0, false);

            // Both.

            candidate.DesiredSalary = new Salary {
                LowerBound = 100000, UpperBound = 200000, Rate = SalaryRate.Year, Currency = Currency.AUD
            };
            _candidatesCommand.UpdateCandidate(candidate);
            email = SendAlertEmail(employer, search, results);
            AssertMail(email, employer, search, results, 0, 0, false);
        }
예제 #2
0
        public void TestStatuses()
        {
            var employer = CreateEmployer(0);

            // Available now.

            var       memberIndex  = 0;
            const int availableNow = 4;

            for (var index = 0; index < availableNow; ++index)
            {
                var member    = _memberAccountsCommand.CreateTestMember(memberIndex++);
                var candidate = _candidatesCommand.GetCandidate(member.Id);
                candidate.Status = CandidateStatus.AvailableNow;
                _candidatesCommand.UpdateCandidate(candidate);
            }

            // Actively looking.

            const int activelyLooking = 3;

            for (var index = 0; index < activelyLooking; ++index)
            {
                var member    = _memberAccountsCommand.CreateTestMember(memberIndex++);
                var candidate = _candidatesCommand.GetCandidate(member.Id);
                candidate.Status = CandidateStatus.ActivelyLooking;
                _candidatesCommand.UpdateCandidate(candidate);
            }

            // Indigenous.

            const int aboriginal = 2;

            for (var index = 0; index < aboriginal; ++index)
            {
                var member = _memberAccountsCommand.CreateTestMember(memberIndex++);
                member.EthnicStatus = EthnicStatus.Aboriginal;
                _memberAccountsCommand.UpdateMember(member);
            }

            const int torreIslander = 3;

            for (var index = 0; index < torreIslander; ++index)
            {
                var member = _memberAccountsCommand.CreateTestMember(memberIndex++);
                member.EthnicStatus = EthnicStatus.TorresIslander;
                _memberAccountsCommand.UpdateMember(member);
            }

            GetNewsletterUrl(employer.Id);

            var document = GetDocument();

            Assert.AreEqual(availableNow, GetSampleResults(document, Sample.ImmediatelyAvailable));
            Assert.AreEqual(activelyLooking + aboriginal + torreIslander, GetSampleResults(document, Sample.ActivelyLooking));
            Assert.AreEqual(aboriginal + torreIslander, GetSampleResults(document, Sample.Indigenous));
        }
예제 #3
0
        public void TestLotsToContact()
        {
            var employer = CreateEmployer(0);

            var credit = _creditsQuery.GetCredit <ContactCredit>();

            _allocationsCommand.CreateAllocation(new Allocation {
                CreditId = credit.Id, InitialQuantity = 100, OwnerId = employer.Id
            });

            // Set up members which the employer can and cannot see and add them to the shortlist folder.

            var folder = _candidateFoldersQuery.GetShortlistFolder(employer);

            for (var index = 0; index < 150; ++index)
            {
                var member    = _memberAccountsCommand.CreateTestMember(index);
                var candidate = _candidatesQuery.GetCandidate(member.Id);
                candidate.DesiredSalary = new Salary {
                    LowerBound = null, UpperBound = index * 1000, Currency = Currency.AUD, Rate = SalaryRate.Year
                };
                _candidatesCommand.UpdateCandidate(candidate);
                _candidateResumesCommand.AddTestResume(candidate);
                _candidateListsCommand.AddCandidateToFolder(employer, folder, member.Id);
            }
        }
예제 #4
0
        private void UpdateStatus(Guid memberId, CandidateStatus status)
        {
            var candidate = _candidatesQuery.GetCandidate(memberId);
            candidate.Status = status;
            _candidatesCommand.UpdateCandidate(candidate);

            //return RedirectToRoute(ProfilesRoutes.Profile, new { succInfoType = "updateStatus" });
        }
예제 #5
0
        protected Member CreateMember(int index, CandidateStatus status)
        {
            var member    = _memberAccountsCommand.CreateTestMember(index);
            var candidate = _candidatesCommand.GetCandidate(member.Id);

            candidate.Status = status;
            _candidatesCommand.UpdateCandidate(candidate);
            return(member);
        }
예제 #6
0
        void btnSave_Click(object sender, EventArgs e)
        {
            ucVisibilityBasicSettings.SaveFormData();
            ucEmployerPrivacy.SaveFormData();

            _memberAccountsCommand.UpdateMember(LoggedInMember);

            ucWorkStatusSettings.Update(_candidate);
            _candidatesCommand.UpdateCandidate(_candidate);

            AddConfirm(ValidationInfoMessages.VISIBILITY_SETTINGS_SAVED);
        }
예제 #7
0
        public void TestDesiredJobTypes()
        {
            // No desired job types.

            var member    = CreateMember(0);
            var candidate = _candidatesQuery.GetCandidate(member.Id);

            candidate.DesiredJobTypes = JobTypes.None;
            _candidatesCommand.UpdateCandidate(candidate);

            var response = Get(GetCandidateUrl(member.Id));
            var view     = GetView(null, member);

            AssertResponse(response, view);
            var model = Deserialize <CandidateResponseModel>(response, new CandidateModelJavaScriptConverter());

            AssertCandidate(model, view);

            // A desired job type.

            candidate.DesiredJobTypes = JobTypes.FullTime;
            _candidatesCommand.UpdateCandidate(candidate);

            response = Get(GetCandidateUrl(member.Id));
            view     = GetView(null, member);
            AssertResponse(response, view);
            model = Deserialize <CandidateResponseModel>(response, new CandidateModelJavaScriptConverter());
            AssertCandidate(model, view);

            // Multiple desired job types.

            candidate.DesiredJobTypes = JobTypes.FullTime | JobTypes.PartTime | JobTypes.Contract;
            _candidatesCommand.UpdateCandidate(candidate);

            response = Get(GetCandidateUrl(member.Id));
            view     = GetView(null, member);
            AssertResponse(response, view);
            model = Deserialize <CandidateResponseModel>(response, new CandidateModelJavaScriptConverter());
            AssertCandidate(model, view);
        }
예제 #8
0
        private void CreateMember(int index, string desiredJobTitle, LocationReference location, Salary salary)
        {
            var member = _memberAccountsCommand.CreateTestMember(index);

            member.Address.Location = location;
            _memberAccountsCommand.UpdateMember(member);
            var candidate = _candidatesCommand.GetCandidate(member.Id);

            candidate.DesiredJobTitle = desiredJobTitle;
            candidate.DesiredSalary   = salary;
            _candidatesCommand.UpdateCandidate(candidate);
            _candidateResumesCommand.AddTestResume(candidate);
        }
예제 #9
0
        protected Member CreateMember(CandidateStatus status, string desiredJobTitle)
        {
            var member    = _memberAccountsCommand.CreateTestMember(EmailAddress, FirstName, LastName);
            var candidate = _candidatesCommand.GetCandidate(member.Id);

            candidate.Status = status;
            if (!string.IsNullOrEmpty(desiredJobTitle))
            {
                candidate.DesiredJobTitle = desiredJobTitle;
            }
            _candidatesCommand.UpdateCandidate(candidate);
            return(member);
        }
        private new Member CreateMember(int index)
        {
            var member    = base.CreateMember(index);
            var candidate = _candidatesCommand.GetCandidate(member.Id);

            _candidateResumesCommand.AddTestResume(candidate);

            candidate.DesiredSalary = new Salary {
                LowerBound = 40000, UpperBound = 50000, Rate = SalaryRate.Year, Currency = Currency.AUD
            };
            _candidatesCommand.UpdateCandidate(candidate);

            return(member);
        }
예제 #11
0
        public AjaxResult SaveWorkStatus(string status, string desiredJob)
        {
            try
            {
                EnsureMemberLoggedIn();

                var candidate = _candidatesCommand.GetCandidate(LoggedInMember.Id);
                candidate.Status = string.IsNullOrEmpty(status)
                    ? CandidateStatus.Unspecified
                    : (CandidateStatus)Enum.Parse(typeof(CandidateStatus), status);
                candidate.DesiredJobTitle = desiredJob;
                _candidatesCommand.UpdateCandidate(candidate);

                return(new AjaxResult(AjaxResultCode.SUCCESS));
            }
            catch (Exception ex)
            {
                return(HandleException(ex));
            }
        }
        private Member CreateMember(bool hasResume)
        {
            var member = CreateMember();

            member.CreatedTime = DateTime.Now.AddDays(-20);
            _memberAccountsCommand.UpdateMember(member);

            var candidate = _candidatesCommand.GetCandidate(member.Id);

            candidate.Status = CandidateStatus.ActivelyLooking;
            _candidatesCommand.UpdateCandidate(candidate);

            if (hasResume)
            {
                _candidateResumesCommand.CreateResume(candidate, new Resume {
                    LastUpdatedTime = DateTime.Now.AddDays(-10)
                });
            }

            return(member);
        }
예제 #13
0
        private Member CreateMember(int index, bool withInvalidPostalSuburb)
        {
            var member = _memberAccountsCommand.CreateTestMember(index);

            member.VisibilitySettings.Personal.FirstDegreeVisibility  = PersonalVisibilitySettings.ModerateFirstDegree;
            member.VisibilitySettings.Personal.SecondDegreeVisibility = PersonalVisibilitySettings.ModerateSecondDegree;
            member.VisibilitySettings.Personal.PublicVisibility       = PersonalVisibilitySettings.ModeratePublic;

            member.Address.Location = withInvalidPostalSuburb
                ? _locationQuery.ResolveLocation(_locationQuery.GetCountry("Australia"), "xyz")
                : _locationQuery.ResolveLocation(_locationQuery.GetCountry("Australia"), "Melbourne VIC 3000");

            _memberAccountsCommand.UpdateMember(member);

            var candidate = _candidatesCommand.GetCandidate(member.Id);

            candidate.Status = CandidateStatus.ActivelyLooking;
            _candidatesCommand.UpdateCandidate(candidate);

            return(member);
        }
예제 #14
0
        private void CreateFriend(Guid memberId, out Member friend, out Candidate candidate, out Resume resume)
        {
            friend    = _memberAccountsCommand.CreateTestMember(1);
            candidate = _candidatesCommand.GetCandidate(friend.Id);

            // Set values.

            candidate.Status = CandidateStatus.OpenToOffers;
            _locationQuery.ResolvePostalSuburb(friend.Address.Location, Australia, Suburb + " " + Postcode + " " + CountrySubdivision);

            friend.PhoneNumbers = new List <PhoneNumber>
            {
                new PhoneNumber {
                    Number = "123123123", Type = PhoneNumberType.Home
                },
                new PhoneNumber {
                    Number = "234234234", Type = PhoneNumberType.Mobile
                },
                new PhoneNumber {
                    Number = "345345345", Type = PhoneNumberType.Work
                },
            };
            friend.Gender = Gender.Male;

            friend.VisibilitySettings.Personal.FirstDegreeVisibility = PersonalVisibility.All;

            // Create a resume.

            _memberAccountsCommand.UpdateMember(friend);
            resume = CreateResume(candidate);

            // Save.

            _memberAccountsCommand.UpdateMember(friend);
            _candidatesCommand.UpdateCandidate(candidate);

            _networkingCommand.CreateFirstDegreeLink(memberId, friend.Id);
        }
예제 #15
0
        void IDataExchange.UpdateStatus(Guid candidateId, State state)
        {
            #region Log
            const string method = "UpdateStatus";
            EventSource.Raise(Event.Flow, method, Event.Arg("candidateId", candidateId), Event.Arg("state", state));
            #endregion

            try
            {
                var candidate = _candidatesCommand.GetCandidate(candidateId);
                if (candidate != null)
                {
                    candidate.Status = state.ToCandidateStatus();
                    _candidatesCommand.UpdateCandidate(candidate);
                }
            }
            catch (Exception e)
            {
                #region Log
                EventSource.Raise(Event.Error, method, e, null, Event.Arg("candidateId", candidateId), Event.Arg("state", state));
                #endregion
            }
        }
예제 #16
0
        private void UpdateMember(Member member, PersonalDetailsMemberModel memberModel)
        {
            var candidate = _candidatesQuery.GetCandidate(member.Id);

            member.FirstName      = memberModel.FirstName;
            member.LastName       = memberModel.LastName;
            member.EmailAddresses = new List <EmailAddress> {
                new EmailAddress {
                    Address = memberModel.EmailAddress
                }
            };

            // Address.

            member.Address = new Address {
                Location = _locationQuery.ResolveLocation(_locationQuery.GetCountry(memberModel.CountryId), memberModel.Location)
            };

            // Phone number.

            if (member.PhoneNumbers == null || member.PhoneNumbers.Count == 0)
            {
                member.PhoneNumbers = new List <PhoneNumber>
                {
                    new PhoneNumber {
                        Number = memberModel.PhoneNumber, Type = memberModel.PhoneNumberType
                    }
                };
            }
            else
            {
                member.PhoneNumbers[0].Number = memberModel.PhoneNumber;
                member.PhoneNumbers[0].Type   = memberModel.PhoneNumberType;
            }

            // Visibility. Start with the current and then ensure each is set as appropriate.

            var visibility = member.VisibilitySettings.Professional.EmploymentVisibility;

            visibility = visibility.SetFlag(ProfessionalVisibility.Resume, memberModel.Visibility.IsFlagSet(ProfessionalVisibility.Resume));
            if (visibility.IsFlagSet(ProfessionalVisibility.Resume))
            {
                visibility = visibility.SetFlag(ProfessionalVisibility.Name, memberModel.Visibility.IsFlagSet(ProfessionalVisibility.Name));
                visibility = visibility.SetFlag(ProfessionalVisibility.PhoneNumbers, memberModel.Visibility.IsFlagSet(ProfessionalVisibility.PhoneNumbers));
                visibility = visibility.SetFlag(ProfessionalVisibility.RecentEmployers, memberModel.Visibility.IsFlagSet(ProfessionalVisibility.RecentEmployers));
            }
            else
            {
                visibility = visibility.ResetFlag(ProfessionalVisibility.Name);
                visibility = visibility.ResetFlag(ProfessionalVisibility.PhoneNumbers);
                visibility = visibility.ResetFlag(ProfessionalVisibility.RecentEmployers);
            }

            visibility = visibility.SetFlag(ProfessionalVisibility.Salary, memberModel.Visibility.IsFlagSet(ProfessionalVisibility.Salary));

            member.VisibilitySettings.Professional.EmploymentVisibility = visibility;

            // Update the member.

            _memberAccountsCommand.UpdateMember(member);

            // Status.

            candidate.Status        = memberModel.Status ?? Defaults.CandidateStatus;
            candidate.DesiredSalary = memberModel.SalaryLowerBound == null
                ? null
                : new Salary {
                LowerBound = memberModel.SalaryLowerBound, Currency = Currency.AUD, Rate = memberModel.SalaryRate
            };

            // Update the candidate.

            _candidatesCommand.UpdateCandidate(candidate);

            // Save the uploaded resume for the member.

            if (Pageflow.FileReferenceId != null)
            {
                var fileReference = _filesQuery.GetFileReference(Pageflow.FileReferenceId.Value);
                if (fileReference != null)
                {
                    if (Pageflow.ParsedResumeId != null && Pageflow.IsResumeValid)
                    {
                        var parsedResume = _resumesQuery.GetParsedResume(Pageflow.ParsedResumeId.Value);
                        _candidateResumesCommand.CreateResume(candidate, parsedResume.Resume.Clone(), fileReference);
                    }
                    else
                    {
                        _candidateResumesCommand.CreateResumeFile(candidate, fileReference);
                    }
                }
            }
        }
예제 #17
0
 private void UpdateCandidate(Candidate candidate, Action <Candidate> updateCandidate)
 {
     updateCandidate(candidate);
     _candidatesCommand.UpdateCandidate(candidate);
 }
예제 #18
0
        public AjaxResult SavePrimaryDetails(string firstName, string lastName, string mobilePhone, string workPhone, string homePhone, string[] industryIds, string countryId, string location)
        {
            var errorMessages = new List <string>();

            if (string.IsNullOrEmpty(location))
            {
                errorMessages.Add(ValidationErrorMessages.REQUIRED_FIELD_LOCATION);
            }

            if (string.IsNullOrEmpty(firstName))
            {
                errorMessages.Add(ValidationErrorMessages.REQUIRED_FIELD_FIRST_NAME);
            }
            else if (!FirstNameRegex.IsMatch(firstName))
            {
                errorMessages.Add(ValidationErrorMessages.INVALID_FIRST_NAME);
            }

            if (string.IsNullOrEmpty(lastName))
            {
                errorMessages.Add(ValidationErrorMessages.REQUIRED_FIELD_LAST_NAME);
            }
            else if (!LastNameRegex.IsMatch(lastName))
            {
                errorMessages.Add(ValidationErrorMessages.INVALID_LAST_NAME);
            }

            if (string.IsNullOrEmpty(mobilePhone) && string.IsNullOrEmpty(workPhone) && string.IsNullOrEmpty(homePhone))
            {
                errorMessages.Add(ValidationErrorMessages.REQUIRED_FIELD_CONTACT_PHONE);
            }

            if ((!string.IsNullOrEmpty(mobilePhone) && !PhoneRegex.IsMatch(mobilePhone)) ||
                (!string.IsNullOrEmpty(workPhone) && !PhoneRegex.IsMatch(workPhone)) ||
                (!string.IsNullOrEmpty(homePhone) && !PhoneRegex.IsMatch(homePhone)))
            {
                errorMessages.Add(ValidationErrorMessages.INVALID_PHONE_NUMBER);
            }

            if (errorMessages.Count != 0)
            {
                return(new AjaxResult(AjaxResultCode.FAILURE, ConvertMessagesToString(errorMessages)));
            }

            try
            {
                EnsureMemberLoggedIn();

                var member = LoggedInMember;
                member.FirstName = firstName;
                member.LastName  = lastName;

                member.PhoneNumbers = new List <PhoneNumber>();
                if (!string.IsNullOrEmpty(mobilePhone))
                {
                    member.PhoneNumbers.Add(new PhoneNumber {
                        Number = mobilePhone, Type = PhoneNumberType.Mobile
                    });
                }
                if (!string.IsNullOrEmpty(homePhone))
                {
                    member.PhoneNumbers.Add(new PhoneNumber {
                        Number = homePhone, Type = PhoneNumberType.Home
                    });
                }
                if (!string.IsNullOrEmpty(workPhone))
                {
                    member.PhoneNumbers.Add(new PhoneNumber {
                        Number = workPhone, Type = PhoneNumberType.Work
                    });
                }

                var country = _locationQuery.GetCountry(int.Parse(countryId));
                member.Address.Location = _locationQuery.ResolveLocation(country, location);
                _memberAccountsCommand.UpdateMember(member);

                var candidate = _candidatesCommand.GetCandidate(member.Id);
                candidate.Industries = (from i in industryIds select _industriesQuery.GetIndustry(ParseUtil.ParseUserInputGuid(i, "industry ID"))).ToList();
                _candidatesCommand.UpdateCandidate(candidate);

                return(new AjaxResult(AjaxResultCode.SUCCESS));
            }
            catch (Exception ex)
            {
                return(HandleException(ex));
            }
        }