public void RefreshDatas(int pageNumber, int currentPage) { ChapterInfo chapterInfo = (ChapterInfo)comboBoxChapter.SelectedItem; ChapterType chapterType = (ChapterType)cboxChaperType.SelectedItem; DataTable data = ChpaterQuestionManager.GetChapterQuestions(chapterType.ID, chapterInfo.ID, cboxClassification.SelectedIndex, comboBoxType.SelectedIndex, "%" + textBoxFilterTittle.Text + "%", pageNumber, currentPage); dataGridView1.Rows.Clear(); if (null == data) { MessageBox.Show("获取题目数据失败"); return; } Console.WriteLine(data.Rows.Count); foreach (DataRow row in data.Rows) { AddItem(row); } }
//TODO;更新题目列表 private void RefreshQuestions() { if (false == isLoadSuccess) { return; } ChapterInfo chapterInfo = (ChapterInfo)comboBoxChapter.SelectedItem; ChapterType chapterType = (ChapterType)cboxChaperType.SelectedItem; //ChpaterQuestionManager.GetChapterQuestionsCount(chapterType.ID, chapterInfo.ID, cboxClassification.SelectedIndex, comboBoxType.SelectedIndex); int dataCount = ChpaterQuestionManager.GetChapterQuestionsCount(chapterType.ID, chapterInfo.ID, cboxClassification.SelectedIndex, comboBoxType.SelectedIndex, "%" + textBoxFilterTittle.Text + "%"); labelQuestionCount.Text = dataCount.ToString(); pageControl1.BeginUpdate(); pageControl1.TotalCount = dataCount; RefreshDatas(pageControl1.PerPageNumber, pageControl1.CurrentPage); pageControl1.EndUpdate(); //labelQuestionCount.Text = data.Rows.Count.ToString(); }