コード例 #1
0
        /// <summary>
        /// 回复评价信息
        /// </summary>
        private void ReplyComment()
        {
            UserInfo user = Session["user"] as UserInfo;

            if (user == null)
            {
                Response.Write("login");
            }
            else
            {
                int    id           = CRequest.GetInt("id", 0);
                string replyContent = CRequest.GetString("replyContent");
                Reply  item         = new Reply();
                item.commentId = id;
                Comment comItem = CommentService.GetModel(id);
                if (comItem.addUser == user.id)
                {
                    Response.Write("self");
                    return;
                }
                item.replyContent = replyContent;
                item.status       = 0;
                item.remark       = "";
                item.addTime      = DateTime.Now;
                item.addUser      = user.id;
                item.infoType     = 0;

                int           num = ReplyService.Add(item);
                StringBuilder sb  = new StringBuilder();
                if (num > 0)
                {
                    DataSet ds = ReplyService.GetList("commentId = " + id);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow dr in ds.Tables[0].Rows)
                        {
                            UserInfo replyUser = UserInfoService.GetModel(Convert.ToInt32(dr["addUser"]));
                            if (replyUser != null)
                            {
                                sb.Append(replyUser.username + ":" + dr["replyContent"].ToString() + "<br/>");
                            }
                        }
                    }
                }
                Response.Write(sb.ToString());
            }
        }