예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string typeid = Request.QueryString["Id"].ToString().Trim();

            //分类开始
            FillXiaoShuoData();
            FillWenYiData();
            FillLiShiData();
            FillJingJiData();
            FillXinLiData();
            FillShengHuoData();
            FillTongShuData();
            FillKeJiData();
            FillYuanBanData();
            //分类结束

            //模糊搜索功能,禁用分类排序功能
            if (typeid == "search")
            {
                LinkButton1.Enabled = false;
                LinkButton2.Enabled = false;
                LinkButton3.Enabled = false;
                LinkButton4.Enabled = false;

                try
                {
                    ArrayList allId  = (ArrayList)Session["result"];
                    string    pinjie = "";
                    foreach (object o in allId)
                    {
                        pinjie += o.ToString() + ",";
                    }
                    pinjie = pinjie.Substring(0, pinjie.Length - 1);
                    string pinjieSql = "select * from Book where Id in (" + pinjie + ")";

                    DB db = new DB();
                    db.LoadExecuteData(pinjieSql);
                    PackageDataList.DataSource   = db.MyDataSet.Tables[0].DefaultView;
                    PackageDataList.DataKeyField = "Id";
                    PackageDataList.DataBind();
                    if (db.MyDataSet.Tables[0].Rows.Count <= 0)
                    {
                        Image5.Visible = true;
                    }
                    db.OffData();
                }
                catch
                {
                    Image5.Visible = true;
                }
            }
            else
            {
                if (!IsPostBack)
                {
                    FillPackageData(typeid, " order by Sales");
                }
            }
        }
예제 #2
0
        //好评填充
        protected void FillGoodComment(int id, string sortText)
        {
            DB     db  = new DB();
            string sql = "select s.* from(select *, row_number() over(partition by Id order by Id) as group_idx from(SELECT top 1000 Book.*, CommentLevel, ReplyNumber FROM Book LEFT JOIN LeaveWord ON Book.Id = LeaveWord.BookID order by CommentLevel " + sortText + ", ReplyNumber " + sortText + ") ta) s where s.group_idx = 1 and BookTypeID = " + id + "order by CommentLevel " + sortText + ", ReplyNumber " + sortText;

            if (id == 0)
            {
                sql = "select s.* from(select *, row_number() over(partition by Id order by Id) as group_idx from(SELECT top 1000 Book.*, CommentLevel, ReplyNumber FROM Book LEFT JOIN LeaveWord ON Book.Id = LeaveWord.BookID order by CommentLevel " + sortText + ", ReplyNumber " + sortText + ") ta) s where s.group_idx = 1 order by CommentLevel " + sortText + ", ReplyNumber " + sortText;
            }
            if (id > 0 && id < 10)
            {
                sql = "select s.* from(select *, row_number() over(partition by Id order by Id) as group_idx from(SELECT top 1000 Book.*, CommentLevel, ReplyNumber FROM Book LEFT JOIN LeaveWord ON Book.Id = LeaveWord.BookID order by CommentLevel " + sortText + ", ReplyNumber " + sortText + ") ta) s , (select Id from BookType where ParentID = " + id + ") as typeid where s.group_idx = 1 and typeid.Id = s.BookTypeID order by CommentLevel " + sortText + ", ReplyNumber " + sortText;
            }
            db.LoadExecuteData(sql);
            PackageDataList.DataSource   = db.MyDataSet.Tables[0].DefaultView;
            PackageDataList.DataKeyField = "Id";
            PackageDataList.DataBind();
            if (db.MyDataSet.Tables[0].Rows.Count <= 0)
            {
                Image5.Visible = true;
            }
            db.OffData();
        }
예제 #3
0
        //根据分类填充数据
        protected void FillPackageData(string typeid, string sortMethood)
        {
            DB     db  = new DB();
            string sql = "select * from Book where BookTypeID =" + typeid.ToString().Trim() + sortMethood;
            int    id  = int.Parse(typeid);

            if (id == 0)
            {
                sql = "select * from Book" + sortMethood;
            }
            if (id > 0 && id < 10)
            {
                sql = "select * from Book where BookTypeID in (select Id from BookType where ParentID = " + id + ")" + sortMethood;
            }
            db.LoadExecuteData(sql);
            PackageDataList.DataSource   = db.MyDataSet.Tables[0].DefaultView;
            PackageDataList.DataKeyField = "Id";
            PackageDataList.DataBind();
            if (db.MyDataSet.Tables[0].Rows.Count <= 0)
            {
                Image5.Visible = true;
            }
            db.OffData();
        }