Ejemplo n.º 1
0
        public ActionResult UserMsgPage(string type, int pageSize, int pageNum = 1)
        {
            int totalCount = 0;

            switch (type)
            {
            case "Breply":
                ViewBag.Breplys = BlogCommentReplyDataSvc.GetPagedEntitys(ref pageNum, pageSize,
                                                                          b => (b.OwnerID != CurrentUser.ID && b.ToUserID == CurrentUser.ID) || (b.OwnerID == CurrentUser.ID && b.ToUserID != CurrentUser.ID),
                                                                          b => b.InsertDate, true, out totalCount).ToList();
                break;

            case "Bcomment":
                ViewBag.Bcomments = BlogCommentDataSvc.GetPagedEntitys(ref pageNum, pageSize, b => b.OwnerID == CurrentUser.ID, b => b.InsertDate, true, out totalCount).ToList();
                break;

            case "Nreply":
                ViewBag.Nreplys = NewBeeFloorReplyDataSvc.GetPagedEntitys(ref pageNum, pageSize,
                                                                          n => (n.OwnerID != CurrentUser.ID && n.ToUserID == CurrentUser.ID) || (n.OwnerID == CurrentUser.ID && n.ToUserID != CurrentUser.ID),
                                                                          n => n.InsertDate, true, out totalCount).ToList();
                break;

            case "Ncomment":
                ViewBag.Ncomments = NewBeeFloorDataSvc.GetPagedEntitys(ref pageNum, pageSize, n => n.OwnerID == CurrentUser.ID, n => n.InsertDate, true, out totalCount).ToList();
                break;
            }
            ViewBag.TotalCount  = totalCount;
            ViewBag.CurrentPage = pageNum;
            ViewBag.Type        = type;
            ViewBag.CUserID     = CurrentUser.ID;
            return(View());
        }
Ejemplo n.º 2
0
        public ActionResult BlogCommentReplyDelete(Guid id)
        {
            BlogCommentReply reply = BlogCommentReplyDataSvc.GetByID(id);

            if (reply.OwnerID != CurrentUser.ID)
            {
                return(Json(new { msg = "错误" }));
            }
            reply.Delete = true;
            BlogCommentReplyDataSvc.Update(reply);
            return(Json(new { msg = "done" }));
        }
Ejemplo n.º 3
0
        public ActionResult AddBlogCommentReply(Guid commentID, Guid toUserID, string txt)
        {
            DisabledUser user = MyRedisDB.GetSet <DisabledUser>(MyRedisKeys.DisabledUsers).Where(d => d.UserID == CurrentUser.ID && d.ObjectType == (int)EnumObjectType.姿势 && d.AbleDate > DateTime.Now).FirstOrDefault();

            if (user != null)
            {
                return(Json(new { msg = "你被封禁至" + user.AbleDate.ToString("yyyy-MM-dd HH:ss") }));
            }
            if (string.IsNullOrEmpty(txt))
            {
                return(Json(new { msg = "参数错误" }));
            }
            if (txt.GetByteCount() > 400)
            {
                return(Json(new { msg = "参数太长" }));
            }

            BlogComment comment = BlogCommentDataSvc.GetByID(commentID);

            comment.ReplyCount += 1;

            BlogCommentReply reply = new BlogCommentReply();

            reply.BlogCommentID = commentID;
            reply.Content       = HttpUtility.HtmlEncode(txt);
            reply.ToUserID      = toUserID;
            reply.OwnerID       = CurrentUser.ID;
            reply.Order         = comment.ReplyCount;
            BlogCommentReplyDataSvc.Add(reply);

            BlogCommentDataSvc.Update(comment);

            if (toUserID != CurrentUser.ID)
            {
                string key    = MyRedisKeys.Pre_RMsg + toUserID;
                RMsg   bcrmsg = new RMsg();
                bcrmsg.ObjType = (int)EnumObjectType.姿势;
                bcrmsg.ObjID   = comment.BlogID;
                bcrmsg.Date    = DateTime.Now;
                bcrmsg.From    = CurrentUser.UserName;
                bcrmsg.COrder  = comment.Order;
                bcrmsg.ROrder  = reply.Order;
                bcrmsg.Title   = txt.MaxByteLength(32);
                MyRedisDB.SetAdd(key, bcrmsg);
            }

            return(Json(new { msg = "done" }));
        }
Ejemplo n.º 4
0
        public ActionResult BlogCommentReplyPage(Guid commentID, int corder, int pageSize, int pageNum = 1)
        {
            int totalCount;

            ViewBag.Login = CurrentUser != null;
            ViewBag.BlogCommentReplyList = BlogCommentReplyDataSvc.GetPagedEntitys(ref pageNum, pageSize, it => it.BlogCommentID == commentID, it => it.InsertDate, false, out totalCount).ToList();
            ViewBag.TotalCount           = totalCount;
            ViewBag.CurrentPage          = pageNum;
            ViewBag.COrder = corder;

            if (ViewBag.Login)
            {
                DisabledUser user = MyRedisDB.GetSet <DisabledUser>(MyRedisKeys.DisabledUsers).Where(d => d.UserID == CurrentUser.ID && d.ObjectType == (int)EnumObjectType.姿势 && d.AbleDate > DateTime.Now).FirstOrDefault();
                if (user != null)
                {
                    ViewBag.DisableMsg = "你被封禁至" + user.AbleDate.ToString("yyyy-MM-dd HH:ss");
                }
                ViewBag.CUID = CurrentUser.ID;
            }

            return(View());
        }