private void SaveOrderBtn_Click(object sender, EventArgs e) { //todo: change 2 to time of reservation Reservation res = DataStorageHandler.Storage.Reservations.FirstOrDefault(r => r.Table == TableNumberTB.Text && CheckResTime(r)); if (res == null) { MessageBox.Show("Kan geen reservering vinden binnen tijdsbestek en bij dit tafelnummer, is de reservering goed aangemaakt?"); } else { CurrentOrder.Reservation = res; if (MenuItemList.Controls == null || MenuItemList.Controls.Count == 0) { } else { var dishes = OrderItems.Select(a => a.DishItem).Where(d => d.Amount > 0).ToList(); if (dishes == null || dishes.Count <= 0) { MessageBox.Show("Er zijn geen gerechten geselecteerd, selecteer 1 of meer gerechten."); } else { CurrentOrder.Dishes = dishes; //Save it to DataStorage if (res.Orders == null) { res.Orders = new List <Order>(); } CurrentOrder.OrderDate = DateTime.Now; res.Orders.Add(CurrentOrder); MessageBox.Show("Bestelling is geplaatst"); OrderSaved?.Invoke(this, EventArgs.Empty); } } } }
public void OnEvent(OrderSaved e) { Console.WriteLine("OrderSavedView -> OrderSaved Event -> {0}", e.Order); }
public void OnEvent(OrderSaved e) { Label.Text = $"Order Saved: {e.Order.OrderNumber}"; }
public void OnEvent(OrderSaved e) { // util saved order }
private void pictureBox1_Click(object sender, EventArgs e) { CurrentOrder = null; OrderSaved?.Invoke(this, EventArgs.Empty); }