public void DataBindToGridview() { ZWL.BLL.ERPBuyOrder MyModel = new ZWL.BLL.ERPBuyOrder(); MyModel.HZ(); string XiaShuUser = ZWL.DBUtility.DbHelperSQL.GetSHSLInt("select top 1 XiaShuUser from ERPUser where UserName='******'"); string SSTempSTR = ""; if (XiaShuUser != "全部") { SSTempSTR = "and UserName in(" + "'" + XiaShuUser.Replace(",", "','") + "'" + ")"; } string sql = ""; if (!string.IsNullOrEmpty(this.TextBox1.Text)) { sql += "(OrderName Like '%" + this.TextBox1.Text + "%' or GongYingShangName Like '%" + this.TextBox1.Text + "%' or Serils Like '%" + this.TextBox1.Text + "%' or DingDanLeiXing Like '%" + this.TextBox1.Text + "%' or UserName Like '%" + this.TextBox1.Text + "%' or SFJF Like '%" + this.TextBox1.Text + "%')"; } if (!string.IsNullOrEmpty(this.TextBox3.Text)) { if (string.IsNullOrEmpty(sql)) { sql += " (TimeStr >='" + this.TextBox3.Text.Trim() + " 00:00:00' and TimeStr<='" + this.TextBox4.Text.Trim() + " 23:59:59') or (LaiHuoDate >='" + this.TextBox3.Text.Trim() + " 00:00:00' and LaiHuoDate<='" + this.TextBox4.Text.Trim() + " 23:59:59') or (TiXingDate >='" + this.TextBox3.Text.Trim() + " 00:00:00' and TiXingDate<='" + this.TextBox4.Text.Trim() + " 23:59:59') "; } else { sql += "and (TimeStr >='" + this.TextBox3.Text.Trim() + " 00:00:00' and TimeStr<='" + this.TextBox4.Text.Trim() + " 23:59:59') or (LaiHuoDate >='" + this.TextBox3.Text.Trim() + " 00:00:00' and LaiHuoDate<='" + this.TextBox4.Text.Trim() + " 23:59:59') or (TiXingDate >='" + this.TextBox3.Text.Trim() + " 00:00:00' and TiXingDate<='" + this.TextBox4.Text.Trim() + " 23:59:59')"; } sql += " " + SSTempSTR + " order by ID desc"; } GVData.DataSource = MyModel.GetList(sql); GVData.DataBind(); LabPageSum.Text = Convert.ToString(GVData.PageCount); LabCurrentPage.Text = Convert.ToString(((int)GVData.PageIndex + 1)); this.GoPage.Text = LabCurrentPage.Text.ToString(); }
public void DataBindToGridview() { ZWL.BLL.ERPBuyOrder MyModel = new ZWL.BLL.ERPBuyOrder(); MyModel.HZ(); string sql = " UserName='******' "; if (!string.IsNullOrEmpty(this.TextBox1.Text)) { sql += " and (OrderName Like '%" + this.TextBox1.Text + "%' or GongYingShangName Like '%" + this.TextBox1.Text + "%' or Serils Like '%" + this.TextBox1.Text + "%' or DingDanLeiXing Like '%" + this.TextBox1.Text + "%' or SFJF Like '%" + this.TextBox1.Text + "%')"; } if (!string.IsNullOrEmpty(this.TextBox3.Text)) { if (string.IsNullOrEmpty(sql)) { sql += " (TimeStr >='" + this.TextBox3.Text.Trim() + " 00:00:00' and TimeStr<='" + this.TextBox4.Text.Trim() + " 23:59:59') or (LaiHuoDate >='" + this.TextBox3.Text.Trim() + " 00:00:00' and LaiHuoDate<='" + this.TextBox4.Text.Trim() + " 23:59:59') or (TiXingDate >='" + this.TextBox3.Text.Trim() + " 00:00:00' and TiXingDate<='" + this.TextBox4.Text.Trim() + " 23:59:59') "; } else { sql += "and (TimeStr >='" + this.TextBox3.Text.Trim() + " 00:00:00' and TimeStr<='" + this.TextBox4.Text.Trim() + " 23:59:59') or (LaiHuoDate >='" + this.TextBox3.Text.Trim() + " 00:00:00' and LaiHuoDate<='" + this.TextBox4.Text.Trim() + " 23:59:59') or (TiXingDate >='" + this.TextBox3.Text.Trim() + " 00:00:00' and TiXingDate<='" + this.TextBox4.Text.Trim() + " 23:59:59')"; } sql += " order by ID desc"; } GVData.DataSource = MyModel.GetList(sql); GVData.DataBind(); LabPageSum.Text = Convert.ToString(GVData.PageCount); LabCurrentPage.Text = Convert.ToString(((int)GVData.PageIndex + 1)); this.GoPage.Text = LabCurrentPage.Text.ToString(); }