#region 加载评论
public void ArticleComment()
{
int PageNo = Convert.ToInt32(Request.QueryString["page"]);
if (ArticleId == null||ArticleId=="")
{
ArticleId = Request.QueryString["ArticleId"];
}
string url = "/Blog/Inc/GetData.aspx?Action=pagefile&ArticleId=" + ArticleId;
AjaxPageSource ajaxPageSource;//这是数据源
Sky.Business.Comment myobj = new Sky.Business.Comment();
ajaxPageSource = myobj.CommentInfo(20, PageNo, ArticleId);//这是数据源
IDataReader idr = ajaxPageSource.myidr;
try
{
TempStr.Append("<table width='90%' border='0' cellspacing='0' cellpadding='0' align='center'>");
while (idr.Read())
{
TempStr.Append("<tr>");
TempStr.Append("<td class='commenttitle'>回复:" + idr["CommentTitle"].ToString() + "</td>");
TempStr.Append("</tr><tr>");
TempStr.Append("<td><span class='commentautor'>作者:" + idr["UserName"].ToString() + "</span> <span class='commenttime'>" + idr["CommentTime"].ToString() + "</span></td>");
TempStr.Append("</tr><tr>");
TempStr.Append("<td class='commentcontent' style='word-wrap:break-word;'>" + idr["CommentContent"].ToString() + "</td>");
TempStr.Append("</tr><tr>");
TempStr.Append("<td><hr align=left width='92%' size=1 ></td></tr>");
}
TempStr.Append("<tr><td height='28' align='center'>" + ajaxPageSource.ShowPage(url, "个评论", "ShowComment") + "</td>");
TempStr.Append("</tr></table>");
}
catch (Exception e)
{
Response.Write(e.Message.ToString());
}
finally
{
idr.Close();
ajaxPageSource.CloseConn();
myobj = null;
}
Response.Write(TempStr.ToString());
}
#endregion
#region 添加评论
public void AddComment()
{
string Title = Request.Form.Get("title");
string Content = Request.Form.Get("content");
string Autor = Request.Form.Get("autor");
string Name = Request.Form.Get("uname");
ArticleId = Request.Form.Get("articleid");
Comment myobj = new Comment();
myobj.commentTitle = Title;
myobj.commentContent = Content;
myobj.userName = Autor;
myobj.userId = Name;
myobj.id = ArticleId;
myobj.isCheck = true;
string Msg=myobj.AddComment();
myobj = null;
this.ArticleComment();
}
#endregion