Ejemplo n.º 1
0
        private byte[] GenerateReviewerCommentsExcel(byte[] template, int currentRow, ref int currentColumn)
        {
            List <ReviewCommentObject> reviewercomments = new List <ReviewCommentObject>();

            foreach (var c in Mains)
            {
                reviewercomments.AddRange(ReviewCommentObject.GetReviewComments(c.MainId.Value));
            }

            bool newSheet = SheetSelection.Contains("Reviewers");
            int  row      = 2;
            int  column   = 1;

            if (!newSheet)
            {
                row            = currentRow;
                column         = currentColumn;
                currentColumn += ReviewerCommentsRowCount;
            }
            else
            {
                column += ReviewersRowCount;
            }

            var data = Talon.Excel(reviewercomments)
                       .Template(template)
                       .StartAt(column, row)
                       .Sheet(newSheet ? ReviewersSheetName : DefaultSheetName)
                       .Name("ReviewerCommentsTable")
                       .Columns(c =>
            {
                c.Bound(x => x.MainTitle).Title("STI Number and Rev");
                c.Bound(x => x.ReviewerName).Title("Reviewer");
                c.Bound(x => x.EntryDateStr).Title("Comment Date");
                c.Bound(x => x.Comment).Title("Comment");
            });

            if (newSheet)
            {
                data.SetValue(column, 1, "Comments");
            }

            return(data.Export());
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="id">Comment Id</param>
        /// <returns></returns>
        public ActionResult DeleteComment(int?id)
        {
            int mid = 0;

            if (id.HasValue)
            {
                var c = ReviewCommentObject.GetReviewComment(id.Value);
                if (c != null)
                {
                    mid = c.MainId;
                    if (c.EmployeeId == Current.User.EmployeeId || Current.IsAdmin)
                    {
                        c.Delete();
                    }
                }
            }

            return(RedirectToAction("Index", new { id = mid }));
        }
Ejemplo n.º 3
0
        public JsonResult GetReviewComment(int?id)
        {
            if (id.HasValue)
            {
                var cmt = ReviewCommentObject.GetReviewComment(id.Value);
                if (cmt != null)
                {
                    var data = new
                    {
                        id       = cmt.ReviewCommentId,
                        reviewId = cmt.ReviewId,
                        comment  = cmt.Comment
                    };

                    return(Json(data));
                }
            }

            return(null);
        }
Ejemplo n.º 4
0
 public void Save()
 {
     if (CommentId.HasValue)
     {
         var c = ReviewCommentObject.GetReviewComment(CommentId.Value);
         if (c != null)
         {
             c.Comment = Comment;
             c.Save();
         }
     }
     else
     {
         var c = new ReviewCommentObject();
         c.MainId     = MainId;
         c.ReviewId   = CommentReviewId.Value;
         c.Comment    = Comment;
         c.EmployeeId = Current.User.EmployeeId;
         c.Save();
     }
 }