public void ConvertFromTest(bool cadReady)
        {
            //Assign
            SetupCalls(cadReady);
            var whatYouWillDoConverter =
                new WhatYouWillDoConverter(fakeDynamicContentExtensions);

            //Act
            whatYouWillDoConverter.ConvertFrom(fakeDynamicContentItem);

            if (cadReady)
            {
                //Assert
                A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
                .MustHaveHappened();
                A.CallTo(() => fakeDynamicContentExtensions.GetRelatedItems(A <DynamicContent> ._, A <string> ._, A <int> ._))
                .MustHaveHappened();
            }
            else
            {
                //Assert
                A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
                .MustNotHaveHappened();
            }
        }
Beispiel #2
0
        public void ConvertFromTest(bool hasValidSkill)
        {
            //set up calls
            var jobProfileRelatedSkillConverter = new JobProfileRelatedSkillConverter(fakeDynamicContentExtensions);
            var expectedSkillDescription        = "TestSkillDescription";

            var dummysRelatedSkills = hasValidSkill ? A.CollectionOfDummy <DynamicContent>(1).AsEnumerable().AsQueryable() : Enumerable.Empty <DynamicContent>().AsQueryable();

            A.CallTo(() => fakeDynamicContentExtensions.GetRelatedItems(A <DynamicContent> ._, A <string> ._, A <int> ._)).Returns(dummysRelatedSkills);

            A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
            .Returns("DummyText");

            A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, nameof(WhatItTakesSkill.Description)))
            .Returns(hasValidSkill ? expectedSkillDescription : null);

            var relatedSkill = jobProfileRelatedSkillConverter.ConvertFrom(fakeDynamicContentItem);

            //Assert
            if (hasValidSkill)
            {
                relatedSkill.Description.Should().BeEquivalentTo(expectedSkillDescription);
            }
            else
            {
                relatedSkill.Should().BeNull();
            }
        }
Beispiel #3
0
        public void ConvertFromTest(bool hasRelatedSocs)
        {
            // Arrange
            SetupCalls(hasRelatedSocs);
            var jobprofileConverter = new JobProfileOverloadForSearchConverter(fakeDynamicContentExtensions);

            var dummyRelatedItems = A.CollectionOfDummy <string>(1).AsEnumerable().AsQueryable();

            A.CallTo(() => fakeDynamicContentExtensions.GetRelatedContentUrl(A <DynamicContent> ._, A <string> ._))
            .Returns(dummyRelatedItems);

            //Act
            jobprofileConverter.ConvertFrom(fakeDynamicContentItem);

            //Assert
            if (hasRelatedSocs)
            {
                A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
                .MustHaveHappened();
            }
            else
            {
                A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
                .MustNotHaveHappened();
            }

            A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <IList <Guid> >(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened();
            A.CallTo(() => fakeDynamicContentExtensions.GetRelatedSearchItems(A <DynamicContent> ._, A <string> ._, A <int> ._))
            .MustHaveHappened();
        }
        public void ConvertFromTest(bool cadReady)
        {
            //Assign
            SetupCalls(cadReady);
            var howToBecomeConverter =
                new HowToBecomeConverter(fakeRelatedClassificationsRepository, fakeDynamicContentExtensions);

            //Act
            howToBecomeConverter.ConvertFrom(fakeDynamicContentItem);

            if (cadReady)
            {
                //Assert
                A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
                .MustHaveHappened();
                A.CallTo(() => fakeRelatedClassificationsRepository.GetRelatedClassifications(A <DynamicContent> ._, A <string> ._, A <string> ._)).MustHaveHappened();
            }
            else
            {
                //Assert
                A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
                .MustNotHaveHappened();
                A.CallTo(() => fakeRelatedClassificationsRepository.GetRelatedClassifications(A <DynamicContent> ._, A <string> ._, A <string> ._)).MustNotHaveHappened();
            }
        }
 public JobProfileRelatedCareer ConvertFrom(DynamicContent content)
 {
     return(new JobProfileRelatedCareer
     {
         Title = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(JobProfile.Title)),
         ProfileLink = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(JobProfile.UrlName)),
     });
 }
Beispiel #6
0
 public StructuredDataInjection ConvertFrom(DynamicContent content)
 {
     return(new StructuredDataInjection
     {
         Title = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(StructuredDataInjection.Title)),
         Script = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(StructuredDataInjection.Script)),
         DataType = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(StructuredDataInjection.DataType))
     });
 }
Beispiel #7
0
 public SocCode ConvertFrom(DynamicContent content)
 {
     return(new SocCode
     {
         Description = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(SocCode.Description)),
         SOCCode = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(SocCode.SOCCode)),
         ONetOccupationalCode = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(SocCode.ONetOccupationalCode)),
         UrlName = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(SocCode.UrlName))
     });
 }
 public FrameworkSkill ConvertFrom(DynamicContent content)
 {
     return new FrameworkSkill
     {
         Description = dynamicContentExtensions.GetFieldValue<Lstring>(content, nameof(FrameworkSkill.Description)),
         Title = dynamicContentExtensions.GetFieldValue<Lstring>(content, nameof(FrameworkSkill.Title)),
         ONetElementId =
             dynamicContentExtensions.GetFieldValue<Lstring>(content, nameof(FrameworkSkill.ONetElementId))
     };
 }
        public void ConvertFromTest()
        {
            //Assign
            SetupCalls();
            var appConverter = new ApprenticeVacancyConverter(dynamicContentExtensions);

            //Act
            appConverter.ConvertFrom(dummyDynamicContent);

            //Assert
            A.CallTo(() => dynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened();
        }
        public EmailTemplate ConvertFrom(DynamicContent content)
        {
            var emailTemplate = new EmailTemplate
            {
                TemplateName = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(EmailTemplate.TemplateName)),
                From         = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(EmailTemplate.From)),
                To           = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(EmailTemplate.To)),
                Subject      = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(EmailTemplate.Subject)),
                Body         = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(EmailTemplate.Body)),
                BodyNoHtml   = dynamicContentExtensions.GetContentWithoutHtmlTags(content, nameof(EmailTemplate.Body))
            };

            return(emailTemplate);
        }
Beispiel #11
0
        public SocSkillMatrix ConvertFrom(DynamicContent content)
        {
            var socSkillsMatrix = new SocSkillMatrix
            {
                Title             = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(SocSkillMatrix.Title)),
                Contextualised    = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(SocSkillMatrix.Contextualised)),
                ONetAttributeType = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(SocSkillMatrix.ONetAttributeType)),
                ONetRank          = dynamicContentExtensions.GetFieldValue <decimal?>(content, nameof(SocSkillMatrix.ONetRank)),
                Rank = dynamicContentExtensions.GetFieldValue <decimal?>(content, nameof(SocSkillMatrix.Rank))
            };

            var socItem = dynamicContentExtensions.GetRelatedItems(content, SocField, 1).FirstOrDefault();

            if (socItem != null)
            {
                socSkillsMatrix.SocCode = dynamicContentExtensions.GetFieldValue <Lstring>(socItem, nameof(JobProfile.SOCCode));
            }

            var skillItem = dynamicContentExtensions.GetRelatedItems(content, SkillField, 1).FirstOrDefault();

            if (skillItem != null)
            {
                socSkillsMatrix.ONetElementId = dynamicContentExtensions.GetFieldValue <Lstring>(skillItem, nameof(socSkillsMatrix.ONetElementId));
                socSkillsMatrix.Skill         = dynamicContentExtensions.GetFieldValue <Lstring>(skillItem, nameof(socSkillsMatrix.Title));
            }

            return(socSkillsMatrix);
        }
        public void ConvertFromTest()
        {
            // Arrange
            SetupCalls();
            var socSkillsMatrixConverter =
                new StructuredDataInjectionConverter(fakeDynamicContentExtensions);

            //Act
            socSkillsMatrixConverter.ConvertFrom(fakeDynamicContentItem);

            //Assert
            A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened(3, Times.Exactly);
        }
Beispiel #13
0
        public void ConvertFromTest()
        {
            // Arrange
            SetupCalls();
            var frameworkSkillConverter =
                new FrameworkSkillConverter(fakeDynamicContentExtensions);

            //Act
            frameworkSkillConverter.ConvertFrom(fakeDynamicContentItem);

            //Assert
            A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened(3, Times.Exactly);
        }
Beispiel #14
0
        public void ConvertFromTest()
        {
            //Assign
            SetupCalls();
            var socCodeReportConverter = new ApprenticeshipReportConverter(dummySocCodeReportConverter, dummyDynamicContentExtensions, dummyCmsReportIteModuleConverter, mapper);

            //Act
            socCodeReportConverter.ConvertFrom(dummyDynamicContent);

            //Assert
            A.CallTo(() => dummyCmsReportIteModuleConverter.ConvertFrom(A <DynamicContent> ._))
            .MustHaveHappened();
            A.CallTo(() => dummyDynamicContentExtensions.GetFieldValue <DynamicContent>(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened();
            A.CallTo(() => dummySocCodeReportConverter.ConvertFrom(A <DynamicContent> ._)).MustHaveHappened();
        }
        public IEnumerable <JobProfileOverloadForWhatItTakes> GetLiveJobProfilesBySocCode(string socCode)
        {
            var socCodeItem = repository.Get(item => item.Status == ContentLifecycleStatus.Live && item.GetValue <string>(nameof(SocCode.SOCCode)) == socCode);

            if (socCodeItem != null)
            {
                var jobProfiles = dynamicContentExtensions.GetRelatedParentItems(socCodeItem, DynamicTypes.JobprofileContentType, repository.GetProviderName());

                if (jobProfiles.Any())
                {
                    var jobProfileOverloadForWhatItTakesList = new List <JobProfileOverloadForWhatItTakes>();
                    foreach (var jobProfile in jobProfiles)
                    {
                        var isCheckedOut = jpRepository.IsCheckedOut(jobProfile);

                        jobProfileOverloadForWhatItTakesList.Add(isCheckedOut ? new JobProfileOverloadForWhatItTakes {
                            UrlName = dynamicContentExtensions.GetFieldValue <Lstring>(jobProfile, nameof(JobProfile.UrlName)), Locked = true
                        } : converterLight.ConvertFrom(jobProfile));
                    }

                    return(jobProfileOverloadForWhatItTakesList);
                }
            }

            return(Enumerable.Empty <JobProfileOverloadForWhatItTakes>().AsQueryable());
        }
Beispiel #16
0
        public void ConvertFromTest()
        {
            // Arrange
            SetupCalls();
            var emailTemplateConverter =
                new EmailTemplateConverter(fakeDynamicContentExtensions);

            //Act
            emailTemplateConverter.ConvertFrom(fakeDynamicContentItem);

            //Assert
            A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened(5, Times.Exactly);
            A.CallTo(() => fakeDynamicContentExtensions.GetContentWithoutHtmlTags(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened(1, Times.Exactly);
        }
        private IQueryable <Taxon> GetClasifications(DynamicContent content, string relatedField, string taxonomyName)
        {
            var relatedClasifications = dynamicContentExtensions.GetFieldValue <IList <Guid> >(content, relatedField);
            var clasifications        = GetMany(c => relatedClasifications.Contains(c.Id) && c.Taxonomy.Name == taxonomyName);

            return(clasifications);
        }
        public void ConvertFromTest()
        {
            //Assign
            SetupCalls();
            var jobProfileApprenticeshipVacancyReportConverter = new JobProfileApprenticeshipVacancyReportConverter(dummySocCodeReportConverter, dummyJobProfileConverter, dummyDynamicContentExtensions);

            //Act
            jobProfileApprenticeshipVacancyReportConverter.ConvertFrom(dummyDynamicContent);

            //Assert
            A.CallTo(() => dummyJobProfileConverter.ConvertFrom(A <DynamicContent> ._))
            .MustHaveHappened();
            A.CallTo(() => dummyDynamicContentExtensions.GetFieldValue <DynamicContent>(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened();
            A.CallTo(() => dummySocCodeReportConverter.ConvertFrom(A <DynamicContent> ._)).MustHaveHappened();
        }
        public PsfOnetSkill ConvertFrom(DynamicContent content)
        {
            var isHidden = dynamicContentExtensions.GetFieldValue <bool>(content, "PSFHidden");

            if (isHidden)
            {
                return(default);
Beispiel #20
0
        public void ConvertFromTest()
        {
            //Assign
            SetupCalls();
            var socCodeReportConverter = new SocCodeReportConverter(dummyDynamicContentExtensions, dummyRelatedClassificationsRepository, dummyCmsReportIteModuleConverter, mapper);

            //Act
            socCodeReportConverter.ConvertFrom(dummyDynamicContent);

            //Assert
            A.CallTo(() => dummyCmsReportIteModuleConverter.ConvertFrom(A <DynamicContent> ._))
            .MustHaveHappened();
            A.CallTo(() => dummyDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened();
            A.CallTo(() => dummyRelatedClassificationsRepository.GetRelatedCmsReportClassifications(A <DynamicContent> ._, A <string> ._, A <string> ._)).MustHaveHappened();
        }
        public SocCodeReport ConvertFrom(DynamicContent content)
        {
            var socCodeReport = new SocCodeReport();
            var cmsReportItem = cmsReportItemConverter.ConvertFrom(content);

            if (cmsReportItem != null)
            {
                socCodeReport = mapper.Map <SocCodeReport>(cmsReportItem);
            }

            socCodeReport.Description = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(SocCode.Description));
            socCodeReport.SOCCode     = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(SocCode.SOCCode));
            socCodeReport.Frameworks  = relatedClassificationsRepository.GetRelatedCmsReportClassifications(content, ApprenticeshipFrameworks, ApprenticeshipFrameworksTaxonomyName);
            socCodeReport.Standards   = relatedClassificationsRepository.GetRelatedCmsReportClassifications(content, ApprenticeshipStandardsRelatedField, ApprenticeshipStandardsTaxonomyName);
            return(socCodeReport);
        }
        public WhatItTakesSkill ConvertFrom(DynamicContent content)
        {
            var skillDescription = GetSkillDescription(content);

            if (!string.IsNullOrEmpty(skillDescription))
            {
                return(new WhatItTakesSkill
                {
                    Title = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(WhatItTakesSkill.Title)),
                    Description = skillDescription,
                    Contextualised = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(WhatItTakesSkill.Contextualised)),
                });
            }
            else
            {
                return(default);
        public void GetRelatedClassificationsTest(bool classificationsAvailable, string relatedField, string taxonomyName)
        {
            //Assign
            SetupCalls(classificationsAvailable);
            var classificationRepo =
                new RelatedClassificationsRepository(fakeTaxonomyManager, fakeDynamicContentExtensions, fakeTaxonomyManagerExtensions);

            //Act
            classificationRepo.GetRelatedClassifications(dummyContentItem, relatedField, taxonomyName);

            //Assert
            A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <IList <Guid> >(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened();

            A.CallTo(() => fakeTaxonomyManagerExtensions.WhereQueryable(A <IQueryable <Taxon> > ._, A <Expression <Func <Taxon, bool> > > ._)).MustHaveHappened();
        }
        private JobProfileSocCodeRepository GetTestJobProfileSocCodeRepository(bool validSoc = false)
        {
            //Setup the fakes and dummies
            var dummySocCode    = A.Dummy <DynamicContent>();
            var dummyAppVacancy = A.Dummy <ApprenticeVacancy>();
            var witJp           = new JobProfileOverloadForWhatItTakes();

            var dummyVacancies = validSoc ? A.CollectionOfDummy <DynamicContent>(2).AsEnumerable().AsQueryable() : Enumerable.Empty <DynamicContent>().AsQueryable();

            A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._)).Returns("test");
            A.CallTo(() => fakeDynamicContentExtensions.GetRelatedParentItems(A <DynamicContent> ._, A <string> ._, A <string> ._)).Returns(dummyVacancies);

            A.CallTo(() => fakeConverterLight.ConvertFrom(A <DynamicContent> ._)).Returns(witJp);

            if (validSoc)
            {
                A.CallTo(() => fakeRepository.Get(A <Expression <Func <DynamicContent, bool> > > ._)).Returns(dummySocCode);
                A.CallTo(() => fakeJobProfileSocConverter.ConvertFrom(dummySocCode)).Returns(dummyAppVacancy);
            }
            else
            {
                A.CallTo(() => fakeRepository.Get(A <Expression <Func <DynamicContent, bool> > > ._)).Returns(null);
                A.CallTo(() => fakeJobProfileSocConverter.ConvertFrom(dummySocCode)).Returns(null);
            }

            return(new JobProfileSocCodeRepository(fakeRepository, fakeJobProfileSocConverter, fakeSocConverter, fakeDynamicContentExtensions, fakeConverterLight, fakeJpRepository));
        }
Beispiel #25
0
        public void ConvertFromTest()
        {
            // Arrange
            SetupCalls();
            var socSkillsMatrixConverter =
                new SocSkillsMatrixConverter(fakeDynamicContentExtensions);

            //Act
            socSkillsMatrixConverter.ConvertFrom(fakeDynamicContentItem);

            //Assert
            A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <Lstring>(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened(6, Times.Exactly);
            A.CallTo(() => fakeDynamicContentExtensions.GetFieldValue <decimal?>(A <DynamicContent> ._, A <string> ._))
            .MustHaveHappened(2, Times.Exactly);
            A.CallTo(() => fakeDynamicContentExtensions.GetRelatedItems(A <DynamicContent> ._, A <string> ._, A <int> ._))
            .MustHaveHappened(2, Times.Exactly);
        }
        public JobProfileOverloadForSearch ConvertFrom(DynamicContent content)
        {
            var jobProfile = new JobProfileOverloadForSearch
            {
                //Need to use a string to get the content cannot use JobProfile.JobProfileCategories as this is already used in the search
                //index and we will get a clash
                JobProfileCategoryIdCollection =
                    dynamicContentExtensions.GetFieldValue <IList <Guid> >(content, RelatedJobProfileCategoriesField)
            };

            var socItem = dynamicContentExtensions.GetRelatedSearchItems(content, SocField, 1).FirstOrDefault();

            if (socItem != null)
            {
                jobProfile.SOCCode = dynamicContentExtensions.GetFieldValue <Lstring>(socItem, nameof(JobProfile.SOCCode));
                jobProfile.ONetOccupationalCode = dynamicContentExtensions.GetFieldValue <Lstring>(socItem, nameof(JobProfile.ONetOccupationalCode));
            }

            //PSF
            jobProfile.RelatedInterests          = dynamicContentExtensions.GetRelatedSearchItemsUrl(content, RelatedInterestsField);
            jobProfile.RelatedEnablers           = dynamicContentExtensions.GetRelatedSearchItemsUrl(content, RelatedEnablersField);
            jobProfile.RelatedTrainingRoutes     = dynamicContentExtensions.GetRelatedSearchItemsUrl(content, RelatedTrainingRoutesField);
            jobProfile.RelatedPreferredTaskTypes = dynamicContentExtensions.GetRelatedSearchItemsUrl(content, RelatedPreferredTaskTypesField);
            jobProfile.RelatedJobAreas           = dynamicContentExtensions.GetRelatedSearchItemsUrl(content, RelatedJobAreasField);

            var skills = dynamicContentExtensions.GetRelatedSearchItemsUrl(content, RelatedSkills);

            if (skills != null)
            {
                jobProfile.RelatedSkills = new List <string>();

                foreach (var skill in skills)
                {
                    jobProfile.RelatedSkills.Add(skill.Substring(skill.IndexOf("-") + 1).Replace(" ", "-"));
                }
            }

            var relatedRelatedEntryQualifications = dynamicContentExtensions.GetRelatedSearchItems(content, RelatedEntryQualificationsField, 100);

            jobProfile.RelatedEntryQualifications    = relatedRelatedEntryQualifications?.AsQueryable().Select(x => $"{x.UrlName}");
            jobProfile.EntryQualificationLowestLevel = GetLowestLevel(relatedRelatedEntryQualifications);

            return(jobProfile);
        }
        public WhatYouWillDo ConvertFrom(DynamicContent content)
        {
            var isCadReady =
                dynamicContentExtensions.GetFieldValue <bool>(content, IsCadReadyField);

            return(!isCadReady
                ? new WhatYouWillDo()
                : new WhatYouWillDo
            {
                IsCadReady = true,
                Introduction =
                    dynamicContentExtensions.GetFieldValue <Lstring>(content, IntroductionField),
                DailyTasks =
                    dynamicContentExtensions.GetFieldValue <Lstring>(content, DailyTasksField),
                Locations = GetRelatedItemDescription(content, RelatedLocationsField),
                Uniforms = GetRelatedItemDescription(content, RelatedUniformsField),
                Environments = GetRelatedItemDescription(content, RelatedEnvironmentsField)
            });
        }
Beispiel #28
0
        public JobProfileOverloadForSearch ConvertFrom(DynamicContent content)
        {
            var jobProfile = new JobProfileOverloadForSearch
            {
                //Need to use a string to get the content cannot use JobProfile.JobProfileCategories as this is already used in the search
                //index and we will get a clash
                JobProfileCategoryIdCollection =
                    dynamicContentExtensions.GetFieldValue <IList <Guid> >(content, RelatedJobProfileCategoriesField)
            };

            var socItem = dynamicContentExtensions.GetRelatedSearchItems(content, SocField, 1).FirstOrDefault();

            if (socItem != null)
            {
                jobProfile.SOCCode = dynamicContentExtensions.GetFieldValue <Lstring>(socItem, nameof(JobProfile.SOCCode));
                jobProfile.ONetOccupationalCode = dynamicContentExtensions.GetFieldValue <Lstring>(socItem, nameof(JobProfile.ONetOccupationalCode));
            }

            return(jobProfile);
        }
Beispiel #29
0
        public JobProfileOverloadForWhatItTakes ConvertFrom(DynamicContent content)
        {
            var jobProfile = new JobProfileOverloadForWhatItTakes();

            jobProfile.UrlName            = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(JobProfile.UrlName));
            jobProfile.Title              = dynamicContentExtensions.GetFieldValue <Lstring>(content, nameof(JobProfile.Title));
            jobProfile.DigitalSkillsLevel = dynamicContentExtensions.GetFieldChoiceValue(content, nameof(JobProfile.DigitalSkillsLevel));

            var socItem = dynamicContentExtensions.GetRelatedItems(content, SocField, 1).FirstOrDefault();

            if (socItem != null)
            {
                jobProfile.SOCCode = dynamicContentExtensions.GetFieldValue <Lstring>(socItem, nameof(JobProfile.SOCCode));
                jobProfile.ONetOccupationalCode = dynamicContentExtensions.GetFieldValue <Lstring>(socItem, nameof(JobProfile.ONetOccupationalCode));
            }

            jobProfile.HasRelatedSocSkillMatrices = dynamicContentExtensions.GetRelatedItems(content, RelatedSkillsField, 1)?.Any() == true;

            return(jobProfile);
        }
Beispiel #30
0
        public ApprenticeshipVacancyReport ConvertFrom(DynamicContent content)
        {
            var cmsReportItem = cmsReportItemConverter.ConvertFrom(content);
            var avReport      = cmsReportItem is null ? new ApprenticeshipVacancyReport() : mapper.Map <ApprenticeshipVacancyReport>(cmsReportItem);
            var socItem       = dynamicContentExtensions.GetFieldValue <DynamicContent>(content, SocCodePropertyName);

            if (socItem != null)
            {
                avReport.SocCode = socCodeReportConverter.ConvertFrom(socItem);
            }

            return(avReport);
        }