/// <summary> /// Ships the specified <paramref name="order"/> /// </summary> /// <param name="order">The order which is to be marked as "shipped"</param> /// <returns>The <see cref="T:GIIS.DataLayer.TransferOrderHeader"/> which has been marked as Shipped</returns> /// <remarks> /// The ship order function is used whenever the caller wishes to update an existing order to the “shipped” status and perform the transfers. ///The process for this function is as follows: ///<list type="ordered"> /// <item><description> [Guard Condition] If the order passed into the function IS NOT in state “Packed” then throw an invalid state exception (sanity check)</description></item> /// <item><description> The function updates the TransferOrderHeader status to “Shipped”.</description></item> /// <item><description> For each item in the TransferOrderDetails for the order: /// <list type="ordered"> /// <item><description>Call <see cref="M:GIIS.BusinessLogic.OrderManagementLogic.UpdateOrderLine(GIIS.DataLayer.TransferOrderDetail)"/>function to set the status of the order detail item to “Shipped”</description></item> /// </list> /// </description></item> /// <item><description> Save the TransferOrderHeader</description></item> /// </list> /// </remarks> public TransferOrderHeader ShipOrder(TransferOrderHeader order, Int32 modifiedBy) { if (order == null) { throw new ArgumentNullException("order"); } // Guard condition if (order.OrderStatus != (int)OrderStatusType.Packed) { throw new IllegalStateException((OrderStatusType)order.OrderStatus, "TransferOrderHeader", "ShipOrder"); } // Update header order.OrderStatus = (int)OrderStatusType.Shipped; order.ModifiedBy = modifiedBy; order.ModifiedOn = DateTime.Now; order.RevNum++; TransferOrderHeader.Update(order); // Update details this.UpdateOrderDetails(order, modifiedBy); return(order); }
/// <summary> /// Cancels an order regardless of state /// </summary> /// <param name="order">The order to be cancelled</param> /// <returns>The cancelled <see cref="T:GIIS.DataLayer.TransferOrderHeader"/></returns> /// <remarks> /// The cancel order function is used to cancel any order and back-out any stock transactions that have occurred. /// The process for this function is as follows: /// <list type="ordered"> /// <item><description> [Guard Condition] If the order passed into the function IS NOT in states “Requested”, “Released” or “Packed” then throw an invalid state exception (sanity check)</description></item> /// <item><description> Create an instance of the StockManagementLogic BLL class</description></item> /// <item><description> The function updates the TransferOrderHeader status to “Cancelled”</description></item> /// <item><description> For each item in the TransferOrderDetails for the order: /// <list type="ordered"> /// <item><description>Call the UpdateOrderLine function to set the status of the order detail item to “Cancelled”.</description></item> /// </list> /// </description></item> /// /// <item><description> Save the TransferOrderHeader</description></item> /// </list> /// </remarks> public TransferOrderHeader CancelOrder(TransferOrderHeader order, Int32 modifiedBy) { if (order == null) { throw new ArgumentNullException("order"); } // Sanity check if (order.OrderStatus != (int)OrderStatusType.Requested && order.OrderStatus != (int)OrderStatusType.Released && order.OrderStatus != (int)OrderStatusType.Packed) { throw new IllegalStateException((OrderStatusType)order.OrderStatus, "TransferOrderHeader", "Cancel"); } // Update the header order.OrderStatus = (int)OrderStatusType.Cancelled; order.ModifiedBy = modifiedBy; order.ModifiedOn = DateTime.Now; order.RevNum++; TransferOrderHeader.Update(order); // Update details this.UpdateOrderDetails(order, modifiedBy); return(order); }