/// <summary> /// Adds the type of the content. /// </summary> /// <param name="contentType">Type of the content.</param> /// <returns>content type id.</returns> /// <exception cref="System.ArgumentNullException">content type is null.</exception> /// <exception cref="System.ArgumentException">contentType.ContentType is empty.</exception> public int AddContentType(ContentType contentType) { //Argument Contract Requires.NotNull("contentType", contentType); Requires.PropertyNotNullOrEmpty("contentType", "ContentType", contentType.ContentType); contentType.ContentTypeId = _DataService.AddContentType(contentType); //Refresh cached collection of types ClearContentTypeCache(); return contentType.ContentTypeId; }
public void DataService_AddContentType_Adds_Record_On_Valid_ContentType() { //Arrange int rowCount = DataUtil.GetRecordCount(DataTestHelper.ConnectionString, ContentDataTestHelper.ContentTypesTableName); DataUtil.AddDatabaseObject(virtualScriptFilePath, addContentType); ContentType contentType = new ContentType(); contentType.ContentType = Constants.CONTENTTYPE_ValidContentType; DataService ds = new DataService(); //Act int contentTypeItemId = ds.AddContentType(contentType); //Assert DatabaseAssert.RecordCountIsEqual(DataTestHelper.ConnectionString, ContentDataTestHelper.ContentTypesTableName, rowCount + 1); }
private static ContentItem CreateFileContentItem() { var typeController = new ContentTypeController(); var contentTypeFile = (from t in typeController.GetContentTypes() where t.ContentType == "File" select t).SingleOrDefault(); if (contentTypeFile == null) { contentTypeFile = new ContentType { ContentType = "File" }; contentTypeFile.ContentTypeId = typeController.AddContentType(contentTypeFile); } var objContent = new ContentItem { ContentTypeId = contentTypeFile.ContentTypeId, Indexed = false, }; objContent.ContentItemId = Util.GetContentController().AddContentItem(objContent); return objContent; }
private static void ImportDocumentLibraryCategoryAssoc(ContentType fileContentType) { DataProvider dataProvider = DataProvider.Instance(); IDataReader dr; try { dr = dataProvider.ExecuteReader("ImportDocumentLibraryCategoryAssoc"); var termController = new TermController(); var vocabulary = new VocabularyController().GetVocabularies().Single(v => v.Name == "Tags"); var terms = termController.GetTermsByVocabulary(vocabulary.VocabularyId); while (dr.Read()) { var file = FileManager.Instance.GetFile((int)dr["FileId"]); ContentItem attachContentItem; if (file.ContentItemID == Null.NullInteger) { attachContentItem = CreateFileContentItem(); file.ContentItemID = attachContentItem.ContentItemId; FileManager.Instance.UpdateFile(file); } else { attachContentItem = Util.GetContentController().GetContentItem(file.ContentItemID); } var term = terms.SingleOrDefault(t => t.Name == dr["CategoryName"].ToString()); if (term == null) { term = new Term(dr["CategoryName"].ToString(), null, vocabulary.VocabularyId); termController.AddTerm(term); } termController.AddTermToContent(term, attachContentItem); } } catch (Exception ex) { Logger.Error(ex); } }
/// <summary> /// Updates the type of the content. /// </summary> /// <param name="contentType">Type of the content.</param> /// <exception cref="System.ArgumentNullException">content type is null.</exception> /// <exception cref="System.ArgumentOutOfRangeException">content type id is less than 0.</exception> /// <exception cref="System.ArgumentException">contentType.ContentType is empty.</exception> public void UpdateContentType(ContentType contentType) { //Argument Contract Requires.NotNull("contentType", contentType); Requires.PropertyNotNegative("contentType", "ContentTypeId", contentType.ContentTypeId); Requires.PropertyNotNullOrEmpty("contentType", "ContentType", contentType.ContentType); _DataService.UpdateContentType(contentType); //Refresh cached collection of types ClearContentTypeCache(); }
/// <summary> /// Creates a Content Type (for taxonomy) in the data store. /// </summary> /// <returns>The primary key value of the new ContentType.</returns> private static int CreateContentType(string ContentTypeName) { var typeController = new ContentTypeController(); var objContentType = new ContentType { ContentType = ContentTypeName }; return typeController.AddContentType(objContentType); }
/// <summary> /// Creates a unique content type for this module /// </summary> /// <returns></returns> private static int CreateContentType() { var typeController = new ContentTypeController(); var objContentType = new ContentType { ContentType = MODULE_TYPE_NAME }; return typeController.AddContentType(objContentType); }
internal static ContentType CreateValidContentType() { ContentType contentType = new ContentType {ContentType = Constants.CONTENTTYPE_ValidContentType}; return contentType; }
private static void CreateContentItem(DesktopModuleInfo desktopModule) { IContentTypeController typeController = new ContentTypeController(); ContentType contentType = (from t in typeController.GetContentTypes() where t.ContentType == "DesktopModule" select t).SingleOrDefault(); if (contentType == null) { contentType = new ContentType { ContentType = "DesktopModule" }; contentType.ContentTypeId = typeController.AddContentType(contentType); } IContentController contentController = Util.GetContentController(); desktopModule.Content = desktopModule.FriendlyName; desktopModule.Indexed = false; desktopModule.ContentTypeId = contentType.ContentTypeId; desktopModule.ContentItemId = contentController.AddContentItem(desktopModule); }
/// <summary>Get a list of content items by ContentType.</summary> public IQueryable<ContentItem> GetContentItemsByContentType(ContentType contentType) { return CBO.FillQueryable<ContentItem>(_dataService.GetContentItemsByContentType(contentType.ContentTypeId)); }
/// <summary>Get a list of content items by ContentType.</summary> /// <returns></returns> public IQueryable <ContentItem> GetContentItemsByContentType(ContentType contentType) { return(this.GetContentItemsByContentType(contentType.ContentTypeId)); }
/// <summary> /// Deletes the type of the content. /// </summary> /// <param name="contentType">Type of the content.</param> /// <exception cref="System.ArgumentNullException">content type is null.</exception> /// <exception cref="System.ArgumentOutOfRangeException">content type id is less than 0.</exception> public void DeleteContentType(ContentType contentType) { //Argument Contract Requires.NotNull("contentType", contentType); Requires.PropertyNotNegative("contentType", "ContentTypeId", contentType.ContentTypeId); _DataService.DeleteContentType(contentType); //Refresh cached collection of types DataCache.RemoveCache(_CacheKey); }
public int AddContentType(ContentType contentType) { return Constants.CONTENTTYPE_AddContentTypeId; }
public void UpdateContentType(ContentType contentType) { }
public void DeleteContentType(ContentType contentType) { }