/// <summary> /// removes the order passed in from the persistent storage. Also the order detail rows belonging with this order will be /// removed. It is wise to refresh the gui after this action, since collections and other data elements have to refreshed to illustrate the /// change. /// </summary> /// <param name="orderToRemove">Order entity to remove from the persistent storage</param> /// <returns>true if the removal was succesful, false otherwise</returns> private bool RemoveOrder(OrderEntity orderToRemove) { Transaction removalTrans = new Transaction(System.Data.IsolationLevel.ReadCommitted, "RemoveOrder"); bool toReturn = false; try { // first remove the orderdetail rows of this order removalTrans.Add(orderToRemove.OrderDetails); orderToRemove.OrderDetails.DeleteMulti(); // remove the order itself removalTrans.Add(orderToRemove); toReturn = orderToRemove.Delete(); // done removalTrans.Commit(); } catch (Exception ex) { removalTrans.Rollback(); throw ex; } finally { removalTrans.Dispose(); } return(toReturn); }