Ejemplo n.º 1
0
 /// <summary>
 /// NAME: Jesse Tomash
 /// DATE: 4/27/2020
 ///
 /// Approver:
 /// Approver:
 ///
 /// Remove Orderitem line from order when remove item is clicked
 /// </summary>
 /// /// <remarks>
 /// UPDATED BY:
 /// UPDATE DATE:
 /// WHAT WAS CHANGED:
 /// </remarks>
 /// <returns></returns>
 private void btnDeleteOrderItem_Click(object sender, RoutedEventArgs e)
 {
     if (dgOrderItems.SelectedItem != null)
     {
         try
         {
             _item = (Item)dgOrderItems.SelectedItem;
             _orderItemLineManager.DeleteOrderItemLineByItemID(_item.ItemID);
             _orderItems.Remove(_item);
             dgOrderItems.Items.Refresh();
         }
         catch
         {
             "Unable to remove Item from order".ErrorMessage();
         }
     }
     else
     {
         "You must select an Item to remove.".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();
     }
 }