/// <summary> /// 启用或禁用评论 /// </summary> /// <param name="state"></param> void SetState(int state) { List <string> ids = GetIDs(); if (ids.Count < 1) { MessageLabel.Text = "你没有选择任何一条记录"; MessagePanel.Visible = true; return; } string aTitle = ""; string content = ""; foreach (string id in ids) { Comments c = new Comments(); c.ID = id; c.State = state; CommentsHelper.UpdateComments(c, new string[] { "ID", "State" }); c = CommentsHelper.GetComment(id, new string[] { "Content" }); string con = c.Content; if (c.Content.Length > 10) { con = c.Content.Substring(0, 10); } aTitle += String.Format("{0};", con); } MessageLabel.Text = string.Format("您已经成功启用{0}条评论", ids.Count.ToString()); content = string.Format("启用了{0}条评论:“{1}”", ids.Count.ToString(), aTitle); if (state == 0) { MessageLabel.Text = string.Format("您已经成功禁用{0}条评论", ids.Count.ToString()); content = string.Format("禁用了{0}条评论:“{1}”", ids.Count.ToString(), aTitle); } AddLog("评论管理", content); MessagePanel.Visible = true; LoadComments(); }