protected void Button1_Click(object sender, EventArgs e) { StringBuilder str = new StringBuilder(); if (start_time.Text != "") { str.Append("time> '" + start_time.Text.Trim() + "' and "); } if (end_time.Text != "") { str.Append("time< '" + end_time.Text.Trim() + "' and "); } if (qishu.SelectedValue != "999") { str.Append("peixunban_id=" + qishu.SelectedValue + " and "); } if (lururen.SelectedValue != "—全部显示—") { str.Append("lururen='" + lururen.SelectedValue.Trim() + "' and "); } if (str.ToString() != "") { str.Remove(str.Length - 4, 4); } Maticsoft.BLL.account_view acc_vie_bll = new BLL.account_view(); GridView1.DataSource = acc_vie_bll.GetList(str.ToString()); GridView1.DataBind(); //if (CheckBox1.Checked == true) //{ // GridView1.Columns[0].Visible = false; // GridView1.Columns[5].Visible = false; // GridView1.Columns[6].Visible = false; // GridView1.Columns[7].Visible = false; //} }
private void loaddata() { Maticsoft.BLL.account_view acc_bll = new BLL.account_view(); GridView1.DataSource = acc_bll.GetList(100, "", "detail_id"); GridView1.DataBind(); Maticsoft.BLL.peixunban1 bll = new Maticsoft.BLL.peixunban1(); DataSet ds = new DataSet(); StringBuilder strWhere = new StringBuilder(); strWhere.Append("[start_time] < '"); strWhere.Append(DateTime.Today.AddDays(30).Date.ToShortDateString()); strWhere.Append("' and [end_time] > '"); strWhere.Append(DateTime.Today.AddDays(-30).Date.ToShortDateString()); strWhere.Append("'"); ds = bll.GetList(strWhere.ToString()); DataRow newrow = ds.Tables[0].NewRow(); newrow["id"] = "999"; newrow["name"] = "—全部显示—"; ds.Tables[0].Rows.Add(newrow); qishu.DataSource = ds; qishu.DataTextField = "name"; qishu.DataValueField = "id"; qishu.DataBind(); Maticsoft.BLL.account account_bll = new BLL.account(); DataSet ds2 = account_bll.lururen(""); DataRow newrow2 = ds2.Tables[0].NewRow(); newrow2["lururen"] = "—全部显示—"; ds2.Tables[0].Rows.Add(newrow2); lururen.DataSource = ds2; lururen.DataTextField = "lururen"; lururen.DataValueField = "lururen"; lururen.DataBind(); }