Example #1
0
        private void GetIndividualClassifications(DynamicModuleManager manager, Type dynamicType, FlatTaxon taxon, string relatedPropertyName)
        {
            IOrganizableProvider contentProvider = manager.Provider as IOrganizableProvider;
            int?totalCount = -1;

            var jobProfileIds = contentProvider.GetItemsByTaxon(taxon.Id, false, relatedPropertyName, dynamicType, null, null, 0, 0, ref totalCount)
                                .Cast <DynamicContent>()
                                .Select(p => p.Id)
                                .ToList();

            DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(Constants.DynamicProvider);
            var classificationData = new List <ClassificationItem>();

            foreach (var jobProfileId in jobProfileIds)
            {
                //Get JobProfile Item
                var relatedJobprofile = dynamicModuleManager.GetDataItem(dynamicType, jobProfileId);

                if (relatedJobprofile.Status.ToString() == Constants.ItemStatusMaster)
                {
                    classificationData.Add(new ClassificationItem
                    {
                        JobProfileId    = dynamicContentExtensions.GetFieldValue <Guid>(relatedJobprofile, nameof(ClassificationItem.Id)),
                        JobProfileTitle = dynamicContentExtensions.GetFieldValue <Lstring>(relatedJobprofile, nameof(ClassificationItem.Title)),
                        Id          = taxon.Id,
                        Title       = taxon.Title,
                        Url         = taxon.UrlName,
                        Description = taxon.Description
                    });
                }
            }

            serviceBusMessageProcessor.SendOtherRelatedTypeMessages(classificationData, taxon.FlatTaxonomy.Name.Trim(), GetActionType(taxon.Status.ToString()));
        }
Example #2
0
        private void GetIndividualClassificationsForSocCodeData(DynamicModuleManager manager, Type dynamicType, FlatTaxon taxon, string relatedPropertyName)
        {
            IOrganizableProvider contentProvider = manager.Provider as IOrganizableProvider;
            int?totalCount = -1;

            var socCodeIds = contentProvider.GetItemsByTaxon(taxon.Id, false, relatedPropertyName, dynamicType, null, null, 0, 0, ref totalCount)
                             .Cast <DynamicContent>()
                             .Select(p => p.Id)
                             .ToList();

            DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(Constants.DynamicProvider);
            var classificationData  = new List <SOCCodeClassificationItem>();
            var contentLinksManager = ContentLinksManager.GetManager();
            var parentType          = TypeResolutionService.ResolveType(ParentType);

            foreach (var socCodeDataId in socCodeIds)
            {
                //Get JobProfile Item
                var relatedSocData = dynamicModuleManager.GetDataItem(dynamicType, socCodeDataId);

                if (relatedSocData.Status.ToString() == Constants.ItemStatusMaster)
                {
                    var socCodeClassificationItem = new SOCCodeClassificationItem
                    {
                        SOCCodeClassificationId = dynamicContentExtensions.GetFieldValue <Guid>(relatedSocData, nameof(SOCCodeClassificationItem.Id)),
                        SOCCode     = dynamicContentExtensions.GetFieldValue <Lstring>(relatedSocData, nameof(SOCCodeClassificationItem.SOCCode)),
                        Id          = taxon.Id,
                        Title       = taxon.Title,
                        Url         = taxon.UrlName,
                        Description = taxon.Description
                    };
                    var jobProfileId = contentLinksManager.GetContentLinks()
                                       .Where(c => c.ParentItemType == ParentType && c.ChildItemId == dynamicContentExtensions.GetFieldValue <Guid>(relatedSocData, nameof(SOCCodeClassificationItem.Id)))
                                       .Select(c => c.ParentItemId).FirstOrDefault();
                    var jobProfileItem = dynamicModuleManager.GetDataItem(parentType, jobProfileId);
                    socCodeClassificationItem.JobProfileId    = jobProfileItem.Id;
                    socCodeClassificationItem.JobProfileTitle = dynamicContentExtensions.GetFieldValue <Lstring>(jobProfileItem, nameof(SOCCodeClassificationItem.Title));
                    classificationData.Add(socCodeClassificationItem);
                }
            }

            serviceBusMessageProcessor.SendOtherRelatedTypeMessages(classificationData, taxon.FlatTaxonomy.Name.Trim(), GetActionType(taxon.Status.ToString()));
        }