Exemplo n.º 1
0
 /// <summary>
 /// Delete the content.
 /// </summary>
 /// <param name="content"></param>
 public void DeleteContent(StaticHtmlContent content)
 {
     ITransaction tx = base.NHSession.BeginTransaction();
     try
     {
         base.NHSession.Delete(content);
         tx.Commit();
         OnContentDeleted(new IndexEventArgs(StaticHtmlContentToSearchContent(content)));
     }
     catch (Exception ex)
     {
         tx.Rollback();
         throw new Exception("Unable to delete content: " + ex.Message, ex);
     }
 }
Exemplo n.º 2
0
 private void SaveStaticHtml()
 {
     Cuyahoga.Core.Domain.User currentUser = (Cuyahoga.Core.Domain.User)Context.User.Identity;
     StaticHtmlContent content = this._module.GetContent();
     if (content == null)
     {
         // New
         content = new StaticHtmlContent();
         content.Section = this._module.Section;
         content.CreatedBy = currentUser;
         content.ModifiedBy = currentUser;
     }
     else
     {
         // Exisiting
         content.ModifiedBy = currentUser;
     }
     content.Content = this.txtEditor.Text.Trim();
     this._module.SaveContent(content);
 }
        private void SaveStaticHtml()
        {
            Cuyahoga.Core.Domain.User currentUser = (Cuyahoga.Core.Domain.User)Context.User.Identity;

            StaticHtmlContent htmlContent = this._module.ContentItemService.FindContentItemsBySection(this._module.Section).FirstOrDefault()
                                            ?? new StaticHtmlContent();

            if (htmlContent == null)
            {
                // New
                htmlContent = new StaticHtmlContent();
                htmlContent.Title = tbTitle.Text;
                htmlContent.Section = this._module.Section;
                htmlContent.CreatedBy = currentUser;
                htmlContent.ModifiedBy = currentUser;
            }
            else
            {
                // Exisiting
                htmlContent.Title = tbTitle.Text;
                htmlContent.ModifiedBy = currentUser;
                htmlContent.Section = this._module.Section;
            }

            htmlContent.Content = this.fckEditor.Value;
            this._module.SaveContent(htmlContent);
        }
Exemplo n.º 4
0
        private SearchContent StaticHtmlContentToSearchContent(StaticHtmlContent shc)
        {
            SearchContent sc = new SearchContent();
            sc.Title = shc.Section.Title;
            sc.Summary = Text.TruncateText(shc.Content, 200); // trunctate the summary to 200 chars
            sc.Contents = shc.Content;
            sc.Author = shc.ModifiedBy.FullName;
            sc.ModuleType = shc.Section.ModuleType.Name;
            sc.Path = this.SectionUrl;
            sc.Category = String.Empty;
            sc.Site = (shc.Section.Node != null ? shc.Section.Node.Site.Name : String.Empty);
            sc.DateCreated = shc.UpdateTimestamp;
            sc.DateModified = shc.UpdateTimestamp;
            sc.SectionId = shc.Section.Id;

            return sc;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Save the content.
 /// </summary>
 /// <param name="content"></param>
 public void SaveContent(StaticHtmlContent content)
 {
     ITransaction tx = base.NHSession.BeginTransaction();
     try
     {
         if (content.Id == -1)
         {
             content.UpdateTimestamp = DateTime.Now;
             base.NHSession.Save(content);
             OnContentCreated(new IndexEventArgs(StaticHtmlContentToSearchContent(content)));
         }
         else
         {
             base.NHSession.Update(content);
             OnContentUpdated(new IndexEventArgs(StaticHtmlContentToSearchContent(content)));
         }
         tx.Commit();
     }
     catch (Exception ex)
     {
         tx.Rollback();
         throw new Exception("Unable to save content: " + ex.Message, ex);
     }
 }
 /// <summary>
 /// Save the content.
 /// </summary>
 /// <param name="content"></param>
 public void SaveContent(StaticHtmlContent content)
 {
     this._contentItemService.Save(content);
 }
 /// <summary>
 /// Delete the content.
 /// </summary>
 /// <param name="content"></param>
 public void DeleteContent(StaticHtmlContent content)
 {
     this._contentItemService.Delete(content);
 }