Example #1
0
        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} &nbsp; &nbsp; &nbsp;   点评时间:{1} &nbsp; &nbsp; &nbsp;   满意度:<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();
        }
Example #2
0
        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;
        }