日期:2014-05-17 浏览次数:20534 次
public partial class index : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ShowAllInfo(GetAllInfo()); } protected void Button1_Click(object sender, EventArgs e) { ShowAllInfo(GetAllInfo()); } public object GetAllInfo() { return QuestionBll.GetAllInfo(txtNum_case.Text.ToString(), txtNam_cust.Text.ToString(),ddl.SelectedValue.ToString(), s2.Value.ToString()); } public void ShowAllInfo(object entities) { this.GridView1.DataSource = entities; this.GridView1.DataBind(); } }
//show index public static DataSet GetAllInfo(string num_case, string nam_cust, string sts_custcar,string dat_car) { string sql = "select a.typ_custcar,a.num_case,a.nam_cust,a.dat_car,a.car_note,a.solution,b.content AS nam_dept_fix,a.dat_plnfix ,a.dat_actfix,a.sts_custcar from web_caseproj_custcars a "; sql = sql + string.Format("left join web_codd b on a.dept_fix = b.code and b.code_id = 'FIXDEPT' where 1=1 "); if (num_case != "") { sql = sql + string.Format("and num_case = '{0}' ", num_case); } else if (nam_cust != "") { sql = sql + string.Format("and nam_cust = '{0}' ", nam_cust); } else if (sts_custcar != "") { sql = sql + string.Format("and sts_custcar = '{0}' ", sts_custcar); } else if (dat_car != "") { sql = sql + string.Format("and dat_car = '{0}' ", DateTime.Parse(dat_car).ToString("yyyyMMdd")); } else { sql = sql + string.Format(" order by dat_car"); } DataSet ds = DBhelpe.ExcuteDataSet(sql); return ds; }