public static SaveResult Insert(OrderShipment orderShipment) { return(orderShipment.Save()); }
public static bool Delete(OrderShipment orderShipment) { return(orderShipment.Delete()); }
public static SaveResult Update(OrderShipment orderShipment) { return(orderShipment.Save()); }
/// <summary> /// Recalculates the current shipment status for this order. /// </summary> public void RecalculateShipmentStatus() { //KEEP TRACK OF UPDATED STATUS TO DETECT CHANGES OrderShipmentStatus newStatus; //CHECK WHETHER THE ORDER HAS ANY SHIPMENTS if (this.Shipments.Count > 0) { //MAKE SURE THERE ARE NO SHIPPABLE ITEMS bool foundShippable = false; int i = 0; while ((i < this.Shipments.Count) && (!foundShippable)) { OrderShipment shipment = this.Shipments[i]; if (!shipment.IsShipped) { foundShippable = true; } i++; } if (foundShippable) { newStatus = OrderShipmentStatus.Unshipped; } else { newStatus = OrderShipmentStatus.Shipped; } } else { //THERE ARE NO SHIPMENTS, THIS ORDER IS NON-SHIPPABLE newStatus = OrderShipmentStatus.NonShippable; } //UNLESS WE KNOW THE ORDER IS UNSHIPED, //CHECK FOR SHIPPABLE PRODUCTS NOT IN A SHIPMENT if (this.ShipmentStatus != OrderShipmentStatus.Unshipped) { bool foundShippable = false; int i = 0; while ((i < this.Items.Count) && (!foundShippable)) { OrderItem item = this.Items[i]; if ((item.OrderItemType == OrderItemType.Product) && (item.OrderShipmentId == 0) && (item.Shippable != Shippable.No)) { foundShippable = true; } i++; } if (foundShippable) { newStatus = OrderShipmentStatus.Unshipped; } } //CHECK FOR CHANGES if (this.ShipmentStatus != newStatus) { OrderDataSource.UpdateShipmentStatus(this, newStatus); } }