public ActionResult Edit(Guid id)
        {
            var custodian = _custodiansQuery.GetCustodian(id);

            if (custodian == null)
            {
                return(NotFound("custodian", "id", id));
            }

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

            if (credentials == null)
            {
                return(NotFound("custodian", "id", id));
            }

            return(View(new CustodianUserModel
            {
                User = custodian,
                UserLogin = new CustodianLoginModel {
                    LoginId = credentials.LoginId
                },
                Community = _communitiesQuery.GetCommunity(custodian.AffiliateId.Value),
            }));
        }
Пример #2
0
        private Community GetCurrentCommunity()
        {
            // Get the current community from the context.

            var id = ActivityContext.Current.Community.Id;

            return(id != null?_communitiesQuery.GetCommunity(id.Value) : null);
        }
Пример #3
0
        void IAffiliationsHandler.OnEnquiryCreated(Guid affiliateId, AffiliationEnquiry enquiry)
        {
            var community = _communitiesQuery.GetCommunity(affiliateId);

            // This is a hack in place for the moment until proper communication settings are in place
            // for community administrators.

            if (community.Name == "Monash University Business and Economics")
            {
                var owners = new[]
                {
                    new EmailRecipient("*****@*****.**", "Catherine Barratt", "Catherine", "Barratt"),
                    new EmailRecipient("*****@*****.**", "Julie Ralph", "Julie", "Ralph")
                };
                _emailsCommand.TrySend(new AdministratorEmployerEnquiryEmail(community, owners, enquiry));
            }
            else
            {
                // This is the proper implementation.

                //                var owners = from id in Container.Current.Resolve<ICommunityOwnersCommand>().GetOwners(e.CommunityId) select Container.Current.Resolve<IRegisteredUserEmailBroker>().GetEmailIdentityForUser(id, UserRoles.CommunityAdministrator);
                //              _communicationEngine.Send(new AdministratorEmployerEnquiryEmail(community, owners, e.Enquiry));
            }

            // Need to send two emails, one to the employer and one to client services.

            _emailsCommand.TrySend(new EmployerCommunityEnquiryEmail(community, enquiry));
        }
Пример #4
0
        public static Community GetCurrentCommunity(this ICommunitiesQuery communitiesQuery)
        {
            // Get the current community from the context.

            var id = ActivityContext.Current.Community.Id;

            return(id != null?communitiesQuery.GetCommunity(id.Value) : null);
        }
Пример #5
0
        public override void OnLoginAuthenticated()
        {
            var member = LoggedInMember;

            if (member != null)
            {
                SetUserContext(member);
                return;
            }

            var employer = LoggedInEmployer;

            if (employer != null)
            {
                // There is one special case that remains from previous work: Autopeople.

                var partner = _partnersQuery.GetPartner(employer.Id);
                if (partner != null)
                {
                    // Set the context.

                    var community = _communitiesQuery.GetCommunity(partner.Name);
                    if (community != null)
                    {
                        var vertical = _verticalsQuery.GetVertical(community.Id);
                        if (vertical != null)
                        {
                            ActivityContext.Current.Set(vertical);
                            return;
                        }
                    }
                }

                SetEmployerContext(employer);
                return;
            }

            var custodian = LoggedInCustodian;

            if (custodian != null)
            {
                SetUserContext(custodian);
            }
        }
Пример #6
0
        private Community GetCommunity(string verticalUrl)
        {
            // Ensure this is a vertical that an account can be reclaimed from.

            var vertical = _verticalsQuery.GetVerticalByUrl(verticalUrl);

            if (vertical == null || !vertical.RequiresExternalLogin)
            {
                return(null);
            }

            return(_communitiesQuery.GetCommunity(vertical.Id));
        }
Пример #7
0
        public ActionResult Edit(Guid id)
        {
            var community = _communitiesQuery.GetCommunity(id);

            if (community == null)
            {
                return(NotFound("community", "id", id));
            }

            var vertical = _verticalsCommand.GetVertical(id);

            if (vertical == null)
            {
                return(NotFound("vertical", "id", id));
            }

            return(View(new CommunityModel
            {
                Community = community,
                Vertical = vertical,
                Countries = _locationQuery.GetCountries()
            }));
        }
Пример #8
0
        protected bool CanPurchase()
        {
            var communityId = ActivityContext.Current.Community.Id;

            if (communityId != null)
            {
                var community = CommunitiesQuery.GetCommunity(communityId.Value);
                if (community.HasOrganisations && !community.OrganisationsCanSearchAllMembers)
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #9
0
        private bool CanSelectCommunity(IEmployer employer)
        {
            var communityId = ActivityContext.Community.Id;

            if (communityId == null)
            {
                return(true);
            }

            var community = _communitiesQuery.GetCommunity(communityId.Value);

            if (community == null)
            {
                return(true);
            }

            // If the community does not have any members then can.

            if (!community.HasMembers)
            {
                return(true);
            }

            // If the community explicitly allows full search then can.

            if (community.OrganisationsCanSearchAllMembers)
            {
                return(true);
            }

            // An anonymous employer cannot.

            if (employer == null)
            {
                return(false);
            }

            // An employer with no affiliation to any community can.

            if (employer.Organisation.AffiliateId == null)
            {
                return(true);
            }

            // An employer with an affiliation to this community cannot.

            return(false);
        }
Пример #10
0
        private static void AppendCommunityHtml(this StringBuilder sb, MemberSearchCriteria criteria)
        {
            if (criteria.CommunityId == null)
            {
                return;
            }

            var community = _communitiesQuery.GetCommunity(criteria.CommunityId.Value);

            if (community != null)
            {
                sb.AppendSeparatorHtml();
                sb.AppendStartPartHtml("Community: ", "community");
                sb.AppendCriterionDataHtml(community.Name);
                sb.AppendEndPartHtml();
            }
        }
Пример #11
0
        private void LoadFormData()
        {
            // Set up the community related controls first.

            var affiliateId = LoggedInMember.AffiliateId;

            if (affiliateId != null)
            {
                var community = _communitiesQuery.GetCommunity(affiliateId.Value);
                if (community != null)
                {
                    phCommunity.Visible = true;
                    chkCommunity.Text   = community.Name + " logo";
                    litCommunity.Text   = community.Name;
                    ucCommunityCandidateImage.Initialise(community.Id);
                }
                else
                {
                    phCommunity.Visible = false;
                }
            }
            else
            {
                phCommunity.Visible = false;
            }

            ProfessionalVisibility ea = LoggedInMember.VisibilitySettings.Professional.EmploymentVisibility;
            bool accessResume         = (ea & ProfessionalVisibility.Resume) != 0;

            chkAnonResume.Checked = accessResume;
            if (accessResume)
            {
                chkName.Checked            = (ea & ProfessionalVisibility.Name) != 0;
                chkPhone.Checked           = (ea & ProfessionalVisibility.PhoneNumbers) != 0;
                chkPhoto.Checked           = (ea & ProfessionalVisibility.ProfilePhoto) != 0;
                chkRecentEmployers.Checked = (ea & ProfessionalVisibility.RecentEmployers) != 0;
                chkCommunity.Checked       = (ea & ProfessionalVisibility.Communities) != 0;

                pnlRecentEmployersMessage.Style["display"] =
                    (chkAnonResume.Checked && !chkRecentEmployers.Checked) ? "block" : "none";
            }
        }
Пример #12
0
        public static bool IsAutoPeople()
        {
            var id = ActivityContext.Current.Community.Id;

            if (id == null)
            {
                return(false);
            }

            var community = _communitiesQuery.GetCommunity(id.Value);

            if (community == null)
            {
                return(false);
            }

            // This is the hack.

            return(community.Name == "Autopeople");
        }
Пример #13
0
        public ActionResult Apply([Bind(Include = "CompanyName,EmailAddress,FirstName,LastName,JobTitle,PhoneNumber")] AffiliationEnquiry enquiry)
        {
            try
            {
                // Create a new enquiry.

                var community = _communitiesQuery.GetCommunity("Monash University Business and Economics");
                _organisationAffiliationsCommand.CreateEnquiry(community.Id, enquiry);

                // Move to the next page.

                return(RedirectToRoute(EnquiriesRoutes.Confirm));
            }
            catch (UserException ex)
            {
                ModelState.AddModelError(ex, new StandardErrorHandler());
            }

            // Show the user the errors.

            return(View(enquiry));
        }