コード例 #1
0
ファイル: ListFuel.ascx.cs プロジェクト: vietnnit/dataenergy
    void BindData()
    {
        FuelService objFuelService = new FuelService();
        DataTable   list           = new DataTable();

        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        int    groupId = 0;
        string strKey  = string.Empty;

        if (txtKeyword.Text != "" && txtKeyword.Text.Trim() != "")
        {
            strKey = txtKeyword.Text.Trim();
        }
        if (ddlParent.SelectedIndex > 0)
        {
            groupId = Convert.ToInt32(ddlParent.SelectedValue);
        }

        list = objFuelService.FindFuelList(strKey, 0, groupId, paging, true);
        if (list != null && list.Rows.Count > 0)
        {
            paging.RowsCount   = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.CurrentPage = CurrentPage;
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.DataLoad();
            if (paging.PagesCount <= 1)
            {
                ltrTotal.Text  = "Tổng số " + paging.RowsCount + " nhiên liệu";
                Paging.Visible = false;
            }
            else
            {
                int  st  = (CurrentPage - 1) * PageSize + 1;
                long end = CurrentPage * PageSize;
                if (end > paging.RowsCount)
                {
                    end = paging.RowsCount;
                }
                ltrTotal.Text  = "Đang xem trang " + CurrentPage + ". Hiển thị từ " + st + " - " + end + " trên tổng số " + paging.RowsCount + " nhiên liệu";
                Paging.Visible = true;
            }
        }
        else
        {
            ltrTotal.Text  = "";
            Paging.Visible = false;
        }
        grvFuel.DataSource = list;
        grvFuel.DataBind();
    }
コード例 #2
0
ファイル: ListFuel.ascx.cs プロジェクト: vietnnit/dataenergy
    void BindData()
    {
        FuelService objFuelService = new FuelService();
        DataTable   list           = new DataTable();

        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(1000, 1);
        int    groupId = 0;
        string strKey  = string.Empty;

        if (ddlParent.SelectedIndex > 0)
        {
            groupId = Convert.ToInt32(ddlParent.SelectedValue);
        }

        list = objFuelService.FindFuelList(strKey, 0, groupId, paging, true);

        grvFuel.DataSource = list;
        grvFuel.DataBind();
    }