public override ChapterVersion CreateChapterVersion(string docId, ChapterVersion chapterVersion, VersionUpdateType versionUpdateType)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                ChapterVersionDataStore dataStore = new ChapterVersionDataStore(transaction);


                int maxSequenceNumber = 0;

                if (versionUpdateType == VersionUpdateType.New)
                {
                    maxSequenceNumber = GetNewSequenceNo(docId); //only generate sequence number when adding a new chapter else use existing sequence number
                }
                else
                {
                    maxSequenceNumber = chapterVersion.Sequence;
                }

                chapterVersion.Version      = GenerateVersionNumber(versionUpdateType, chapterVersion.Version);
                chapterVersion.VersionOrder = GetVersionOrder(docId, chapterVersion.ChapterId);

                //if (!CheckChapterName(docId, chapterVersion.Name))
                // {
                ChapterVersion chapterVer = new ChapterVersion(docId, chapterVersion.ChapterId, chapterVersion.Name, chapterVersion.Content, chapterVersion.Version, chapterVersion.VersionOrder, maxSequenceNumber);

                dataStore.Insert(chapterVer);
                transaction.Commit();

                return(chapterVer);
                //}
                //else
                //  return chapterVersion;
            }
        }
        public override void UpdateChapterVersion(ChapterVersion chapterVers)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                ChapterVersionDataStore dataStore = new ChapterVersionDataStore(transaction);

                dataStore.Update(chapterVers);

                transaction.Commit();
            }
        }
        public override IList <string> GetSubChapters(string chapterId)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                ChapterVersionDataStore chapVersion = new ChapterVersionDataStore(transaction);

                ChapterVersion cv        = chapVersion.FindAllItems().First(x => x.Id.Equals(chapterId));
                XHTMLText      xhtmlText = new XHTMLText();

                IList <string> subChapters = xhtmlText.GetSubChapters(cv.Content);

                return(subChapters);
            }
        }
        public override IList <SubSectionChap> GetChapterSubSection(string chapterId)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                ChapterVersionDataStore chapVersion = new ChapterVersionDataStore(transaction);

                ChapterVersion cv        = chapVersion.FindAllItems().First(x => x.Id.Equals(chapterId));
                XHTMLText      xhtmlText = new XHTMLText();

                IList <string> subChapters = xhtmlText.GetSubChapters(cv.Content);

                List <SubSectionChap> chapSections = new List <SubSectionChap>();
                foreach (string subSec in subChapters)
                {
                    chapSections.Add(new SubSectionChap {
                        ChapId = chapterId, AnchorTag = subSec
                    });
                }
                return(chapSections);
            }
        }
Esempio n. 5
0
 public static void UpdateChapterVersion(ChapterVersion chapterVers)
 {
     Provider.UpdateChapterVersion(chapterVers);
 }
Esempio n. 6
0
 public static ChapterVersion CreateChapterVersion(string docId, ChapterVersion chapterVersion, VersionUpdateType versionUpdateType)
 {
     return(Provider.CreateChapterVersion(docId, chapterVersion, versionUpdateType));
 }
Esempio n. 7
0
 public abstract void UpdateChapterVersion(ChapterVersion chapterVers);
Esempio n. 8
0
 public abstract ChapterVersion CreateChapterVersion(string docId, ChapterVersion chapterVersion, VersionUpdateType versionUpdateType);