Ejemplo n.º 1
0
        /*public void DisplayOrderItemList()
         * {
         *  List<string> itemDetailsList = new List<string>();
         *  foreach (OrderItem oi in orderItemList)
         *  {
         *      itemDetailsList.Add(oi.ToString());
         *  }
         *  cartsListView.ItemsSource = itemDetailsList;
         * }*/
        private void addButton_Click(object sender, RoutedEventArgs e)
        {
            int i = itemsListView.SelectedIndex;

            if (i >= 0)
            {
                if (listused == 1)
                {
                    MenuItem mi     = menuItemList[i];
                    string   output = mi.ToString();
                    cartDetailsList.Add(output);
                    cartsListView.ItemsSource = null;
                    cartsListView.ItemsSource = cartDetailsList;
                }
                else if (listused == 2)
                {
                    ValueMeal vm     = valueMealList[i];
                    string    output = vm.ToString();
                    cartDetailsList.Add(output);
                    cartsListView.ItemsSource = null;
                    cartsListView.ItemsSource = cartDetailsList;
                }
                else if (listused == 3)
                {
                    Side   s      = sideList[i];
                    string output = s.ToString();
                    cartDetailsList.Add(output);
                    cartsListView.ItemsSource = null;
                    cartsListView.ItemsSource = cartDetailsList;
                }
                else if (listused == 4)
                {
                    Beverage b      = beverageList[i];
                    string   output = b.ToString();
                    cartDetailsList.Add(output);
                    cartsListView.ItemsSource = null;
                    cartsListView.ItemsSource = cartDetailsList;
                }
            }
        }
Ejemplo n.º 2
0
        void InitInfo()
        {
            MenuItem mi1 = new MenuItem("Breakfast set \n(Hotcake with sausage, Hash brown)", 7.90);
            MenuItem mi2 = new MenuItem("Hamburger combo \n(Hamburger, fries, cola)", 10.20);
            MenuItem mi3 = new MenuItem("Dinner set \n(Ribeye steak, fries, caesar \nsalad, coffee)", 18.50);

            menuItemList.Add(mi1);
            menuItemList.Add(mi2);
            menuItemList.Add(mi3);
            ValueMeal vm1 = new ValueMeal("Hotcake with sausage", 6.90);
            ValueMeal vm2 = new ValueMeal("Hamburger", 7.50);
            ValueMeal vm3 = new ValueMeal("Ribeye Steak", 10.20);

            valueMealList.Add(vm1);
            valueMealList.Add(vm2);
            valueMealList.Add(vm3);
            Side s1 = new Side("Hash brown", 2.10);
            Side s2 = new Side("Truffle fries", 3.70);
            Side s3 = new Side("Calamari", 3.40);
            Side s4 = new Side("Caesar salad", 4.30);

            sideList.Add(s1);
            sideList.Add(s2);
            sideList.Add(s3);
            sideList.Add(s4);
            Beverage b1 = new Beverage("Cola", 2.85);
            Beverage b2 = new Beverage("Green Tea", 3.70);
            Beverage b3 = new Beverage("Coffee", 2.70);
            Beverage b4 = new Beverage("Tea", 2.70);
            Beverage b5 = new Beverage("Tom's Root Beer", 9.70);
            Beverage b6 = new Beverage("MockTail", 15.90);

            beverageList.Add(b1);
            beverageList.Add(b2);
            beverageList.Add(b3);
            beverageList.Add(b4);
            beverageList.Add(b5);
            beverageList.Add(b6);
        }
Ejemplo n.º 3
0
        void InitData()
        {
            Side     s1  = new Side("Hash brown", 2.10);
            Side     s2  = new Side("Truffle fries", 3.70);
            Side     s3  = new Side("Calamari", 3.40);
            Side     s4  = new Side("Caesar salad", 4.30);
            MenuItem sm1 = new MenuItem(s1.Name, s1.Price);

            sm1.ProductList.Add(s1);
            MenuItem sm2 = new MenuItem(s2.Name, s2.Price);

            sm2.ProductList.Add(s2);
            MenuItem sm3 = new MenuItem(s3.Name, s3.Price);

            sm2.ProductList.Add(s3);
            MenuItem sm4 = new MenuItem(s4.Name, s4.Price);

            sm2.ProductList.Add(s4);

            SideMenu.Add(sm1);
            SideMenu.Add(sm2);
            SideMenu.Add(sm3);
            SideMenu.Add(sm4);

            DateTime Today = DateTime.Now;

            DateTime startTime = new DateTime(Today.Year, Today.Month, Today.Day, 0, 0, 0);
            DateTime endTime   = new DateTime(Today.Year, Today.Month, Today.Day, 0, 0, 0);

            ValueMeal v1  = new ValueMeal("HotCake & sausage", 6.90, startTime, endTime);
            MenuItem  vm1 = new MenuItem(v1.Name, v1.Price);

            vm1.ProductList.Add(v1);
            ValueMealMenu.Add(vm1);

            startTime = new DateTime(Today.Year, Today.Month, Today.Day, 10, 0, 0);
            endTime   = new DateTime(Today.Year, Today.Month, Today.Day, 19, 0, 0);

            ValueMeal v2  = new ValueMeal("HamBurger", 7.50, startTime, endTime);
            MenuItem  vm2 = new MenuItem(v2.Name, v2.Price);

            vm1.ProductList.Add(v2);
            ValueMealMenu.Add(vm2);

            startTime = new DateTime(Today.Year, Today.Month, Today.Day);
            endTime   = new DateTime(Today.Year, Today.Month, Today.Day);

            ValueMeal v3  = new ValueMeal("Nasi Lemak", 5.40, startTime, endTime);
            MenuItem  vm3 = new MenuItem(v3.Name, v3.Price);

            vm1.ProductList.Add(v3);
            ValueMealMenu.Add(vm3);

            startTime = new DateTime(Today.Year, Today.Month, Today.Day, 16, 0, 0);
            endTime   = new DateTime(Today.Year, Today.Month, Today.Day, 22, 0, 0);

            ValueMeal v4  = new ValueMeal("Ribeye steak", 10.20, startTime, endTime);
            MenuItem  vm4 = new MenuItem(v4.Name, v4.Price);

            vm1.ProductList.Add(v4);
            ValueMealMenu.Add(vm4);

            if (v1.IsAvailable())
            {
                ValueMealMenu.Add(vm1);
            }
            if (v2.IsAvailable())
            {
                ValueMealMenu.Add(vm2);
            }
            if (v3.IsAvailable())
            {
                ValueMealMenu.Add(vm3);
            }
            if (v4.IsAvailable())
            {
                ValueMealMenu.Add(vm4);
            }

            Beverage b1 = new Beverage("Cola", 2.85, 0);
            Beverage b2 = new Beverage("Green Tea", 3.70, 0);
            Beverage b3 = new Beverage("Coffee", 2.70, 0);
            Beverage b4 = new Beverage("Tea", 2.70, 0);
            Beverage b5 = new Beverage("Tom's Root Beer", 9.70, 0);
            Beverage b6 = new Beverage("Mocktail", 15.90, 0);

            MenuItem bm1 = new MenuItem(b1.Name, b1.Price);
            MenuItem bm2 = new MenuItem(b2.Name, b2.Price);
            MenuItem bm3 = new MenuItem(b3.Name, b3.Price);
            MenuItem bm4 = new MenuItem(b4.Name, b4.Price);
            MenuItem bm5 = new MenuItem(b5.Name, b5.Price);
            MenuItem bm6 = new MenuItem(b6.Name, b6.Price);

            BeverageMenu.Add(bm1);
            BeverageMenu.Add(bm2);
            BeverageMenu.Add(bm3);
            BeverageMenu.Add(bm4);
            BeverageMenu.Add(bm5);
            BeverageMenu.Add(bm6);


            MenuItem bfm1 = new MenuItem("Breakfast set", 7.90);

            bfm1.ProductList.Add(v1);
            bfm1.ProductList.Add(s2);
            if (v1.IsAvailable())
            {
                BundleMenu.Add(bfm1);
            }
            BundleMenu.Add(bfm1);
        }