Example #1
0
        //void InitializeDishList()
        //{
        //    Dishes dish1 = new Dishes();
        //    dish1.Name = "borsch";
        //    dish1.KindOfDish = "ukrainian";
        //    dish1.TypeOfDish = "first cource";
        //    dish1.OrderOfDish = DishOrder.firstCource;

        //    Dishes dish2 = new Dishes();
        //    dish2.Name = "fried potatoes";
        //    dish2.TypeOfDish = "second cource";
        //    dish2.KindOfDish = "german";
        //    dish2.OrderOfDish = DishOrder.secondCource;

        //    Dishes dish4 = new Dishes();
        //    dish4.Name = "just salad";
        //    dish4.TypeOfDish = "salad";
        //    dish4.KindOfDish = "unknown";
        //    dish4.OrderOfDish = DishOrder.salad;

        //    Dishes dish3 = new Dishes();
        //    dish3.Name = "milkshake";
        //    dish3.TypeOfDish = "dessert";
        //    dish3.KindOfDish = "unknown";
        //    dish3.OrderOfDish = DishOrder.dessert;

        //    Dishes dish5 = new Dishes();
        //    dish5.Name = "just salad2";
        //    dish5.TypeOfDish = "salad";
        //    dish5.KindOfDish = "unknown";
        //    dish5.OrderOfDish = DishOrder.salad;

        //    DishesList.Add(dish1);
        //    DishesList.Add(dish5);
        //    DishesList.Add(dish3);
        //    DishesList.Add(dish2);
        //    DishesList.Add(dish4);

        //    DishesList = DishSortByOrder(DishesList);
        //}


        public List <Dishes> DishSortByOrder(List <Dishes> dishes) //first cource -> 2 cource -> ... -> dessert
        {
            for (int counter = 0; counter < dishes.Count - 1; counter++)
            {
                for (int i = 0; i < dishes.Count - 1; i++)
                {
                    if (dishes[i].OrderOfDish > dishes[i + 1].OrderOfDish)
                    {
                        Dishes tmp = dishes[i];
                        dishes[i]     = dishes[i + 1];
                        dishes[i + 1] = tmp;
                    }
                }
            }
            return(dishes);
        }
Example #2
0
 public HowToCookPage(Dishes _dish)
 {
     InitializeComponent();
     dish = _dish;
 }