Example #1
0
    public void DataBindToGridview()
    {
        ZWL.BLL.ERPReimburse MyModel = new ZWL.BLL.ERPReimburse();
        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 += "(HeTongName Like '%" + this.TextBox1.Text + "%' or QianYueKeHu Like '%" + this.TextBox1.Text + "%' or ReimburseContent Like '%" + this.TextBox1.Text + "%' or UserName Like '%" + this.TextBox1.Text + "%')";
        }
        if (!string.IsNullOrEmpty(this.TextBox3.Text))
        {
            if (string.IsNullOrEmpty(sql))
            {
                sql += " ApplyTime >='" + this.TextBox3.Text.Trim() + " 00:00:00' and ApplyTime<='" + this.TextBox4.Text.Trim() + " 23:59:59' ";
            }
            else
            {
                sql += "and ApplyTime >='" + this.TextBox3.Text.Trim() + " 00:00:00' and ApplyTime<='" + 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();
    }