Esempio n. 1
0
        public void TestPaginateOrderFirstColumnWithSkip()
        {
            var paging = new Paging2 {
                Take = 2
            };
            var list = this.DbContext.Users.Paginate(paging).ToList();

            list.Should().HaveCount(2);
        }
Esempio n. 2
0
        public void TestPaginateSkipOrder()
        {
            var paging = new Paging2 {
                Take = 2
            };
            var list = this.DbContext.Users.OrderBy(p => p.Age).Paginate(paging).ToList();

            list.Should().HaveCount(2);
        }
Esempio n. 3
0
    private void BindData()
    {
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        //if (m_UserValidation.OrgId > 0)
        //{
        int AuditYear = 0;

        if (ddlYear.SelectedIndex > 0)
        {
            AuditYear = Convert.ToInt32(ddlYear.SelectedValue);
        }
        int AreaId = 0;

        if (ddlArea.SelectedIndex > 0)
        {
            AreaId = Convert.ToInt32(ddlArea.SelectedValue);
        }
        int DistrictId = 0;
        //if (ddlDistrict.SelectedIndex > 0)
        //    DistrictId = Convert.ToInt32(ddlDistrict.SelectedValue);
        DataTable list = new AuditReportService().FindList(AreaId, 0, 0, 0, 0, DistrictId, Convert.ToInt32(AuditReportStatus.CONFIRMED), AuditYear, txtKeyword.Text.Trim(), paging);

        rptAuditReport.DataSource = list;
        rptAuditReport.DataBind();
        if (list != null && list.Rows.Count > 0)
        {
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.DataLoad();
            Paging2.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging2.PageSize    = PageSize;
            Paging2.DataLoad();
            if (Paging.TotalPages > 1)
            {
                ltTotal.Text    = "Có " + list.Rows.Count + " trong tổng số " + list.Rows[0]["Total"] + " báo cáo";
                Paging2.Visible = Paging.Visible = true;
            }
            else
            {
                ltTotal.Text    = "Có tổng số " + list.Rows[0]["Total"] + " báo cáo";
                Paging2.Visible = Paging.Visible = false;
            }
        }
        else
        {
            Paging2.Visible = Paging.Visible = false;
        }
        //}
    }
Esempio n. 4
0
    private void BindData()
    {
        IList <Fuel> listFuel = new List <Fuel>();

        if (!AspNetCache.CheckCache(Constants.Cache_ReportFuel_Fuel_All))
        {
            listFuel = new FuelService().FindAll();
            AspNetCache.SetCache(Constants.Cache_ReportFuel_Fuel_All, listFuel);
        }
        else
        {
            listFuel = (IList <Fuel>)AspNetCache.GetCache(Constants.Cache_ReportFuel_Fuel_All);
        }
        foreach (Fuel fuel in listFuel)
        {
            ltHeaderFuel.Text = ltHeaderFuel.Text + "<th>" + fuel.FuelName + "</th>";
        }
        ePower.Core.PagingInfo paging = new ePower.Core.PagingInfo(PageSize, CurrentPage);
        //if (m_UserValidation.OrgId > 0)
        //{
        int AuditYear = 0;

        if (ddlYear.SelectedIndex > 0)
        {
            AuditYear = Convert.ToInt32(ddlYear.SelectedValue);
        }
        int AreaId = 0;

        if (ddlArea.SelectedIndex > 0)
        {
            AreaId = Convert.ToInt32(ddlArea.SelectedValue);
        }
        int DistrictId = 0;
        //if (ddlDistrict.SelectedIndex > 0)
        //    DistrictId = Convert.ToInt32(ddlDistrict.SelectedValue);
        DataTable list = new AuditReportService().FindList(AreaId, 0, 0, 0, 0, DistrictId, Convert.ToInt32(AuditReportStatus.CONFIRMED), AuditYear, txtKeyword.Text.Trim(), paging);

        rptAuditReport.DataSource = list;
        rptAuditReport.DataBind();
        if (list != null && list.Rows.Count > 0)
        {
            Paging.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging.PageSize    = PageSize;
            Paging.DataLoad();
            Paging2.TotalRecord = Convert.ToInt32(list.Rows[0]["Total"]);
            Paging2.PageSize    = PageSize;
            Paging2.DataLoad();
            if (Paging.TotalPages > 1)
            {
                ltTotal.Text    = "Có " + list.Rows.Count + " trong tổng số " + list.Rows[0]["Total"] + " báo cáo";
                Paging2.Visible = Paging.Visible = true;
            }
            else
            {
                ltTotal.Text    = "Có tổng số " + list.Rows[0]["Total"] + " báo cáo";
                Paging2.Visible = Paging.Visible = false;
            }
        }
        else
        {
            Paging2.Visible = Paging.Visible = false;
        }
        //}
    }