private void Ok_Click(object sender, RoutedEventArgs e)
        {
            int inputAmount;

            try
            {
                inputAmount = Convert.ToInt32(InputAmount.Text);
            }
            catch (Exception ex)
            {
                Buchhaltung.Log(ex.Message);
                Buchhaltung.SaveErrorMsg(ex);
                inputAmount = -1;
            }

            if (inputAmount > -1 && InputId.Text.Length > 0)
            {
                SaveEntry();
                Close();
            }
            else if (inputAmount != -1)
            {
                MessageBox.Show("Nicht alle Felder wurden korrekt ausgefüllt!");
            }
        }
        private void SaveEntry()
        {
            try
            {
                foreach (Product p in Buchhaltung.Products)
                {
                    if (p.Id != Convert.ToInt32(InputId.Text))
                    {
                        continue;
                    }
                    Entry e;
                    if (InputAmountOnTheHouse.Text == "")
                    {
                        _actualAmount = Convert.ToInt32(InputAmount.Text);
                        e             = new Entry(p, _actualAmount, 0, _priceInUse);
                    }
                    else
                    {
                        _actualAmount = Convert.ToInt32(p.Amount * Convert.ToInt32(InputAmount.Text) + Convert.ToInt32(InputAmountOnTheHouse.Text));
                        e             = new Entry(p, _actualAmount, Convert.ToInt32(InputAmountOnTheHouse.Text), _priceInUse);
                    }
                    //Adds at the currentWeek and the current Day the entry
                    Buchhaltung.CurrWeek.GetCurrentDayAndAddEntry(e);
                    break;
                }
            }
            catch (Exception e)
            {
                Buchhaltung.Log(e.Message);
                Buchhaltung.SaveErrorMsg(e);
            }

            Buchhaltung.SaveEntrys();
        }
        //Updates toBank value currDay
        private void okBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (ToBankInput.Text != "")
                {
                    string toBank = ToBankInput.Text;

                    if (toBank.Contains("€"))
                    {
                        toBank = toBank.Replace("€", "");
                    }

                    Buchhaltung.CurrWeek.GetCurrentDay().AddBank(Convert.ToDouble(toBank));

                    Close();
                }
                else
                {
                    Buchhaltung.Log("Felder sind leer!");
                }
            }
            catch (Exception ex)
            {
                Buchhaltung.Log(ex.Message);
                Buchhaltung.SaveErrorMsg(ex);
            }
        }
        private void CalcPrice()
        {
            if (InputId.Text.Length <= 0 || InputAmount.Text.Length <= 0)
            {
                return;
            }

            PriceOutput.Text = "Preis: ";
            try
            {
                foreach (Product p in Buchhaltung.Products)
                {
                    if (Convert.ToInt32(InputId.Text) == p.Id)
                    {
                        PriceOutput.Text += "   " + (p.Price * Convert.ToInt32(InputAmount.Text)) + "€";
                        _priceInUse       = p.Price * Convert.ToDouble(InputAmount.Text);
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Buchhaltung.Log(e.Message);
                Buchhaltung.SaveErrorMsg(e);
            }
        }
        private void SearchForProduct()
        {
            if (InputId.Text.Length <= 0)
            {
                return;
            }

            ProductOutput.Text = "Produkt:";
            try
            {
                foreach (Product p in Buchhaltung.Products)
                {
                    if (p.Id == Convert.ToInt32(InputId.Text))
                    {
                        ProductOutput.Text += "       " + p.Name;
                        break;
                    }
                }
            }
            catch (Exception e)
            {
                Buchhaltung.Log(e.Message);
                Buchhaltung.SaveErrorMsg(e);
            }
        }
Exemple #6
0
 //Calls delete function
 private void Delete_Click(object sender, RoutedEventArgs e)
 {
     if (Buchhaltung.ShowYesNoMessageBox("Bist du sicher das du diesen Eintrag löschen willst?", "Löschen"))
     {
         DeleteCurrEntry();
     }
 }
Exemple #7
0
        private void SearchFunc(object sender, TextChangedEventArgs e)
        {
            try
            {
                ProductTable.Items.Filter = o =>
                {
                    if (SearchBox.Text == "")
                    {
                        return(true);
                    }
                    using (Product p = o as Product)
                    {
                        if (p != null && p.Id.ToString() == SearchBox.Text.Trim()
                            | (SearchBox.Text.ToLower().Contains((p.Name).ToLower()))
                            | (SearchBox.Text.ToLower().Contains(Convert.ToString(p.Price, CultureInfo.CurrentCulture).ToLower()))
                            | (SearchBox.Text.ToLower().Contains(Convert.ToString(p.Tax).ToLower()))
                            | (p.Name.ToLower().Contains(SearchBox.Text.ToLower()))
                            | (Convert.ToString(p.Price, CultureInfo.CurrentCulture).ToLower().Contains(SearchBox.Text.ToLower()))
                            | (Convert.ToString(p.Tax).ToLower().Contains(SearchBox.Text.ToLower()))
                            | (Convert.ToString(p.KindOfAmount).ToLower().Contains(SearchBox.Text.ToLower())))
                        {
                            return(true);
                        }
                    }

                    return(false);
                };
            }
            catch (Exception ex)
            {
                Buchhaltung.Log(ex.Message + ex.StackTrace);
            }
        }
        private void SaveEntry()
        {
            try
            {
                foreach (Product p in Buchhaltung.products)
                {
                    if (p.ID != Convert.ToInt32(inputID.Text))
                    {
                        continue;
                    }
                    Entry e;
                    if (inputAmountOnTheHouse.Text == "")
                    {
                        // Convert.ToInt32(p.Amount *     Falls Probleme auftreten wieder probieren
                        actualAmount = Convert.ToInt32(inputAmount.Text);
                        e            = new Entry(p, actualAmount, 0, priceInUse);
                    }
                    else
                    {
                        actualAmount = Convert.ToInt32(p.Amount * Convert.ToInt32(inputAmount.Text) + Convert.ToInt32(inputAmountOnTheHouse.Text));
                        e            = new Entry(p, actualAmount, Convert.ToInt32(inputAmountOnTheHouse.Text), priceInUse);
                    }
                    //Adds at the currentWeek and the current Day the entry
                    Buchhaltung.currWeek.GetCurrentDayAndAddEntry(e);
                    break;
                }
            }
            catch (Exception e)
            {
                Buchhaltung.Log(e.Message);
                Buchhaltung.SaveErrorMsg(e);
            }

            Buchhaltung.SaveEntrys();
        }
 private void StartProgramm()
 {
     try
     {
         if (Convert.ToInt32(weekNrTextBox.Text) > 0 && Convert.ToInt32(weekNrTextBox.Text) < 56)
         {
             if (!File.Exists(@"Data\" + weekNrTextBox.Text + @".week"))
             {
                 MessageBox.Show("Die Woche wurde nicht gefunden! Es wird eine neue erstellt.");
                 using (StreamWriter writer = new StreamWriter(@"Data\" + weekNrTextBox.Text + @".week"))
                 {
                     writer.Write("[monday]\n[tuesday]\n[wednesday]\n[thursday]\n[saturday]\n[sunday]\n[end]");
                 }
             }
             Buchhaltung b = new Buchhaltung(weekNrTextBox.Text);
             b.Show();
             this.Close();
         }
         else
         {
             Buchhaltung.Log("Ungültige Woche");
         }
     }
     catch (Exception e)
     {
         Buchhaltung.Log(e.Message);
         Buchhaltung.SaveErrorMsg(e);
     }
 }
Exemple #10
0
        /// <summary>
        /// Deletes CurrEntry in Table and Data
        /// </summary>
        private void DeleteCurrEntry()
        {
            GetCurrEntry();

            if (IdInput.Text != "" && AmountInput.Text != "" && OnTheHouseInput.Text != "" && NumInput.Text != "")
            {
                bool suc = false; //to stop the loop
                foreach (Day d in Buchhaltung.CurrWeek.DaysInWeek)
                {
                    if (d.Name == Buchhaltung.CurrDay)
                    {
                        for (int i = 0; i < d.Entrys.Count; i++)
                        {
                            //compares the original entry with the entrys in the mainProgramm
                            if (_originalEntry.ProductForEntry.Id == (d.Entrys[i].ProductForEntry.Id) &&
                                _originalEntry.Amount == (d.Entrys[i].Amount))
                            {
                                d.Entrys.RemoveAt(i);
                                suc = true;
                                break;
                            }
                        }
                    }

                    if (suc)
                    {
                        break;
                    }
                }

                Buchhaltung.SaveEntrys();
                Close();
            }
        }
Exemple #11
0
 //Starts the programm with the data needed
 private void StartProgramm()
 {
     try
     {
         if (Convert.ToInt32(WeekNrTextBox.Text) > 0 && Convert.ToInt32(WeekNrTextBox.Text) < 56) //Week in year
         {
             if (File.Exists(@"Data\" + WeekNrTextBox.Text + @".week"))                           //Week does exist
             {
                 Buchhaltung b = new Buchhaltung(WeekNrTextBox.Text);
                 b.Show();
             }
             else
             {
                 string oldCashDeskStr = OldCashDesk.Text;
                 if (oldCashDeskStr.Contains("€"))
                 {
                     oldCashDeskStr = oldCashDeskStr.Replace('€', ' ');
                 }
                 Buchhaltung b = new Buchhaltung(WeekNrTextBox.Text, NameInput.Text, Convert.ToDateTime(DateTextBox.Text), Convert.ToDouble(oldCashDeskStr));
                 MessageBox.Show("Die Woche wurde nicht gefunden! Es wird eine neue erstellt.");
                 b.Show();
             }
             Close();
         }
         else
         {
             Buchhaltung.Log("Ungültige Woche");
         }
     }
     catch (Exception e)
     {
         Buchhaltung.Log(e.Message);
         Buchhaltung.SaveErrorMsg(e);
     }
 }
Exemple #12
0
        //Saves the product to Buchhaltung
        public void SaveProduct()
        {
            bool doIt = false;

            try
            {
                string tax = TaxOfProduct.Text, price = PriceOfProduct.Text;
                if (tax.Contains("%"))
                {
                    tax = tax.Replace("%", "");
                }
                if (price.Contains("€"))
                {
                    price = price.Replace("€", "");
                }

                tax   = tax.Trim();
                price = price.Trim();

                double dTax = Convert.ToDouble(tax);

                if (dTax > 0 && dTax < 101)
                {
                    doIt = true;
                }

                //adds the product
                if (Buchhaltung.Products.Max() != null && doIt)
                {
                    Product p = new Product(NameOfTheProdukt.Text, Convert.ToDouble(price), Convert.ToInt32(tax), Convert.ToDouble(AmountOfProduct.Text), KindOfAmount.Text, Buchhaltung.Products.Max().Id);
                    Buchhaltung.Products.Add(p);
                }
                else if (doIt)
                {
                    Product p = new Product(NameOfTheProdukt.Text, Convert.ToDouble(price), Convert.ToInt32(tax), Convert.ToDouble(AmountOfProduct.Text), KindOfAmount.Text, 0);
                    Buchhaltung.Products.Add(p);
                }

                if (doIt)
                {
                    Buchhaltung.SaveProducts();
                    Close();
                }
                else
                {
                    Buchhaltung.Log("Prozente überschritten!");
                }
            }
            catch (Exception e)
            {
                Buchhaltung.Log(e.Message);
                Buchhaltung.SaveErrorMsg(e);
            }
        }
 private void okBtn_Click(object sender, RoutedEventArgs e)
 {
     if (NameTextBox.Text != "" && (WeekNrTextBox.Text != "" && Convert.ToInt32(WeekNrTextBox.Text) > 0 && Convert.ToInt32(WeekNrTextBox.Text) < 53) && DateTextBox.Text != "" &&
         OldCashTextBox.Text != "")
     {
         UpdateWeek();
         Close();
     }
     else
     {
         Buchhaltung.Log("Fehlerhafte Eingabe!");
     }
 }
Exemple #14
0
 public OutputOfProducts()
 {
     try
     {
         InitializeComponent();
         LoadDataInWpfWindow();
     }
     catch (Exception e)
     {
         Buchhaltung.Log(e.Message);
         Buchhaltung.SaveErrorMsg(e);
     }
     Topmost = true;
 }
        private void InputPrice_keyDown(object sender, KeyEventArgs e)
        {
            try
            {
                string t     = InputAmount.Text;
                double dummy = Convert.ToDouble(t);

                CalcPrice();
            }
            catch (Exception ex)
            {
                Buchhaltung.SaveErrorMsg(ex);
            }
        }
        private void OnTextInput_ID(object sender, KeyEventArgs e)
        {
            string input = InputId.Text;

            try
            {
                int dummy = Convert.ToInt32(input);
                SearchForProduct();
            }
            catch (Exception ex)
            {
                Buchhaltung.SaveErrorMsg(ex);
            }
        }
Exemple #17
0
        /// <summary>
        /// Edits data In Table and Data
        /// </summary>
        private void EditDataAndSave()
        {
            if (IdInput.Text != "" && AmountInput.Text != "" && OnTheHouseInput.Text != "" && NumInput.Text != "")
            {
                bool stopIt = false; //to stop the loop
                try
                {
                    foreach (Day dummy in Buchhaltung.CurrWeek.DaysInWeek)
                    {
                        foreach (Product t in Buchhaltung.Products)
                        {
                            if (IdInput.Text == Convert.ToString(t.Id)) //Checks the id of the product
                            {
                                //Gives the newEntry the correct information
                                Product pNew = t;
                                _newEntry.ProductForEntry  = pNew;
                                _newEntry.Amount           = Convert.ToInt32(AmountInput.Text);
                                _newEntry.AmountOnTheHouse = Convert.ToInt32(OnTheHouseInput.Text);
                                _newEntry.Price            = _originalEntry.Amount * _originalEntry.ProductForEntry.Price;
                                stopIt = true;
                                break;
                            }
                        }

                        if (stopIt) //stopsLoop
                        {
                            break;
                        }
                    }

                    OverridesEntryInMainProgramm();
                    Buchhaltung.SaveEntrys();
                    Close();
                }
                catch (Exception e)
                {
                    Buchhaltung.Log(e.Message);
                    Buchhaltung.SaveErrorMsg(e);
                }
            }
            else
            {
                Buchhaltung.Log("Es wurden Felder leer gelassen!");
            }
        }
Exemple #18
0
 /// <summary>
 /// For a new Entry to add it to the correct Day
 /// </summary>
 /// <param name="e"></param>
 public void GetCurrentDayAndAddEntry(Entry e)
 {
     try
     {
         foreach (Day d in DaysInWeek)
         {
             if (d.Name == Buchhaltung.CurrDay)
             {
                 d.AddEntry(e);
                 break;
             }
         }
     }
     catch (Exception x)
     {
         Buchhaltung.SaveErrorMsg(x);
     }
 }
Exemple #19
0
        public NewProduct()
        {
            InitializeComponent();
            try
            {
                IdOfProduct.Text += Buchhaltung.Products[Buchhaltung.Products.Count - 1].Id + 1;
            }
            catch (Exception e)
            {
                Buchhaltung.Log(e.Message);
                Buchhaltung.SaveErrorMsg(e);
            }

            LoadProducts();
            LoadTaxDropDown();
            LoadChangeOfAmount();
            Topmost = true;
        }
Exemple #20
0
 //Displays all Entrys in this week (DBG)
 public void ShowDays()
 {
     try
     {
         foreach (Day d in DaysInWeek)
         {
             MessageBox.Show(d.Name.ToString());
             foreach (Entry t in d.Entrys)
             {
                 MessageBox.Show("Name: " + t.ProductForEntry.Name + "; Menge: " + t.Amount + "; Preis: " + t.Price);
             }
         }
     }
     catch (Exception e)
     {
         Buchhaltung.SaveErrorMsg(e);
     }
 }
Exemple #21
0
 private void LoadChangeOfAmount()
 {
     try
     {
         for (int i = 0; i < _allProductsSplitted.GetLength(0) - 1; i++)
         {
             if (!KindOfAmoutDropDown.Items.Contains(_allProductsSplitted[i, 5]))
             {
                 KindOfAmoutDropDown.Items.Add(_allProductsSplitted[i, 5]);
             }
         }
     }
     catch (Exception e)
     {
         Buchhaltung.Log(e.Message);
         Buchhaltung.SaveErrorMsg(e);
     }
 }
Exemple #22
0
 private void LoadTaxDropDown()
 {
     try
     {
         for (int i = 0; i < _allProductsSplitted.GetLength(0) - 1; i++)
         {
             if (!TaxDropDown.Items.Contains(_allProductsSplitted[i, 3] + "%"))
             {
                 TaxDropDown.Items.Add(_allProductsSplitted[i, 3] + "%");
             }
         }
     }
     catch (Exception e)
     {
         Buchhaltung.Log(e.Message);
         Buchhaltung.SaveErrorMsg(e);
     }
 }
 //edits the data
 private void EditDataAndSave()
 {
     if (id_input.Text != "" && amount_input.Text != "" && onTheHouse_input.Text != "" && num_input.Text != "")
     {
         bool stopIt = false; //to stop the loop
         try
         {
             foreach (Day d in Buchhaltung.currWeek.DaysInWeek)
             {
                 Product pNew;
                 for (int i = 0; i < Buchhaltung.products.Count; i++)
                 {
                     if (id_input.Text == Convert.ToString(Buchhaltung.products[i].ID)) //Checks the id of the product
                     {
                         //Gives the newEntry the correct information
                         pNew = Buchhaltung.products[i]; //generates new Product for the entry
                         _newEntry.ProductForEntry  = pNew;
                         _newEntry.Amount           = Convert.ToInt32(amount_input.Text);
                         _newEntry.AmountOnTheHouse = Convert.ToInt32(onTheHouse_input.Text);
                         _newEntry.Price            = _originalEntry.Amount * _originalEntry.ProductForEntry.Price; //schon verhaut
                         stopIt = true;
                         break;
                     }
                 }
                 if (stopIt) //stopsLoop
                 {
                     break;
                 }
             }
             OverridesEntryInMainProgramm();
             Buchhaltung.SaveEntrys();
             this.Close();
         }
         catch (Exception e)
         {
             Buchhaltung.Log(e.Message);
             Buchhaltung.SaveErrorMsg(e);
         }
     }
     else
     {
         Buchhaltung.Log("Es wurden Felder leer gelassen");
     }
 }
        /// <summary>
        /// Saves All Data into BackUp path
        /// </summary>
        /// <param name="path"></param>
        private void MakeBackUp(string path)
        {
            try
            {
                for (int i = 0; i < 53; i++)
                {
                    //gets the whole week and saves it
                    if (File.Exists(@"Data\" + i + @".week"))
                    {
                        string text;
                        using (StreamReader reader = new StreamReader(@"Data\" + i + @".week")) //reads the file
                        {
                            text = reader.ReadToEnd();
                        }

                        using (StreamWriter writer = new StreamWriter(path + @"\" + i + @".week", append: false)) //saves the file
                        {
                            writer.Write(text);
                        }
                    }
                }

                //gets the products and saves them
                string textPr;
                using (StreamReader reader = new StreamReader(@"Data\products.p")) //reads the file
                {
                    textPr = reader.ReadToEnd();
                }

                using (StreamWriter writer = new StreamWriter(path + @"\products.p", append: false)) //saves the file
                {
                    writer.Write(textPr);
                }

                MessageBox.Show("BackUp erfolgreich erstellt!");
                Close();
            }
            catch (Exception ex)
            {
                Buchhaltung.Log(ex.Message);
                Buchhaltung.SaveErrorMsg(ex);
            }
        }
 private void SearchFunc(object sender, TextChangedEventArgs e)
 {
     try
     {
         ProductTable.Items.Clear();
         if (SearchBox.Text.Trim() != "")
         {
             //items
             foreach (Product p in Buchhaltung.products.FindAll(p => (p.ID.ToString() == SearchBox.Text.Trim())
                                                                | (SearchBox.Text.ToLower()
                                                                   .Contains((p.Name).ToLower()))
                                                                | (SearchBox.Text.ToLower()
                                                                   .Contains(Convert.ToString(p.Price)
                                                                             .ToLower()))
                                                                | (SearchBox.Text.ToLower()
                                                                   .Contains(Convert.ToString(p.Tax)
                                                                             .ToLower()))
                                                                | (p.Name.ToLower()
                                                                   .Contains(SearchBox.Text.ToLower()))
                                                                | (Convert.ToString(p.Price).ToLower()
                                                                   .Contains(SearchBox.Text.ToLower()))
                                                                | (Convert.ToString(p.Tax).ToLower()
                                                                   .Contains(SearchBox.Text.ToLower()))
                                                                | (Convert.ToString(p.KindOfAmount)
                                                                   .ToLower().Contains(
                                                                       SearchBox.Text.ToLower()))
                                                                )
                      )
             {
                 var data = p;
                 ProductTable.Items.Add(data);
             }
         }
         else
         {
             LoadDataInWpfWindow();
         }
     }
     catch (Exception ex)
     {
         Buchhaltung.Log(ex.Message + ex.StackTrace);
     }
 }
        /// <summary>
        /// Checks if OnTheHouse is ok
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void InputOnTheHouse_keyDown(object sender, KeyEventArgs e)
        {
            try
            {
                double dummy;

                string t = InputAmountOnTheHouse.Text;
                if (t.Length > 0)
                {
                    dummy = Convert.ToDouble(t);
                }

                _onTheHouseIsOk = true;
            }
            catch (Exception ex)
            {
                _onTheHouseIsOk = false;
                Buchhaltung.SaveErrorMsg(ex);
            }
        }
        /// <summary>
        /// Update Data
        /// </summary>
        private void UpdateWeek()
        {
            try
            {
                string oldCashDeskStr = (OldCashTextBox.Text);

                if (oldCashDeskStr.Contains("€"))
                {
                    oldCashDeskStr = oldCashDeskStr.Replace("€", "");
                }

                Buchhaltung.CurrWeek.WeekNr        = WeekNrTextBox.Text;
                Buchhaltung.CurrWeek.EditName      = NameTextBox.Text;
                Buchhaltung.CurrWeek.LastChashDesk = Convert.ToDouble(oldCashDeskStr);
                Buchhaltung.CurrWeek.ExactTime     = Convert.ToDateTime(DateTextBox.Text);
            }
            catch (Exception ex)
            {
                Buchhaltung.Log(ex.Message);
                Buchhaltung.SaveErrorMsg(ex);
            }
        }
        //Changes the OutputFields when the num textBox is changed and gets the correct entry
        private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            bool suc = false;

            try
            {
                foreach (DataBoxForGrid d in Buchhaltung.Db)
                {
                    if (NumInput.Text == Convert.ToString(d.C))
                    {
                        IdInput.Text         = Convert.ToString(d.Id);
                        OutputName.Text      = d.Name;
                        AmountInput.Text     = Convert.ToString(d.Amount);
                        OnTheHouseInput.Text = Convert.ToString(d.OnTheHouse);
                        suc = true;
                        break;
                    }
                    else
                    {
                        IdInput.Text         = "";
                        OutputName.Text      = "";
                        AmountInput.Text     = "";
                        OnTheHouseInput.Text = "";
                    }
                }
                GetCurrEntry();

                if (!suc)
                {
                    _originalEntry = null;
                    _newEntry      = null;
                }
            }
            catch (Exception ex)
            {
                Buchhaltung.SaveErrorMsg(ex);
            }
        }
        private static double GetSales()
        {
            try
            {
                double sales = 0;
                foreach (Day d in Buchhaltung.CurrWeek.DaysInWeek)
                {
                    foreach (Entry e in d.Entrys)
                    {
                        sales += e.Price;
                    }
                }

                return(sales);
            }
            catch (Exception ex)
            {
                Buchhaltung.Log(ex.Message);
                Buchhaltung.SaveErrorMsg(ex);
            }

            return(0); //error
        }
Exemple #30
0
        //Saves the product to Buchhaltung
        public void SaveProduct()
        {
            try
            {
                string tax = TaxOfProduct.Text, price = PriceOfProduct.Text;
                if (tax.Contains("%"))
                {
                    tax = tax.Replace("%", "");
                }
                if (price.Contains("€"))
                {
                    price = price.Replace("€", "");
                }

                tax   = tax.Trim();
                price = price.Trim();
                //adds the product
                if (Buchhaltung.products.Max() != null)
                {
                    Product p = new Product(NameOfTheProdukt.Text, Convert.ToDouble(price), Convert.ToInt32(tax), Convert.ToDouble(AmountOfProduct.Text), KindOfAmount.Text, Buchhaltung.products.Max().ID);
                    Buchhaltung.products.Add(p);
                }
                else
                {
                    Product p = new Product(NameOfTheProdukt.Text, Convert.ToDouble(price), Convert.ToInt32(tax), Convert.ToDouble(AmountOfProduct.Text), KindOfAmount.Text, 0);
                    Buchhaltung.products.Add(p);
                }
                Buchhaltung.SaveProducts();
                MessageBox.Show("Erfolgreich gespeichert!");
                this.Close();
            }
            catch (Exception e)
            {
                Buchhaltung.Log(e.Message);
                Buchhaltung.SaveErrorMsg(e);
            }
        }