Exemplo n.º 1
0
        private void SearchTieZiPageList()
        {
            int     CurrentPage = ReInt("CurrentPage", 1);
            decimal ForumId     = ReDecimal("ForumId");
            int     MaxPage     = ReInt("MaxPage", 30); //每一页显示的行数
            string  cols        = ReStr("cols", " * "); //所有列名, 如果没有获取则为全部列
            bool    Invalid     = ReBool("Invalid", false);

            BLL.BBSBLL    bll = new BLL.BBSBLL();
            StringBuilder s   = new StringBuilder();

            s.Append(" 1=1 ");
            if (ForumId != 0)
            {
                s.Append(" and ForumId='" + ForumId + "' ");
            }
            else
            {
            }
            s.Append(" and TieZiType='主贴' ");
            s.Append(" and Invalid='" + Invalid + "' ");
            s.Append("  ORDER BY RecommendLv desc, UpdateTime desc ");


            DataSet ds = bll.GetTieZiPageList(s.ToString(), CurrentPage, MaxPage, cols);

            DataTable dt = ds.Tables[2];

            if (dt.Rows.Count > 0)
            {
                dt.Columns.Add("huitie");
                s.Clear();
                List <string> ls = new List <string>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt.Rows[i];

                    ls.Add(" select * from ( select top 3 " + cols + " from BBS.dbo.TieZiView WITH(NOLOCK) where  ParentTieZiId='" + dr["TieZiId"] + "' and Invalid = 0 order by CreateTime desc )   a" + i + "   ");
                }
                string sqlstr = string.Join(" UNION ALL ", ls);
                if (sqlstr.Trim() != "")
                {
                    DataTable dtHuiYing = DAL.DalComm.BackData(sqlstr).Tables[0];
                    foreach (DataRow dr in dt.Rows)
                    {
                        StringBuilder w    = new StringBuilder();
                        DataTable     dthy = Common.DataSetting.TableSelect(" ParentTieZiId='" + dr["TieZiId"] + "' ", dtHuiYing);
                        dr["huitie"] = JsonHelper.ToJson(dthy);
                    }
                }
            }

            RePage(ds);
        }
Exemplo n.º 2
0
        private void GetHuiYing()
        {
            decimal ParentTieZiId = ReDecimal("ParentTieZiId");

            int           PageInt = ReInt("PageInt", 5);
            string        cols    = ReStr("cols", "*");
            StringBuilder s       = new StringBuilder();

            s.Append(" 1=1 ");
            s.Append(" and ParentTieZiId ='" + ParentTieZiId + "' ");
            s.Append(" order by createTime ");
            int CurrentPage = ReInt("CurrentPage");

            BLL.BBSBLL bll = new BLL.BBSBLL();
            DataSet    ds  = bll.GetTieZiPageList(s.ToString(), CurrentPage, PageInt, cols);

            RePage(ds);
        }
Exemplo n.º 3
0
        private void GetTieZiInfoPageList()
        {
            decimal       TieZiId     = ReDecimal("TieZiId");
            int           CurrentPage = ReInt("CurrentPage");
            bool          AddHot      = ReBool("AddHot", true);
            bool          OnlyLz      = ReBool("OnlyLz", false);
            StringBuilder s           = new StringBuilder();

            s.Append(" TieZiId='" + TieZiId + "' ");

            s.Append("  or ParentTieZiId='" + TieZiId + "' ");

            s.Append(" and Invalid=0 ");
            s.Append(" order by CHARINDEX(CONVERT(VARCHAR(20),TieZiId) , '" + TieZiId + "') desc, ");
            if (OnlyLz)
            {
                string lz = DAL.DalComm.ExStr(" select CreateUser from BBS.dbo.TieZi where TieZiId='" + TieZiId + "'  ");
                s.Append("CHARINDEX(CONVERT(VARCHAR(50),CreateUser) , '" + lz + "') desc,");
            }

            s.Append(" CreateTime   ");

            BLL.BBSBLL bll = new BLL.BBSBLL();
            if (AddHot)
            {
                bll.AddHot(TieZiId);
            }
            DataSet ds = bll.GetTieZiPageList(s.ToString(), CurrentPage, 10, "*");

            DataTable dt = ds.Tables[2];

            if (dt.Rows.Count > 0)
            {
                dt.Columns.Add("huiying");
                s.Clear();
                List <string> ls = new List <string>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt.Rows[i];
                    if (i != 0)
                    {
                        ls.Add(" select top 5 * from BBS.dbo.TieZiView where  ParentTieZiId='" + dr["TieZiId"] + "' ");
                    }
                }

                string sqlstr = string.Join(" UNION ALL ", ls);


                if (sqlstr.Trim() != "")
                {
                    DataTable dtHuiYing = DAL.DalComm.BackData(sqlstr).Tables[0];


                    foreach (DataRow dr in dt.Rows)
                    {
                        StringBuilder w    = new StringBuilder();
                        DataTable     dthy = Common.DataSetting.TableSelect(" ParentTieZiId='" + dr["TieZiId"] + "' ", dtHuiYing);
                        dr["huiying"] = JsonHelper.ToJson(dthy);
                    }
                }
            }

            RePage(ds);
        }