Ejemplo n.º 1
0
        public Order CreateNewOrder(CustomerIdentity customerId, IEnumerable <OrderItem> orderDetails)
        {
            var id        = _orderIdentityGenerator.Next();
            var orderDate = _timeService.Now;

            return(new Order(id, customerId, orderDate, OrderStatus.New, orderDetails));
        }
Ejemplo n.º 2
0
        private void Save(IReadOnlyCollection <PerformedOperationFinalProcessing> transportMessages)
        {
            foreach (var transportMessage in transportMessages)
            {
                transportMessage.Id = _identityGenerator.Next();
            }

            _repository.AddRange(transportMessages);
            _repository.Save();
        }
Ejemplo n.º 3
0
        private void Save(IReadOnlyCollection <PerformedOperationFinalProcessing> transportMessages, Guid targetFlowId)
        {
            foreach (var transportMessage in transportMessages)
            {
                transportMessage.Id            = _identityGenerator.Next();
                transportMessage.CreatedOn     = DateTime.UtcNow;
                transportMessage.MessageFlowId = targetFlowId;
            }

            _repository.AddRange(transportMessages);
            _repository.Save();
        }
Ejemplo n.º 4
0
        public OrderItem CreateNewOrderItem(Product product, decimal quantity)
        {
            if (product == null)
            {
                throw new ArgumentException();
            }

            if (quantity < 0)
            {
                throw new ArgumentException();
            }

            var id = _orderItemIdentityGenerator.Next();

            return(new OrderItem(id, product.Id, quantity, product.ListPrice, OrderItemStatus.Allocated));
        }
Ejemplo n.º 5
0
        public Customer Create(string firstName, string lastName)
        {
            var id = _customerIdentityGenerator.Next();

            return(new Customer(id, firstName, lastName));
        }
Ejemplo n.º 6
0
        public Product CreateNewProduct(string productCode, string productName, decimal listPrice)
        {
            var id = _productIdentityGenerator.Next();

            return(new Product(id, productCode, productName, listPrice, DefaultIsListed));
        }
Ejemplo n.º 7
0
        public Document Create(string title, string content)
        {
            var id = _bookIdentityGenerator.Next();

            return(new Document(id, title, content));
        }