private void deleteShelfButton_Click(object sender, EventArgs e)//删除书架 { BookShelf shelf = shelfBindingSource.Current as BookShelf; BookShelfService.RemoveBookShelf(shelf.BookShelfId); shelfBindingSource.DataSource = BookShelfService.GetAllShelfs(); }
public FormManage(FormMain form, Client client) { InitializeComponent(); this.formMain = form; this.currentClient = client; this.shelfBindingSource.DataSource = BookShelfService.GetAllShelfs(); }
private void refreshButton_Click(object sender, EventArgs e)//刷新 { isNormal = true; shelfBindingSource.DataSource = BookShelfService.GetAllShelfs(); bookBindingSource.DataSource = shelfBindingSource; bookBindingSource.DataMember = "Books"; }
private void sortButton_Click(object sender, EventArgs e)//按分类管理 { isNormal = false; shelfBindingSource.DataSource = BookShelfService.GetAllShelfs(); bookBindingSource.DataMember = null; bookBindingSource.DataSource = BookShelfService.Query(4); }
private void addShelfButton_Click(object sender, EventArgs e)//添加书架 { int k = Convert.ToInt32(BookShelfService.GetAllShelfs().Max(i => i.BookShelfId)) + 1; BookShelfService.AddBookShelf(new BookShelf() { BookShelfId = k + "" }); shelfBindingSource.DataSource = BookShelfService.GetAllShelfs(); }
private void deleteBookButton_Click(object sender, EventArgs e)//删除书籍 { Book book = bookBindingSource.Current as Book; if (book == null) { MessageBox.Show("请选择一本书进行操作!"); return; } BookShelfService.RemoveBooks(book.BookId); shelfBindingSource.DataSource = BookShelfService.GetAllShelfs(); }
public void resetLibrary() { this.shelfBindingSource.DataSource = BookShelfService.GetAllShelfs(); }