Beispiel #1
0
        protected void DeleteBtn_Click(object sender, EventArgs e)
        {
            if (DemoSiteMessage)
            {
                return;                             //是否是演示站点
            }
            List <string> ids = GetIDs();

            if (ids.Count < 1)
            {
                MessageLabel.Text    = "你没有选择任何一条记录";
                MessagePanel.Visible = true;
                return;
            }

            string aTitle = "";

            foreach (string id in ids)
            {
                Comments c = CommentsHelper.GetComment(id, new string[] { "Content" });
                CommentsHelper.DeleteComment(id);

                string con = c.Content;
                if (c.Content.Length > 10)
                {
                    con = c.Content.Substring(0, 10);
                }

                aTitle += String.Format("{0};", con);
            }

            //记录日志
            string content = string.Format("删除了{0}条评论:“{1}”", ids.Count.ToString(), aTitle);

            AddLog("评论管理", content);

            MessageLabel.Text    = string.Format("您已经成功删除{0}条记录", ids.Count.ToString());
            MessagePanel.Visible = true;
            LoadComments();
        }