Beispiel #1
0
        public DataTable GetPageData(string keywords, string tid, int pageIndex, int pageSize, out int recordsCount)
        {
            string where = "1=1";
            if (!string.IsNullOrEmpty(tid))
            {
                where += " AND TypeId=" + int.Parse(tid);
            }
            if (!string.IsNullOrEmpty(keywords))
            {
                where += " AND Subject LIKE '%" + keywords.Replace("'", "''") + "%'";
            }
            PagerProc pp = new PagerProc()
            {
                fields          = "Id,Subject,Contents,AppTime,(SELECT Name FROM [UserInfo] WHERE UserId=FromId) AS FromName",
                order           = "Id DESC",
                pageIndex       = pageIndex,
                pageSize        = pageSize,
                tables          = "Posts",
                uniqueField     = "Id",
                uniqueFieldType = "int",
                where           = where,
                group           = string.Empty
            };
            var dt = pp.ToDataSet().Tables[0];

            recordsCount = pp.recordsCount;
            return(dt);
        }
Beispiel #2
0
        public DataTable GetPageData(int uid, int pageIndex, int pageSize, out int recordsCount)
        {
            string where = "1=1";
            where       += " AND Id in (Select PostsId from Collection where UserID=" + uid + ")";
            PagerProc pp = new PagerProc()
            {
                fields          = "Id,Subject,Contents,AppTime,(SELECT Name FROM [UserInfo] WHERE UserId=FromId) AS FromName",
                order           = "Id DESC",
                pageIndex       = pageIndex,
                pageSize        = pageSize,
                tables          = "Posts",
                uniqueField     = "Id",
                uniqueFieldType = "int",
                where           = where,
                group           = string.Empty
            };
            var dt = pp.ToDataSet().Tables[0];

            recordsCount = pp.recordsCount;
            return(dt);
        }