示例#1
0
 public void AddHistory(History history) {
   try {
     for (History tmp : helper.Histories().queryForEq("Book", history.getBook())) {
       helper.Histories().deleteById(tmp.getId());
     }
     helper.Histories().create(history);
   } catch (SQLException e) {
     e.printStackTrace();
   }
 }
示例#2
0
 public void DeleteCollection(int id) {
   try {
     List<Book> books = helper.Books().queryForEq("Collection", id);
     Collection defColl = helper.Collections().queryForEq("Name", "д╛хо").get(0);
     for (Book book : books) {
       book.setCollection(defColl.getId());
       helper.Books().update(book);
     }
     helper.Collections().deleteById(id);
   } catch (SQLException e) {
     e.printStackTrace();
   }
 }
示例#3
0
 public void DeleteCollection(String name) {
   try {
     DeleteCollection(helper.Collections().queryForEq("Name", name).get(0).getId());
   } catch (SQLException e) {
     e.printStackTrace();
   }
 }
示例#4
0
 public void AddCollection(Collection collection) {
   try {
     helper.Collections().create(collection);
   } catch (SQLException e) {
     e.printStackTrace();
   }
 }
示例#5
0
 public void DeleteBook(Book book) {
   try {
     helper.Books().delete(book);
   } catch (SQLException e) {
     e.printStackTrace();
   }
 }
示例#6
0
 public void DeleteBook(int id) {
   try {
     helper.Books().deleteById(id);
   } catch (SQLException e) {
     e.printStackTrace();
   }
 }
示例#7
0
 public void AddBook(Book book) {
   try {
     helper.Books().create(book);
   } catch (SQLException e) {
     e.printStackTrace();
   }
 }
示例#8
0
 public List<Book> GetAllBooks() {
   try {
     return helper.Books().queryForAll();
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return null;
 }
示例#9
0
 public List<Book> GetBooks(int collection) {
   try {
     return helper.Books().queryForEq("Collection", collection);
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return null;
 }
示例#10
0
 public Book GetBook(int id) {
   try {
     return helper.Books().queryForId(id);
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return null;
 }
示例#11
0
 public List<History> GetAllHistories() {
   try {
     return helper.Histories().queryForAll();
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return null;
 }
示例#12
0
 public List<Collection> GetAllCollections() {
   try {
     return helper.Collections().queryForAll();
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return null;
 }