Esempio n. 1
0
        public Draft FindDraftByArticleId(string articleId)
        {
            int lowestOrderNumber = DocoManager.GetLowestSequenceNumber(articleId);

            IList <ChapterVersion> chapters = DocoManager.GetAllItemsByArticleId(articleId);

            if (chapters.Count > 0)
            {
                var chaps = from c in chapters
                            where c.Sequence == lowestOrderNumber
                            select c;

                List <ChapterVersion> ListchapVersions = chaps.ToList <ChapterVersion>();

                if (ListchapVersions.Count > 0)
                {
                    Draft draft = new Draft();
                    draft = FindItemByChapterId(ListchapVersions.First <ChapterVersion>().Id).FirstOrDefault <Draft>();
                    return(draft);
                }
            }

            return(new Draft()
            {
                Content = ""
            });
        }
        public int GetVersionOrder(string docId, string chapterId)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                IList <ChapterVersion> chapList = DocoManager.GetAllItemsByArticleId(docId);

                var list = from ch in chapList
                           where ch.ChapterId == chapterId
                           select ch;
                List <ChapterVersion> listChapVer = list.ToList <ChapterVersion>();

                return(GetMaxNumber(listChapVer, "version"));
            }
        }
        public int GetNewSequenceNo(string docId)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                IList <ChapterVersion> chapList = DocoManager.GetAllItemsByArticleId(docId);

                var list = from ch in chapList
                           select ch;

                List <ChapterVersion> listChapVer = list.ToList <ChapterVersion>();

                return(GetMaxNumber(listChapVer, "sequence"));
            }
        }
        public bool CheckChapterNameExists(string docId, string chapterName)
        {
            using (TransactionScope transaction = new TransactionScope(mConfiguration))
            {
                IList <ChapterVersion> chapList = DocoManager.GetAllItemsByArticleId(docId);

                var list = from ch in chapList
                           where ch.Name.ToLower() == chapterName.ToLower()
                           select ch;

                List <ChapterVersion> listChapVer = list.ToList <ChapterVersion>();

                if (listChapVer.Count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }