Esempio n. 1
0
        private void Add_Click(object sender, RoutedEventArgs e)
        {

            var dish = new Dish();
            dish.refr += (() => { RefreshData(); });
            
            dish.ShowDialog();


        }
Esempio n. 2
0
        private void MenuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem temp = sender as MenuItem;
            IGrouping<BE.Dish, BE.category> dish;
            
            switch (temp.Tag.ToString())
            {
                case "Main":
                    dish = MaindataGrid.SelectedCells[0].Item as IGrouping<BE.Dish, BE.category>;
                    var d = new Dish();
                    

                    d.dishNameTextBox.Text = dish.Key.DishName;
                    d.dishNumberTextBox.Text = dish.Key.DishNumber.ToString();
                    d.dishPriceTextBox.Text = dish.Key.DishPrice.ToString();
                    d.dishCategoryComboBox.Text = dish.Key.DishCategory.ToString();
                    d.kosherLevelComboBox.Text = dish.Key.kosherLevel.ToString();
                    myBl.RemoveDish(myBl.SearchDishById(dish.Key.DishNumber));
                    d.refr += (() => { RefreshData(); });
                    d.ShowDialog();
                    break;
                case "Starters":
                    dish = StartersdataGrid.SelectedCells[0].Item as IGrouping<BE.Dish, BE.category>;
                    var s = new Dish();
                    s.dishNameTextBox.Text = dish.Key.DishName;
                    s.dishNumberTextBox.Text = dish.Key.DishNumber.ToString();
                    s.dishPriceTextBox.Text = dish.Key.DishPrice.ToString();
                    s.dishCategoryComboBox.Text = dish.Key.DishCategory.ToString();
                    s.kosherLevelComboBox.Text = dish.Key.kosherLevel.ToString();
                    myBl.RemoveDish(myBl.SearchDishById(dish.Key.DishNumber));
                    s.refr += (() => { RefreshData(); });
                    s.ShowDialog();
                    break;
                case "Dessers":
                    dish = dessersdataGrid.SelectedCells[0].Item as IGrouping<BE.Dish, BE.category>;
                    var de = new Dish();

                    de.dishNameTextBox.Text = dish.Key.DishName;
                    de.dishNumberTextBox.Text = dish.Key.DishNumber.ToString();
                    de.dishPriceTextBox.Text = dish.Key.DishPrice.ToString();
                    de.dishCategoryComboBox.Text = dish.Key.DishCategory.ToString();
                    de.kosherLevelComboBox.Text = dish.Key.kosherLevel.ToString();
                    myBl.RemoveDish(myBl.SearchDishById(dish.Key.DishNumber));
                    de.refr += (() => { RefreshData(); });
                    de.ShowDialog();
                    break;
                case "Drink":
                    dish = DrinkdataGrid.SelectedCells[0].Item as IGrouping<BE.Dish, BE.category>;
                    var dr = new Dish();
                    dr.dishNameTextBox.Text = dish.Key.DishName;
                    dr.dishNumberTextBox.Text = dish.Key.DishNumber.ToString();
                    dr.dishPriceTextBox.Text = dish.Key.DishPrice.ToString();
                    dr.dishCategoryComboBox.Text = dish.Key.DishCategory.ToString();
                    dr.kosherLevelComboBox.Text = dish.Key.kosherLevel.ToString();
                    myBl.RemoveDish(myBl.SearchDishById(dish.Key.DishNumber));
                    dr.refr += (() => { RefreshData(); });
                    dr.ShowDialog();
                    break;

                default:
                    break;
            }
        }