SetDefaultItemVersionSettings() private method

This method will configure the default ItemVersionSettings for an article, it is called from the Create method on article so that users of the API do not have to pass in itemversionsettings.
private SetDefaultItemVersionSettings ( ) : void
return void
コード例 #1
0
        /// <summary>
        /// Creates an Article object that you can continue to modify or save back into the database.
        /// </summary>
        /// <param name="name">Name of the Category to be created.</param>
        /// <param name="description">The description/abstract of the category to be created.</param>
        /// <param name="articleText"></param>
        /// <param name="authorUserId">The ID of the author of this category.</param>
        /// <param name="parentCategoryId"></param>
        /// <param name="moduleId">The moduleid for where this category will most likely be displayed.</param>
        /// <param name="portalId">The Portal ID of the portal this category belongs to.</param>
        /// <returns>A <see cref="Article" /> with the assigned values.</returns>
        public static Article Create(string name, string description, string articleText, int authorUserId, int parentCategoryId, int moduleId, int portalId)
        {
            var a = new Article
            {
                Name         = name,
                Description  = description.Replace("<br>", "<br />"),
                _articleText = articleText.Replace("<br>", "<br />"),
                AuthorUserId = authorUserId
            };
            //should we strip <br> tags now?

            var irel = new ItemRelationship
            {
                RelationshipTypeId = Util.RelationshipType.ItemToParentCategory.GetId(),
                ParentItemId       = parentCategoryId
            };

            a.Relationships.Add(irel);
            a.StartDate = a.LastUpdated = a.CreatedDate = DateTime.Now.ToString(CultureInfo.InvariantCulture);
            a.PortalId  = portalId;
            a.ModuleId  = moduleId;
            Category c = Category.GetCategory(parentCategoryId, portalId);

            a.DisplayTabId     = c.ChildDisplayTabId;
            a.ApprovalStatusId = ApprovalStatus.Approved.GetId();
            a.NewWindow        = false;
            a.SetDefaultItemVersionSettings();
            return(a);
        }
コード例 #2
0
        /// <summary>
        /// Creates an Article object that you can continue to modify or save back into the database. 
        /// </summary>
        /// <param name="name">Name of the Category to be created.</param>
        /// <param name="description">The description/abstract of the category to be created.</param>
        /// <param name="articleText"></param>
        /// <param name="authorUserId">The ID of the author of this category.</param>
        /// <param name="parentCategoryId"></param>
        /// <param name="moduleId">The moduleid for where this category will most likely be displayed.</param>
        /// <param name="portalId">The Portal ID of the portal this category belongs to.</param>
        /// <returns>A <see cref="Article" /> with the assigned values.</returns>
        public static Article Create(string name, string description, string articleText, int authorUserId, int parentCategoryId, int moduleId, int portalId)
        {
            var a = new Article
                        {
                                Name = name,
                                Description = description.Replace("<br>", "<br />"),
                                _articleText = articleText.Replace("<br>", "<br />"),
                                AuthorUserId = authorUserId
                        };
            //should we strip <br> tags now?

            var irel = new ItemRelationship
                           {
                                   RelationshipTypeId = Util.RelationshipType.ItemToParentCategory.GetId(),
                                   ParentItemId = parentCategoryId
                           };
            a.Relationships.Add(irel);
            a.StartDate = a.LastUpdated = a.CreatedDate = DateTime.Now.ToString(CultureInfo.InvariantCulture);
            a.PortalId = portalId;
            a.ModuleId = moduleId;
            Category c = Category.GetCategory(parentCategoryId, portalId);
            a.DisplayTabId = c.ChildDisplayTabId;
            a.ApprovalStatusId = ApprovalStatus.Approved.GetId();
            a.NewWindow = false;
            a.SetDefaultItemVersionSettings();
            return a;
        }