Exemple #1
0
        private void ShowInfo(int _id)
        {
            BLL.Forum_Post   bll   = new BLL.Forum_Post(subTableId);
            Model.Forum_Post model = bll.GetModel(_id);
            //编写赋值操作Begin

            txtMessage.Text      = model.Message;
            rblBan.SelectedValue = model.Ban.ToString();

            //编写赋值操作End
        }
Exemple #2
0
        private bool DoEdit(int _id)
        {
            bool result = false;

            BLL.Forum_Post   bll   = new BLL.Forum_Post(subTableId);
            Model.Forum_Post model = bll.GetModel(_id);

            //编写编辑操作Begin

            model.Message = txtMessage.Text;
            model.Ban     = Convert.ToInt32(rblBan.SelectedValue);

            //编写编辑操作End

            if (bll.Update(model))
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理员:" + model.Title); //记录日志
                result = true;
            }

            return(result);
        }
Exemple #3
0
        private void reply(HttpContext context)
        {
            string _v = verify_code(context, vc);

            if (_v != "success")
            {
                JsonHelper.WriteJson(context, new
                {
                    error       = 1,
                    description = _v
                });
            }


            if (string.IsNullOrEmpty(message))
            {
                JsonHelper.WriteJson(context, new
                {
                    error       = 1,
                    description = "内容不写你打算做什么呢!"
                });
            }

            if (!BLL.Forum_BoardPermission.CheckPermission(board_id + "|" + modelUser.GroupId, "PostReply"))
            {
                JsonHelper.WriteJson(context, new
                {
                    error       = 1,
                    description = "您当前还没有权限哦!"
                });
            }

            message = FilterWord(message);

            Model.Forum_Topic modelTopic = new BLL.Forum_Topic().GetModel(topic_id);

            int _post_id = new BLL.Forum_PostId().Add(new Model.Forum_PostId {
                TopicId = topic_id
            });

            int attachment_count = 0;

            foreach (string item in context.Request.Form.AllKeys)
            {
                if (item.ToLower().IndexOf("attachment_description_") != -1)
                {
                    attachment_count += 1;

                    string strDescription = context.Request.Form[item].ToString().Replace("'", "");

                    string _id = item.ToLower().Replace("attachment_description_", "").Replace("'", "");

                    new BLL.Forum_Attachment().UpdateField("Id=" + _id, " [TopicId]=" + modelTopic.Id + ",[PostId]=" + _post_id + " , Description='" + strDescription + "' ");
                }
            }

            //int attachment_count = new BLL.Forum_Attachment().UpdateField(" [BoardId]=" + board_id + " and [UserId]=" + modelUser.UserId + " and  [PostId]=0 ", " [TopicId]=" + modelTopic.Id + ",[PostId]=" + _post_id + " ");

            Model.Forum_Post modelPost = new Model.Forum_Post();

            modelPost.BoardId   = modelTopic.BoardId;
            modelPost.Title     = modelTopic.Title;
            modelPost.Signature = signature;
            modelPost.Url       = autoUrl;
            modelPost.Message   = message;
            modelPost.TopicId   = topic_id;

            modelPost.PostUserId   = modelUser.UserId;
            modelPost.PostUsername = modelUser.UserName;
            modelPost.PostNickname = modelUser.Nickname;
            modelPost.PostDateTime = System.DateTime.Now;
            modelPost.Id           = _post_id;
            modelPost.Attachment   = attachment_count;

            BLL.Forum_Post bll = new BLL.Forum_Post(modelTopic.PostSubTable);

            //引用
            if (post_id != 0)
            {
                Model.Forum_Post modelQuotePost = bll.GetModel(post_id);

                if (modelQuotePost != null)
                {
                    if (string.IsNullOrEmpty(modelQuotePost.QuotePostIds))
                    {
                        modelPost.QuotePostIds = modelQuotePost.Id.ToString();
                    }
                    else
                    {
                        //拼接
                        modelPost.QuotePostIds = modelQuotePost.QuotePostIds + "," + modelQuotePost.Id.ToString();
                    }

                    modelPost.QuoteUserId   = modelQuotePost.PostUserId;
                    modelPost.QuoteNickname = modelQuotePost.PostNickname;
                    modelPost.QuoteMessage  = modelQuotePost.Message;
                }
            }

            bll.Add(modelTopic, modelPost);

            HttpContext.Current.Session["SESSION_USER_EXTENDED"] = new BLL.Forum_UserExtended().SetGroupId(modelUser);

            JsonHelper.WriteJson(context, new
            {
                tid  = modelTopic.Id,
                turl = new DTcms.Web.UI.BasePage().linkurl("forum_topic", modelTopic.Id, -_post_id) + "#reply_" + _post_id
            });
        }