public ActionResult Create([Bind(Include = "CommentID,UserID,ProductID,CommentContent,CreateDate,CreateUser,ModifiedDate,ModifiedUser,IsActive")] Comment comment)
        {
            var UserSession = (UserLogin)Session[TechDeviShopVs002.Common.CommonConstants.USER_SESSION];

            if (ModelState.IsValid)
            {
                var _dal = new CommentDAL();

                comment.CreateUser = UserSession.UserID;

                int id = _dal.Insert(comment);
                if (id > 0)
                {
                    return(RedirectToAction("Index", "Comments"));
                }
                else
                {
                    ModelState.AddModelError("", "Thêm bình luận ko thành công");
                }
            }

            ViewBag.ProductID = new SelectList(db.Products, "ProductID", "ProductName", comment.ProductID);
            ViewBag.ArticleID = new SelectList(db.Articles, "ArticleID", "Title", comment.ArticleID);
            return(View(comment));
        }
예제 #2
0
        public ActionResult ProductComment(int ProductID)
        {
            string productComment = String.Format("{0}", Request.Form["CommentContent"]);
            string CommentName    = String.Format("{0}", Request.Form["Name"]);
            string CommentEmail   = String.Format("{0}", Request.Form["Email"]);
            var    pComment       = new Comment();

            if (ModelState.IsValid)
            {
                pComment.ProductID      = ProductID;
                pComment.Email          = CommentEmail;
                pComment.Name           = CommentName;
                pComment.CommentContent = productComment;
                pComment.IsActive       = true;
                var result = new CommentDAL().Insert(pComment);
                if (result > 0)
                {
                    return(RedirectToAction("Detail", "Product", new { id = ProductID }));
                }
                else
                {
                    ModelState.AddModelError("", "Thêm bình luận ko thành công");
                }
            }
            return(View(pComment));
        }
예제 #3
0
        public ActionResult ArticleComment(string CommentContent, string Name, string Email, int ArticleID)
        {
            //string productComment = String.Format("{0}", Request.Form["CommentContent"]);
            //string CommentName = String.Format("{0}", Request.Form["Name"]);
            //string CommentEmail = String.Format("{0}", Request.Form["Email"]);
            var pComment = new Comment();

            if (ModelState.IsValid)
            {
                pComment.ArticleID      = ArticleID;
                pComment.Email          = Email;
                pComment.Name           = Name;
                pComment.CommentContent = CommentContent;
                pComment.IsActive       = true;
                var result = new CommentDAL().Insert(pComment);
                if (result > 0)
                {
                    return(RedirectToAction("Details", "Article", new { id = ArticleID }));
                }
                else
                {
                    ModelState.AddModelError("", "Thêm bình luận ko thành công");
                }
            }
            return(View(pComment));
        }
        public CommentBLL FindCommentByCommentID(int CommentID)
        {
            CommentBLL ProposedReturnValue = null;
            CommentDAL DataLayerObject     = _context.FindCommentByCommentID(CommentID);

            if (null != DataLayerObject)
            {
                ProposedReturnValue = new CommentBLL(DataLayerObject);
            }
            return(ProposedReturnValue);
        }
        public CommentBLL FindCommentByLiked(bool Liked)
        {
            CommentBLL ProposedReturnValue = null;
            CommentDAL DataLayerObject     = _context.FindCommentByLiked(Liked);

            if (null != DataLayerObject)
            {
                ProposedReturnValue = new CommentBLL(DataLayerObject);
            }
            return(ProposedReturnValue);
        }
        // GET: Admin/Comments/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var comment = new CommentDAL().ViewDetail(id);

            if (comment == null)
            {
                return(HttpNotFound());
            }
            return(View(comment));
        }
예제 #7
0
        public JsonResult DeleteComment(Guid id)
        {
            ProductComment pComment = CommentDAL.Get(x => x.ProductCommentID == id);

            //foreach (var item in pComment.Product.ProductComments)
            //{

            //}

            //ProductDAL.Save();
            CommentDAL.Delete(pComment);

            return(Json(true));
        }
예제 #8
0
        public Comment GetCommentById(int Id)
        {
            try
            {
                CommentDAL repository = new CommentDAL();
                Comment    comment    = new Comment();

                return(comment = repository.GetCommentById(Id));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #9
0
        public bool PutComment(Comment comment)
        {
            try
            {
                CommentDAL repository = new CommentDAL();
                bool       operation  = repository.PutComment(comment);

                return(operation);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #10
0
        public JsonResult AddCommentJson(string comment, Guid id)
        {
            ProductComment _comment = new ProductComment();

            _comment.ProductCommentID = Guid.NewGuid();
            _comment.IsActive         = true;
            _comment.Content          = comment;
            _comment.CreatedDate      = DateTime.Now;
            _comment.UserID           = ((User)Session["user"]).UserID;
            _comment.ProductID        = id;

            CommentDAL.Add(_comment);
            return(Json(CommentDAL.GetList(x => x.ProductCommentID == _comment.ProductCommentID).Select(x => new { x.ProductCommentID, x.Content, x.User.FullName, x.CreatedDate }).FirstOrDefault()));
        }
예제 #11
0
        public List <Comment> GetCollectionComment()
        {
            try
            {
                CommentDAL     repository = new CommentDAL();
                List <Comment> comments   = new List <Comment>();

                return(comments = repository.GetCollectionComment());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        // GET: Admin/Comments/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var comment = new CommentDAL().ViewDetail(id);

            if (comment == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ProductID = new SelectList(db.Products, "ProductID", "ProductName", comment.ProductID);
            ViewBag.ArticleID = new SelectList(db.Articles, "ArticleID", "Title", comment.ArticleID);
            return(View(comment));
        }
예제 #13
0
        /// <summary>
        /// 获取文档评论及评论会员信息的JSON格式数据
        /// </summary>
        /// <param name="archive"></param>
        /// <returns></returns>
        public string GetCommentDetailsJSON(string archiveID)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("[");
            DataTable dt = new CommentDAL().GetCommentsDetailsTable(archiveID);
            int       i  = dt.Rows.Count;

            foreach (DataRow dr in dt.Rows)
            {
                sb.Append("{member:{id:").Append(dr["uid"]).Append(",avatar:'")
                .Append(String.IsNullOrEmpty(dr["avatar"].ToString()) ? "/images/noavatar.gif" : dr["avatar"].ToString())
                .Append("',nick:'").Append(dr["nickname"].ToString())
                .Append("'},comment:{id:").Append(dr["cid"].ToString()).Append(",txt:'").Append(dr["content"].ToString())
                .Append("',time:'").Append(dr["createdate"].ToString()).Append("'}}");
                if (dr != dt.Rows[i - 1])
                {
                    sb.Append(",");
                }
            }
            sb.Append("]");
            return(sb.ToString());
        }
        public int Comment(McComm mc)
        {
            CommentDAL cd = new CommentDAL();

            return(cd.Comment(mc));
        }
예제 #15
0
 public CommentBLL()
 {
     _commentDAL = new CommentDAL();
 }
예제 #16
0
 public List <Comment> GetAllComments()
 {
     return(CommentDAL.GetAllComments());
 }
예제 #17
0
 public int AddComment(Comment comment)
 {
     CommentDAL.AddComment(comment);
     return(CommentDAL.GetLastRowIndex());
 }
예제 #18
0
 public void DeleteComment(int id)
 {
     CommentDAL.DeleteComment(id);
 }
예제 #19
0
 public CommentBAL()
 {
     commentDal = new CommentDAL();
 }
예제 #20
0
        public CommentDTO GetComment(int id)
        {
            CommentDAL cmtDAL = new CommentDAL();

            return(cmtDAL.GetComment(id));
        }
예제 #21
0
 public CompensateBLL()
 {
     cDAL  = new CompensateDAL();
     cmDAL = new CommentDAL();
 }
예제 #22
0
        public bool UpdateComment(CommentDTO comment)
        {
            CommentDAL cmtDAL = new CommentDAL();

            return(cmtDAL.UpdateComment(comment));
        }
예제 #23
0
        public bool InsertComment(CommentDTO comment)
        {
            CommentDAL cmtDAL = new CommentDAL();

            return(cmtDAL.InsertComment(comment));
        }
예제 #24
0
 public Comment GetCommentById(int id)
 {
     return(CommentDAL.GetCommentById(id));
 }
        public int CommentReply(McComm mc, int cmID)
        {
            CommentDAL cd = new CommentDAL();

            return(cd.CommentReply(mc, cmID));
        }
예제 #26
0
 public void UpdateComment(Comment comment)
 {
     CommentDAL.UpdateComment(comment);
 }
        public DataSet GetAllCommentList()
        {
            CommentDAL cd = new CommentDAL();

            return(cd.GetAllCommentList());
        }
예제 #28
0
        public List <Comment> GetCommentByTaskId(int id)
        {
            List <Comment> comments = CommentDAL.GetAllComments();

            return(comments.FindAll(c => c.Task == id));
        }
        public DataSet GetCommentListByMcID(int mcID)
        {
            CommentDAL cd = new CommentDAL();

            return(cd.GetCommentListByMcID(mcID));
        }
예제 #30
0
 /// <summary>
 /// 获取文档评论及评论会员信息的JSON格式数据
 /// </summary>
 /// <param name="archive"></param>
 /// <returns></returns>
 public string GetCommentDetailsJSON(string archiveID)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append("[");
     DataTable dt = new CommentDAL().GetCommentsDetailsTable(archiveID);
     int i=dt.Rows.Count;
     foreach (DataRow dr in dt.Rows)
     {
         sb.Append("{member:{id:").Append(dr["uid"]).Append(",avatar:'")
             .Append(String.IsNullOrEmpty(dr["avatar"].ToString()) ? "/images/noavatar.gif" : dr["avatar"].ToString())
             .Append("',nick:'").Append(dr["nickname"].ToString())
             .Append("'},comment:{id:").Append(dr["cid"].ToString()).Append(",txt:'").Append(dr["content"].ToString())
             .Append("',time:'").Append(dr["createdate"].ToString()).Append("'}}");
         if (dr != dt.Rows[i - 1]) sb.Append(",");
     }
     sb.Append("]");
     return sb.ToString();
 }
        public DataSet GetPageCommentListByPdID(int pdID, int pageIndex, int pageSize, out int count)
        {
            CommentDAL cd = new CommentDAL();

            return(cd.GetPageCommentListByPdID(pdID, pageIndex, pageSize, out count));
        }