Ejemplo n.º 1
0
        private void BindList()
        {
            DataTable myTable = comBLL.GetData("UserName='******'");

            myTable  = pg.pagination(myTable, 10, "");
            pageInfo = pg.pageNumList;

            StringBuilder sb = new StringBuilder();
            List <ClassLibrary.Model.RouteClass> rcList = new List <ClassLibrary.Model.RouteClass>();

            if (myTable.Rows.Count != 0)
            {
                ClassLibrary.BLL.RouteClass rcBLL = new ClassLibrary.BLL.RouteClass();
                rcList = rcBLL.GetModelList(string.Empty);
            }
            int rowIndex = 0;

            foreach (DataRow dr in myTable.Rows)
            {
                sb.Append("<tr'>");
                ClassLibrary.Model.Routes route = routeBLL.GetModel(Convert.ToInt32(dr["routeID"]));

                string tmpClassPy = rcList.Find(delegate(ClassLibrary.Model.RouteClass rc) { return(rc.ID == route.LocationID); }).ClassNamePY;

                sb.AppendFormat("<td align='center'>{0}</td>", ++rowIndex);
                sb.AppendFormat("<td align='center'><a href='{3}/{2}/{0}.html' target='_blank'>{1}</a></td>", dr["routeID"].ToString(), route.Title, tmpClassPy, SysConfig.webSite);
                sb.AppendFormat("<td align='center'>{0}</td>", GetGradeImg(dr["Grade"].ToString()));
                sb.AppendFormat("<td align='center'>{0}</td>", dr["Content"].ToString());
                sb.AppendFormat("<td align='center'>{0}</td>", Convert.ToBoolean(dr["Checked"]) ? "<span class='red'>已审核</span>" : "审核中");
                sb.AppendFormat("<td align='center'>{0}</td>", Convert.ToDateTime(dr["CreatedTime"]).ToString("yyyy-MM-dd"));

                sb.Append("</tr>");
            }

            if (sb.Length == 0)
            {
                sb.Append("<tr><td colspan='6'>暂无评价!</td></tr>");
            }

            dataList = sb.ToString();
        }
Ejemplo n.º 2
0
        private void BindData()
        {
            DataTable myTable = routeCommentBLL.GetData(" id =" + routeCommentId);

            if (myTable.Rows.Count == 1)
            {
                userName    = myTable.Rows[0]["UserName"].ToString();
                nickname    = myTable.Rows[0]["Nickname"].ToString();
                anonymous   = Convert.ToBoolean(myTable.Rows[0]["Anonymous"]) ? "是" : "否";
                route       = GetRoute(Convert.ToInt32(myTable.Rows[0]["routeID"].ToString()));
                grade       = Convert.ToInt32(myTable.Rows[0]["Grade"]);
                email       = myTable.Rows[0]["Email"].ToString();
                content     = myTable.Rows[0]["Content"].ToString();
                checkeds    = Convert.ToBoolean(myTable.Rows[0]["Checked"]) ? "是" : "否";
                createdTime = Convert.ToDateTime(myTable.Rows[0]["CreatedTime"]);
            }
            else
            {
                Function.goMessagePage("显示路线评论", "操作失败,数据不存在!", "RouteComment/RouteCommentList.aspx");
            }
        }
Ejemplo n.º 3
0
        private void BindData(string sql)
        {
            DataTable myTable = routeCommentBLL.GetData(sql);

            myTable  = pg.pagination(myTable, 20, "");
            pageInfo = pg.pageNumList;

            StringBuilder sb = new StringBuilder();

            foreach (DataRow dr in myTable.Rows)
            {
                sb.AppendFormat("<tr id='tr_{0}'>", dr["ID"].ToString());
                ClassLibrary.Model.Routes rmodel = routeBLL.GetModel(Convert.ToInt32(dr["routeId"]));
                string tmpClassPy = rcList.Find(delegate(ClassLibrary.Model.RouteClass rcm) { return(rcm.ID == rmodel.LocationID); }).ClassNamePY;

                sb.AppendFormat("<td><a href='/{2}/{1}.html' target='_blank'>{0}</a></td>", Function.Clip(GetRoute(Convert.ToInt32(dr["routeID"])), 10, true), Convert.ToInt32(dr["routeID"]), tmpClassPy);
                sb.AppendFormat("<td>{0}</td>", Convert.ToInt16(dr["Grade"].ToString()));
                sb.AppendFormat("<td>{0}</td>", dr["UserName"].ToString());
                sb.AppendFormat("<td>{0}</td>", dr["Nickname"].ToString());
                sb.AppendFormat("<td>{0}</td>", dr["Email"].ToString());
                sb.AppendFormat("<td>{0}</td>", Convert.ToBoolean(dr["Checked"]) ? "<span class='green'>是</span>" : "<span class='red'>否</span>");
                sb.AppendFormat("<td>{0}</td>", dr["CreatedTime"].ToString());
                sb.Append("<td>");
                if (!Convert.ToBoolean(dr["Checked"]))
                {
                    sb.AppendFormat("<a href='RouteCommentList.aspx?ID={0}'>审核</a> ", dr["ID"].ToString());
                }
                else
                {
                    sb.Append("   ");
                }
                sb.AppendFormat("<a href='RouteCommentDetail.aspx?id={0}'>查看</a> ", dr["ID"].ToString());
                sb.AppendFormat("<a href='javascript:void(0)' onclick='routeCommentDelete({0})'>删除</a>", dr["ID"].ToString());
                sb.Append("</td>");

                sb.Append("</tr>");
            }
            dataRouteCommentList = sb.ToString();
        }
Ejemplo n.º 4
0
        //添加评论
        private void AddComment()
        {
            if (!isLogin)
            {
                Response.Write("<script>alert('仅登录会员可评论...');history.back(-1);</script>");
                return;
            }
            ClassLibrary.Model.RouteComment model = new ClassLibrary.Model.RouteComment();

            model.routeID  = Convert.ToInt32(Function.GetFormString("routeID"));
            model.Nickname = Function.GetFormString("Nickname");
            model.Email    = HttpUtility.HtmlEncode(Function.GetFormString("Email"));
            model.Grade    = Convert.ToByte(Function.GetFormString("xing"));
            model.Content  = HttpUtility.HtmlEncode(Function.GetFormString("Content"));
            string pingyin = Function.GetFormString("pingyin");

            model.UserName = userName;

            if (!string.IsNullOrEmpty(Function.GetFormString("Anonymous")))
            {
                model.Anonymous = Convert.ToBoolean(Function.GetFormString("Anonymous"));
            }
            model.Checked = false;

            if (Session["ValidateCode"] == null)
            {
                Response.Write("<script>alert('验证码输入错误,请重新输入。');history.back(-1);</script>");
                return;
            }
            else if (Request.Form["yanz"] != Session["ValidateCode"].ToString())
            {
                Response.Write("<script>alert('验证码输入错误,请重新输入。');history.back(-1);</script>");
                return;
            }

            DataTable myTable = cmtBLL.GetData("routeID=" + model.routeID);

            DateTime lastTime     = DateTime.Now;
            bool     existcomment = false;

            foreach (DataRow dr in myTable.Rows)
            {
                lastTime     = DateTime.Parse(dr["CreatedTime"].ToString());
                existcomment = true;
                break;
            }

            System.TimeSpan ts = DateTime.Now - lastTime;

            if (existcomment && ts.Days == 0 && ts.Hours == 0 && ts.Minutes <= 3)
            {
                Response.Write("<script>alert('请3分钟后重新输入!');history.back(-1);</script>");
                return;
            }

            if (cmtBLL.Add(model) > 0)
            {
                Response.Write("<script>alert('评论成功!');location.href='/" + pingyin + "/" + model.routeID + ".html';</script>");
            }
            else
            {
                Response.Write("<script>alert('评论失败,数据错误,请重试。。。');location.href='/" + pingyin + "/" + model.routeID + ".html';</script>");
            }
        }