sectionrequest.cs

来自「ASP.NET简洁论坛源代码 这是一个简单的论坛」· CS 代码 · 共 64 行

CS
64
字号
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using NetFocus.Web.Core;

namespace NetFocus.Web.Applications.Forum
{
    public class SectionRequest : EntityRequest
    {
        public int GroupId = 0;
        public int Enabled = -1;

        public bool HasGroupId
        {
            get
            {
                return GroupId > 0;
            }
        }

        public override string GetPopulateSql()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("Select top {0} {2} From tb_Entities E where E.EntityType = {1}", (PageIndex + 1) * PageSize, (int)NetFocus.Web.Applications.Forum.EntityType.Section, GetInternalSelectSql());

            if (HasGroupId)
            {
                sb.AppendFormat(" and E.IntField2 = {0}", GroupId);
            }

            if (Enabled == 0 || Enabled == 1)
            {
                sb.AppendFormat(" and E.IntField3 = {0}", Enabled);
            }

            sb.Append(base.GetOrderSql());

            return sb.ToString();
        }
        public override string GetFullPopulateSql()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("Select E.EntityId From tb_Entities E where E.EntityType = {0}", (int)NetFocus.Web.Applications.Forum.EntityType.Section);

            if (HasGroupId)
            {
                sb.AppendFormat(" and E.IntField2 = {0}", GroupId);
            }

            if (Enabled == 0 || Enabled == 1)
            {
                sb.AppendFormat(" and E.IntField3 = {0}", Enabled);
            }

            return sb.ToString();
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?