Example #1
0
        /// <summary>
        /// Creates this instance.
        /// </summary>
        /// <returns></returns>
        private bool Create()
        {
            int newID = -1;

            this.itemGuid = Guid.NewGuid();

            newID = DBHtmlContent.AddHtmlContent(
                this.itemGuid,
                this.moduleGuid,
                this.moduleID,
                this.title,
                this.excerpt,
                this.body,
                this.moreLink,
                this.sortOrder,
                this.beginDate,
                this.endDate,
                this.createdDate,
                this.createdBy,
                this.userGuid,
                this.excludeFromRecentContent);

            this.itemID = newID;

            bool result = (newID > -1);

            //IndexHelper.IndexItem(this);
            if (result)
            {
                ContentChangedEventArgs e = new ContentChangedEventArgs();
                OnContentChanged(e);
            }

            return(result);
        }
Example #2
0
        public bool Save(HtmlContent content)
        {
            bool result = false;

            if (content == null)
            {
                return(result);
            }

            content.LastModUtc = DateTime.UtcNow;

            if (content.ItemId > -1)
            {
                result = DBHtmlContent.UpdateHtmlContent(
                    content.ItemId,
                    content.ModuleId,
                    content.Title,
                    content.Excerpt,
                    content.Body,
                    content.MoreLink,
                    content.SortOrder,
                    content.BeginDate,
                    content.EndDate,
                    content.LastModUtc,
                    content.LastModUserGuid,
                    content.ExcludeFromRecentContent);
            }
            else
            {
                content.ItemGuid = Guid.NewGuid();

                int newId = DBHtmlContent.AddHtmlContent(
                    content.ItemGuid,
                    content.ModuleGuid,
                    content.ModuleId,
                    content.Title,
                    content.Excerpt,
                    content.Body,
                    content.MoreLink,
                    content.SortOrder,
                    content.BeginDate,
                    content.EndDate,
                    content.CreatedDate,
                    content.CreatedBy,
                    content.UserGuid,
                    content.ExcludeFromRecentContent);

                content.ItemId = newId;

                result = (newId > -1);
            }

            if (result)
            {
                ContentChangedEventArgs e = new ContentChangedEventArgs();
                content.OnContentChanged(e);
            }

            return(result);
        }