Пример #1
0
        public static int DeleteContentReply(ContentReply contentreply)
        {
            string sql = "delete BBS_Reply where ClassID=@ClassID";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@ReplyID", contentreply.Replyid)
            };

            return(DBHelper.ExecuteCommand(sql, para));
        }
Пример #2
0
        public static int addReply(ContentReply contentreply)  //增加回复
        {
            string sql = "insert into BBS_Reply(TopicID,ReContentery,UserID,CreatedOn,ReplyCount) " + " values(@TopicID,@ReContentery,@UserID,@CreatedOn,@ReplyCount)";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@TopicID", contentreply.Content.Topicid),
                new SqlParameter("@ReContentery", contentreply.Recontentery),
                new SqlParameter("@UserID", contentreply.User.Userid),
                new SqlParameter("@CreatedOn", contentreply.Createon),
                new SqlParameter("@ReplyCount", contentreply.Content.Replycount),
            };
            return(DBHelper.ExecuteCommand(sql, para));
        }
Пример #3
0
        public static int ModifyContentReply(ContentReply contentreply)           //修改内容
        {
            string sql = "update BBS_Reply set ReContentery=@ReContentery,CreatedOn=@CreatedOn where ReplyID=@ReplyID";

            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@ReplyID", contentreply.Replyid),
                new SqlParameter("@ReContentery", contentreply.Recontentery),
                //new SqlParameter("@UserID",contentreply.User.Userid),
                //new SqlParameter("@TopicID",contentreply.Content.Topicid),
                new SqlParameter("@CreatedOn", contentreply.Createon)
            };
            return(DBHelper.ExecuteCommand(sql, para));
        }
Пример #4
0
        private static IList <ContentReply> GetContentReplyBySql(string safeSql)
        {
            List <ContentReply> list  = new List <ContentReply>();
            DataTable           table = DBHelper.GetDataSet(safeSql);

            foreach (DataRow row in table.Rows)
            {
                ContentReply contentreply = new ContentReply();
                contentreply.Replyid      = (int)row["ReplyID"];
                contentreply.Recontentery = (string)row["ReContentery"];
                contentreply.Createon     = (DateTime)row["CreatedOn"];
                contentreply.Userid       = (int)row["UserID"];
                contentreply.Topicid      = (int)row["TopicID"];
                //contentreply.User.Headurl = (string)row["HeadUrl"];
                contentreply.Content = CCService.GetContentByTId((int)row["TopicID"]); //外键的处理
                contentreply.User    = UserService.GetUserById1((int)row["UserID"]);   //外键的处理
                list.Add(contentreply);
            }
            return(list);
        }
Пример #5
0
        protected void btnOK_Click(object sender, EventArgs e)
        {
            if (Session["UserID"] != null)
            {
                if (FreeTextBox1.Text.Trim().Length == 0)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('内容不能为空!')</script>");
                    return;
                }


                LBBS.Model.Content content = ContentManager.GetContentByID1(Convert.ToInt32(Request.QueryString["topicid"]));

                ContentReply contentreply = new ContentReply();
                User         user         = (User)Session["User"];
                user.Userid = Convert.ToInt32(Session["UserID"]);
                //int userid= int.Parse(Session["UserID"].ToString());
                contentreply.Recontentery = FreeTextBox1.Text;
                contentreply.Createon     = Convert.ToDateTime(DateTime.Now.ToString(""));
                contentreply.User         = user;//关联表数据设定
                contentreply.Content      = content;
                if (ReManager.addReply(contentreply) > 0)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('回复成功!')</script>");
                    Response.Redirect("TopicContent.aspx?topicid=" + topicid + "");
                    return;
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('回复失败!');</script>");
                    return;
                }
            }
            else
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('你还未登录,请先登录!')</script>");
                return;
            }
        }
Пример #6
0
        /// <summary>
        /// 新增评论
        /// </summary>
        /// <param name="contentId"></param>
        /// <param name="replyInfo"></param>
        /// <param name="fileIds">评论上传附件集合</param>
        /// <param name="replyId"></param>
        /// <returns></returns>
        public object CerateReply(int contentId, string replyInfo, string fileIds, int?replyId)
        {
            ContentReply reply = new ContentReply();

            reply.Info         = replyInfo;
            reply.ContentId    = contentId;
            reply.CreationTime = DateTime.Now;
            if (replyId != null)
            {
                reply.ParentId = (long)replyId;
            }
            else
            {
                reply.ParentId = null;
            }
            if (AbpSession.UserId != null)
            {
                reply.DeleteUid = (long)AbpSession.UserId;//因有约束条件FK_EM_CONTENT_REPLY_DELETE_UID 则删除人默认等于创建人
                reply.ReolyUId  = (long)AbpSession.UserId;
                //reply.ReplyUser = _userRepository.Get(reply.ReolyUId);
            }
            var rId = _contentReplyRepository.InsertAndGetId(reply);
            //保存评论附件上传文件
            //上传附件ID集合
            var fileIdList = fileIds.Split(',');
            int fileNumber = 0;

            if (fileIdList.Count() > 0)
            {
                //保存上传附件和评论ID
                foreach (var item in fileIdList)
                {
                    if (item != "" && item != "删除")
                    {
                        var fileId = item.ToInt32();
                        if (fileId != 0)
                        {
                            ContentReplyFile rfiles = new ContentReplyFile
                            {
                                ContentReplyId = rId,
                                FileId         = fileId
                            };
                            _contentReplyFileRepository.Insert(rfiles);
                            fileNumber++;
                        }
                    }
                }
            }
            var        result = _contentReplyRepository.Get(rId);
            ReplyModel rm     = new ReplyModel
            {
                Info          = result.Info,
                ContentId     = result.ContentId,
                Id            = result.Id,
                CreationTime  = result.CreationTime,
                ReplyUserName = _userRepository.Get(result.ReolyUId).Name,
                //返回上传附件数量,刚刚上传,查询不出来
                //IsFileNumber=_contentReplyFileRepository.GetAll().Count(x=>x.ContentReplyId== result.Id)
                IsFileNumber = fileNumber
            };

            if (result.ParentId != null)
            {
                rm.ParentName = _contentReplyRepository.FirstOrDefault((long)result.ParentId).ReplyUser.Name;
            }
            var content    = _contentRepository.Get(contentId);
            var defineType = _contentTypeRepository.Get(content.DefineTypeId);
            var defineId   = Convert.ToInt32(defineType.DefineId);
            //获取内容权限
            var defineConfig = _defineConfigRepository.GetAll().SingleOrDefault(a => a.DefineId == defineId);

            if (defineConfig != null)
            {
                rm.IsReolyFloor = Convert.ToBoolean(defineConfig.IsReolyFloor);
            }
            if (defineConfig != null)
            {
                rm.IsLike = Convert.ToBoolean(defineConfig.IsLike);
            }
            if (defineConfig != null)
            {
                rm.IsReolyFile = Convert.ToBoolean(defineConfig.IsReolyFile);
            }
            if (defineConfig != null)
            {
                rm.IsReolyFloorFile = Convert.ToBoolean(defineConfig.IsReolyFloorFile);
            }
            return(rm);
        }
Пример #7
0
 //public static int ModifyContent(string recontentery, DateTime createdon, int topicid, int userid, int replyid)
 //{
 //    LBBS.Model.ContentReply contentreply = ReSevice.GetContentReplyByID(replyid);
 //    contentreply.User = UserManager.GetUserById1(userid);
 //    contentreply.Content = ContentService.GetContentById(topicid);
 //    contentreply.Createon = createdon;
 //    contentreply.Recontentery = recontentery;
 //    return ReSevice.ModifyContentReply(contentreply);
 //}
 public static int ModifyContentReply(ContentReply contentreply)
 {
     return(ReSevice.ModifyContentReply(contentreply));
 }
Пример #8
0
 public static int DeleteContentReply(ContentReply contentreply)
 {
     return(ReSevice.DeleteContentReply(contentreply));
 }
Пример #9
0
 public static int addReply(ContentReply contentreply)
 {
     return(ReSevice.addReply(contentreply));
 }