예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack)
     {
         string               txtInfo = Request.Form["txtInfo"];
         string[]             words   = txtInfo.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
         Articel_WordsManager bll     = new Articel_WordsManager();
         foreach (string word in words)
         {
             string[]      s     = word.Split('=');
             Articel_Words model = new Articel_Words();
             model.WordPattern = s[0];
             if (s[1] == "{BANNED}")
             {
                 model.IsForbid = true;
             }
             else if (s[1] == "{MOD}")
             {
                 model.IsMod = true;
             }
             else
             {
                 model.ReplaceWord = s[1];
             }
             bll.Add(model);
         }
     }
 }
예제 #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //取值
            string name = context.Request["name"];
            string ci   = context.Request["ci"];

            //判断
            if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(ci))
            {
                context.Response.Write("kong");
            }
            else
            {
                if (ci == "禁用词" || ci == "敏感词")
                {
                    Articel_Words aw = new Articel_Words();
                    aw.WordPattern = name;
                    aw.IsForbid    = false;
                    aw.IsMod       = false;
                    if (ci == "敏感词")
                    {
                        aw.IsMod = true;
                    }
                    else if (ci == "禁用词")
                    {
                        aw.IsForbid = true;
                    }
                    Articel_WordsBll bll = new Articel_WordsBll();
                    int row = bll.Add(aw);
                    if (row > 0)
                    {
                        context.Response.Write("ok");
                    }
                    else
                    {
                        context.Response.Write("no");
                    }
                }
                else
                {
                    context.Response.Write("cuo");
                }
            }
        }