//浏览模式 下一个 按钮 void Button6Click(object sender, EventArgs e) { if (tp != null) { int sumtu = TestUnitDao.QueryTestUnitCount(tp.Moduleid, tp.Manageid, tp.Level, tp.State, tp.Begintime, tp.Endtime); List <TestUnit> tulist = TestUnitDao.QueryTestUnit(tp.Moduleid, tp.Manageid, tp.Level, tp.State, tp.Begintime, tp.Endtime, tp.Startindex + 1, 1); if (tulist.Count > 0) { this.tu = TestUnitDao.gettestUnitById(tulist[0].Id); TestUnitBingData(); tp.Startindex = tp.Startindex + 1; if (tp.Startindex - 1 < 0) { this.button5.Enabled = false; } else { this.button5.Enabled = true; } if (tp.Startindex + 2 > sumtu) { this.button6.Enabled = false; } else { this.button6.Enabled = true; } } else { MessageBox.Show("没有找到下一条数据", "出错"); } } }
/// <summary> /// 获取所有缺陷单元 /// </summary> void getTestUnitList() { string moduleid = this.comboBox1.SelectedValue.ToString(); string manageid = this.comboBox2.SelectedValue.ToString(); string level = this.comboBox3.Text; string state = "全部"; string begin = this.dateTimePicker1.Value.ToShortDateString() + " 00:00:00"; string end = this.dateTimePicker2.Value.ToShortDateString() + " 23:59:59"; if (this.dateTimePicker1.IsDisposed && this.dateTimePicker2.IsDisposed) { begin = null; end = null; } this.count = TestUnitDao.QueryTestUnitCount(moduleid, manageid, level, state, begin, end); int countpage = (count % pagesize == 0)?count / pagesize:count / pagesize + 1; if (this.currentpage > countpage) { this.currentpage = 1; } this.label3.Text = string.Format(currentstr, this.currentpage); this.label5.Text = string.Format(pagestr, this.pagesize); this.label4.Text = string.Format(countstr, countpage, this.count); this.listView1.Items.Clear(); List <TestUnit> alltu = TestUnitDao.QueryTestUnit(moduleid, manageid, level, state, begin, end, (currentpage > 1)?((this.currentpage - 1) * pagesize):0 , pagesize); foreach (TestUnit tu in alltu) { ListViewBing(tu); } }