private void queryButton_Click(object sender, EventArgs e)//排序 { List <Book> books = new List <Book>(); switch (queryComboBox.Text) { case "推荐数": books = BookShelfService.Query(1); break; case "书号": books = BookShelfService.Query(2); break; case "作者": books = BookShelfService.Query(3); break; case "分类": books = BookShelfService.Query(4); break; case "书架号": books = BookShelfService.Query(5); break; default: MessageBox.Show("没有选择正确的排序方式!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Information); break; } this.bookBindingSource.DataSource = books; }
private void sortButton_Click(object sender, EventArgs e)//按分类管理 { isNormal = false; shelfBindingSource.DataSource = BookShelfService.GetAllShelfs(); bookBindingSource.DataMember = null; bookBindingSource.DataSource = BookShelfService.Query(4); }