private List <Guid> GetParentItemsForSocSkillsMatrix(DynamicContent item) { var contentLinksManager = ContentLinksManager.GetManager(); return(contentLinksManager.GetContentLinks() .Where(c => c.ParentItemType == ParentType && c.ChildItemId == item.Id) .Select(c => c.ParentItemId).ToList()); }
private void GenerateServiceBusMessageForSocSkillsMatrixType(DynamicContent liveItem, DynamicContent masterItem, MessageAction eventAction) { DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(Constants.DynamicProvider); var contentLinksManager = ContentLinksManager.GetManager(); var parentItemContentLinks = contentLinksManager.GetContentLinks() .Where(c => c.ParentItemType == ParentType && c.ChildItemId == masterItem.Id) .Select(c => c.ParentItemId).ToList(); var relatedSocSkillsMatrixContentTypes = GetSocSkillMatrixRelatedItems(liveItem, parentItemContentLinks, dynamicModuleManager, ParentType); serviceBusMessageProcessor.SendOtherRelatedTypeMessages(relatedSocSkillsMatrixContentTypes, liveItem.GetType().Name, eventAction.ToString()); }
private void GenerateServiceBusMessageForTextFieldTypes(DynamicContent item, MessageAction eventAction) { DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(Constants.DynamicProvider); var contentLinksManager = ContentLinksManager.GetManager(); var parentItemContentLinks = contentLinksManager.GetContentLinks() .Where(c => c.ParentItemType == ParentType && c.ChildItemId == item.Id) .Select(c => c.ParentItemId).ToList(); var relatedTextFieldTypes = GetTextFieldRelatedItems(item, parentItemContentLinks, dynamicModuleManager, ParentType); serviceBusMessageProcessor.SendOtherRelatedTypeMessages(relatedTextFieldTypes, item.GetType().Name, eventAction.ToString()); }
/// <summary> /// This is the default Action. /// </summary> public ActionResult Index() { var model = new WebinarModelList(); var providerName = String.Empty; // Set a transaction name var transactionName = "someTransactionName"; DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager(providerName, transactionName); Type webinarType = TypeResolutionService.ResolveType("Telerik.Sitefinity.DynamicTypes.Model.Webinars.Webinar"); // trying out the join var contentLinksManager = ContentLinksManager.GetManager(); var links = contentLinksManager.GetContentLinks() .Where(cl => cl.ParentItemType == typeof(WebinarModel).FullName && cl.ComponentPropertyName == "RelatedEvent"); var webinars = dynamicModuleManager.GetDataItems(webinarType); var eventsManager = EventsManager.GetManager(); var events = eventsManager.GetEvents(); var relatedData = events .Join(links, (bp) => bp.OriginalContentId, (cl) => cl.ChildItemId, (bp, cl) => new { bp, cl }) .Join(webinars, (bpcl) => bpcl.cl.ParentItemId, (n) => n.OriginalContentId, (bpcl, n) => new { n, bpcl.bp }).Select(x => new WebinarModel() { Title = x.n.GetString("Title"), description = x.n.GetString("Description"), EventId = x.bp.Id.ToString() }).ToList(); //passing back the collection (before performance optimizations) //List<WebinarModel> myCollection = dynamicModuleManager.GetDataItems(webinarType).Select(x => new WebinarModel() //{ // Title = x.GetValue("Title").ToString(), // description = x.GetValue("Description").ToString(), // StartTime = Convert.ToDateTime(x.GetValue("StartTime")), // EndTime = Convert.ToDateTime(x.GetValue("EndTime")), // EventId = EventsManager.GetManager().GetEvents().Where(e => e.Title == x.GetValue("Title").ToString()).Select(y => y.Id).ToString() //}).ToList(); return(View("Default", relatedData)); }
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())); }
private IEnumerable <SkillContentItem> GetRelatedSkillTypeItems(DynamicContent childItem, List <Guid> parentItemLinks, DynamicModuleManager dynamicModuleManager, string parentName) { //When you update a skill get all the socskill matrixes that have this skill var relatedContentItems = new List <SkillContentItem>(); var socSkillsMatrixType = TypeResolutionService.ResolveType(SocSkillsMatrixType); var parentType = TypeResolutionService.ResolveType(ParentType); dynamicModuleManager = DynamicModuleManager.GetManager(Constants.DynamicProvider); var contentLinksManager = ContentLinksManager.GetManager(); foreach (var contentId in parentItemLinks) { var parentItem = dynamicModuleManager.GetDataItem(socSkillsMatrixType, contentId); if ((parentItem.ApprovalWorkflowState == Constants.WorkflowStatusPublished || parentItem.ApprovalWorkflowState == Constants.WorkflowStatusDraft) && !parentItem.IsDeleted) { var jobProfileId = contentLinksManager.GetContentLinks() .Where(c => c.ParentItemType == ParentType && c.ChildItemId == parentItem.Id) .Select(c => c.ParentItemId).FirstOrDefault(); if (jobProfileId != Guid.Empty) { var jobProfileItem = dynamicModuleManager.GetDataItem(parentType, jobProfileId); if (jobProfileItem.ApprovalWorkflowState == Constants.WorkflowStatusPublished && !jobProfileItem.IsDeleted) { relatedContentItems.Add(new SkillContentItem { JobProfileId = dynamicContentExtensions.GetFieldValue <Guid>(jobProfileItem, nameof(SkillContentItem.Id)), JobProfileTitle = dynamicContentExtensions.GetFieldValue <Lstring>(jobProfileItem, nameof(SkillContentItem.Title)), Id = dynamicContentExtensions.GetFieldValue <Guid>(childItem, nameof(SkillContentItem.Id)), Title = dynamicContentExtensions.GetFieldValue <Lstring>(childItem, nameof(SkillContentItem.Title)), ONetElementId = dynamicContentExtensions.GetFieldValue <Lstring>(childItem, nameof(SkillContentItem.ONetElementId)), SocSkillMatrixId = dynamicContentExtensions.GetFieldValue <Guid>(parentItem, nameof(SkillContentItem.Id)), SocSkillMatrixTitle = dynamicContentExtensions.GetFieldValue <Lstring>(parentItem, nameof(SkillContentItem.Title)), Description = dynamicContentExtensions.GetFieldValue <Lstring>(childItem, nameof(SkillContentItem.Description)) }); } } } } return(relatedContentItems); }