コード例 #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));
        }
コード例 #2
0
        private void Save(IReadOnlyCollection <PerformedOperationFinalProcessing> transportMessages)
        {
            foreach (var transportMessage in transportMessages)
            {
                transportMessage.Id = _identityGenerator.Next();
            }

            _repository.AddRange(transportMessages);
            _repository.Save();
        }
コード例 #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();
        }
コード例 #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));
        }
コード例 #5
0
ファイル: CustomerFactory.cs プロジェクト: optivem/demo
        public Customer Create(string firstName, string lastName)
        {
            var id = _customerIdentityGenerator.Next();

            return(new Customer(id, firstName, lastName));
        }
コード例 #6
0
ファイル: ProductFactory.cs プロジェクト: optivem/demo
        public Product CreateNewProduct(string productCode, string productName, decimal listPrice)
        {
            var id = _productIdentityGenerator.Next();

            return(new Product(id, productCode, productName, listPrice, DefaultIsListed));
        }
コード例 #7
0
        public Document Create(string title, string content)
        {
            var id = _bookIdentityGenerator.Next();

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