private void addButton_Click(object sender, EventArgs e)//添加图书,必须选取一个书架才能添加 { BookShelf shelf = shelfBindingSource.Current as BookShelf; FormBookDetail formBookDetail = new FormBookDetail(shelf); if (formBookDetail.ShowDialog() == DialogResult.OK) { shelfBindingSource.DataSource = BookShelfService.GetAllShelfs(); bookBindingSource.DataSource = shelfBindingSource; bookBindingSource.DataMember = "Books"; } }
private void changeDetailButton_Click(object sender, EventArgs e)//修改图书细节 { BookShelf shelf = shelfBindingSource.Current as BookShelf; Book book = bookBindingSource.Current as Book; FormBookDetail formBookDetail = new FormBookDetail(book, currentClient, 2); if (formBookDetail.ShowDialog() == DialogResult.OK) { shelfBindingSource.DataSource = BookShelfService.GetAllShelfs(); bookBindingSource.DataSource = shelfBindingSource; bookBindingSource.DataMember = "Books"; } }
private void intoDetailButton_Click(object sender, EventArgs e)//查看细节,完成 { if (currentClient == null) { MessageBox.Show("请登录后再进行此操作!"); return; } Book book = booksBindingSource.Current as Book; FormBookDetail formBookDetail = new FormBookDetail(book, currentClient, 1); if (formBookDetail.ShowDialog() == DialogResult.OK) { Query(1); appointBooks = BookShelfService.GetAllAppointedBooks(currentClient); lendBooks = BookShelfService.GetAllLentBooks(currentClient); appointBindingSource.DataSource = appointBooks; lendBindingSource.DataSource = lendBooks; } }