コード例 #1
0
ファイル: B_GuestBook.cs プロジェクト: baixue001/IPS
        /// <summary>
        /// 用于留言中心显示留言列表
        /// </summary>
        /// <param name="OnCateStatus"></param>
        /// <param name="userid">指定用户的未审核留言不被筛选</param>
        /// <param name="isShowListByAudit">true:根据留言所属分类的显示模式来筛选</param>
        /// <returns></returns>
        public static PageSetting SelPage(int cpage, int psize, F_Guest filter)
        {
            // int status = -100, int cateid = -100, int pid = -100, string skey = "", int userid = 0, bool isShowListByAudit = false
            string where = " 1=1";
            List <SqlParameter> sp = new List <SqlParameter>();

            if (filter.status != -100)
            {
                where += " AND A.Status=" + filter.status;
            }
            else
            {
                where += " AND A.Status<>-1";
            }
            if (!string.IsNullOrEmpty(filter.cateIds))
            {
                where += " AND A.CateID IN(" + filter.cateIds + ")";
            }
            if (filter.parentId != -100)
            {
                where += " AND A.ParentID=" + filter.parentId;
            }
            //如指定值,则抽取其与其下的回复贴
            if (filter.gid > 0)
            {
                where += "A.Gid=" + filter.gid + " OR (ParentID=" + filter.gid + " AND Status=1)";
            }
            //前台直接输入ID,按ID搜索
            if (DataConvert.CLng(filter.skey) > 0)
            {
                where += " AND A.Gid=" + DataConvert.CLng(filter.skey);
            }
            else if (string.IsNullOrEmpty(filter.skey))
            {
                sp.Add(new SqlParameter("skey", "%" + filter.skey + "%"));
                where += " AND A.Title LIKE @skey";
            }
            //仅显示已审核和自己所发布的贴子,用于留言中心显示留言
            if (filter.onlyAudit)
            {
                where += " AND (A.Status!=0 OR B.IsShowUnaudit=1";
                if (!string.IsNullOrEmpty(filter.uids))
                {
                    SafeSC.CheckIDSEx(filter.uids);
                    where += " OR A.UserID IN (" + filter.uids + ")";
                }
                where += ")";
            }
            PageSetting setting = PageSetting.Double(cpage, psize, strTableName, "ZL_GuestCate", "A.GID", "A.CateID=B.CateID", where, filter.sort, sp);

            setting.fields  = "A.*,B.CateName";
            setting.fields += ",(SELECT UserName FROM ZL_User WHERE ZL_User.UserID=A.UserID) UserName";
            setting.fields += ",(SELECT HoneyName FROM ZL_User WHERE ZL_User.UserID=A.UserID) HoneyName";
            setting.fields += ",(SELECT salt FROM ZL_User WHERE ZL_User.UserID=A.UserID) UserFace";
            DBCenter.SelPage(setting);
            return(setting);
        }
コード例 #2
0
ファイル: B_GuestBook.cs プロジェクト: baixue001/IPS
 public static DataTable SelPage(F_Guest filter)
 {
     return(SelPage(1, int.MaxValue, filter).dt);
 }