private void query_bt_Click(object sender, EventArgs e) { this.defalut_select = radioGroup1.SelectedIndex; if (textBox_ljhao.Text == "") { MessageBox.Show("请输入查询字段"); return; } this.reQuery(); Maticsoft.BLL.test test_bll = new Maticsoft.BLL.test(); string where_string = this.query_wherestring(); this.totle_num = test_bll.GetRecordCount2(where_string); if (this.totle_num % this.cur_page_lenb == 0) { this.totle_page_num = this.totle_num / this.cur_page_lenb; } else { this.totle_page_num = this.totle_num / this.cur_page_lenb + 1; } //int tot_page_index = this.totle_num / this.cur_page_lenb + (this.totle_num % this.cur_page_lenb == 0 ? 0 : 1); string page_info = string.Format("{0}/{1}", 1, totle_page_num); this.labelX1.Text = page_info; this.radioGroup1.SelectedIndex = defalut_select; return; }
private string get_okpara() { string result = ""; radioGroup1.Invoke(new Action(() => { Maticsoft.BLL.test test_bll = new Maticsoft.BLL.test(); radioGroup1.SelectedIndex = 0; string where_string1 = this.query_wherestring(); int tot = test_bll.GetRecordCount2(where_string1); radioGroup1.SelectedIndex = 2; string where_string2 = this.query_wherestring(); int ok_num = test_bll.GetRecordCount2(where_string2); double percent = Convert.ToDouble(ok_num) / Convert.ToDouble(tot); result = string.Format("{0:0.00%}", percent);//得到5.88% radioGroup1.SelectedIndex = 0; })); //MessageBox.Show(result); return(result); }
private void QueryFrom_Load(object sender, EventArgs e) { string default_str = ""; Maticsoft.BLL.test test_bll = new Maticsoft.BLL.test(); // 获得最后一条 DataSet ds = test_bll.GetModelListLast(); DataTable dt = ds.Tables[0]; if (dt.Rows.Count == 1) { this.textBox_ljhao.Text = dt.Rows[0]["componentId"].ToString(); } //textBox_ljhao.Text = Program.gdvid; global.CurActive = "QueryFrom"; this.timeselect_dtp.Value = global.startTime; this.dgv.ReadOnly = true; #region 一共有多少 // 下一页 string where_string = this.query_wherestring(); reQuery(); this.totle_num = test_bll.GetRecordCount2(where_string); // 当前多少页面 if (this.totle_num % this.cur_page_lenb == 0) { this.totle_page_num = this.totle_num / this.cur_page_lenb; } else { this.totle_page_num = this.totle_num / this.cur_page_lenb + 1; } string parem_num = string.Format("1/{0}", this.totle_page_num); labelX1.Text = parem_num; #endregion // 添加 智能补全 this.AddAutoComp(); }