Beispiel #1
0
        private void btnEditItem_Click(object sender, EventArgs e)
        {
            Product item     = GetSelectedProduct();
            Person  selected = GetSelectedPerson();

            if (item != null)
            {
                item = ItemEditor.Edit(item, persons);
                if (item != null)
                {
                    Recalculate();
                    RefreshPersons();
                    RefreshItems();
                    RefreshSummary();
                    SaveData();

                    SelectPerson(selected);
                    SelectProduct(item);
                }
            }
        }
Beispiel #2
0
        private void btnAddItem_Click(object sender, EventArgs e)
        {
            Person  selected = GetSelectedPerson();
            Payment payment  = GetDefaultTransaction(selected);
            Product product  = new Product("New product", 100, payment, new List <Person>());
            Product edited   = ItemEditor.Edit(product, persons);

            if (edited != null)
            {
                Recalculate();
                RefreshItems();
                RefreshPersons();
                RefreshButtons();
                RefreshSummary();
                SaveData();

                SelectPerson(selected);
                SelectProduct(edited);
            }
            else
            {
                product.Transaction = null;
            }
        }