//filter to check if the completed order belongs to the chef, bartender, or both private ListViewItem CheckOrder(Order order) { ListViewItem li; order.items = service.GetItems(order); foreach (Item item in order.items) { if (employee.Position == Enum_Employee.Chef && (item.Type == Enum_Item_Type.Dinner_Desserts || item.Type == Enum_Item_Type.Dinner_Mains || item.Type == Enum_Item_Type.Dinner_Starters || item.Type == Enum_Item_Type.Lunch_Bites || item.Type == Enum_Item_Type.Lunch_Mains || item.Type == Enum_Item_Type.Lunch_Specials)) { li = Item(order); return(li); } else if (employee.Position == Enum_Employee.Barman && (item.Type == Enum_Item_Type.Beer || item.Type == Enum_Item_Type.Hot_Drink || item.Type == Enum_Item_Type.Soft_Drink || item.Type == Enum_Item_Type.Wine)) { li = Item(order); return(li); } } return(null); }
//showing the listview private void ShowOrder() { //retrieve the current order items order.items = service.GetItems(order); listViewOrder.Clear(); listViewOrder.View = View.Details; listViewOrder.Columns.Add("Name", 220, HorizontalAlignment.Left); listViewOrder.Columns.Add("Amount", 65, HorizontalAlignment.Left); listViewOrder.Columns.Add("Comment", 120, HorizontalAlignment.Left); foreach (Item item in order.items) { if (item.Status == Enum_Item_Status.Preparing) { ListViewItem li = CheckItem(item); if (li != null) { listViewOrder.Items.Add(li); } } } }