/// <summary> /// Generates order shipments from the basket data /// </summary> /// <param name="basket">The basket checking out</param> /// <param name="order">The order being created</param> /// <param name="idLookup">A translation table to map basket ids to order ids</param> /// <remarks>This method does not modify the basket object</remarks> internal static void GenerateOrderShipmentObjects(Basket basket, Order order, Dictionary <string, int> idLookup) { foreach (BasketShipment bs in basket.Shipments) { OrderShipment os = new OrderShipment(); os.OrderId = order.OrderId; os.WarehouseId = bs.WarehouseId; RecordShippingAddress(bs, os); if (bs.ShipMethod != null) { os.ShipMethodId = bs.ShipMethodId; os.ShipMethodName = bs.ShipMethod.Name; } os.ShipMessage = bs.ShipMessage; os.Save(); //TODO: WHY IS THE IF STATEMENT NECESSARY? IF NEW ORDERSHIPMENT IS CREATED? //THIS SHOULD ALWAY BE TRUE AND WILL ALWAYS BE EXECUTED? if (order.Shipments.IndexOf(os.OrderShipmentId) < 0) { order.Shipments.Add(os); } idLookup.Add("S" + bs.BasketShipmentId, os.OrderShipmentId); } }
public static SaveResult Insert(OrderShipment orderShipment) { return(orderShipment.Save()); }
public static SaveResult Update(OrderShipment orderShipment) { return(orderShipment.Save()); }