public static void UpdateAnnotations(String bookID, List <Page> newPageList)
        {
            List <Page> oldPageList = PagesOnDeviceDataAccessor.GetPages(bookID);

            if (oldPageList != null)
            {
                foreach (Page oldPage in oldPageList)
                {
                    bool notFound = true;
                    foreach (Page newPage in newPageList)
                    {
                        if (oldPage.ID == newPage.ID)
                        {
                            notFound = false;
                            break;
                        }
                    }

                    if (notFound)
                    {
                        RemoveAnnotation(bookID, oldPage.ID);
                    }
                }
            }
        }
Example #2
0
        public static List <Note> GetNotesInChapter(String bookID, String chapterID)
        {
            List <Note> list     = null;
            List <Page> pageList = PagesOnDeviceDataAccessor.GetPagesInChapter(bookID, chapterID);

            if (pageList != null)
            {
                List <Note> noteList = GetNotes(bookID);
                if (noteList != null && noteList.Count > 0)
                {
                    foreach (var page in pageList)
                    {
                        List <Note> tempList = noteList.Where(i => i.PageID == page.ID).ToList();
                        if (tempList != null && tempList.Count > 0)
                        {
                            if (list == null)
                            {
                                list = new List <Note>();
                            }
                            list.AddRange(tempList);
                        }
                    }
                }
            }

            return(list);
        }
        public static String GetChapterID(String bookID, nint pageNumber)
        {
            Page page = PagesOnDeviceDataAccessor.GetPage(bookID, pageNumber);

            if (page != null)
            {
                return(page.ChapterID);
            }
            else
            {
                return(String.Empty);
            }
        }
Example #4
0
        public static void RemoveOrphanBookmarks(String bookID, List <Page> newPageList)
        {
            List <Page> oldPageList = PagesOnDeviceDataAccessor.GetPages(bookID);

            if (oldPageList != null)
            {
                foreach (Page oldPage in oldPageList)
                {
                    var item = newPageList.Where(i => i.ID == oldPage.ID).FirstOrDefault();
                    if (item == null)
                    {
                        RemoveBookmark(bookID, oldPage.ID);
                    }
                }
            }
        }
 public static int GetNumAnnotationsInChapter(String bookID, String chapterID)
 {
     return(GetNumAnnotations(bookID, PagesOnDeviceDataAccessor.GetPagesInChapter(bookID, chapterID)));
 }
 public static int GetNumAnnotationsInBook(String bookID)
 {
     return(GetNumAnnotations(bookID, PagesOnDeviceDataAccessor.GetPages(bookID)));
 }
 public static Page GetPage(String bookID, String pageID)
 {
     return(PagesOnDeviceDataAccessor.GetPage(bookID, pageID));
 }
 public static Page GetPage(String bookID, nint pageNumber)
 {
     return(PagesOnDeviceDataAccessor.GetPage(bookID, pageNumber));
 }
 public static List <Page> GetPages(String bookID, String chapterID)
 {
     return(PagesOnDeviceDataAccessor.GetPagesInChapter(bookID, chapterID));
 }
 public static List <Page> GetPages(String bookID)
 {
     return(PagesOnDeviceDataAccessor.GetPages(bookID));
 }
 public static void UpdatePages(String bookID, List <Page> pageList)
 {
     PagesOnDeviceDataAccessor.UpdatePages(bookID, pageList);
 }
 public static void RemovePages(String bookID)
 {
     PagesOnDeviceDataAccessor.RemovePages(bookID);
 }