C2C.Web/shop/shopList.aspx.cs

(完整代码) 2KB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
namespace C2C.Web.shop
{
    public partial class shopList : System.Web.UI.Page
    {
        BLL.pubuser bllUser = new BLL.pubuser();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string str = GetStrWhere();
                BindData(str.ToString());
         
            }
            this.Page.Title = webName.GetWebName() + "-店铺中心";
        }

        private string GetStrWhere()
        {
            StringBuilder str = new StringBuilder();
            str.Append("1=1");
            if (!string.IsNullOrEmpty(Request["id"]))
            {
                str.Append(" and id=");
                str.Append(Request["id"]);
            }

            if (!string.IsNullOrEmpty(Request["types"]))
            {
                str.Append(" and shopType='");
                str.Append(Request["types"]);
                str.Append("'");
            }
            str.Append(" and shopName<>'' and shopStatus=1 AND seller=1");
            return str.ToString();
        }
       
        private void BindData(string strWhere)
        {
            int count = bllUser.GetRecordCount(strWhere);//数据总条数
            int startIndex = (this.AspNetPager1.CurrentPageIndex - 1) * this.AspNetPager1.PageSize + 1;
            int endIndex = this.AspNetPager1.CurrentPageIndex * this.AspNetPager1.PageSize;
            this.Repeater1.DataSource = bllUser.GetListByPage(strWhere, "id ", startIndex, endIndex).Tables[0];
            this.Repeater1.DataBind();
            this.AspNetPager1.RecordCount = count;
        }

        protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
        {
            this.AspNetPager1.CurrentPageIndex = e.NewPageIndex;
            BindData(GetStrWhere());
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。