示例#1
0
        /// <summary>
        /// get tocid by annotation ,and used for get TOC By TOCId;
        /// </summary>
        /// <param name="annotation"></param>
        /// <returns></returns>
        public int GetTOCIdByAnnotation(Annotation annotation)
        {
            DomainEvents.Publish(new PublicationOpeningEvent(annotation.BookId, false)).Wait();
            var tocDetail = packageAccess.GetTOCDetailByDocId(GlobalAccess.Instance.CurrentPublication.DecryptedDbFullName, annotation.DocId);

            return(tocDetail.ID);
        }
示例#2
0
        public async Task <int> GetTOCIDByDocId(int bookId, string docId)
        {
            await RefreshCurrentPublication(bookId);

            var           docids      = docId.Split(',');
            TOCNodeDetail tocDetail   = null;
            string        sqlFullName = GlobalAccess.Instance.CurrentPublication.DecryptedDbFullName;

            foreach (var docid in docids)
            {
                tocDetail = packageAccess.GetTOCDetailByDocId(sqlFullName, docid);
                if (tocDetail != null)
                {
                    break;
                }
            }
            if (tocDetail != null)
            {
                return(tocDetail.ID);
            }
            else
            {
                throw new NullReferenceException("null tocDetail");
            }
        }