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 deleteSecondMeal(DataGrid mealList)
 {
     if (mealList.SelectedItem != null && mealList.SelectedIndex >= 0)
     {
         SecondMeal meal = mealList.SelectedItem as SecondMeal;
         secondMeals.RemoveAt(secondMeals.FindIndex(x => x.guid == meal.guid));
         CSVHandler.deleteRow(meal);
         CSVHandler.deleteComboRows(meal);
         secondMealList.Items.Refresh();
     }
 }
Exemplo n.º 3
0
        // ##############################################################
        //                      Second Meal:
        // ##############################################################

        private void btnSafeNewSecondMeal_Click(object sender, RoutedEventArgs e)
        {
            SecondMeal meal = getSecondMealFromTextBox();

            if (meal != null)
            {
                clearAllSecondMealTextBoxes();
                addSecondMealToDataGrid(meal);
                generateMealCombos(meal);
                CSVHandler.addToCSV(meal);
            }
        }
Exemplo n.º 4
0
        private void generateMealCombos(SecondMeal secondMeal)
        {
            List <IMeal>           mainMeals  = getMainMealsFromCSV();
            List <MealCombination> mealCombos = new List <MealCombination>();
            MealCombination        mealCombo;

            foreach (MainMeal mainMeal in mainMeals)
            {
                mealCombo = MealCombination.getMealCombination(mainMeal, secondMeal);
                mealCombos.Add(mealCombo);
            }
            CSVHandler.addToCSV(mealCombos);
        }
Exemplo n.º 5
0
 private SecondMeal getSecondMealFromTextBox()
 {
     try
     {
         SecondMeal meal = new SecondMeal();
         meal.mealName = txtBoxSecondMeal.Text;
         meal.price    = Convert.ToDecimal(txtBoxSecondMealSinglePrice.Text);
         return(meal);
     }
     catch (Exception ex)
     {
         ExceptionHandler.Log(ex);
         return(null);
     }
 }