Exemplo n.º 1
0
    /// <summary>
    /// 绑定数据
    /// </summary>
    protected void BackupDatabaseDataBind()
    {
        DataTable dt = DataBackupBLL.GetBackupDatabaseInfo();

        gvBackupDatabase.DataSource = dt;
        gvBackupDatabase.DataBind();

        Pager page = Page.FindControl("uclPager") as Pager;

        page.PageBind(0, 10, table, columns, condition, key, "gvBackupDatabase");
    }
Exemplo n.º 2
0
    /// <summary>
    /// GridView排序事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void gvBackupDatabase_Sorting(object sender, GridViewSortEventArgs e)
    {
        ///按升序排还是按降序排
        bool     flag       = true;
        DataView dv         = new DataView(DataBackupBLL.GetBackupDatabaseInfo());
        string   sortString = e.SortExpression;

        switch (sortString.ToLower().Trim())
        {
        case "databackupid":
            if (blDataBackupID)
            {
                dv.Sort = "DataBackupID desc";
                flag    = blDataBackupID = false;
            }

            else
            {
                dv.Sort = "DataBackupID asc";
                flag    = blDataBackupID = true;
            }
            break;

        case "databackuptime":
            if (blDataBackupTime)
            {
                dv.Sort = "DataBackupTime desc";
                flag    = blDataBackupTime = false;
            }

            else
            {
                dv.Sort = "DataBackupTime asc";
                flag    = blDataBackupTime = true;
            }
            break;

        case "pathfilename":
            if (blPathFileName)
            {
                dv.Sort = "PathFileName desc";
                flag    = blPathFileName = false;
            }

            else
            {
                dv.Sort = "PathFileName asc";
                flag    = blPathFileName = true;
            }
            break;

        case "operatornum":
            if (blOperatorNum)
            {
                dv.Sort = "OperatorNum desc";
                flag    = blOperatorNum = false;
            }

            else
            {
                dv.Sort = "OperatorNum asc";
                flag    = blOperatorNum = true;
            }
            break;
        }
        this.gvBackupDatabase.DataSource = dv;
        this.gvBackupDatabase.DataBind();
        ///按关键字排序分页
        Pager page = Page.FindControl("uclPager") as Pager;

        page.PagingSort(0, 10, table, columns, condition, sortString.ToLower().Trim(), flag, "gvBackupDatabase");
    }