private void BindComment() { ClassLibrary.BLL.RouteComment cBll = new ClassLibrary.BLL.RouteComment(); DataSet mtSet = cBll.GetPageData(100, 1, "checked = 1 and routeID=" + routeID, " createdTime desc"); StringBuilder sb = new StringBuilder(); DataTable myTable1 = mtSet.Tables["Data"]; //DataTable tableCount1 = mtSet.Tables["Count"]; int i = 0; int fen = 0; foreach (DataRow row in myTable1.Rows) { i++; fen += Convert.ToInt32(row["grade"]); sb.Append("<div class='comment_item'>"); sb.AppendFormat("<div class='comment_user'>出游人:{0} 点评时间:{1} 满意度:<em>{2}</em></div>", Convert.ToBoolean(row["Anonymous"]) ? "匿名" : row["Nickname"].ToString(), Convert.ToDateTime(row["createdTime"]).ToShortDateString(), Convert.ToDouble(row["grade"]) * 20 + "%"); sb.AppendFormat("<p class='comment_content'>{0}</p>", row["Content"]); sb.Append("</div>"); } if (i == 0) { sb.Append("<div class='comment_item'>该线路暂无评论</div>"); } commentGrade = i == 0 ? "100%" : Convert.ToDouble(fen / i) * 20 + "%"; commentCount = i; datacomment = sb.ToString(); }
private void RouteCommentCheck(int id) { ClassLibrary.BLL.RouteComment routeCommentBLL = new ClassLibrary.BLL.RouteComment(); if (routeCommentBLL.UpdateCheck(id) > 0) { Response.Write("<script>alert('审核成功!');location.href='RouteCommentList.aspx';</script>"); } }
protected string checkNewComment() { string comments = ""; ClassLibrary.BLL.RouteComment commentsBLL = new ClassLibrary.BLL.RouteComment(); int countNewComment = commentsBLL.Count("Checked = 0"); if (countNewComment != 0) { comments = "您有 <a href='./RouteComment/RouteCommentList.aspx'>" + countNewComment + "</a> 条留言未处理!"; } return(comments); }
private void RouteCommentDelete(HttpContext context) { string id = context.Request.QueryString["id"]; ClassLibrary.BLL.RouteComment routeCommentBLL = new ClassLibrary.BLL.RouteComment(); if (routeCommentBLL.Delete(int.Parse(id)) > 0) { Print(context, "success"); } else { Print(context, "errors"); } }
private void BindComment() { ClassLibrary.BLL.RouteComment cBll = new ClassLibrary.BLL.RouteComment(); DataSet mtSet = cBll.GetPageData(100, 1, "checked = 1 and routeID=" + routeID, " createdTime desc"); DataTable myTable1 = mtSet.Tables["Data"]; int i = 0; int fen = 0; foreach (DataRow row in myTable1.Rows) { i++; fen += Convert.ToInt32(row["grade"]); } commentGrade = i == 0 ? "100%" : Convert.ToDouble(fen / i) * 20 + "%"; commentCount = i; }