예제 #1
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Comments EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToComments(Comment comment)
 {
     base.AddObject("Comments", comment);
 }
예제 #2
0
        private MasterOrder GenerateMasterOrder(OrderTypeEnum orderType, string commentText, int entityId, int receivingId = 0)
        {
            if (receivingId == 0)
            {
                receivingId = entityId;
            }
            // Assign order and master order properties
            var masterOrder = new MasterOrder
                {
                    CreatingEntityId = entityId,
                    CreateDateTime = DateTime.Now,
                    ReceivingEntityId = orderType == OrderTypeEnum.Dropship ? 8 : receivingId
                };

            // find a master order number that doesn't exist
            var masterOrderNumber = 0;
            using (var context = DBContextFactory.CreateContext())
            {
                while (masterOrderNumber == 0 || context.MasterOrders.FirstOrDefault(o => o.MasterOrderId == masterOrderNumber) != null)
                {
                    masterOrderNumber = _random.Next(100000000, 999999999);
                }
            }

            masterOrder.MasterOrderId = masterOrderNumber;

            if (!String.IsNullOrEmpty(commentText))
            {
                var comment = new Comment
                    {
                        CommentEntityId = entityId,
                        CommentOrderId = masterOrder.MasterOrderId,
                        CommentText = commentText,
                        CommentTime = masterOrder.CreateDateTime
                    };

                masterOrder.Comments.Add(comment);
            }
            return masterOrder;
        }
예제 #3
0
 /// <summary>
 /// Create a new Comment object.
 /// </summary>
 /// <param name="commentId">Initial value of the CommentId property.</param>
 /// <param name="commentTime">Initial value of the CommentTime property.</param>
 /// <param name="commentText">Initial value of the CommentText property.</param>
 public static Comment CreateComment(global::System.Int32 commentId, global::System.DateTime commentTime, global::System.String commentText)
 {
     Comment comment = new Comment();
     comment.CommentId = commentId;
     comment.CommentTime = commentTime;
     comment.CommentText = commentText;
     return comment;
 }