/// <summary> /// 获取支持的章节类型列表 /// </summary> /// <param name="chapterTypeList"></param> /// <returns></returns> public bool GetChapterTypeList(out List <ChapterType> chapterTypeList, bool isFilter = false) { chapterTypeList = new List <ChapterType>(); try { string sql = @"select * from group_type where id<@data"; SQLiteParameter[] sqlPara; if (isFilter) { sqlPara = new SQLiteParameter[] { new SQLiteParameter("@data", 3) } } ; else { sqlPara = new SQLiteParameter[] { new SQLiteParameter("@data", 10) } }; DataTable data = SQLiteHelper.SQLiteHelper.GetDataTable(sql, sqlPara); foreach (DataRow row in data.Rows) { ChapterType typeData = new ChapterType(); typeData.ID = Convert.ToInt32(row["id"].ToString()); typeData.Name = row["name"].ToString(); chapterTypeList.Add(typeData); } return(true); } catch (Exception ex) { return(false); } }
private void cboxSkill_SelectedIndexChanged(object sender, EventArgs e) { if (cboxSkill.SelectedItem == null) { return; } ChapterType chapterType = (ChapterType)cboxSkill.SelectedItem; _Type = chapterType.ID; RefreshGroups(); }
private void cboxChaperType_SelectedIndexChanged(object sender, EventArgs e) { if (cboxChaperType.SelectedIndex < 0) { return; } isLoadSuccess = false; ChapterType chapterType = (ChapterType)cboxChaperType.SelectedItem; ChapterManager.GetChapterList(chapterType.ID, out List <ChapterInfo> chapterInfoList); comboBoxChapter.Items.Clear(); ChapterInfo modelNull = new ChapterInfo(); modelNull.ID = 0; modelNull.Name = "全部"; comboBoxChapter.Items.Add(modelNull); ChapterInfo modelNotSplit = new ChapterInfo(); modelNotSplit.ID = -1; modelNotSplit.Name = "未分类"; comboBoxChapter.Items.Add(modelNotSplit); foreach (ChapterInfo chapterInfo in chapterInfoList) { comboBoxChapter.Items.Add(chapterInfo); } comboBoxChapter.SelectedIndex = 0; cboxClassification.SelectedIndex = 0; comboBoxType.SelectedIndex = 0; textBoxFilterTittle.Text = ""; isLoadSuccess = true; RefreshQuestions(); //textBoxFilterOptions.Text = ""; }
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(); }