示例#1
0
  public static void CreateOneBook(
      Context context,
      String bookName,
      String author,
      String version,
      String bookImage,
      String description,
      String level,
      String section,
      String shelve,
      String bookNumber,
      String nfcReferencecode) {
    BookDataSource bookDataSource = new BookDataSource(context);
    bookDataSource.open();

    bookDataSource.createBook(
        bookName,
        author,
        version,
        bookImage,
        description,
        level,
        section,
        shelve,
        bookNumber,
        nfcReferencecode);
    bookDataSource.close();
  }
示例#2
0
  public static BookInfo GetOneBookByNFC(Context context, String nfcCode) {
    BookDataSource bookDataSource = new BookDataSource(context);
    bookDataSource.open();

    BookInfo bookInfo = null;
    bookInfo = bookDataSource.getBookByNFC(nfcCode);
    bookDataSource.close();

    return bookInfo;
  }
示例#3
0
  public static BookInfo GetOneBook(Context context, int bookID) {
    BookDataSource bookDataSource = new BookDataSource(context);
    bookDataSource.open();

    BookInfo bookInfo = null;
    bookInfo = bookDataSource.getBook(bookID);
    bookDataSource.close();

    return bookInfo;
  }
示例#4
0
  public static ArrayList<BookInfo> GetAllBooks(Context context) {
    BookDataSource bookDataSource = new BookDataSource(context);
    bookDataSource.open();

    ArrayList<BookInfo> bookInfList = null;
    bookInfList = bookDataSource.getBooks();
    bookDataSource.close();

    return bookInfList;
  }
示例#5
0
  public static void clearDatabase(Context context) {

    CategoryDataSource categoryDataSource = new CategoryDataSource(context);
    categoryDataSource.open();
    categoryDataSource.clearCategory();
    categoryDataSource.close();

    MyListDataSource myListDataSource = new MyListDataSource(context);
    myListDataSource.open();
    myListDataSource.clearMyList();
    myListDataSource.close();

    BookDataSource bookDataSource = new BookDataSource(context);
    bookDataSource.open();
    bookDataSource.clearBook();
    bookDataSource.close();
  }
示例#6
0
  public static ArrayList<BookInfo> GetBooks(Context context, int categoryID) {
    MyListDataSource myListDataSource = new MyListDataSource(context);
    myListDataSource.open();

    ArrayList<MyListInfo> myListInfoList = null;
    myListInfoList = myListDataSource.getMyList(categoryID);
    myListDataSource.close();

    // for(MyListInfo mylist : myListInfoList)
    // Log.v("test", "list: " + mylist.getBookID());

    BookDataSource bookDataSource = new BookDataSource(context);
    bookDataSource.open();

    ArrayList<BookInfo> bookInfoList = null;
    bookInfoList = bookDataSource.getMyList(myListInfoList);
    bookDataSource.close();

    return bookInfoList;
  }