Exemplo n.º 1
0
        private void AssertFriend(Member friend, ICandidate candidate, IResume resume)
        {
            AssertPageContains(friend.FullName);

            var viewer = new PersonalView(friend, PersonalContactDegree.FirstDegree, PersonalContactDegree.FirstDegree);

            // Current Jobs.

            if (viewer.CanAccess(PersonalVisibility.CurrentJobs))
            {
                AssertPageContains(resume.GetCurrentJobsDisplayHtml());
            }
            else
            {
                AssertPageDoesNotContain(resume.GetCurrentJobsDisplayHtml());
            }

            // Candidate Status.

            if (viewer.CanAccess(PersonalVisibility.CandidateStatus))
            {
                if (candidate.Status != CandidateStatus.Unspecified)
                {
                    AssertPageContains(NetworkerFacade.GetCandidateStatusText(candidate.Status));
                }
            }
            else
            {
                if (candidate.Status != CandidateStatus.Unspecified)
                {
                    AssertPageDoesNotContain(NetworkerFacade.GetCandidateStatusText(candidate.Status));
                }
            }

            // Suburb.

            if (viewer.CanAccess(PersonalVisibility.Suburb))
            {
                AssertPageContains(friend.Address.Location.Suburb);
                AssertPageContains(" " + friend.Address.Location.Postcode);
            }
            else
            {
                AssertPageDoesNotContain(friend.Address.Location.Suburb);
                AssertPageDoesNotContain(" " + friend.Address.Location.Postcode); // GUIDs can contain "3143", too!
            }

            // CountrySubdivision.

            if (viewer.CanAccess(PersonalVisibility.CountrySubdivision))
            {
                AssertPageContains(friend.Address.Location.CountrySubdivision.ShortName);
            }
            else
            {
                AssertPageDoesNotContain(friend.Address.Location.CountrySubdivision.ShortName);
            }
        }
Exemplo n.º 2
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            rdoAvailable.Text  = NetworkerFacade.GetCandidateStatusText(CandidateStatus.AvailableNow);
            rdoActive.Text     = NetworkerFacade.GetCandidateStatusText(CandidateStatus.ActivelyLooking);
            rdoOpen.Text       = NetworkerFacade.GetCandidateStatusText(CandidateStatus.OpenToOffers);
            rdoNotLooking.Text = NetworkerFacade.GetCandidateStatusText(CandidateStatus.NotLooking);
        }
Exemplo n.º 3
0
        protected string GetEthnicStatusText()
        {
            string statusText = NetworkerFacade.GetEthnicStatusText(_member, false);

            if (!string.IsNullOrEmpty(statusText))
            {
                statusText = "Indigenous status indicated: " + statusText;
            }

            return(ResumeViewHelper.GetOptionalListItem(statusText));
        }
Exemplo n.º 4
0
        private bool AssertFriendsFriend(Guid memberId, Member friendsFriend, ICandidate friendsCandidate, IResume friendsResume, bool checkAddress)
        {
            try
            {
                AssertPageContains(friendsFriend.FullName);

                var contactDegree = friendsFriend.Id == memberId ? PersonalContactDegree.Self : PersonalContactDegree.SecondDegree;
                var view          = new PersonalView(friendsFriend, contactDegree, contactDegree);

                // Current Jobs.

                if (view.CanAccess(PersonalVisibility.CurrentJobs))
                {
                    var currentJobs = friendsResume.GetCurrentJobsDisplayHtml();
                    if (!string.IsNullOrEmpty(currentJobs))
                    {
                        AssertPageContains(currentJobs);
                    }
                }
                else
                {
                    var currentJobs = friendsResume.GetCurrentJobsDisplayHtml();
                    if (!string.IsNullOrEmpty(currentJobs))
                    {
                        AssertPageDoesNotContain(friendsResume.GetCurrentJobsDisplayHtml());
                    }
                }

                // Candidate Status.

                if (view.CanAccess(PersonalVisibility.CandidateStatus))
                {
                    if (friendsCandidate.Status != CandidateStatus.Unspecified)
                    {
                        AssertPageContains(NetworkerFacade.GetCandidateStatusText(friendsCandidate.Status));
                    }
                }
                else
                {
                    if (friendsCandidate.Status != CandidateStatus.Unspecified)
                    {
                        AssertPageDoesNotContain(NetworkerFacade.GetCandidateStatusText(friendsCandidate.Status));
                    }
                }

                // Suburb.

                if (checkAddress)
                {
                    if (view.CanAccess(PersonalVisibility.Suburb))
                    {
                        AssertPageContains(friendsFriend.Address.Location.Suburb);
                        AssertPageContains(" " + friendsFriend.Address.Location.Postcode);
                    }
                    else
                    {
                        AssertPageDoesNotContain(friendsFriend.Address.Location.Suburb);
                        AssertPageDoesNotContain(" " + friendsFriend.Address.Location.Postcode);
                    }

                    // CountrySubdivision.

                    if (view.CanAccess(PersonalVisibility.CountrySubdivision))
                    {
                        AssertPageContains(friendsFriend.Address.Location.CountrySubdivision.ShortName);
                    }
                    else
                    {
                        AssertPageDoesNotContain(friendsFriend.Address.Location.CountrySubdivision.ShortName);
                    }
                }

                return(true);
            }
            catch (AssertFailedException)
            {
                return(false);
            }
        }
Exemplo n.º 5
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // Read the member ID from the query string, default to the logged in member.

            try
            {
                var memberId = ParseUtil.ParseUserInputGuidOptional(Request.QueryString[MemberIdParam], "member ID");
                if (memberId == null)
                {
                    _member = LoggedInMember;
                }
                else
                {
                    _member = _membersQuery.GetMember(memberId.Value);
                    if (_member == null)
                    {
                        throw new UserException("There is no member with ID " + memberId + ".");
                    }
                }

                _candidate = _candidatesQuery.GetCandidate(_member.Id);
                _resume    = _candidate.ResumeId == null ? null : _resumesQuery.GetResume(_candidate.ResumeId.Value);
            }
            catch (UserException ex)
            {
                AddError(ex.Message);
                return;
            }

            // Display the resume.
            bool doDisplay = false;

            if (_member.Id == LoggedInMember.Id)
            {
                ucPrimaryResumeDetails.DisplayMemberToSelf(_member, _candidate, false, false);
                ucDesiredJob.DisplayToSelf(_candidate, false);
                ucEmploymentSummary.DisplayExperienceToSelf(_member, _resume);
                ucResumeTextSections.DisplayResume(_resume, false, null, false, false);
                doDisplay = true;
            }
            else
            {
                var view = _memberViewsQuery.GetPersonalView(LoggedInUserId, _member);
                if (view.CanAccess(PersonalVisibility.Resume))
                {
                    ucPrimaryResumeDetails.DisplayMemberToOther(_member, _candidate);
                    ucEmploymentSummary.DisplayExperienceToOtherMember(_member, _resume);
                    ucResumeTextSections.DisplayResume(_resume, false, null, false, false);
                    doDisplay = true;
                }
            }

            phContent.Visible = doDisplay;
            if (doDisplay)
            {
                ucProfilePhoto.DisplayPhotoReadOnly(NetworkerFacade.GetProfilePhotoUrlOrDefault(_member));
            }
            else
            {
                AddError(ValidationErrorMessages.NO_ACCESS_TO_RESUME);
            }
        }
Exemplo n.º 6
0
 protected string GetJoinedText()
 {
     return(GetOptionalListItem(NetworkerFacade.GetJoinDateText(_member.CreatedTime)));
 }
Exemplo n.º 7
0
 protected string GetCandidateStatusText()
 {
     return(GetOptionalListItem(NetworkerFacade.GetCandidateStatusText(_candidate.Status)));
 }
Exemplo n.º 8
0
        public void DisplayContact(PersonalView view, Member member, Candidate candidate, Resume resume, string itemSuffix)
        {
            // Image.

            lnkPhoto.NavigateUrl = BuildViewProfileLink(view.Id).ToString();
            imgPhoto.ImageUrl    = view.GetPhotoUrlOrDefault().ToString();

            // Full Name.

            lnkFullName.NavigateUrl = BuildViewProfileLink(view.Id).ToString();
            lnkFullName.Text        = AlwaysDisplayNames ? HtmlUtil.TextToHtml(((ICommunicationRecipient)view).FullName) : HtmlUtil.TextToHtml(view.GetFullNameDisplayText());

            // Representative.

            switch (view.EffectiveContactDegree)
            {
            case PersonalContactDegree.Representative:
                phRepresentative.Visible = true;
                lblRepresentative.Text   = view.EffectiveContactDegree.GetRepresentativeDescriptionText();
                break;

            case PersonalContactDegree.Representee:
                phRepresentative.Visible = true;
                lblRepresentative.Text   = view.EffectiveContactDegree.GetRepresentativeDescriptionText();
                break;

            default:
                phRepresentative.Visible = false;
                break;
            }

            // Current Title.

            var currentJobsText = resume == null ? null : resume.GetCurrentJobsDisplayHtml();

            if (string.IsNullOrEmpty(currentJobsText))
            {
                phCurrentJobs.Visible = false;
            }
            else
            {
                lblCurrentJobsCaption.Text = GetCurrentJobsCaption(resume);
                ltlCurrentJobs.Text        = currentJobsText;
                SetPlaceHolderVisibility(phCurrentJobs, view, PersonalVisibility.CurrentJobs);
            }

            // Candidate Status.

            if (candidate.Status == CandidateStatus.Unspecified)
            {
                phCandidateStatus.Visible = false;
            }
            else
            {
                ltlCandidateStatus.Text = NetworkerFacade.GetCandidateStatusText(candidate.Status);
                SetPlaceHolderVisibility(phCandidateStatus, view, PersonalVisibility.CandidateStatus);
            }

            // Location.

            var locationText = GetDisplayText(member.Address.Location, view);

            if (string.IsNullOrEmpty(locationText))
            {
                phLocation.Visible = false;
            }
            else
            {
                ltlLocation.Text   = locationText;
                phLocation.Visible = true;
            }

            // Full Profile.

            lnkFullProfile.NavigateUrl = BuildViewProfileLink(view.Id).ToString();

            // Send Message.

            if (LoggedInUserId == view.Id)
            {
                phThisIsYou.Visible = true;
            }

            // View Friends.

            lnkViewFriends.NavigateUrl = BuildViewFriendsLink(view.Id).ToString();
            SetPlaceHolderVisibility(phViewFriends, view, PersonalVisibility.FriendsList);

            if (!CanAccessFriends)
            {
                phViewFriends.Visible = false;
            }

            // Add To Friends.

            lnkAddToFriends.NavigateUrl = "javascript:populateOverlayPopup('"
                                          + GetUrlForPage <InvitationPopupContents>() + "', '"
                                          + InvitationPopupContents.InviteeIdParameter + "=" + view.Id + "');";
            phAddToFriends.Visible = (view.ActualContactDegree != PersonalContactDegree.Self && view.ActualContactDegree != PersonalContactDegree.FirstDegree &&
                                      view.CanAccess(PersonalVisibility.SendInvites));

            if (!CanAddToFriends)
            {
                phAddToFriends.Visible = false;
            }

            // Extra details, if any.

            PopulateDynamicControls(phExtraDescription, view, itemSuffix);
            PopulateDynamicControls(phExtraActions, view, itemSuffix);
        }
Exemplo n.º 9
0
 protected string GetEthnicStatusText()
 {
     return(NetworkerFacade.GetEthnicStatusText(_member, true));
 }
Exemplo n.º 10
0
        public AjaxResult SaveProfileDetails(string firstName, string lastName,
                                             string gender, int day, int month, string year, string countryStr, string location, int ethnicStatus,
                                             string ageControlName, string ethnicStatusControlName)
        {
            try
            {
                EnsureMemberLoggedIn();

                var errors = new List <string>();

                if (string.IsNullOrEmpty(firstName))
                {
                    errors.Add(ValidationErrorMessages.REQUIRED_FIELD_FIRST_NAME);
                }

                if (string.IsNullOrEmpty(lastName))
                {
                    errors.Add(ValidationErrorMessages.REQUIRED_FIELD_LAST_NAME);
                }

                PartialDate?dateOfBirth = null;
                if (day != 0 && month != 0 && !string.IsNullOrEmpty(year))
                {
                    try
                    {
                        dateOfBirth = new PartialDate(ParseUtil.ParseUserInputInt32(year, "year of birth"), month, day);
                    }
                    catch (ArgumentException)
                    {
                        errors.Add(ValidationErrorMessages.INVALID_DATE_OF_BIRTH);
                    }
                    catch (UserException ex)
                    {
                        errors.Add(ex.Message);
                    }
                }
                else if (day != 0 || month != 0 || !string.IsNullOrEmpty(year))
                {
                    errors.Add(ValidationErrorMessages.INCOMPLETE_DATE_OF_BIRTH);
                }

                Country country = null;
                if (string.IsNullOrEmpty(countryStr))
                {
                    errors.Add(ValidationErrorMessages.REQUIRED_FIELD_COUNTRY);
                }
                else
                {
                    country = _locationQuery.GetCountry(countryStr);
                    if (country == null)
                    {
                        errors.Add(ValidationErrorMessages.INVALID_COUNTRY);
                    }
                }

                if (string.IsNullOrEmpty(location))
                {
                    errors.Add(ValidationErrorMessages.REQUIRED_FIELD_SUBURB);
                }

                if (errors.Count > 0)
                {
                    return(new AjaxResult(AjaxResultCode.FAILURE, errors.ToArray()));
                }

                var member = LoggedInMember;
                member.FirstName        = firstName;
                member.LastName         = lastName;
                member.Address.Location = _locationQuery.ResolveLocation(country, location);
                member.DateOfBirth      = dateOfBirth;
                member.Gender           = GetGender(member, gender);
                member.EthnicStatus     = (EthnicStatus)ethnicStatus;
                _memberAccountsCommand.UpdateMember(member);

                _authenticationManager.UpdateUser(new HttpContextWrapper(HttpContext.Current), member, false);

                var ageValue          = member.DateOfBirth.GetAgeDisplayText();
                var ethnicStatusValue = NetworkerFacade.GetEthnicStatusText(member, true);

                var userData = new ElementValuesUserData(
                    new[] { ageControlName, ethnicStatusControlName },
                    new[] { ageValue, ethnicStatusValue });

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