📄 commentexcerpt.cs
字号:
namespace PowerEasy.WebSite.CommentUI
{
using PowerEasy.Common;
using PowerEasy.Components;
using PowerEasy.Contents;
using PowerEasy.Controls;
using PowerEasy.Model.Contents;
using PowerEasy.Model.UserManage;
using PowerEasy.UserManage;
using PowerEasy.Web.UI;
using PowerEasy.WebSite.Controls;
using System;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
public class CommentExcerpt : DynamicPage
{
protected Button BtnReset;
protected Button BtnSubmit;
protected CheckBox ChkIsPrivate;
protected HtmlForm form1;
protected HtmlHead Head1;
protected Label LblCommentTitle;
protected Label LblContent;
protected Label LblEmail;
protected Label LblMessage;
protected Label LblPassedItems;
protected Label LblTitle;
protected Label LblUpdateDateTime;
protected Label LblUserExp;
protected Label LblUserFace;
protected Label LblUserName;
protected Label LblUserRegTime;
protected Label LblUserShow;
protected RadioButtonList RadlPosition;
protected PowerEasy.WebSite.Controls.ScoreControl ScoreControl;
protected TextBox TxtCommentRestore;
protected TextBox TxtCommentTitle;
protected TextBox TxtEmail;
protected TextBox TxtUserName;
protected HtmlTableRow UserExp;
protected PowerEasy.Controls.RequiredFieldValidator ValrCommentRestore;
protected PowerEasy.Controls.RequiredFieldValidator ValrCommentTitle;
protected PowerEasy.Controls.RequiredFieldValidator ValrEmail;
protected PowerEasy.Controls.RequiredFieldValidator ValrUserName;
protected void BtnReset_Click(object sender, EventArgs e)
{
base.Response.Redirect(@"..\Item.aspx?id=" + BasePage.RequestInt32("id").ToString());
}
protected void BtnSubmit_Click(object sender, EventArgs e)
{
CommentInfo commentInfo = new CommentInfo();
commentInfo.GeneralId = BasePage.RequestInt32("GeneralId");
commentInfo.TopicId = 1;
commentInfo.NodeId = 0;
commentInfo.CommentTitle = StringHelper.RemoveXss(this.TxtCommentTitle.Text);
commentInfo.Content = StringHelper.RemoveXss(this.TxtCommentRestore.Text);
commentInfo.UpdateDateTime = DateTime.Now;
commentInfo.Score = this.ScoreControl.Score;
commentInfo.Position = DataConverter.CLng(this.RadlPosition.SelectedValue);
commentInfo.Status = true;
commentInfo.IP = PEContext.Current.UserHostAddress;
if (this.ChkIsPrivate.Checked)
{
commentInfo.IsPrivate = true;
}
else
{
commentInfo.IsPrivate = false;
}
if (!string.IsNullOrEmpty(PEContext.Current.User.UserName))
{
commentInfo.UserName = PEContext.Current.User.UserName;
commentInfo.ReplyUserName = this.TxtUserName.Text;
}
else
{
commentInfo.UserName = "游客";
commentInfo.ReplyUserName = this.TxtUserName.Text;
}
commentInfo.Face = "";
if (Comment.Add(commentInfo))
{
DynamicPage.WriteSuccessMsg("<li>添加评论成功!</li>", @"..\Item.aspx?id=" + BasePage.RequestInt32("id").ToString());
}
else
{
DynamicPage.WriteErrMsg("<li>添加评论失败,请返回!</li>");
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(PEContext.Current.User.UserName))
{
UserInfo usersByUserName = Users.GetUsersByUserName(PEContext.Current.User.UserName);
this.TxtUserName.Text = usersByUserName.UserName;
this.TxtEmail.Text = usersByUserName.Email;
this.TxtUserName.Enabled = false;
this.TxtEmail.Enabled = false;
}
if (!base.IsPostBack)
{
int num = BasePage.RequestInt32("GeneralId");
int commentId = BasePage.RequestInt32("CommentID");
string str = BasePage.RequestString("Title");
if (num == 0)
{
DynamicPage.WriteErrMsg("<li>没有找到隶属信息评论,请返回。</li>");
}
else
{
CommentInfo extendCommentInfo = Comment.GetExtendCommentInfo(commentId);
if (!base.User.Identity.IsAuthenticated)
{
this.ChkIsPrivate.Enabled = false;
}
this.LblTitle.Text = str;
if (!string.IsNullOrEmpty(extendCommentInfo.UserFace))
{
this.LblUserFace.Text = string.Concat(new object[] { "<img alt='' src='", extendCommentInfo.UserFace, "' width='", extendCommentInfo.FaceWidth, "' height='", extendCommentInfo.FaceHeight, "' />" });
}
else
{
this.LblUserFace.Text = "<img alt='' src='../Images/Comment/01.gif' width='80' height='90' />";
}
this.LblUserName.Text = extendCommentInfo.UserName;
this.LblPassedItems.Text = extendCommentInfo.PassedItems.ToString();
this.LblUserExp.Text = extendCommentInfo.UserExp.ToString();
this.LblUserRegTime.Text = extendCommentInfo.UserRegTime.ToString("yyyy-MM-dd");
this.LblMessage.Text = "<a href='../Accessories/MessageSend.aspx?UserName=" + extendCommentInfo.UserName + "'><img alt='发送短信' src='../Images/Comment/message.gif' border='0' /></a>";
this.LblUserShow.Text = "<a href='../User/UserShow.aspx?UserId=" + extendCommentInfo.UserId.ToString() + "'><img alt='用户信息' src='../Images/Comment/profile.gif' border='0' /></a>";
this.LblEmail.Text = "<a href='mailto:" + extendCommentInfo.Email + "'><img alt='邮箱' src='../Images/Comment/email.gif' border='0' /></a>";
this.LblContent.Text = extendCommentInfo.Content;
this.LblUpdateDateTime.Text = extendCommentInfo.UpdateDateTime.ToString("yyyy-MM-dd");
this.TxtCommentRestore.Text = extendCommentInfo.Content;
}
if (!SiteConfig.SiteOption.EnablePointMoneyExp)
{
this.UserExp.Style.Add("display", "none");
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -