Exemplo n.º 1
0
        public static Member Map <TAddressEntity, TLocationReferenceEntity>(this IMemberEntity <TAddressEntity, TLocationReferenceEntity> memberEntity, IRegisteredUserEntity registeredUserEntity, ICommunityMemberEntity communityMemberEntity, ILocationQuery locationQuery)
            where TAddressEntity : class, IAddressEntity <TLocationReferenceEntity>
            where TLocationReferenceEntity : class, ILocationReferenceEntity
        {
            var member = registeredUserEntity.MapTo <Member>();

            ((IHaveEmailAddressesEntity)registeredUserEntity).MapTo(member);
            memberEntity.MapTo(member);
            member.LastUpdatedTime    = memberEntity.lastEditedTime;
            member.Gender             = (Gender)memberEntity.gender;
            member.DateOfBirth        = memberEntity.Map();
            member.EthnicStatus       = (EthnicStatus)(memberEntity.ethnicFlags == null ? 0 : memberEntity.ethnicFlags.Value);
            member.Address            = memberEntity.AddressEntity == null ? null : memberEntity.AddressEntity.Map(locationQuery);
            member.PhotoId            = memberEntity.profilePhotoId;
            member.AffiliateId        = communityMemberEntity == null ? (Guid?)null : communityMemberEntity.primaryCommunityId;
            member.VisibilitySettings = new VisibilitySettings
            {
                Personal =
                {
                    FirstDegreeVisibility  = (PersonalVisibility)memberEntity.firstDegreeAccess,
                    SecondDegreeVisibility = (PersonalVisibility)memberEntity.secondDegreeAccess,
                    PublicVisibility       = (PersonalVisibility)memberEntity.publicAccess
                },
                Professional =
                {
                    EmploymentVisibility = (ProfessionalVisibility)memberEntity.employerAccess,
                }
            };
            return(member);
        }
Exemplo n.º 2
0
        public static Employer Map(IEmployerEntity employerEntity, IRegisteredUserEntity registeredUserEntity, IIndustriesQuery industriesQuery)
        {
            var employer = registeredUserEntity.MapTo <Employer>();

            ((IHaveEmailAddressEntity)registeredUserEntity).MapTo(employer);
            ((IHavePhoneNumberEntity)employerEntity).MapTo(employer);
            employer.JobTitle   = employerEntity.jobTitle;
            employer.SubRole    = (EmployerSubRole)employerEntity.subRole;
            employer.Industries = employerEntity.EmployerIndustryEntities == null
                ? null
                : employerEntity.EmployerIndustryEntities.Map(industriesQuery);
            return(employer);
        }