page.cs

来自「一个比较简单的」· CS 代码 · 共 94 行

CS
94
字号
using System;
using System.Collections.Generic;
using System.Text;
using AssetsSystem.Inc;

namespace AssetsSystem.Dao
{
    class Page
    {
        //当前页数
        private String page = "1";
        //总页数
        private String totalpage = "1";
        //总记录数
        private int total;
        //每页记录数目
        private String pageSize = "30";

        public void setPage(String s)
        {
            this.page = s;
        }
        public String getPage()
        {
            return this.page;
        }
        public int getPageInInt()
        {
            return Convert.ToInt32(this.page);
        }
        public void setTotalPage(String s)
        {
            this.totalpage = s;
        }

        public String getTotalPage()
        {//返回总页数
            return totalpage;
        }

        public void setTotal(int totalCount)
        {
            if (totalCount > 0)
            {
                this.total = totalCount;
                int count = totalCount / this.getPageSizeInInt();
                if (totalCount % this.getPageSizeInInt() > 0)
                    count++;
                setTotalPage(count.ToString());
            }
            else
            {
                this.total = 0;
            }


        }
        public int getTotal()
        {//返回总记录
            return total;
        }


        public void setPageSize(String s)
        {
            this.pageSize = s;
        }
        public String getPageSize()
        {
            return this.pageSize;
        }
        public int getPageSizeInInt()
        {
            return Convert.ToInt32(this.pageSize);
        }
        public int getFirstResult()
        {
            return ((this.getPageInInt() - 1) * this.getPageSizeInInt());
        }


        public bool isSupport()
        {
            if (!Util.isnumstr(this.page) || !Util.isnumstr(this.pageSize))
            {
                return false;
            }
            return true;
        }
	        
        
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?