private void buttonAcceptNewOrder_Click(object sender, EventArgs e) { try { // Add the detail to the details for the current order. currentOrder.SalesOrderDetail.Add(newSalesOrderDetail); // Update the order totals. currentOrder.UpdateOrderTotal(); } catch (Exception exception) { MessageBox.Show("Msg: " + exception.Message + "\r\nInner Exception: " + exception.InnerException); } }
private void buttonDeleteDetail_Click(object sender, EventArgs e) { try { // Get the selected detail from the grid. SalesOrderDetail selectedDetail = (SalesOrderDetail)bindingSourceOrderDetails.Current; // Call the method to delete the specific order detail. objCtx.DeleteObject(selectedDetail); // Update the order total. currentOrder.UpdateOrderTotal(); } catch (Exception ex) { MessageBox.Show("The following error has occured: \n\t" + ex.Message, "Error"); } }