private void RefreshReadingRecord()
        {
            List <ReadingRecord> records = bookService.RefreshReadingRecord(phoneAppServeice.State["username"].ToString(), currentISBN);

            foreach (ReadingRecord record in records)
            {
                Debug.WriteLine("[DEBUG]Record belongs to the book with ISBN: " + record.ISBN);
            }
            int totalHaveReadPage = CaculateHaveReadPage(records);

            if (totalHaveReadPage == book.PageNo)
            {
                book.Status = BookStatus.FINISHED;
                MessageBox.Show("又读完了一本书!");
            }
            book.HaveReadPage = totalHaveReadPage;
            bookService.update(book);

            //int days2forecast = ForecastDays2Finish(records, totalHaveReadPage);
            Days2FinishTextBlock.Text = ForecastDays2Finish(records);

            readingProgressBar.DataContext = book;
            readingProgressBar.Value       = book.HaveReadPage;

            ProgressTextBlock.DataContext    = book;
            ProgressTextBlock.Text           = ((double)book.HaveReadPage / book.PageNo * 100).ToString("f0") + "%";
            ReadingRecordHistory.ItemsSource = records;
        }
        private void Reading_Click(object sender, RoutedEventArgs e)
        {
            Button       b    = (Button)sender;
            BookListItem book = b.DataContext as BookListItem;

            book.Status = BookStatus.READING;
            bookService.update(book);
            MessageBox.Show("已经将本书添加到正在阅读的列表中!");

            //RefreshWishBookList();


            RefreshWishBookList();
            //RefreshFinishBookList();
        }
Exemplo n.º 3
0
        public void BookServiceUpdateBoundaryTest()                    //BookService边界测试
        {
            BookService service = BookService.getInstance();

            BookListItem book = new BookListItem();     //边界测试需要的数据

            bool ret3 = service.update(book);           //边界测试4,更新,Book内容为空

            Assert.IsTrue(ret3 == false);
        }
Exemplo n.º 4
0
        public void BookServiceUpdateFuncTest()               //BookService功能测试
        {
            BookService         service = BookService.getInstance();
            List <BookListItem> list;

            list = service.searchByISBN("10010", "TestUser");    //正常测试需要的数据
            BookListItem book2 = list[0];

            book2.Author = "TestAuthorx";

            bool ret5 = service.update(book2);                   //正常测试3,更新

            Assert.IsTrue(ret5 == true);
        }