示例#1
0
        /// <summary>
        /// Runs the processor.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public virtual void Process([NotNull] PipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            object orderNumber = args.CustomData["orderNumber"];

            Assert.IsNotNull(orderNumber, "OrderNumber cannot be null.");

            VisitorOrderManager orderRepository = Context.Entity.Resolve <VisitorOrderManager>();

            Assert.IsNotNull(orderRepository, "OrderManager cannot be null.");

            string orderId = orderNumber.ToString();
            Order  order   = orderRepository.GetAll().SingleOrDefault(o => (o != null) && (o.OrderId == orderId));

            Assert.IsNotNull(order, "Order cannot be null.");

            OrderConfirmation orderConfirmation = Context.Entity.Resolve <OrderConfirmation>();

            Assert.IsNotNull(orderConfirmation, "OrderConfirmation cannot be null.");
            Assert.IsNotNull(orderConfirmation.ConfirmationMessageBuilder, "OrderConfirmation.ConfirmationMessageBuilder cannot be null.");

            orderConfirmation.ConfirmationMessageBuilder.Order = order;

            orderConfirmation.Send();
        }
        /// <summary>
        /// Executes the specified order.
        /// </summary>
        /// <param name="order">The order.</param>
        protected override void Execute([NotNull] Order order)
        {
            Assert.ArgumentNotNull(order, "order");
            this.OrderId = order.OrderId;

            OrderConfirmation orderConfirmation = Context.Entity.Resolve <OrderConfirmation>();

            Assert.IsNotNull(orderConfirmation, "OrderConfirmation cannot be null.");
            Assert.IsNotNull(orderConfirmation.ConfirmationMessageBuilder, "OrderConfirmation.ConfirmationMessageBuilder cannot be null.");

            orderConfirmation.ConfirmationMessageBuilder.Order = order;
            orderConfirmation.Send();
        }