Ejemplo n.º 1
0
        /// <summary>
        /// 显示产品图片
        /// </summary>
        private void ShowProImg()
        {
            Maticsoft.BLL.Products.Product bll = new Maticsoft.BLL.Products.Product();
            DataSet ds = bll.GetListByCategoryID(15, "");

            PagedDataSource objPds = new PagedDataSource();

            objPds.DataSource       = ds.Tables[0].DefaultView;
            objPds.AllowPaging      = true;
            objPds.PageSize         = 4;
            objPds.CurrentPageIndex = 0;
            DataList2.DataSource    = objPds;
            DataList2.DataBind();
            StringBuilder strImg = new StringBuilder();

            if (ds.Tables.Count > 0)
            {
                int rowcout = ds.Tables[0].Rows.Count;
                if (rowcout > 0)
                {
                    for (int n = 0; n < rowcout; n++)
                    {
                        string Name  = ds.Tables[0].Rows[n]["Name"].ToString();
                        string Image = ds.Tables[0].Rows[n]["Image"].ToString();
                        strImg.Append("<IMG height=130 alt=\"" + Name + "\" src=\"ProductImages/" + Image + "\" width=150 border=0 /> ");
                    }
                }
            }
            strImglist = strImg.ToString();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// ��ʾ��ƷͼƬ
        /// </summary>
        private void ShowProImg()
        {
            Maticsoft.BLL.Products.Product bll = new Maticsoft.BLL.Products.Product();
            DataSet ds = bll.GetListByCategoryID(15,"");

            PagedDataSource objPds = new PagedDataSource();
            objPds.DataSource = ds.Tables[0].DefaultView;
            objPds.AllowPaging = true;
            objPds.PageSize = 4;
            objPds.CurrentPageIndex = 0;
            DataList2.DataSource = objPds;
            DataList2.DataBind();
            StringBuilder strImg = new StringBuilder();
            if (ds.Tables.Count > 0)
            {
                int rowcout=ds.Tables[0].Rows.Count;
                if (rowcout > 0)
                {
                    for (int n = 0; n < rowcout; n++)
                    {
                        string Name=ds.Tables[0].Rows[n]["Name"].ToString();
                        string Image = ds.Tables[0].Rows[n]["Image"].ToString();
                        strImg.Append("<IMG height=130 alt=\"" + Name + "\" src=\"ProductImages/" + Image + "\" width=150 border=0 /> ");
                    }
                }
            }
            strImglist = strImg.ToString();
        }
Ejemplo n.º 3
0
        //所有商品
        public void BindData(string BrandId, string CategoryId, string Page)
        {
            Maticsoft.BLL.Products.Product bllp = new Maticsoft.BLL.Products.Product();
            DataSet ds = new DataSet();

            if ((CategoryId != "") || (BrandId != ""))
            {
                ds = bllp.GetListByCategoryID(9, CategoryId, BrandId);
            }
            else
            {
                ds = bllp.GetAllList();
            }
            PagedDataSource objPds = new PagedDataSource();

            objPds.DataSource = ds.Tables[0].DefaultView;
            int record_Count = ds.Tables[0].Rows.Count;
            int page_Size    = 9;
            int totalPages   = int.Parse(Math.Ceiling((double)record_Count / page_Size).ToString());

            int CurPage;

            if (Page != "")
            {
                CurPage = Convert.ToInt32(Page);
            }
            else
            {
                CurPage = 1;
            }

            objPds.AllowPaging      = true;
            objPds.PageSize         = page_Size;
            objPds.CurrentPageIndex = CurPage - 1;

            if (!objPds.IsFirstPage)
            {
                this.lnkFirst.NavigateUrl = Request.CurrentExecutionFilePath + "?BrandId=" + BrandId + "&Page=1";
                lnkPrev.NavigateUrl       = Request.CurrentExecutionFilePath + "?BrandId=" + BrandId + "&Page=" + Convert.ToString(CurPage - 1);
            }
            if (!objPds.IsLastPage)
            {
                lnkNext.NavigateUrl      = Request.CurrentExecutionFilePath + "?BrandId=" + BrandId + "&Page=" + Convert.ToString(CurPage + 1);
                this.lnkLast.NavigateUrl = Request.CurrentExecutionFilePath + "?BrandId=" + BrandId + "&Page=" + totalPages.ToString();
            }
            MyList.DataSource = objPds;
            MyList.DataBind();

            //显示数量
            if (objPds.CurrentPageIndex == 0)
            {
                lnkFirst.Enabled = false;
                lnkPrev.Enabled  = false;
                if (totalPages == 1)
                {
                    lnkLast.Enabled = false;
                    lnkNext.Enabled = false;
                }
            }
            else if (objPds.CurrentPageIndex == totalPages - 1)
            {
                lnkLast.Enabled = false;
                lnkNext.Enabled = false;
            }
            this.lblpagesum.Text     = totalPages.ToString();
            this.lblCurrentPage.Text = CurPage.ToString();
            this.lblrowscount.Text   = record_Count.ToString();
        }
Ejemplo n.º 4
0
        //������Ʒ
        public void BindData(string BrandId, string CategoryId, string Page)
        {
            Maticsoft.BLL.Products.Product bllp = new Maticsoft.BLL.Products.Product();
            DataSet ds = new DataSet();
            if ((CategoryId != "") || (BrandId!=""))
            {
                ds = bllp.GetListByCategoryID(9,CategoryId, BrandId);
            }
            else
            {
                ds = bllp.GetAllList();
            }
            PagedDataSource objPds = new PagedDataSource();
            objPds.DataSource = ds.Tables[0].DefaultView;
            int record_Count = ds.Tables[0].Rows.Count;
            int page_Size = 9;
            int totalPages = int.Parse(Math.Ceiling((double)record_Count / page_Size).ToString());

            int CurPage;
            if (Page != "")
                CurPage = Convert.ToInt32(Page);
            else
                CurPage = 1;

            objPds.AllowPaging = true;
            objPds.PageSize = page_Size;
            objPds.CurrentPageIndex = CurPage - 1;

            if (!objPds.IsFirstPage)
            {
                this.lnkFirst.NavigateUrl = Request.CurrentExecutionFilePath + "?BrandId=" + BrandId + "&Page=1";
                lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + "?BrandId=" + BrandId + "&Page=" + Convert.ToString(CurPage - 1);
            }
            if (!objPds.IsLastPage)
            {
                lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + "?BrandId=" + BrandId + "&Page=" + Convert.ToString(CurPage + 1);
                this.lnkLast.NavigateUrl = Request.CurrentExecutionFilePath + "?BrandId=" + BrandId + "&Page=" + totalPages.ToString();
            }
            MyList.DataSource = objPds;
            MyList.DataBind();

            //��ʾ����
            if (objPds.CurrentPageIndex == 0)
            {
                lnkFirst.Enabled = false;
                lnkPrev.Enabled = false;
                if (totalPages == 1)
                {
                    lnkLast.Enabled = false;
                    lnkNext.Enabled = false;
                }
            }
            else if (objPds.CurrentPageIndex == totalPages - 1)
            {
                lnkLast.Enabled = false;
                lnkNext.Enabled = false;
            }
            this.lblpagesum.Text = totalPages.ToString();
            this.lblCurrentPage.Text = CurPage.ToString();
            this.lblrowscount.Text = record_Count.ToString();
        }