Exemplo n.º 1
0
        private void addSingleMainMealToDataGrid(MainMeal mainMeal)
        {
            SecondMeal secondMeal = new SecondMeal();

            secondMeal.price    = 0;
            secondMeal.mealName = "ohne";
            MealCombination mc = MealCombination.getMealCombination(mainMeal, secondMeal);

            updateTotalPriceTxtBox(mainMeal.price);
            addMealCombosToDataGrid(mc);
        }
Exemplo n.º 2
0
        private void Row_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            DataGridRow row  = sender as DataGridRow;
            MainMeal    meal = row.Item as MainMeal;

            if (meal.insertable)
            {
                mealCombinationEditer mCE = new mealCombinationEditer(meal);
                mCE.ShowDialog();
            }
        }
Exemplo n.º 3
0
 private void deleteMainMeal(DataGrid mealList)
 {
     if (mealList.SelectedItem != null && mealList.SelectedIndex >= 0)
     {
         MainMeal meal = mealList.SelectedItem as MainMeal;
         mainMeals.RemoveAt(mainMeals.FindIndex(x => x.guid == meal.guid));
         CSVHandler.deleteRow(meal);
         CSVHandler.deleteComboRows(meal);
         mainMealList.Items.Refresh();
     }
 }
Exemplo n.º 4
0
        private void btnSafeNewMainMeal_Click(object sender, RoutedEventArgs e)
        {
            MainMeal meal = getMainMealFromTextBox();

            if (meal != null)
            {
                clearAllMainMealTextBoxes();
                addMainMealToDataGrid(meal);
                CSVHandler.addToCSV(meal);
                generateMealCombos(meal);
            }
        }
Exemplo n.º 5
0
        // TODO: Die bestehenden MealCombos werden so immer überschrieben -> Preise weg -.-
        private void generateMealCombos(MainMeal mainMeal)
        {
            List <IMeal>           secondMeals = getSecondMealsFromCSV();
            List <MealCombination> mealCombos  = new List <MealCombination>();
            MealCombination        mealCombo;

            foreach (SecondMeal secondMeal in secondMeals)
            {
                mealCombo = MealCombination.getMealCombination(mainMeal, secondMeal);
                mealCombos.Add(mealCombo);
            }
            CSVHandler.addToCSV(mealCombos);
        }
Exemplo n.º 6
0
 private MainMeal getMainMealFromTextBox()
 {
     try
     {
         MainMeal meal = new MainMeal();
         meal.mealName   = txtBoxMainMeal.Text;
         meal.price      = Convert.ToDecimal(txtBoxMainMealSinglePrice.Text);
         meal.insertable = checkBoxInertable.IsChecked.HasValue ? checkBoxInertable.IsChecked.Value : false;
         return(meal);
     }
     catch (Exception ex)
     {
         ExceptionHandler.Log(ex);
         return(null);
     }
 }
Exemplo n.º 7
0
 private void addMealCombinationsToDataGrid(MainMeal mainMeal)
 {
     mealCombos           = CSVHandler.getMealCombinationsFromCSV(mainMeal);
     dataGrid.ItemsSource = mealCombos;
 }
Exemplo n.º 8
0
 public mealCombinationEditer(MainMeal meal)
 {
     InitializeComponent();
     addMealCombinationsToDataGrid(meal);
     this.meal = meal;
 }
Exemplo n.º 9
0
        public static List <MealCombination> getMealCombinationsFromCSV(MainMeal mainMeal)
        {
            List <MealCombination> combos = readCombos("BonDrucker.MealCombination");

            return(combos.FindAll(x => x.mainMealGUID == mainMeal.guid));
        }
Exemplo n.º 10
0
 public secondMealChooser(MainMeal mainMeal)
 {
     InitializeComponent();
     _mainMeal = mainMeal;
     addButtonsToForm();
 }