/// <summary> /// NAME: Jesse Tomash /// DATE: 4/15/2020 /// /// Approver: /// Approver: /// /// Helper method to refresh the order item lines datagirid /// </summary> /// /// <remarks> /// UPDATED BY: /// UPDATE DATE: /// WHAT WAS CHANGED: /// </remarks> /// <returns></returns> private void RefreshOrderItemLines() { _items = _itemManager.retrieveItems(); try { List <OrderItemLine> lines = (List <OrderItemLine>)_orderItemLineManager.SelectOrderItemLinesByOrderID(_order.OrderID); if (lines.Count > 0) { foreach (OrderItemLine _orderItemLine in lines) { _orderItems.Add(_itemManager.SelectItemByItemID(_orderItemLine.ItemID)); } } } catch { if (dgOrderItems.ItemsSource != null) { "Could not load order item lines".ErrorMessage(); } } }
/// <summary> /// NAME: Jesse Tomash /// DATE: 3/30/2020 /// /// Approver: Brandyn T. Coverdill /// Approver: /// /// Action to delete order when an delete order is clicked /// </summary> /// /// <remarks> /// UPDATED BY: Brandyn T. Coverdill /// UPDATE DATE: 4/28/2020 /// WHAT WAS CHANGED: Changed the error message if no order was selected. /// </remarks> /// <returns></returns> private void btnDeleteOrder_Click(object sender, RoutedEventArgs e) { if (dgOrders.SelectedItem != null) { try { _order = (Order)dgOrders.SelectedItem; _orderManager.DeleteOrder(_order.OrderID); foreach (OrderItemLine line in _orderItemLineManager.SelectOrderItemLinesByOrderID(_order.OrderID)) { _orderItemLineManager.DeleteOrderItemLineByItemID(line.ItemID); } dgOrders.ItemsSource = _orderManager.RetrieveOrders(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { "Please select an Order.".ErrorMessage(); } }