//Finds the lowest sequence/order number for the article.
        public int LowestSeqNumber(string articleId)
        {
            IList <Chapter> chapters = DocoManager.GetAllChapters(articleId);
            int             tempMin  = 999999;
            //Load the chapter from the docoID
            var chaps = from c in chapters
                        where c.DocId == articleId
                        select c;

            ICriteria criteria = CreateCriteria();

            List <string> ids = new List <string>();

            if (chaps.Count <Chapter>() > 0)
            {
                foreach (Chapter item in chaps.ToList())
                {
                    ChapterVersion minChapSeq = FindLowest(item.Id).FirstOrDefault <ChapterVersion>();
                    if (minChapSeq != null)
                    {
                        if (minChapSeq.Sequence < tempMin)
                        {
                            tempMin = minChapSeq.Sequence;
                        }
                    }
                }
                return(tempMin);
            }
            else
            {
                return(0);
            }
        }
        public IList <ChapterVersion> FindAllItemsByArticleId(string articleId)
        {
            IList <Chapter> chapters = DocoManager.GetAllChapters(articleId);

            //Load the chapter from the docoID
            var chaps = from c in chapters
                        where c.DocId == articleId
                        select c;

            ICriteria criteria = CreateCriteria();

            List <string> ids = new List <string>();

            foreach (Chapter item in chaps.ToList())
            {
                ChapterVersion maxChapVersion = FindMaxVersion(item.Id).FirstOrDefault <ChapterVersion>();

                if (maxChapVersion != null)
                {
                    ids.Add(maxChapVersion.Id);
                }
            }

            criteria.Add(Expression.In("Id", ids));
            criteria.AddOrder(Order.Asc("Sequence"));

            return(base.Find(criteria, false));
        }
Ejemplo n.º 3
0
 public virtual IList <Chapter> FindAllItems()
 {
     return(DocoManager.GetAllChapters());
 }