private void AppBarButton_Click(object sender, RoutedEventArgs e)
        {
            using (DishContext db = new DishContext())
            {
                dishesList.ItemsSource = null;
                dishesList.Items.Clear();
                var  dishes = db.Dishes.ToList();
                Dish dish   = new Dish();
                foreach (Dish d in dishes)
                {
                    string sKey = null;
                    switch (searchKey.SelectedIndex)
                    {
                    case 0:
                        sKey = d.Title;
                        break;

                    case 1:
                        sKey = d.Category;
                        break;

                    case 2:
                        sKey = d.Products;
                        break;
                    }
                    if (sKey != null)
                    {
                        if (sKey.IndexOf(searchPanel.Text) >= 0)
                        {
                            dishesList.Items.Add(d);
                        }
                    }
                }
            }
        }
 private void SearchPage_Loaded(object sender, RoutedEventArgs e)
 {
     using (DishContext db = new DishContext())
     {
         dishesList.ItemsSource = db.Dishes.ToList();
     }
 }
 private void AppBarButton_Click_1(object sender, RoutedEventArgs e)
 {
     using (DishContext db = new DishContext())
     {
         dishesList.ItemsSource = db.Dishes.ToList();
     }
 }
Beispiel #4
0
        /// <summary>
        /// Инициализирует одноэлементный объект приложения.  Это первая выполняемая строка разрабатываемого
        /// кода; поэтому она является логическим эквивалентом main() или WinMain().
        /// </summary>

        public App()
        {
            this.InitializeComponent();
            this.Suspending += OnSuspending;
            using (var db = new DishContext())
            {
                db.Database.Migrate();
            }
        }
Beispiel #5
0
 public void ListPage_Loaded(object sender, RoutedEventArgs e)
 {
     using (DishContext db = new DishContext())
     {
         foreach (Product p in db.Products)
         {
             if (p.Amount > 0)
             {
                 productsBox.Items.Add(p.Title);
             }
         }
         dishesList.ItemsSource = db.Dishes.ToList();
     }
 }
Beispiel #6
0
 public void BuildingPage_Loaded(object sender, RoutedEventArgs e)
 {
     using (DishContext db = new DishContext())
     {
         var dishes = db.Dishes.ToList();
         foreach (Dish d in dishes)
         {
             if (d.Category == "Первое блюдо")
             {
                 dishesList.Items.Add(d);
             }
         }
     }
 }
Beispiel #7
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     dishesList.Items.Clear();
     categories        = CATEGORIES.SECOND_DISH;
     button0.IsChecked = false;
     button1.IsChecked = true;
     button2.IsChecked = false;
     button3.IsChecked = false;
     using (DishContext db = new DishContext())
     {
         var dishes = db.Dishes.ToList();
         foreach (Dish d in dishes)
         {
             if (d.Category == "Второе блюдо")
             {
                 dishesList.Items.Add(d);
             }
         }
     }
 }
        private void SearchPanel_KeyDown(object sender, KeyRoutedEventArgs e)
        {
            if (e.Key == Windows.System.VirtualKey.Enter && searchPanel.Text != null)
            {
                using (DishContext db = new DishContext())
                {
                    dishesList.ItemsSource = null;
                    dishesList.Items.Clear();
                    var  dishes = db.Dishes.ToList();
                    Dish dish   = new Dish();
                    foreach (Dish d in dishes)
                    {
                        string sKey = null;
                        switch (searchKey.SelectedIndex)
                        {
                        case 0:
                            sKey = d.Title;
                            break;

                        case 1:
                            sKey = d.Category;
                            break;

                        case 2:
                            sKey = d.Products;
                            break;
                        }
                        if (sKey != null)
                        {
                            if (sKey.IndexOf(searchPanel.Text) >= 0)
                            {
                                dishesList.Items.Add(d);
                            }
                        }
                    }
                }
            }
        }
Beispiel #9
0
        private void AppBarButton_Tapped(object sender, TappedRoutedEventArgs e)
        {
            dishesList.ItemsSource = null;
            dishesList.Items.Clear();
            string sCategory = null;

            switch (categoryBox.SelectedIndex)
            {
            case 0:
                sCategory = "Первое блюдо";
                break;

            case 1:
                sCategory = "Второе блюдо";
                break;

            case 2:
                sCategory = "Закуска";
                break;

            case 3:
                sCategory = "Десерт";
                break;
            }
            using (DishContext db = new DishContext())
            {
                var dishes = db.Dishes.ToList();
                foreach (Dish d in dishes)
                {
                    string sKey = d.Products;
                    if (sKey.IndexOf(productsBox.SelectedValue.ToString()) >= 0 && d.Category == sCategory)
                    {
                        dishesList.Items.Add(d);
                    }
                }
            }
        }