private void addButtonsToForm()
        {
            List <MealCombination> mealCombos = CSVHandler.getMealCombinationsFromCSV(_mainMeal);

            grid.Children.Clear();
            int index = 0;

            foreach (MealCombination combo in mealCombos)
            {
                Button newBtn = new Button();
                grid.ColumnDefinitions.Add(new ColumnDefinition());
                newBtn.Content   = combo.secondMealName;
                newBtn.Name      = "secondMealButton";
                newBtn.Tag       = combo;
                newBtn.IsEnabled = !CSVHandler.isSecondMealDeactivated(combo.secondMealGUID);
                newBtn.Margin    = new Thickness(5, 0, 5, 0);
                newBtn.FontSize  = 18;
                newBtn.MinHeight = 200;
                newBtn.Click    += new RoutedEventHandler(secondMealButton_click);

                Grid.SetColumn(newBtn, index);
                index++;
                grid.Children.Add(newBtn);
            }
        }
Beispiel #2
0
 private void btnSave_Click(object sender, RoutedEventArgs e)
 {
     foreach (MealCombination combo in mealCombos)
     {
         CSVHandler.updateCSV(combo);
     }
     this.Close();
 }
        private void addStatisticToForm()
        {
            List <Statistic> statistic = CSVHandler.readStatistic();

            addLastOrdersToDataGrid(statistic);
            addCountedMealCombosToDataGrid(statistic);
            addCountedMealsToDataGrid(statistic);
        }
 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();
     }
 }
Beispiel #5
0
 private void bntPrint_Click(object sender, RoutedEventArgs e)
 {
     if (_mealCombos.Count > 0)
     {
         CSVHandler.addToStatistic(_mealCombos);
         PrintingHandler.Print(_mealCombos);
         Calculator c = new Calculator(_totalPrice);
         c.Owner = this;
         c.ShowDialog();
         resetForm();
     }
 }
        private void btnSafeNewMainMeal_Click(object sender, RoutedEventArgs e)
        {
            MainMeal meal = getMainMealFromTextBox();

            if (meal != null)
            {
                clearAllMainMealTextBoxes();
                addMainMealToDataGrid(meal);
                CSVHandler.addToCSV(meal);
                generateMealCombos(meal);
            }
        }
        // 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);
        }
Beispiel #8
0
 static private List <IMeal> getSecondMealsFromCSV()
 {
     return(CSVHandler.readMeals("BonDrucker.SecondMeal"));
 }
Beispiel #9
0
 private void addMealCombinationsToDataGrid(MainMeal mainMeal)
 {
     mealCombos           = CSVHandler.getMealCombinationsFromCSV(mainMeal);
     dataGrid.ItemsSource = mealCombos;
 }
Beispiel #10
0
 private List <IMeal> getMainMealsFromCSV()
 {
     return(CSVHandler.readMeals("BonDrucker.MainMeal"));
 }
 private void changeMeal(IMeal meal)
 {
     CSVHandler.updateCSV(meal);
 }