private void FillLVViewOrder() { ViewOrders viewOrders = ViewOrders.GetInstances(); listViewViewOrders.Items.Clear(); foreach (OrderItem item in viewOrders.changedSortedItems) { ListViewItem lvItem = new ListViewItem(new string[] { item.MenuProduct.Name, item.Quantity.ToString(), item.Comment }); lvItem.Tag = item; listViewViewOrders.Items.Add(lvItem); } }
private void btn_OrdersDelete_Click(object sender, EventArgs e) { ViewOrders viewOrders = ViewOrders.GetInstances(); if (listViewViewOrders.SelectedItems.Count == 0) { return; } viewOrders.Delete((OrderItem)listViewViewOrders.SelectedItems[0].Tag); FillLVViewOrder(); }
private void btn_OrdersPlus_Click(object sender, EventArgs e) { ViewOrders viewOrders = ViewOrders.GetInstances(); if (listViewViewOrders.SelectedItems.Count == 0) { return; } OrderItem orderItem = (OrderItem)listViewViewOrders.SelectedItems[0].Tag; viewOrders.AddQuantity(orderItem); FillLVViewOrder(orderItem); }
private void btn_OrdersChangeConfirm_Click(object sender, EventArgs e) { ViewOrders viewOrders = ViewOrders.GetInstances(); if (btn_OrdersChangeConfirm.Text == "Wijzig") { btn_OrdersDelete.Show(); btn_OrdersMinus.Show(); btn_OrdersPlus.Show(); btn_OrdersBackCancel.Text = "Annuleer"; btn_OrdersChangeConfirm.Text = "Bevestig"; } else if (btn_OrdersChangeConfirm.Text == "Bevestig") { order_Service.ChangeOrders(viewOrders.ConfirmChanges()); ShowPanel("ViewOrders"); } }
private void FillLVViewOrder(OrderItem orderItem) { ViewOrders viewOrders = ViewOrders.GetInstances(); int selectedItem = 0; listViewViewOrders.Items.Clear(); foreach (OrderItem item in viewOrders.changedSortedItems) { ListViewItem lvItem = new ListViewItem(new string[] { item.MenuProduct.Name, item.Quantity.ToString(), item.Comment }); lvItem.Tag = item; listViewViewOrders.Items.Add(lvItem); } foreach (ListViewItem lvItem in listViewViewOrders.Items) { if (lvItem.Tag == orderItem) { listViewViewOrders.Items[selectedItem].Selected = true; break; } selectedItem++; } }