Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.objRowProductGroup = this.objProduct.getProductGroup().Rows;

        #region get option
        try
        {
            this.nPage = int.Parse(Request["Page"].ToString());
        }
        catch { }
        if (this.nPage < 1)
        {
            this.nPage = 1;
        }

        try
        {
            this.ProductGroup = int.Parse(Request["Group"].ToString());
        }
        catch { }

        try
        {
            this.VBType = int.Parse(Request["Type"].ToString());
        }
        catch { }
        if (this.VBType > 2)
        {
            this.VBType = 0;
        }
        #endregion

        #region Tính số trang
        this.ncount  = objProduct.getCountProductOption(this.VBType, this.ProductGroup);
        this.MaxPage = this.ncount / this.PageItem;
        if (this.ncount % this.PageItem != 0)
        {
            this.MaxPage++;
        }
        if (this.MaxPage == 0)
        {
            this.MaxPage = 1;
        }
        if (this.nPage > this.MaxPage)
        {
            this.nPage = this.MaxPage;
        }
        #endregion

        this.objTableProduct = objProduct.getProductOption(this.VBType, this.ProductGroup, this.PageItem, (this.nPage - 1) * this.PageItem);

        this.Message = objProduct.ErrorMessage;
    }