Esempio n. 1
0
        public JsonResult ReplyFloor(TopicFloorDetailModel model)
        {
            JsonModel jm = new JsonModel();

            try
            {
                int CurrentUserId = GetCurrentUser().Id;
                IPostBarTopicDiscussBLL replyTopicBLL = BLLFactory <IPostBarTopicDiscussBLL> .GetBLL("PostBarTopicDiscussBLL");

                var replyTopic = new T_PostBarTopicDiscuss()
                {
                    Content    = model.ReplyContent,
                    ReplyId    = model.ReplyId,
                    PostUserId = CurrentUserId,
                    PostTime   = DateTime.Now,
                    TopicId    = model.TopicId,
                    ParentId   = model.FloorId
                };

                replyTopicBLL.Save(replyTopic);
            }
            catch
            {
                jm.Msg = "回复楼层失败";
            }

            return(Json(jm, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        /// <summary>
        /// 楼层详细列表
        /// </summary>
        /// <param name="floorId">一级回复的主键Id</param>
        /// <param name="replyId">准备要回复对方的Id</param>
        /// <returns></returns>
        public ActionResult FloorDetailList(int floorId, int replyId)
        {
            int CurrentUserId = GetCurrentUser().Id;

            WeixinApiInit();

            //获取当前楼层(也就是一级回复的)信息
            IPostBarTopicDiscussBLL topicDiscussBLL = BLLFactory <IPostBarTopicDiscussBLL> .GetBLL("PostBarTopicDiscussBLL");

            var topicDiscuss = topicDiscussBLL.GetEntity(m => m.Id == floorId);
            //主题下面所有的一级Ids
            var level1Ids = topicDiscussBLL.GetList(m => m.TopicId == topicDiscuss.TopicId && m.ParentId == null).OrderBy(m => m.PostTime).Select(m => m.Id).ToList();
            //当前是第几楼
            int FloorNo = level1Ids.FindIndex(m => m == floorId) + 1;

            ViewBag.FloorNo = string.Format("{0}楼", FloorNo);

            IUserBLL userBll = BLLFactory <IUserBLL> .GetBLL("UserBLL");

            var replidUserName = "";

            var replyUser = userBll.GetEntity(m => m.Id == replyId);

            replidUserName = string.Format("回复{0}:", replyUser.UserName);

            var model = new TopicFloorDetailModel()
            {
                FloorId            = topicDiscuss.Id,
                FloorNo            = string.Format("第{0}楼", FloorNo),
                PostUserId         = topicDiscuss.PostUserId,
                PostUserName       = topicDiscuss.PostUser.UserName,
                PostUserHeadPath   = topicDiscuss.PostUser.HeadPath,
                ImgPath            = topicDiscuss.ImgPath,
                ImgThumbnail       = topicDiscuss.ImgThumbnail,
                PostDate           = string.Format("第{0}楼 {1}", FloorNo, TimeFormat(topicDiscuss.PostTime)),
                Content            = topicDiscuss.Content,
                PropertyPlaceId    = topicDiscuss.PostBarTopic.PropertyPlaceId,
                TopicId            = topicDiscuss.PostBarTopic.Id,
                LevelTwoReplyCount = topicDiscussBLL.Count(m => m.ParentId == topicDiscuss.Id && m.TopicId == topicDiscuss.TopicId),
                ReplyId            = replyId,
                ReplidUserName     = replidUserName,
                CurrentUserId      = CurrentUserId,
                CanDelete          = topicDiscuss.PostUserId == CurrentUserId
            };

            return(View(model));
        }