コード例 #1
0
        private Complaint rowToComplaint(CommentID commentID, ComplaintRow row)
        {
            if (row == null)
            {
                return(default(Complaint));
            }

            return(new Complaint(new CommentID(commentID.G_Volume, row.G_Comment),
                                 row.GDID,
                                 GetNode(row.G_AuthorNode),
                                 row.Kind,
                                 row.Message,
                                 row.Create_Date,
                                 row.In_Use));
        }
コード例 #2
0
        public GraphChangeStatus Complain(CommentID commentId, GDID gAuthorNode, string kind, string message)
        {
            if (commentId.IsZero)
            {
                return(GraphChangeStatus.NotFound);
            }

            try
            {
                var comment = getCommentRow(commentId);
                if (comment == null)
                {
                    return(GraphChangeStatus.NotFound);
                }

                var ctx          = ForComment(commentId.G_Volume);
                var complaintRow = new ComplaintRow(true)
                {
                    G_Comment    = commentId.G_Comment,
                    G_AuthorNode = gAuthorNode,
                    Kind         = kind,
                    Message      = message,
                    Create_Date  = App.TimeSource.UTCNow,
                    In_Use       = true
                };
                ctx.Insert(complaintRow);

                comment.ComplaintCount++;
                ctx.Update(comment, filter: "ComplaintCount".OnlyTheseFields());

                return(GraphChangeStatus.Updated);
            }
            catch (Exception ex)
            {
                Log(MessageType.Error, "Complain", ex.ToMessageWithType(), ex);
                throw new GraphException(StringConsts.GS_COMPLAINT_ERROR.Args(commentId.G_Comment), ex);
            }
        }