Exemplo n.º 1
0
 public ExpenseViewData(Expense expense)
 {
     Wrapped = expense;
 }
        private void saveExpenseButton_Click(object sender, RoutedEventArgs e)
        {
            var expense = new Expense()
            {
                Category = (ExpenseCategory)categoriesListView.SelectedItem,
                Description = descriptionTextBox.Text,
            };
            decimal value;
            expense.Value = decimal.TryParse(valueTextBox.Text, out value) ? value : 0;
            DateTime date;
            expense.Date = DateTime.TryParse(expenseDatePicker.Text, out date) ? date : DateTime.Now;

            expenseDao.Save(expense);

            if (addExpensePopUp.IsOpen)
                addExpensePopUp.IsOpen = false;
        }