Пример #1
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            if (lbTransactions.SelectedItem != null)
            {
                EditTransaction editTransactionWindow = new EditTransaction(SelectedTransaction, Categories);
                if (editTransactionWindow.ShowDialog() ?? false)
                {
                    Categories.Refresh();
                    lblBalance.Content = _transactionList.Balance.ToString("C");

                    string connectionString = "Data Source=.; Integrated Security=True; Initial Catalog=Checkbook";
                    TransactionList.SaveTransaction(connectionString, SelectedTransaction);
                }
            }
        }
Пример #2
0
        private void editButton_Click(object sender, RoutedEventArgs e)
        {
            int i = transactionListBox.SelectedIndex;

            if (i < 0)
            {
                i = 0;
            }
            Transaction     t          = _transactionList[i];
            EditTransaction editWindow = new EditTransaction(t, _categoryList);

            Nullable <bool> dialogResult = editWindow.ShowDialog();

            if (dialogResult == true)
            {
                transactionListBox.ItemsSource = null;
                transactionListBox.ItemsSource = _transactionList;
            }
        }