Exemple #1
0
        private bool Create()
        {
            int newID = -1;

            this.itemGuid = Guid.NewGuid();

            newID = DBLinks.AddLink(
                this.itemGuid,
                this.moduleGuid,
                this.moduleID,
                this.title,
                this.url,
                this.viewOrder,
                this.description,
                this.createdDate,
                this.createdByUser,
                this.target,
                this.userGuid);

            this.itemID = newID;

            bool result = (newID > 0);

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

            return(result);
        }
Exemple #2
0
        private bool Create()
        {
            string content = string.Empty;
            int    newID   = -1;

            this.itemGuid = Guid.NewGuid();

            if (this.ContentItems.Count < 1)
            {
                otherSettings.Content        = this.content;
                otherSettings.CssClass       = this.cssClass;
                otherSettings.MobileCssClass = this.mobileCssClass;
                otherSettings.FeaturedImage  = this.featuredImage;
                try
                {
                    content = Json.Encode(otherSettings);
                }
                catch (System.ArgumentException ex)
                {
                    content = this.content;
                }
            }
            else
            {
                try
                {
                    content = JsonConvert.SerializeObject(this.ContentItems);
                }
                catch (JsonSerializationException ex)
                {
                    content = this.content;
                }
            }

            newID = DBLinks.AddLink(
                this.itemGuid,
                this.moduleGuid,
                this.moduleID,
                this.title,
                this.url,
                this.viewOrder,
                content,
                this.createdDate,
                this.createdByUser,
                this.target,
                this.userGuid);

            this.itemID = newID;

            bool result = (newID > 0);

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

            return(result);
        }