示例#1
0
        public void Delete(int commentId)
        {
            try
            {
                Context.Response.ContentType = "application/json";
                Encoding encoding = new UTF8Encoding();
                Context.Response.ContentEncoding = encoding;

                if (!ProductPermission.CanDeleteComment)
                {
                    Context.Response.Write("{\"Result\":\"Access Denined\"}");
                    return;
                }

                ProductComment comment = new ProductComment(commentId);

                if (comment != null && comment.CommentId > -1)
                {
                    ProductComment.Delete(comment.CommentId);
                    LogActivity.Write("Delete comment", comment.FullName);
                }

                Context.Response.Write("{\"Result\":\"Success\"}");
            }
            catch (Exception ex)
            {
                log.Error(ex);
                Context.Response.Write("{\"Result\":\"Error\"}");
            }
        }
示例#2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (!canDelete)
                {
                    return;
                }

                if (comment != null && comment.CommentId > -1)
                {
                    ProductComment.Delete(comment.CommentId);
                    LogActivity.Write("Delete product comment", comment.FullName);

                    message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "DeleteSuccessMessage");
                }

                WebUtils.SetupRedirect(this, SiteRoot + "/Product/AdminCP/ReviewList.aspx");
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }
示例#3
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                if (!canDelete)
                {
                    return;
                }

                bool isDeleted = false;

                foreach (GridDataItem data in grid.SelectedItems)
                {
                    int            commentId = Convert.ToInt32(data.GetDataKeyValue("CommentId"));
                    ProductComment comment   = new ProductComment(commentId);

                    if (comment != null && comment.CommentId > -1)
                    {
                        ProductComment.Delete(comment.CommentId);
                        LogActivity.Write("Delete comment", comment.FullName);

                        isDeleted = true;
                    }
                }

                if (isDeleted)
                {
                    message.SuccessMessage = ResourceHelper.GetResourceString("Resource", "DeleteSuccessMessage");
                    BindGrid();
                }
            }
            catch (Exception ex)
            {
                log.Error(ex);
            }
        }