private void Add_Order_Click(object sender, RoutedEventArgs e)
        {
            IDishRepository dishRepo = new DishRepository();
            Order           order    = new Order()
            {
                DishID = Convert.ToInt32(dishRepo.GetDish(dishSelect.Text).DishID), TableID = Convert.ToInt32(tableSelect.Text), TimeStamp = DateTime.Now.ToString("HH:mm:ss")
            };
            IOrderRepository repository = new OrderRepository();

            repository.CreateOrder(order);
        }
        public OrdersPage()
        {
            InitializeComponent();

            IDishRepository  dishRepo  = new DishRepository();
            IOrderRepository orderRepo = new OrderRepository();
            int tableCount             = 6;
            var orders    = orderRepo.GetOrders();
            var dishesInt = orderRepo.GetDishes(1);

            Dish[]      dishes1      = new Dish[dishesInt.Length];
            OrderDish[] DO           = new OrderDish[dishesInt.Length];
            int         foreach_iter = 0;

            IOrderedEnumerable <OrderDish>[] query = new IOrderedEnumerable <OrderDish> [tableCount + 1];
            IEnumerable <String>             TimeQuery;
            IEnumerable <int> IDQuery;

            double[] TablePrice = new double[tableCount + 1];
            for (int table_number = 1; table_number <= tableCount; table_number++)
            {
                dishesInt    = orderRepo.GetDishes(table_number);
                dishes1      = new Dish[dishesInt.Length];
                DO           = new OrderDish[dishesInt.Length];
                foreach_iter = 0;
                foreach (var x in dishesInt)
                {
                    dishes1[foreach_iter] = dishRepo.GetDish(x);
                    DO[foreach_iter]      = new OrderDish
                    {
                        DishPrice = dishes1[foreach_iter].DishPrice,
                        Name      = dishes1[foreach_iter].Name
                    };
                    TablePrice[table_number] += dishes1[foreach_iter].DishPrice;
                    foreach_iter++;
                }

                TimeQuery =
                    from o in orders
                    where o.TableID == table_number
                    select o.TimeStamp;

                IDQuery =
                    from o in orders
                    where o.TableID == table_number
                    select o.OrderID;

                foreach_iter = 0;
                foreach (var p in TimeQuery)
                {
                    DO[foreach_iter].TimeStamp = p;
                    foreach_iter++;
                }

                foreach_iter = 0;
                foreach (var p in IDQuery)
                {
                    DO[foreach_iter].OrderID = p;
                    foreach_iter++;
                }

                query[table_number] =
                    DO.Select(n => n)
                    .OrderBy(n => n.TimeStamp)
                    .ThenBy(n => n.Name);
            }

            TablePrice1.Content = TablePrice[1];
            TablePrice2.Content = TablePrice[2];
            TablePrice3.Content = TablePrice[3];
            TablePrice4.Content = TablePrice[4];
            TablePrice5.Content = TablePrice[5];
            TablePrice6.Content = TablePrice[6];
            Stolik1.ItemsSource = query[1];
            Stolik2.ItemsSource = query[2];
            Stolik3.ItemsSource = query[3];
            Stolik4.ItemsSource = query[4];
            Stolik5.ItemsSource = query[5];
            Stolik6.ItemsSource = query[6];
        }