/// <summary> /// This should run only after a thread has been added/updated in data store and the ContentItem exists. /// </summary> /// <param name="objTopic">The content item we are associating categories with. In this module, it will always be a thread.</param> /// <param name="objContent"></param> internal void ManageThreadTerms(TopicInfo objTopic, ContentItem objContent) { RemoveThreadTerms(objContent); foreach (var term in objTopic.Terms) { Util.GetTermController().AddTermToContent(term, objContent); } }
/// <summary> /// This is used to update the content in the ContentItems table. Should be called when a project is updated. /// </summary> /// <param name="objTopic"></param> /// <param name="tabId"></param> internal void UpdateContentItem(TopicInfo objTopic, int tabId) { var objContent = Util.GetContentController().GetContentItem(objTopic.ContentItemId); if (objContent == null) return; //objContent.Content = objTopic.Description; //objContent.ContentKey = "view=" + Constants.PageScope.ProjectDetail + "&project=" + objTopic.Title; objContent.ModuleID = objTopic.ModuleID; objContent.TabID = tabId; Util.GetContentController().UpdateContentItem(objContent); // Update Terms //var cntTerm = new Terms(); //cntTerm.ManageThreadTerms(objTopic, objContent); }
/// <summary> /// /// </summary> /// <param name="objTopic"></param> /// <param name="tabId"></param> /// <returns>The newly created ContentItemID from the data store.</returns> /// <remarks>This should only run once a topic is in the data store.</remarks> internal ContentItem CreateContentItem(TopicInfo objTopic, int tabId) { var objContent = new ContentItem { //Content = objTopic.Description, ContentTypeId = GetContentTypeID(), Indexed = false, //ContentKey = "view=" + Constants.PageScope.ProjectDetail + "&project=" + objTopic.Title, ModuleID = objTopic.ModuleID, TabID = tabId }; objContent.ContentItemId = Util.GetContentController().AddContentItem(objContent); //// Add Terms //var cntTerm = new Terms(); //cntTerm.ManageThreadTerms(objTopic, objContent); return objContent; }
/// <summary> /// This removes a content item associated with a project from the data store. Should run every time a project is deleted. /// </summary> /// <param name="objTopic">The Content Item we wish to remove from the data store.</param> internal void DeleteContentItem(TopicInfo objTopic) { if (objTopic.ContentItemId <= Null.NullInteger) return; var objContent = Util.GetContentController().GetContentItem(objTopic.ContentItemId); if (objContent == null) return; // remove any metadata/terms associated first (perhaps we should just rely on ContentItem cascade delete here?) var cntTerms = new Terms(); cntTerms.RemoveThreadTerms(objTopic); Util.GetContentController().DeleteContentItem(objContent); }