예제 #1
0
        public void AddEvent(OrderComment orderComment, int accountId)
        {
            var orderOwnerEvent = new UserEvent
            {
                Description = orderComment.Comment,
                OrderId = orderComment.OrderId,
                EventSunscriberId = accountId,
                EventPublisherId = orderComment.AuthorId,
                EventType = UserEventType.NewCommentTOwnedOrderEvent,
                CommentId = orderComment.Id
            };

            var orderEmployeeEvent = new UserEvent
            {
                Description = orderComment.Comment,
                OrderId = orderComment.OrderId,
                EventSunscriberId = orderComment.AuthorId,
                EventPublisherId = orderComment.AuthorId,
                EventType = UserEventType.NewCommentToOrderByEmployeeEvent,
                CommentId = orderComment.Id
            };

            this.Save(orderOwnerEvent);
            this.Save(orderEmployeeEvent);
        }
예제 #2
0
 public OrderCommentViewModel(OrderComment comment)
 {
     this.Comment = comment.Comment;
     this.CreationTime = comment.CreatedTime;
     this.Cost = comment.ProposedCost;
     this.AuthorId = comment.AuthorId;
 }
예제 #3
0
 public void AddCommentToOrder(OrderComment orderComment)
 {
     using (var context = new DataBaseContext())
     {
         orderComment.CreatedTime = DateTime.UtcNow;
         context.OrderComments.Add(orderComment);
         context.SaveChanges();
     }
 }
예제 #4
0
 public bool AddCommentToOrder(OrderComment orderComment)
 {
     var order = orderRepository.GetById(orderComment.OrderId);
     if (order.Status == OrderStatus.Openned)
     {
         this.orderCommentRepository.AddCommentToOrder(orderComment);
         this.eventsService.AddEvent(orderComment, order.CreaterId);
         return true;
     }
     return false;
 }