public CreateOrderActivity(IOrderRepository orderRepository,
            ICustomerSessionService customerService, 
            SequencesClient sequencesClient)
		{
            _orderRepository = orderRepository;
			_customerSessionService = customerService;
            _sequencesClient = sequencesClient;
		}
示例#2
0
        /// <summary>
        /// Converts shopping cart as order.
        /// </summary>
        /// <returns>Order.</returns>
        public virtual Order AsOrder()
        {
            var customerName = CustomerSession.CustomerName;

            //If user is anonymous take name from billing address
            if (string.IsNullOrEmpty(customerName))
            {
                var billingAddress = Cart.OrderAddresses.FirstOrDefault(a => a.OrderAddressId == Cart.AddressId);
                if (billingAddress != null)
                {
                    customerName = string.Format("{0} {1}", billingAddress.FirstName, billingAddress.LastName);
                }
            }

            var order = new Order();

            order.InjectFrom <CloneInjection>(Cart);
            order.CustomerName   = customerName;
            order.Status         = "Pending";
            order.Name           = "Default";
            order.TrackingNumber = SequencesClient.GenerateNext(typeof(Order).FullName);

            foreach (var newOf in order.OrderForms)
            {
                newOf.Name = "Default";
                newOf.OrderFormPropertyValues.Add(new OrderFormPropertyValue()
                {
                    ShortTextValue = CustomerSession.Language, Name = "Language"
                });
                if (!string.IsNullOrEmpty(CustomerSession.CsrUsername))
                {
                    //Add order form property CSR username is saved in the order form property called "Purchased By CSR"
                    newOf.OrderFormPropertyValues.Add(new OrderFormPropertyValue()
                    {
                        ShortTextValue = CustomerSession.CsrUsername, Name = "Purchased By CSR"
                    });
                }
            }

            return(order);
        }
示例#3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SequenceService"/> class.
 /// </summary>
 /// <param name="client">The sequences client.</param>
 public SequenceService(SequencesClient client)
 {
     _client = client;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SequenceService"/> class.
 /// </summary>
 /// <param name="client">The sequences client.</param>
 public SequenceService(SequencesClient client)
 {
     _client = client;
 }