public void DataBindToGridview() { string XiaShuUser = ZWL.DBUtility.DbHelperSQL.GetSHSLInt("select top 1 XiaShuUser from ERPUser where UserName='******'"); string SSTempSTR = ""; if (XiaShuUser != "全部") { SSTempSTR = "and CreateUser in(" + "'" + XiaShuUser.Replace(",", "','") + "'" + ")"; } ZWL.BLL.ERPContract MyModel = new ZWL.BLL.ERPContract(); MyModel.HZ(); string sql = ""; if (!string.IsNullOrEmpty(this.TextBox1.Text)) { sql += "(HeTongName Like '%" + this.TextBox1.Text + "%' or HeTongSerils Like '%" + this.TextBox1.Text + "%' or QianYueKeHu Like '%" + this.TextBox1.Text + "%' or HeTongLeiXing Like '%" + this.TextBox1.Text + "%' or CreateUser Like '%" + this.TextBox1.Text + "%' or SFJF Like '%" + this.TextBox1.Text + "%')"; } if (!string.IsNullOrEmpty(this.TextBox3.Text)) { if (string.IsNullOrEmpty(sql)) { sql += " (CreateTime >='" + this.TextBox3.Text.Trim() + " 00:00:00' and CreateTime<='" + this.TextBox4.Text.Trim() + " 23:59:59') or QianYueRenBuy = '" + this.TextBox3.Text + "' or QianYueRenBuy = '" + this.TextBox4.Text + "' or QianYueRenSell = '" + this.TextBox3.Text + "' or QianYueRenSell = '" + this.TextBox4.Text + "'"; } else { sql += " and CreateTime >='" + this.TextBox3.Text.Trim() + " 00:00:00' and CreateTime<='" + this.TextBox4.Text.Trim() + " 23:59:59') or QianYueRenBuy = '" + this.TextBox3.Text + "' or QianYueRenBuy = '" + this.TextBox4.Text + "' or QianYueRenSell = '" + this.TextBox3.Text + "' or QianYueRenSell = '" + this.TextBox4.Text + "' "; } 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.ERPContract MyModel = new ZWL.BLL.ERPContract(); MyModel.HZ(); string sql = " CreateUser='******'"; if (!string.IsNullOrEmpty(this.TextBox1.Text)) { sql += " and (HeTongName Like '%" + this.TextBox1.Text + "%' or HeTongSerils Like '%" + this.TextBox1.Text + "%' or QianYueKeHu Like '%" + this.TextBox1.Text + "%' or HeTongLeiXing Like '%" + this.TextBox1.Text + "%' or SFJF Like '%" + this.TextBox1.Text + "%')"; } if (!string.IsNullOrEmpty(this.TextBox3.Text)) { if (string.IsNullOrEmpty(sql)) { sql += " (CreateTime >='" + this.TextBox3.Text.Trim() + " 00:00:00' and CreateTime<='" + this.TextBox4.Text.Trim() + " 23:59:59') or QianYueRenBuy = '" + this.TextBox3.Text + "' or QianYueRenBuy = '" + this.TextBox4.Text + "' or QianYueRenSell = '" + this.TextBox3.Text + "' or QianYueRenSell = '" + this.TextBox4.Text + "'"; } else { sql += "and (CreateTime >='" + this.TextBox3.Text.Trim() + " 00:00:00' and CreateTime<='" + this.TextBox4.Text.Trim() + " 23:59:59') or QianYueRenBuy = '" + this.TextBox3.Text + "' or QianYueRenBuy = '" + this.TextBox4.Text + "' or QianYueRenSell = '" + this.TextBox3.Text + "' or QianYueRenSell = '" + this.TextBox4.Text + "'"; } 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(); }