Exemple #1
0
        //validate the items, and save them to their files
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            string[] records = { NameBox.Text, AddressBox.Text, TaxNumberBox.Text, AccountNumberBox.Text };
            if (!Validator.ValidateTextArray(records))
            {
                MessageBox.Show("Hibás adatok!", "Hiba", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            InfoHandler.ownCompany.Name          = NameBox.Text;
            InfoHandler.ownCompany.Address       = AddressBox.Text;
            InfoHandler.ownCompany.TaxNumber     = TaxNumberBox.Text;
            InfoHandler.ownCompany.AccountNumber = AccountNumberBox.Text;
            if (Validator.ValidateTaxRate(TaxToAddBox.Text) && !InfoHandler.taxRate.TaxRates.Contains(TaxToAddBox.Text))
            {
                InfoHandler.taxRate.TaxRates.Add(TaxToAddBox.Text);
            }
            if (Validator.ValidateTaxRate(TaxToDelete.Text))
            {
                InfoHandler.taxRate.TaxRates.Remove(TaxToDelete.Text);
            }

            InfoHandler.SaveDatas();
            loadDatas();
            MessageBox.Show("Sikeres mentés", "Mentve", MessageBoxButton.OK);
        }