Exemplo n.º 1
0
        public JsonResult DeleteComments(ViewModels.CommentType ReplyType, string ID)
        {
            CommentPostHandlerResult result = new CommentPostHandlerResult();
            long?  memberID = (long?)null;
            Member curUser  = Member.Current;

            if (curUser == null)
            {
                result.Result  = HandlerResult.MustLogin;
                result.Message = "請先登入會員或會員登入時效已過期!";
                return(Json(result));
            }
            memberID = curUser.ID;
            bool IsDelete = Models.DataAccess.PageCommentsDAO.DeleteItem(long.Parse(ID));

            if (IsDelete)
            {
                result.Result  = HandlerResult.Success;
                result.Message = "刪除成功";
            }
            else
            {
                result.Result  = HandlerResult.Fail;
                result.Message = "刪除失敗";
            }
            return(Json(result));
        }
Exemplo n.º 2
0
        public JsonResult PostEditComments(ViewModels.CommentType ReplyType, string ID, string SiteID, string PosterName, string CommentContent)
        {
            CommentPostHandlerResult result = new CommentPostHandlerResult();
            long?  memberID = (long?)null;
            Member curUser  = Member.Current;

            if (ReplyType == ViewModels.CommentType.MemberOnly)
            {
                if (curUser == null)
                {
                    result.Result  = HandlerResult.MustLogin;
                    result.Message = "請先登入會員或會員登入時效已過期!";
                    return(Json(result));
                }
                memberID = curUser.ID;
            }
            if (curUser != null)
            {
                memberID = curUser.ID;
            }
            Models.PageCommentsModels comment = Models.DataAccess.PageCommentsDAO.GetSingleItem(long.Parse(SiteID), ID);
            comment.PosterName     = PosterName;
            comment.CommentContent = CommentContent;
            Models.DataAccess.PageCommentsDAO.SetItem(comment);
            result.Result  = HandlerResult.Success;
            result.Message = "儲存成功";
            return(Json(result));
        }
Exemplo n.º 3
0
        public JsonResult PostReplyComments(ViewModels.CommentType ReplyType, string PageSN, string Url, long ParentID, string PosterName, string CommentContent)
        {
            CommentPostHandlerResult result = new CommentPostHandlerResult();
            long?  memberID = (long?)null;
            Member curUser  = Member.Current;

            if (ReplyType == ViewModels.CommentType.MemberOnly)
            {
                if (curUser == null)
                {
                    result.Result  = HandlerResult.MustLogin;
                    result.Message = "請先登入會員或會員登入時效已過期!";
                    return(Json(result));
                }
                memberID = curUser.ID;
            }
            if (curUser != null)
            {
                memberID = curUser.ID;
            }
            if (ReplyType == ViewModels.CommentType.FB ||
                ReplyType == ViewModels.CommentType.Closed)
            {
                result.Result  = HandlerResult.NotSupport;
                result.Message = "系統不提供回文功能!";
                return(Json(result));
            }
            if (Models.DataAccess.PageCommentsDAO.IsPostCommentOverTime(PageSN, memberID))
            {
                result.Result  = HandlerResult.NoRepeat;
                result.Message = "您已「回文」過!";
                return(Json(result));
            }
            Models.PageCommentsModels comment = new Models.PageCommentsModels();
            comment.ID             = WorkLib.GetItem.NewSN();
            comment.PageSN         = PageSN;
            comment.ParentID       = ParentID;
            comment.PostDate       = DateTime.Now;
            comment.PosterName     = PosterName;
            comment.MemberShipID   = memberID;
            comment.ShowStatus     = true;
            comment.Title          = "Re:";
            comment.IP             = WorkLib.GetItem.IPAddr();
            comment.IPNum          = ((long)WorkLib.GetItem.GetIPNum()).ToString();
            comment.CommentContent = CommentContent;
            Models.DataAccess.PageCommentsDAO.SetItem(comment);
            result.Result  = HandlerResult.Success;
            result.Message = "回覆成功";
            return(Json(result));
        }