示例#1
0
  public static void UpdateBookCategory(Context context, int categoryID, int bookID) {
    MyListDataSource myListDataSource = new MyListDataSource(context);
    myListDataSource.open();

    myListDataSource.updateCategory(categoryID, bookID);

    myListDataSource.close();
  }
示例#2
0
  public static void DeleteBook(Context context, int categoryID, int bookID) {
    MyListDataSource myListDataSource = new MyListDataSource(context);
    myListDataSource.open();

    myListDataSource.deleteMyList(categoryID, bookID);

    myListDataSource.close();
  }
示例#3
0
  public static void DeleteWholeCategory(Context context, int categoryID) {
    MyListDataSource myListDataSource = new MyListDataSource(context);
    myListDataSource.open();

    myListDataSource.deleteCategory(categoryID);

    myListDataSource.close();

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

    categoryDataSource.deleteCategory(categoryID);

    categoryDataSource.close();
  }
示例#4
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();
  }
示例#5
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;
  }