private void buttonOrderNew_Click(object sender, EventArgs e) { Order theOrder = new Order(); theOrder.Manufacturer = Manufacturer.GetAll()[0]; theOrder.OrderStatus = OrderStatus.GetAll()[0]; theOrder.Save(); FormOrderNew theFormOrderNew = new FormOrderNew(theOrder); theFormOrderNew.ShowDialog(); LoadOrders(); }
private void buttonOrderEdit_Click(object sender, EventArgs e) { try { Order theOrder = this.listBoxOrders.SelectedItem as Order; if (theOrder == null) { return; } theOrder.Manufacturer = Manufacturer.GetAll()[0]; theOrder.OrderStatus = OrderStatus.GetAll()[0]; FormOrderNew theFormOrderNew = new FormOrderNew(theOrder); theFormOrderNew.ShowDialog(); LoadOrders(); } catch (Exception ex) { this.listBoxOrders.DataSource = null; this.listBoxOrders.Items.Add(ex.Message); } }