Exemplo n.º 1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(BCW.Model.Blacklist model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(BCW.Model.Blacklist model)
 {
     dal.Update(model);
 }
Exemplo n.º 3
0
    private void AdminPage(string act, int meid)
    {
        int    hid   = int.Parse(Utils.GetRequest("hid", "all", 2, @"^[0-9]\d*$", "会员ID错误"));
        int    ptype = int.Parse(Utils.GetRequest("ptype", "all", 2, @"^[0-9]\d*$", "选择权限错误"));
        string info  = Utils.GetRequest("info", "post", 1, "", "");
        string sName = string.Empty;
        string Role  = string.Empty;

        if (!new BCW.BLL.User().Exists(hid))
        {
            Utils.Error("不存在的会员ID", "");
        }
        string UsName = new BCW.BLL.User().GetUsName(hid);

        if (ptype == 1)
        {
            sName = "锁定";
            Role  = "A";
        }
        else if (ptype == 2)
        {
            sName = "发帖";
            Role  = "B";
        }
        else if (ptype == 3)
        {
            sName = "回贴";
            Role  = "C";
        }
        else if (ptype == 4)
        {
            sName = "短消息";
            Role  = "D";
        }
        else if (ptype == 5)
        {
            sName = "聊天室";
            Role  = "E";
        }
        else if (ptype == 6)
        {
            sName = "留言本";
            Role  = "F";
        }
        else if (ptype == 7)
        {
            sName = "发广播";
            Role  = "G";
        }
        else if (ptype == 8)
        {
            sName = "全站评论";
            Role  = "H";
        }
        else if (ptype == 9)
        {
            sName = "上传文件";
            Role  = "I";
        }
        else if (ptype == 10)
        {
            sName = "金融系统";
            Role  = "J";
        }
        else if (ptype == 11)
        {
            sName = "社区游戏";
            Role  = "K";
        }
        else if (ptype == 12)
        {
            sName = "使用日记";
            Role  = "L";
        }
        else if (ptype == 13)
        {
            sName = "使用相册";
            Role  = "M";
        }
        else if (ptype == 14)
        {
            sName = "使用闲聊";
            Role  = "N";
        }
        else if (ptype == 15)
        {
            sName = "社区应用";
            Role  = "O";
        }
        if (act == "admin")
        {
            if (ptype == 1)
            {
                sName = "锁定";
            }
            else
            {
                sName = "禁止" + sName + "";
            }
        }
        else
        {
            if (ptype == 1)
            {
                sName = "解锁";
            }
            else
            {
                sName = "解禁" + sName + "";
            }
        }
        if (info == "ok")
        {
            string Why  = Utils.GetRequest("Why", "post", 3, @"^[^\^]{1,50}$", "理由限50字内,可留空");
            int    rDay = 0;
            if (act == "admin")
            {
                rDay = int.Parse(Utils.GetRequest("rDay", "post", 2, @"^0|1|2|3|5|10|15|30|90$", "期限选择错误"));
                if (ptype != 1)
                {
                    if (rDay == 0)
                    {
                        Utils.Error("只有锁定类型才可以选择永久期限", "");
                    }
                }
                //如果已存在过期加黑记录则先删除
                new BCW.BLL.Blacklist().DeleteRole(hid, Role);
                if (new BCW.BLL.Blacklist().ExistsRole(hid, Role))
                {
                    Utils.Error("此ID已被" + sName + "", "");
                }
                BCW.Model.Blacklist model = new BCW.Model.Blacklist();
                model.UsID      = hid;
                model.UsName    = UsName;
                model.ForumID   = 0;
                model.ForumName = "";
                model.BlackRole = Role;
                model.BlackWhy  = Why;
                model.BlackDay  = rDay;
                model.Include   = 0;
                model.AdminUsID = meid;
                model.ExitTime  = DateTime.Now.AddDays(rDay);
                model.AddTime   = DateTime.Now;
                new BCW.BLL.Blacklist().Add(model);
                //永久锁定
                if (ptype == 1 && rDay == 0)
                {
                    string Limit = new BCW.BLL.User().GetLimit(hid);
                    Limit = Limit + "|lock";
                    new BCW.BLL.User().UpdateLimit(hid, Limit);
                }
            }
            else
            {
                if (ptype > 1)
                {
                    if (new BCW.BLL.Blacklist().ExistsRole(hid, "A"))
                    {
                        Utils.Error("你必须解除锁定才能进行此操作", "");
                    }
                }
                string Limit = new BCW.BLL.User().GetLimit(hid);
                if (!new BCW.BLL.Blacklist().ExistsRole(hid, Role) && !Limit.Contains("lock"))
                {
                    Utils.Error("不存在的加黑记录", "");
                }
                new BCW.BLL.Blacklist().DeleteRole(hid, Role);
                //解除永久锁定
                if (ptype == 1)
                {
                    Limit = Limit.Replace("lock", "");
                    new BCW.BLL.User().UpdateLimit(hid, Limit);
                }
            }
            //记录日志
            string strLog  = "系统管理员对[url=/bbs/uinfo.aspx?uid=" + hid + "]" + UsName + "[/url]" + sName + "";
            string strLog2 = "系统管理员将你" + sName + "";
            if (act == "admin")
            {
                if (rDay == 0)
                {
                    strLog  += "(永久)";
                    strLog2 += "(永久)";
                }
                else
                {
                    strLog  += "" + rDay + "天";
                    strLog2 += "" + rDay + "天";
                }
            }
            if (!string.IsNullOrEmpty(Why))
            {
                strLog  += ",理由:" + Why + "";
                strLog2 += ",理由:" + Why + "";
            }
            new BCW.BLL.Forumlog().Add(0, 0, strLog);
            new BCW.BLL.Guest().Add(0, hid, UsName, strLog2);
            Utils.Success("管理会员", "执行管理成功,正在返回..", Utils.getUrl("usermanage.aspx?hid=" + hid + "&amp;backurl=" + Utils.getPage(0) + ""), "1");
        }
        else
        {
            builder.Append(Out.Tab("<div class=\"title\">", ""));
            builder.Append("对<a href=\"" + Utils.getUrl("uinfo.aspx?uid=" + hid + "&amp;backurl=" + Utils.PostPage(1) + "") + "\">" + UsName + "(" + hid + ")</a>执行《" + sName + "》");
            builder.Append(Out.Tab("</div>", ""));
            if (act == "admin")
            {
                strText = ",,理由(50字内):/,期限:,,,,";
                strName = "hid,ptype,Why,rDay,act,info,backurl";
                strType = "hidden,hidden,textarea,select,hidden,hidden,hidden";
                strValu = "" + hid + "'" + ptype + "''10'admin'ok'" + Utils.getPage(0) + "";
                if (ptype == 1)
                {
                    strEmpt = "false,false,false,0|永久|1|1天|2|2天|3|3天|5|5天|10|10天|15|15天|30|30天|90|90天,false,false,false";
                }
                else
                {
                    strEmpt = "false,false,false,1|1天|2|2天|3|3天|5|5天|10|10天|15|15天|30|30天|90|90天,false,false,false";
                }
            }
            else
            {
                strText = ",,理由(50字内):/,,,,";
                strName = "hid,ptype,Why,act,info,backurl";
                strType = "hidden,hidden,textarea,hidden,hidden,hidden";
                strValu = "" + hid + "'" + ptype + "''admin2'ok'" + Utils.getPage(0) + "";
                strEmpt = "false,false,false,false,false,false";
            }
            strIdea = "/";
            strOthe = "确定执行,usermanage.aspx,post,1,red";
            builder.Append(Out.wapform(strText, strName, strType, strValu, strEmpt, strIdea, strOthe));
            builder.Append(Out.Tab("<div>", ""));
            builder.Append(" <a href=\"" + Utils.getUrl("usermanage.aspx?hid=" + hid + "&amp;backurl=" + Utils.getPage(0) + "") + "\">重选</a><br />");
            builder.Append("<a href=\"" + Utils.getPage("usermanage.aspx?hid=" + hid + "") + "\">&gt;返回上一级</a>");
            if (ptype == 1)
            {
                builder.Append("<br />温馨提示:<br />1.锁定会员后,该会员将不能正常使用所有功能.");
            }
            builder.Append(Out.Tab("</div>", "<br />"));
        }
    }