public CreateOrderActivity(IOrderRepository orderRepository, ICustomerSessionService customerService, SequencesClient sequencesClient) { _orderRepository = orderRepository; _customerSessionService = customerService; _sequencesClient = sequencesClient; }
/// <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); }
/// <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; }