protected override void Initialize() { if (!We7Helper.IsEmptyID(CommentID)) { Comments cm = CommentsHelper.GetComment(CommentID, null); AuthorLiteral.Text = cm.Author; IPLiteral.Text = cm.IP; ContentLiteral.Text = cm.Content; TimeLiteral.Text = cm.Created.ToString(); StateLiteral.Text = cm.AuditText; try { SummaryLabel.Text = String.Format("管理文章:“{0}”的评论", ArticleHelper.GetArticle(cm.ArticleID, new string[] { "Title" }).Title); } catch { string chID = ChannelHelper.GetChannelIDByOnlyName(cm.ArticleID); Channel ch = ChannelHelper.GetChannel(chID, new string[] { "FullPath" }); if (ch != null) { SummaryLabel.Text = String.Format("管理栏目:“{0}”的评论", ch.FullPath); } } RefreshHyperLink.NavigateUrl = String.Format("CommentDetail.aspx?id={0}", CommentID); } else { MessageLabel.Text = "没有任何评论"; } }
/// <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(); }
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(); }