Beispiel #1
0
        //Code for the Menukaarten panel
        #region Menukaarten
        //Load all drinks into the menukaarten listView
        private void LoadMenukaartenDrinks()
        {
            //Empty the listView
            CP_Menukaarten_listView.Clear();

            //Get a list of all drinks
            List <Drink> drinkList = drinkService.GetAllDrinks();

            //Fill the listView with drinks
            for (int i = 0; i < drinkList.Count; i++)
            {
                ListViewItem li = new ListViewItem(drinkList[i].Name);
                li.SubItems.Add(drinkList[i].Alcoholic.ToString());
                li.SubItems.Add("€" + drinkList[i].Price.ToString("0.00"));

                //Tag is used to store the Drink Object
                li.Tag = drinkList[i];

                CP_Menukaarten_listView.Items.Add(li);
            }

            // Create some column headers for the data.
            columnheader      = new ColumnHeader();
            columnheader.Text = "Naam";
            CP_Menukaarten_listView.Columns.Add(columnheader);

            columnheader      = new ColumnHeader();
            columnheader.Text = "Alcoholisch";
            CP_Menukaarten_listView.Columns.Add(columnheader);

            columnheader      = new ColumnHeader();
            columnheader.Text = "Prijs";
            CP_Menukaarten_listView.Columns.Add(columnheader);

            // Loop through and size each column header to fit the column header text.
            foreach (ColumnHeader ch in CP_Menukaarten_listView.Columns)
            {
                ch.Width = -2;
            }

            //Keep track of what type of menu is shown
            shownMenu = MenuType.Drinksmenu;

            //Select the first item in the listview
            if (CP_Menukaarten_listView.Items.Count > 0)
            {
                CP_Menukaarten_listView.Items[0].Selected = true;
            }

            //Change the text of the buttons
            CP_Menukaarten_btnNewItem.Text  = "Nieuwe drank toevoegen";
            CP_Menukaarten_btnEditItem.Text = "Drank aanpassen";
        }
Beispiel #2
0
        //Load all dinner dishes into the menukaarten listView
        private void LoadMenukaartenDinner()
        {
            //Clear the listView
            CP_Menukaarten_listView.Clear();

            //Get a list of all dinner dishes
            List <Dish> dinnerList = dishService.GetAllDinner();

            //Fill the listview with the dinnerlist
            for (int i = 0; i < dinnerList.Count; i++)
            {
                ListViewItem li = new ListViewItem(dinnerList[i].Name);
                li.SubItems.Add(dinnerList[i].Description);
                li.SubItems.Add(dinnerList[i].Ingredients);
                li.SubItems.Add(dinnerList[i].Category.ToString());
                li.SubItems.Add("€" + dinnerList[i].Price.ToString("0.00"));

                //Tag is used to store the Dish Object
                li.Tag = dinnerList[i];

                CP_Menukaarten_listView.Items.Add(li);
            }

            // Create some column headers for the data.
            columnheader      = new ColumnHeader();
            columnheader.Text = "Naam";
            CP_Menukaarten_listView.Columns.Add(columnheader);

            columnheader      = new ColumnHeader();
            columnheader.Text = "Omschrijving";
            CP_Menukaarten_listView.Columns.Add(columnheader);

            columnheader      = new ColumnHeader();
            columnheader.Text = "Ingredienten";
            CP_Menukaarten_listView.Columns.Add(columnheader);

            columnheader      = new ColumnHeader();
            columnheader.Text = "Categorie";
            CP_Menukaarten_listView.Columns.Add(columnheader);

            columnheader      = new ColumnHeader();
            columnheader.Text = "Prijs";
            CP_Menukaarten_listView.Columns.Add(columnheader);

            // Loop through and size each column header to fit the column header text.
            foreach (ColumnHeader ch in CP_Menukaarten_listView.Columns)
            {
                ch.Width = -2;
            }

            //Keep track of what type of menu is shown
            shownMenu = MenuType.Dinnermenu;

            //Select the first item in the listview
            if (CP_Menukaarten_listView.Items.Count > 0)
            {
                CP_Menukaarten_listView.Items[0].Selected = true;
            }

            //Change the text of the buttons
            CP_Menukaarten_btnNewItem.Text  = "Nieuw gerecht toevoegen";
            CP_Menukaarten_btnEditItem.Text = "Gerecht aanpassen";
        }