Ejemplo n.º 1
0
        private RelatedSocCodeItem GetRelatedSocData(DynamicContent jobprofileContent, DynamicContent content)
        {
            var socCodes = new RelatedSocCodeItem
            {
                Id      = dynamicContentExtensions.GetFieldValue <Guid>(content, content.GetContentItemIdKey()),
                SOCCode = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(SocCode.SOCCode)).ToLower()
            };

            return(socCodes);
        }
Ejemplo n.º 2
0
        public JobProfileMessage ConvertFrom(DynamicContent content)
        {
            DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(Constants.DynamicProvider);
            var jobProfileMessage = new JobProfileMessage
            {
                JobProfileId             = dynamicContentExtensions.GetFieldValue <Guid>(content, content.GetContentItemIdKey()),
                Title                    = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(JobProfileMessage.Title)),
                WidgetContentTitle       = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(JobProfileMessage.WidgetContentTitle)),
                AlternativeTitle         = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(JobProfileMessage.AlternativeTitle)),
                Overview                 = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(JobProfileMessage.Overview)),
                SalaryStarter            = dynamicContentExtensions.GetFieldValue <decimal?>(content, nameof(JobProfileMessage.SalaryStarter)),
                SalaryExperienced        = dynamicContentExtensions.GetFieldValue <decimal?>(content, nameof(JobProfileMessage.SalaryExperienced)),
                MinimumHours             = dynamicContentExtensions.GetFieldValue <decimal?>(content, nameof(JobProfileMessage.MinimumHours)),
                MaximumHours             = dynamicContentExtensions.GetFieldValue <decimal?>(content, nameof(JobProfileMessage.MaximumHours)),
                CareerPathAndProgression = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(JobProfileMessage.CareerPathAndProgression)),
                CourseKeywords           = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(JobProfileMessage.CourseKeywords)),

                //Need to use a string to get the content cannot use JobProfileMessage.JobProfileCategories as this is already used in the search
                //index and we will get a clash
                UrlName    = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(JobProfileMessage.UrlName)),
                IsImported = dynamicContentExtensions.GetFieldValue <bool>(content, nameof(JobProfileMessage.IsImported)),

                // How To Become section
                HowToBecomeData    = htbContentPropertyConverter.ConvertFrom(content),
                RelatedCareersData = GetRelatedCareersData(content, Constants.RelatedCareerProfiles),
                Restrictions       = GetRestrictions(content, RelatedRestrictionsField),
                OtherRequirements  = dynamicContentExtensions.GetFieldValue <Lstring>(content, OtherRequirementsField),
                DynamicTitlePrefix = dynamicContentExtensions.GetFieldChoiceLabel(content, nameof(JobProfileMessage.DynamicTitlePrefix)),
                DigitalSkillsLevel = dynamicContentExtensions.GetFieldChoiceLabel(content, nameof(JobProfileMessage.DigitalSkillsLevel)),
            };

            jobProfileMessage.IncludeInSitemap = content.IncludeInSitemap;

            //What You will do section
            jobProfileMessage.WhatYouWillDoData = GetWYDRelatedDataForJobProfiles(content);

            //Related Skills Data
            jobProfileMessage.SocSkillsMatrixData = GetSocSkillMatrixItems(content, Constants.RelatedSkills);

            //Get SOC Code data
            var socItem = dynamicContentExtensions.GetRelatedItems(content, Constants.SocField, 1).FirstOrDefault();

            //SocCode Data
            jobProfileMessage.SocCodeData = GenerateSocData(content, socItem);

            //Working Pattern Details
            jobProfileMessage.WorkingPatternDetails = MapClassificationData(content.GetValue <TrackedList <Guid> >(Constants.WorkingPatternDetail));

            //Working Hours Details
            jobProfileMessage.WorkingHoursDetails = MapClassificationData(content.GetValue <TrackedList <Guid> >(Constants.WorkingHoursDetail));

            //Working Pattern
            jobProfileMessage.WorkingPattern = MapClassificationData(content.GetValue <TrackedList <Guid> >(Constants.WorkingPattern));

            //Hidden Alternative Title
            jobProfileMessage.HiddenAlternativeTitle = MapClassificationData(content.GetValue <TrackedList <Guid> >(Constants.HiddenAlternativeTitle));

            //Job Profile Specialism
            jobProfileMessage.JobProfileSpecialism = MapClassificationData(content.GetValue <TrackedList <Guid> >(Constants.JobProfileSpecialism));

            if (socItem != null)
            {
                jobProfileMessage.SocLevelTwo = dynamicContentExtensions.GetFieldValue <Lstring>(socItem, Constants.SOCCode).ToString().Substring(0, 2);
            }

            jobProfileMessage.LastModified         = dynamicContentExtensions.GetFieldValue <DateTime>(content, nameof(JobProfileMessage.LastModified));
            jobProfileMessage.CanonicalName        = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(JobProfileMessage.UrlName)).ToLower();
            jobProfileMessage.JobProfileCategories = GetJobCategories(dynamicContentExtensions.GetFieldValue <IList <Guid> >(content, RelatedJobProfileCategoriesField));
            return(jobProfileMessage);
        }
Ejemplo n.º 3
0
        private IEnumerable <WYDRelatedContentType> GetWYDRelatedItems(DynamicContent content, string relatedField)
        {
            var items = dynamicContentExtensions.GetRelatedItems(content, relatedField);
            var relatedContentTypes = new List <WYDRelatedContentType>();

            if (items != null && items.Any())
            {
                foreach (var item in items)
                {
                    relatedContentTypes.Add(new WYDRelatedContentType
                    {
                        Id          = dynamicContentExtensions.GetFieldValue <Guid>(item, content.GetContentItemIdKey()),
                        Description = dynamicContentExtensions.GetFieldValue <Lstring>(item, nameof(WYDRelatedContentType.Description)),
                        Title       = dynamicContentExtensions.GetFieldValue <Lstring>(item, nameof(WYDRelatedContentType.Title)),
                        Url         = dynamicContentExtensions.GetFieldValue <Lstring>(item, Constants.Url),
                        IsNegative  = dynamicContentExtensions.GetFieldValue <bool>(item, nameof(WYDRelatedContentType.IsNegative))
                    });
                }

                return(relatedContentTypes);
            }

            return(Enumerable.Empty <WYDRelatedContentType>());
        }
Ejemplo n.º 4
0
        private IEnumerable <JobProfileRelatedCareerItem> GetRelatedCareersData(DynamicContent content, string relatedField)
        {
            var jobProfileRelatedCareerData = new List <JobProfileRelatedCareerItem>();
            var relatedItems = dynamicContentExtensions.GetRelatedItems(content, relatedField);

            if (relatedItems != null)
            {
                foreach (var relatedItem in relatedItems)
                {
                    jobProfileRelatedCareerData.Add(new JobProfileRelatedCareerItem
                    {
                        Id          = dynamicContentExtensions.GetFieldValue <Guid>(relatedItem, content.GetContentItemIdKey()),
                        Title       = dynamicContentExtensions.GetFieldValue <Lstring>(relatedItem, nameof(JobProfileRelatedCareerItem.Title)),
                        ProfileLink = dynamicContentExtensions.GetFieldValue <Lstring>(relatedItem, Constants.Url),
                    });
                }
            }

            return(jobProfileRelatedCareerData);
        }
Ejemplo n.º 5
0
        private IEnumerable <RestrictionItem> GetRestrictions(DynamicContent content, string relatedField)
        {
            var restrictions = new List <RestrictionItem>();
            var relatedItems = dynamicContentExtensions.GetRelatedItems(content, relatedField);

            if (relatedItems != null)
            {
                foreach (var relatedItem in relatedItems)
                {
                    restrictions.Add(new RestrictionItem
                    {
                        Id    = dynamicContentExtensions.GetFieldValue <Guid>(relatedItem, content.GetContentItemIdKey()),
                        Title = dynamicContentExtensions.GetFieldValue <Lstring>(relatedItem, nameof(RestrictionItem.Title)),
                        Info  = dynamicContentExtensions.GetFieldValue <Lstring>(relatedItem, nameof(RestrictionItem.Info))
                    });
                }
            }

            return(restrictions);
        }
Ejemplo n.º 6
0
        private IEnumerable <SocSkillMatrixItem> GetSocSkillMatrixItems(DynamicContent content, string relatedField)
        {
            var relatedSkills = new List <SocSkillMatrixItem>();
            var relatedItems  = dynamicContentExtensions.GetRelatedItems(content, relatedField);

            if (relatedItems != null)
            {
                foreach (var relatedItem in relatedItems)
                {
                    relatedSkills.Add(new SocSkillMatrixItem
                    {
                        Id                = dynamicContentExtensions.GetFieldValue <Guid>(relatedItem, content.GetContentItemIdKey()),
                        Title             = dynamicContentExtensions.GetFieldValue <Lstring>(relatedItem, nameof(SocSkillMatrixItem.Title)),
                        Contextualised    = dynamicContentExtensions.GetFieldValue <Lstring>(relatedItem, nameof(SocSkillMatrixItem.Contextualised)),
                        ONetAttributeType = dynamicContentExtensions.GetFieldValue <Lstring>(relatedItem, nameof(SocSkillMatrixItem.ONetAttributeType)),
                        ONetRank          = dynamicContentExtensions.GetFieldValue <decimal?>(relatedItem, nameof(SocSkillMatrixItem.ONetRank)).GetValueOrDefault(0),
                        Rank              = dynamicContentExtensions.GetFieldValue <decimal?>(relatedItem, nameof(SocSkillMatrixItem.Rank)).GetValueOrDefault(0),
                        RelatedSkill      = GetRelatedSkillsData(content, relatedItem, nameof(SocSkillMatrixItem.RelatedSkill)),
                        RelatedSOC        = GetRelatedSocsData(content, relatedItem, nameof(SocSkillMatrixItem.RelatedSOC))
                    });
                }
            }

            return(relatedSkills);
        }
        private IEnumerable <MoreInformationLinkItem> GetRelatedLinkItems(DynamicContent content, string relatedField)
        {
            var linkItems    = new List <MoreInformationLinkItem>();
            var relatedItems = dynamicContentExtensions.GetRelatedItems(content, relatedField);

            if (relatedItems != null)
            {
                foreach (var relatedItem in relatedItems)
                {
                    var link = dynamicContentExtensions.GetFieldValue <Lstring>(relatedItem, nameof(MoreInformationLinkItem.Url));
                    linkItems.Add(new MoreInformationLinkItem
                    {
                        Id    = dynamicContentExtensions.GetFieldValue <Guid>(relatedItem, content.GetContentItemIdKey()),
                        Title = dynamicContentExtensions.GetFieldValue <Lstring>(relatedItem, nameof(MoreInformationLinkItem.Title)),
                        Url   = !string.IsNullOrWhiteSpace(link) ? new Uri(link, UriKind.RelativeOrAbsolute) : default,