private void CompleteOrder_Click(object sender, EventArgs e) { if (CurrentOrder.Items.Count > 0) { COrder tmp = new COrder(); tmp.setId(++DataContainer.orderId); tmp.setCost(0); List <CEvent> cur = new List <CEvent>(); for (int i = 0; i < CurrentOrder.Items.Count; ++i) { CEvent toAdd = new CEvent(CurrentOrder.Items[i].ToString()); cur.Add(toAdd); tmp.setCost(tmp.getCost() + toAdd.getCost()); tmp.setCity(toAdd.getCity()); } tmp.setEvents(cur); DataContainer.updateOrders(tmp); } else { MessageBox.Show("empty order"); } }
public bool Equals(CEvent e) { return(id == e.id); }