📄 commentmanage.cs
字号:
namespace PowerEasy.WebSite.Controls
{
using PowerEasy.Common;
using PowerEasy.Components;
using PowerEasy.Contents;
using PowerEasy.Controls;
using PowerEasy.Model.Contents;
using PowerEasy.Web.UI;
using System;
using System.Text;
using System.Web.UI.WebControls;
public class CommentManage : BaseUserControl
{
protected Button BtnAllComment;
protected Button BtnAuditedComment;
protected Button BtnUNAuditedComment;
protected HiddenField HdnListType;
protected Label LblTitle;
private int m_floorNumber;
private int m_GeneralId;
protected AspNetPager Pager;
protected string Path = "";
protected Repeater RptCommentList;
protected void BtnAllComment_Click(object sender, EventArgs e)
{
this.HdnListType.Value = "0";
this.Pager.CurrentPageIndex = 1;
this.CommentBindData();
}
protected void BtnAuditedComment_Click(object sender, EventArgs e)
{
this.HdnListType.Value = "1";
this.Pager.CurrentPageIndex = 1;
this.CommentBindData();
}
protected void BtnUNAuditedComment_Click(object sender, EventArgs e)
{
this.HdnListType.Value = "2";
this.Pager.CurrentPageIndex = 1;
this.CommentBindData();
}
private void CommentBindData()
{
this.m_floorNumber = (this.Pager.CurrentPageIndex - 1) * this.Pager.PageSize;
this.RptCommentList.DataSource = Comment.GetList((this.Pager.CurrentPageIndex - 1) * this.Pager.PageSize, this.Pager.PageSize, this.m_GeneralId, DataConverter.CLng(this.HdnListType.Value));
this.Pager.RecordCount = Comment.GetTotalOfCommentInfo();
this.RptCommentList.DataBind();
}
protected void InitComment()
{
if (this.m_GeneralId == 0)
{
BaseUserControl.WriteErrMsg("<li>没有找到隶属信息评论,请返回!</li>");
}
else
{
string s = BaseUserControl.RequestString("Title");
this.LblTitle.Text = s;
string returnurl = "ContentView.aspx?GeneralID=" + this.m_GeneralId.ToString() + "&title=" + base.Server.UrlEncode(s);
int commentId = BaseUserControl.RequestInt32("CommentID");
switch (BaseUserControl.RequestString("Action"))
{
case "Delete":
if (Comment.Delete(commentId))
{
BaseUserControl.WriteSuccessMsg("<li>删除指定信息评论成功!</li>", returnurl);
}
break;
case "Audited":
if (Comment.SetStatus(commentId, true))
{
BaseUserControl.WriteSuccessMsg("<li>指定信息评论审核成功!</li>", returnurl);
}
break;
case "UnAudited":
if (Comment.SetStatus(commentId, false))
{
BaseUserControl.WriteSuccessMsg("<li>已取消指定评论审核!</li>", returnurl);
}
break;
case "Premier":
if (Comment.Elite(commentId, true))
{
BaseUserControl.WriteSuccessMsg("<li>设定指定评论精华成功!</li>", returnurl);
}
break;
case "UnPremier":
if (Comment.Elite(commentId, false))
{
BaseUserControl.WriteSuccessMsg("<li>已取消指定评论精华!</li>", returnurl);
}
break;
case "AddPKZone":
{
CommentPKZoneInfo commentPKZoneInfo = new CommentPKZoneInfo();
commentPKZoneInfo.CommentId = commentId;
commentPKZoneInfo.Content = base.Request["ItemContent"];
commentPKZoneInfo.Position = DataConverter.CLng(base.Request["RadlPosition"]);
commentPKZoneInfo.IP = PEContext.Current.UserHostAddress;
commentPKZoneInfo.UpdateTime = DateTime.Now;
commentPKZoneInfo.UserName = "匿名发表";
CommentPKZone.Add(commentPKZoneInfo);
BaseUserControl.WriteSuccessMsg("<li>感谢您的参与,添加辩论成功!</li>", returnurl);
break;
}
}
this.CommentBindData();
}
}
protected void Page_Load(object sender, EventArgs e)
{
this.m_GeneralId = BaseUserControl.RequestInt32("GeneralID");
this.Path = this.Page.Request.ApplicationPath.Equals("/") ? string.Empty : this.Page.Request.ApplicationPath;
this.Path = this.Page.Request.Url.Scheme + "://" + this.Page.Request.Url.Authority + this.Path;
this.InitComment();
}
protected void Pager_PageChanged(object src, PageChangedEventArgs e)
{
this.Pager.CurrentPageIndex = e.NewPageIndex;
this.CommentBindData();
}
protected void RptCommentContent_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
Label label = e.Item.FindControl("LblNum") as Label;
Label label2 = e.Item.FindControl("LblUserFace") as Label;
Label label3 = e.Item.FindControl("LblCommentContent") as Label;
CommentInfo dataItem = (CommentInfo) e.Item.DataItem;
Label label4 = e.Item.FindControl("LblSustain") as Label;
Label label5 = e.Item.FindControl("LblOppose") as Label;
Label label6 = e.Item.FindControl("LblNeutralismNetizen") as Label;
Label label7 = e.Item.FindControl("LblPKZone") as Label;
Label label8 = e.Item.FindControl("LblPKAgree") as Label;
Label label9 = e.Item.FindControl("LblPKOppose") as Label;
Label label10 = e.Item.FindControl("LblExcerpt") as Label;
Label label11 = e.Item.FindControl("LblRestore") as Label;
Label label12 = e.Item.FindControl("LblDelete") as Label;
string str = "CommentID=" + dataItem.CommentId.ToString() + "&GeneralId=" + this.m_GeneralId.ToString() + "&Title=" + base.Server.UrlEncode(BaseUserControl.RequestString("Title"));
this.m_floorNumber++;
label4.Text = CommentPKZone.GetPKCount(dataItem.CommentId, 1).ToString();
label5.Text = CommentPKZone.GetPKCount(dataItem.CommentId, -1).ToString();
label6.Text = CommentPKZone.GetPKCount(dataItem.CommentId, 0).ToString();
label.Text = "第<span style='color:Red'>" + this.m_floorNumber.ToString() + "</span>楼";
if (!string.IsNullOrEmpty(dataItem.UserFace))
{
label2.Text = string.Concat(new object[] { "<img alt='' src='", dataItem.UserFace, "' width='", dataItem.FaceWidth, "' height='", dataItem.FaceHeight, "' />" });
}
else
{
label2.Text = "<img alt='' src='" + this.Path + "/Images/Comment/01.gif' width='80' height='90' />";
}
Label label13 = e.Item.FindControl("LblContent") as Label;
label13.Text = dataItem.Content;
StringBuilder builder = new StringBuilder();
builder.Append("信息:" + dataItem.PassedItems + "<br/>");
if (SiteConfig.SiteOption.EnablePointMoneyExp)
{
builder.Append("积分:" + dataItem.UserExp + "<br/>");
}
builder.Append("时间:" + dataItem.UserRegTime.ToString("yyyy-MM-dd"));
label3.Text = builder.ToString();
StringBuilder builder2 = new StringBuilder();
builder2.Append("<table class='Reply' cellspacing='0' cellpadding='6' width='95%' border='0'>");
builder2.Append("<tr>");
builder2.Append(" <td class='ReplyAdminTd' >");
builder2.Append(" <span class='ReplyAdmin'>管理员回复</span>:<br/>");
builder2.Append(dataItem.Reply);
builder2.Append("<br/>");
builder2.Append("<p align='right'>" + dataItem.ReplyDateTime.ToString() + "</span>");
builder2.Append("</td>");
builder2.Append("</tr>");
builder2.Append("</table>");
if (!dataItem.ReplyIsPrivate && !string.IsNullOrEmpty(dataItem.Reply))
{
label13.Text = label13.Text + builder2.ToString();
}
label7.Text = " <a href='CommentPKZoneManage.aspx?" + str.ToString() + "'> PK Zone</a>";
label8.Text = " <a href='CommentPKZoneManage.aspx?" + str.ToString() + "' onkeydown=\"return Agree(event);\" onmouseover=\"PopupArea(event, 'Agree" + dataItem.CommentId.ToString() + "')\" onmouseout = \"jsAreaMouseOut(event)\"> 支持</a>";
label9.Text = " <a href='CommentPKZoneManage.aspx?" + str.ToString() + "' onkeydown=\"return Oppose(event);\" onmouseover=\"PopupArea(event, 'Oppose" + dataItem.CommentId.ToString() + "')\" onmouseout = \"jsAreaMouseOut(event)\"> 反对</a>";
label10.Text = " <a href='CommentExcerpt.aspx?" + str.ToString() + "'> 信息引用</a>";
label11.Text = " <a href='CommentRestore.aspx?" + str.ToString() + "'> 回复</a>";
if (!string.IsNullOrEmpty(PEContext.Current.Admin.UserName))
{
label12.Text = "<a href='ContentView.aspx?Action=Delete&" + str + "' onclick=\"return confirm('确定要删除此评论吗?');\">删除</a>";
Label label14 = e.Item.FindControl("LblAuditing") as Label;
if (dataItem.Status)
{
label14.Text = "<span style='color:green'><a href='" + BaseUserControl.AppendSecurityCode("ContentView.aspx?Action=UnAudited&" + str) + "'>取消审核</a></span>";
}
else
{
label14.Text = "<span style='color:blue'><a href='" + BaseUserControl.AppendSecurityCode("ContentView.aspx?Action=Audited&" + str) + "'>通过审核</a></span>";
}
Label label15 = e.Item.FindControl("LblIsElite") as Label;
if (dataItem.IsElite)
{
label15.Text = "<span style='color:green'><a href='" + BaseUserControl.AppendSecurityCode("ContentView.aspx?Action=UnPremier&" + str) + "'>取消精华</a></span>";
}
else
{
label15.Text = "<span style='color:blue'><a href='" + BaseUserControl.AppendSecurityCode("ContentView.aspx?Action=Premier&" + str) + "'>设置为精华</a></span>";
}
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -