コード例 #1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(BCW.Model.Forum model)
 {
     dal.Update(model);
 }
コード例 #2
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(BCW.Model.Forum model)
 {
     dal.Add(model);
 }
コード例 #3
0
    private void AddPage()
    {
        int    id       = int.Parse(Utils.GetRequest("id", "get", 1, @"^[0-9]\d*$", "0"));
        int    forumid  = int.Parse(Utils.GetRequest("forumid", "get", 1, @"^[0-9]\d*$", "0"));
        string PostName = string.Empty;

        if (id != 0)
        {
            PostName = "编辑";
        }
        else
        {
            PostName = "添加";
        }

        BCW.Model.Forum model  = null;
        int             NodeId = 0;
        //添加状态时的显示
        string sText = string.Empty;
        string sName = string.Empty;
        string sType = string.Empty;
        string sValu = string.Empty;
        string sEmpt = string.Empty;

        if (id == 0)
        {
            sText = "*分配论坛ID(填0则自动分配):/,";
            sName = "id,";
            sType = "num,";
            sValu = "0'";
            sEmpt = "false,";
        }
        else
        {
            model = new BCW.BLL.Forum().GetForum(id);
            if (model == null)
            {
                Utils.Error("不存在的论坛记录", "");
            }
            NodeId = model.NodeId;
            sText  = ",";
            sName  = "id,";
            sType  = "hidden,";
            sValu  = "" + model.ID + "'";
            sEmpt  = "false,";
        }
        builder.Append(Out.Tab("<div class=\"title\">", ""));
        builder.Append("" + PostName + "论坛版块");
        builder.Append(Out.Tab("</div>", ""));
        strText = "" + sText + "*论坛名称:/,论坛口号:/,论坛LOGO:/,版规公告:/,帖子分类标签:(可空)/,版块顶部Ubb:/,版块底部Ubb:/,发帖限制:/,回帖限制:/,等级限制(级):/,访问限制:/,显示帖子方式:/,显示下级版块:/,允许访问的ID(用#分开):/,关联圈子ID(不关联请填0):/,电脑访问:/,运行状态:/,排序:/,,";
        strName = "" + sName + "Title,Notes,Logo,Content,Label,TopUbb,FootUbb,Postlt,Replylt,Gradelt,Visitlt,ShowType,IsNode,VisitId,GroupId,IsPc,IsActive,Paixu,forumid,act";
        strType = "" + sType + "text,text,text,textarea,text,textarea,textarea,select,select,num,select,select,select,text,num,select,select,num,hidden,hidden";
        if (id == 0)
        {
            strValu = "" + sValu + "'''''''0'0'0'0'0'0''0'0'0'0'" + forumid + "'save";
        }
        else
        {
            strValu = "" + sValu + "" + model.Title + "'" + model.Notes + "'" + model.Logo + "'" + model.Content + "'" + model.Label + "'" + model.TopUbb + "'" + model.FootUbb + "'" + model.Postlt + "'" + model.Replylt + "'" + model.Gradelt + "'" + model.Visitlt + "'" + model.ShowType + "'" + model.IsNode + "'" + model.VisitId + "'" + model.GroupId + "'" + model.IsPc + "'" + model.IsActive + "'" + model.Paixu + "'" + model.NodeId + "'editsave";
        }
        strEmpt = "" + sEmpt + "false,true,true,true,true,true,true,0|不限制|1|VIP会员|2|限版主|3|限管理员|4|禁止发帖,0|不限制|1|VIP会员|2|限版主|3|限管理员|4|禁止回帖,false,0|不限制|1|限会员|2|VIP会员|3|限版主|4|限管理员,0|只显本版贴|1|显示下级帖,0|不显示|1|显示,true,false,0|开启电脑访问|1|关闭电脑访问,0|正常运行|1|暂停运行,false,false";
        strIdea = "/";
        strOthe = "确定" + PostName + "|reset,forum.aspx,post,1,red|blue";

        builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe));
        builder.Append(Out.Tab("<div>", "<br />"));
        builder.Append("温馨提示:<br />1.帖子标签格式:1|美图|2|游戏|3|软件,其中1、2、3是编号,设置后请慎重修改.<br />2.允许访问的ID留空时则不限制.<br />3.不管限制如何,版主和管理员都可以穿透限制.");
        builder.Append(Out.Tab("</div>", ""));
        builder.Append(Out.Tab("<div class=\"hr\"></div>", Out.Hr()));
        builder.Append(Out.Tab("<div>", ""));
        if (id != 0)
        {
            builder.Append("<a href=\"" + Utils.getUrl("forum.aspx?act=view&amp;id=" + id + "") + "\">查看论坛</a><br />");
        }
        if (NodeId != 0)
        {
            builder.Append("<a href=\"" + Utils.getUrl("forum.aspx?act=view&amp;id=" + NodeId + "") + "\">返回上一级</a><br />");
        }
        else
        {
            builder.Append("<a href=\"" + Utils.getUrl("forum.aspx") + "\">返回上一级</a><br />");
        }
        builder.Append(Out.Tab("</div><div class=\"title\"><a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>", "<a href=\"" + Utils.getUrl("default.aspx") + "\">返回管理中心</a>"));
        builder.Append(Out.Tab("</div>", "<br />"));
    }
コード例 #4
0
    private void SavePage()
    {
        int    id      = int.Parse(Utils.GetRequest("id", "post", 2, @"^[0-9]\d*$", "ID错误"));
        int    forumid = int.Parse(Utils.GetRequest("forumid", "post", 2, @"^[0-9]\d*$", "ID错误"));
        string Title   = Utils.GetRequest("Title", "post", 2, @"^[^\^]{1,30}$", "论坛名称不能超30字符");
        string Notes   = Utils.GetRequest("Notes", "post", 3, @"^[^\^]{1,30}$", "论坛口号不能超50字符");
        string Logo    = Utils.GetRequest("Logo", "post", 3, @"^[^\^]{1,200}$", "论坛LOGO不能超200字符");
        string Content = Utils.GetRequest("Content", "post", 3, @"^[^\^]{1,3000}$", "版块公告不能超3000字符");

        string Label = Utils.GetRequest("Label", "post", 3, @"^[^\|]{1,5}(?:\|[^\|]{1,5}){1,500}$", "帖子分类标签填写错误,例子如:1|美图|2|游戏|3|软件");

        //----------计算分类合法性开始
        if (Label != "")
        {
            int GetNum = Utils.GetStringNum(Label, "|");
            if (GetNum % 2 == 0)
            {
                Utils.Error("帖子分类标签填写错误,例子如:1|美图|2|游戏|3|软件", "");
            }
            string[] sTemp = Label.Split("|".ToCharArray());
            for (int j = 0; j < sTemp.Length; j++)
            {
                if (j % 2 == 0)
                {
                    if (sTemp[j] == "0")
                    {
                        Utils.Error("帖子分类标签填写错误,例子如:1|美图|2|游戏|3|软件", "");
                        break;
                    }
                    try
                    {
                        int a = int.Parse(sTemp[j]);
                    }
                    catch
                    {
                        Utils.Error("帖子分类标签填写错误,例子如:1|美图|2|游戏|3|软件", "");
                        break;
                    }
                    int b = int.Parse(sTemp[j]);
                    if (j != 0)
                    {
                        if ((b - 1) != int.Parse(sTemp[j - 2]))
                        {
                            Utils.Error("帖子分类标签填写错误,例子如:1|美图|2|游戏|3|软件", "");
                            break;
                        }
                    }
                }
            }
        }
        //----------计算分类合法性结束

        string TopUbb   = Utils.GetRequest("TopUbb", "post", 3, @"^[^\^]{1,800}$", "版块顶部Ubb限800字内");
        string FootUbb  = Utils.GetRequest("FootUbb", "post", 3, @"^[^\^]{1,800}$", "版块底部Ubb限800字内");
        int    Postlt   = int.Parse(Utils.GetRequest("Postlt", "post", 2, @"^[0-4]$", "发帖限制选择错误"));
        int    Replylt  = int.Parse(Utils.GetRequest("Replylt", "post", 2, @"^[0-4]$", "回帖限制选择错误"));
        int    Gradelt  = int.Parse(Utils.GetRequest("Gradelt", "post", 2, @"^[0-4]$", "等级级数填写错误"));
        int    Visitlt  = int.Parse(Utils.GetRequest("Visitlt", "post", 2, @"^[0-4]$", "访问限制选择错误"));
        int    ShowType = int.Parse(Utils.GetRequest("ShowType", "post", 2, @"^[0-1]$", "显示帖子方式选择错误"));
        int    IsNode   = int.Parse(Utils.GetRequest("IsNode", "post", 2, @"^[0-1]$", "显示下级版块选择错误"));
        string VisitId  = Utils.GetRequest("VisitId", "post", 3, @"^[^\#]{1,10}(?:\#[^\#]{1,10}){0,800}$", "限制访问ID填写错误,格式如1234#1111#2222");
        int    GroupId  = int.Parse(Utils.GetRequest("GroupId", "post", 2, @"^[0-9]\d*$", "关联圈子ID填写错误,不关联请填写0"));
        int    IsPc     = int.Parse(Utils.GetRequest("IsPc", "post", 2, @"^[0-1]$", "电脑访问选择错误"));
        int    IsActive = int.Parse(Utils.GetRequest("IsActive", "post", 2, @"^[0-1]$", "运行状态选择错误"));
        int    Paixu    = int.Parse(Utils.GetRequest("Paixu", "post", 2, @"^[0-9]\d*$", "排序填写错误"));

        //ID是否可用
        if (Request["act"] == "save")
        {
            if (id != 0)
            {
                if (new BCW.BLL.Forum().Exists(id))
                {
                    Utils.Error("此ID已被使用,请选择其它ID或者填0自动分配", "");
                }
            }
            else
            {
                id = new BCW.BLL.Forum().GetMaxId();
            }
        }
        BCW.Model.Forum model = new BCW.Model.Forum();
        model.ID       = id;
        model.NodeId   = forumid;
        model.Title    = Title;
        model.Notes    = Notes;
        model.Logo     = Logo;
        model.Content  = Content;
        model.Label    = Label;
        model.Postlt   = Postlt;
        model.Replylt  = Replylt;
        model.Gradelt  = Gradelt;
        model.Visitlt  = Visitlt;
        model.ShowType = ShowType;
        model.IsNode   = IsNode;
        model.VisitId  = VisitId;
        model.GroupId  = GroupId;
        model.IsPc     = IsPc;
        model.IsActive = IsActive;
        model.TopUbb   = TopUbb;
        model.FootUbb  = FootUbb;
        model.Paixu    = Paixu;
        if (Request["act"] == "save")
        {
            new BCW.BLL.Forum().Add(model);
            string ForUrl = string.Empty;
            if (forumid == 0)
            {
                ForUrl = "forum.aspx";
            }
            else
            {
                ForUrl = "forum.aspx?act=view&amp;id=" + forumid + "";
            }

            // 更新forumid下级ID集合
            if (forumid > 0)
            {
                BCW.User.Users.UpdateForumNode(id);
            }

            Utils.Success("添加论坛", "添加论坛成功..", Utils.getUrl(ForUrl), "1");
        }
        else
        {
            new BCW.BLL.Forum().Update(model);
            Utils.Success("编辑论坛", "编辑论坛成功..", Utils.getUrl("forum.aspx?act=edit&amp;id=" + id + ""), "1");
        }
    }
コード例 #5
0
    private void ReloadPage()
    {
        int ptype   = int.Parse(Utils.GetRequest("ptype", "get", 1, @"^[1-2]$", "0"));
        int forumid = int.Parse(Utils.GetRequest("forumid", "get", 1, @"^[1-9]\d*$", "0"));

        BCW.Model.Forum m = null;

        Master.Title = "在线会员";
        if (forumid > 0)
        {
            if (ub.GetSub("BbsIsOnline", "/Controls/bbs.xml") != "0")
            {
                Utils.Error("未开放此功能", "");
            }
            m = new BCW.BLL.Forum().GetForumBasic(forumid);
            if (m == null)
            {
                Utils.Error("不存在的论坛记录", "");
            }

            builder.Append(Out.Tab("<div class=\"title\">", ""));
            builder.Append("<a href=\"" + Utils.getUrl("forum.aspx?forumid=" + forumid + "") + "\">" + m.Title + "</a>&gt;在线会员");
            builder.Append(Out.Tab("</div>", "<br />"));
        }
        else
        {
            builder.Append(Out.Tab("<div class=\"title\">", ""));
            if (ptype == 1)
            {
                builder.Append("全站美女在线");
            }
            else if (ptype == 2)
            {
                builder.Append("全站帅哥在线");
            }
            else
            {
                builder.Append("全站在线会员");
            }

            builder.Append(Out.Tab("</div>", "<br />"));
        }
        int    pageIndex;
        int    recordCount;
        int    pageSize = Convert.ToInt32(ub.Get("SiteListNo"));
        string strWhere = "";

        string[] pageValUrl = { "ptype", "forumid", "backurl" };
        pageIndex = Utils.ParseInt(Request.QueryString["page"]);
        if (pageIndex == 0)
        {
            pageIndex = 1;
        }

        if (forumid > 0)
        {
            strWhere += "EndForumID=" + forumid + " and EndTime>='" + DateTime.Now.AddMinutes(-Convert.ToInt32(ub.Get("SiteExTime"))) + "'";
        }
        else
        {
            //查询条件
            if (ptype == 1)
            {
                strWhere = "Sex<=1 and";
            }
            else if (ptype == 2)
            {
                strWhere = "Sex=2 and";
            }

            strWhere += " EndTime>='" + DateTime.Now.AddMinutes(-Convert.ToInt32(ub.Get("SiteExTime"))) + "'";
        }
        // 开始读取列表
        IList <BCW.Model.User> listUser = new BCW.BLL.User().GetUsers(pageIndex, pageSize, strWhere, out recordCount);

        if (listUser.Count > 0)
        {
            int k = 1;
            foreach (BCW.Model.User n in listUser)
            {
                if (k % 2 == 0)
                {
                    builder.Append(Out.Tab("<div class=\"text\">", "<br />"));
                }
                else
                {
                    if (k == 1)
                    {
                        builder.Append(Out.Tab("<div>", ""));
                    }
                    else
                    {
                        builder.Append(Out.Tab("<div>", "<br />"));
                    }
                }
                //if (n.State == 1)
                //    builder.Append("" + ((pageIndex - 1) * pageSize + k) + ".隐身会员");

                builder.Append("<a href=\"" + Utils.getUrl("uinfo.aspx?uid=" + n.ID + "&amp;backurl=" + Utils.PostPage(1) + "") + "\">" + BCW.User.Users.SetUser(n.ID) + "(" + n.ID + ")</a>");

                k++;
                builder.Append(Out.Tab("</div>", ""));
            }
            // 分页
            builder.Append(BasePage.MultiPage(pageIndex, pageSize, recordCount, Utils.getPageUrl(), pageValUrl, "page", 1));
        }
        else
        {
            builder.Append(Out.Div("div", "没有相关记录.."));
        }
        builder.Append(Out.Tab("<div>", "<br />"));
        if (forumid > 0)
        {
            builder.Append("最高" + m.TopLine + "人,发生在" + DT.FormatDate(m.TopTime, 5) + "<br />");
            builder.Append("<a href=\"" + Utils.getUrl("forum.aspx?forumid=" + forumid + "") + "\">返回" + m.Title + "</a>");
        }
        else
        {
            builder.Append("帅哥<a href=\"" + Utils.getUrl("online.aspx?ptype=2&amp;backurl=" + Utils.getPage(0) + "") + "\">" + new BCW.BLL.User().GetNum(2) + "</a>|美女<a href=\"" + Utils.getUrl("online.aspx?ptype=1&amp;backurl=" + Utils.getPage(0) + "") + "\">" + new BCW.BLL.User().GetNum(1) + "</a>");
        }
        builder.Append(Out.Tab("</div>", ""));
        builder.Append(Out.Tab("<div class=\"title\">", Out.Hr()));
        builder.Append("<a href=\"" + Utils.getUrl("/default.aspx") + "\">首页</a>-");
        builder.Append("<a href=\"" + Utils.getPage("uinfo.aspx") + "\">上级</a>");
        builder.Append(Out.Tab("</div>", ""));
    }