Example #1
0
    protected void SaveContent(string ChapID, int sequence)
    {
        try
        {
            ChapterVersion       chapterVersion = new ChapterVersion();
            BusiBlocks.XHTMLText xhtml          = new BusiBlocks.XHTMLText();

            IList <ChapterVersion> allChapters = DocoManager.GetAllItemsByArticleId(ArticleId);

            chapterVersion = allChapters.First(x => x.Id.Equals(ChapID));

            Draft draft = DocoManager.GetDraftByChapterId(chapterVersion.Id);

            string temp = chapterVersion.Content;

            if (draft != null)
            {
                chapterVersion.Content = draft.Content;
            }

            //add anchor tags for subchapters.

            chapterVersion.Sequence = sequence;
            chapterVersion.Content  = xhtml.AddAnchorTags(chapterVersion.Content);

            //if this is the first time chapter content is added and no content has been uploaded then
            if (string.IsNullOrEmpty(temp)) // if the content is empty or is being added for the first time it will update the only existing single record.
            {
                BusiBlocks.DocoBlock.DocoManager.UpdateChapterVersion(chapterVersion);
            }
            else
            //Update chapter ID if using the button to save content, if not then do no update since the wmLoadChapter does it.
            {
                BusiBlocks.DocoBlock.DocoManager.CreateChapterVersion(ArticleId, chapterVersion, VersionUpdateType.Content);
            }

            Article a = DocoManager.GetArticle(ArticleId);
            a.UpdateDate = DateTime.Now;
            DocoManager.UpdateArticle(a, false);
        }
        catch (Exception ex)
        {
            //Log - unable to save current content for the selected chapter.
            throw ex;
        }
    }
Example #2
0
    public static object wmLoadDraft(string Id)
    {
        try
        {
            Draft draft = DocoManager.GetDraftByChapterId(Id);

            //bind all the drafts saved for the chapter version.
            //wmBindDraftsList(draft.VersionId);

            ViewArticle2.DraftId = Id;

            return(draft);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }