private void Add_Click(object sender, EventArgs e) { string name = TextBoxName.Text; Category category = InputUtility.GetCategory(ComboBoxCategory.Text); double amount = Convert.ToDouble(TextBoxAmount.Text); Currency currency = InputUtility.GetCurrency(ComboBoxCurrency.Text); DateTime occuredTime = OccuredTimePicker.Value; string note = TextBoxNote.Text; if (note == null) { note = "None"; } string content = TextBoxContent.Text; if (content == null) { content = "None"; } AccountItem item = new AccountItem(name, category, amount, currency, occuredTime, content, note); account.AddItem(item); DataInputAccess.WriteAccountItems(account); All.Items.Add(item); }
private void AddButton_Click(object sender, EventArgs e) { if (!File.Exists(Path.Text)) { Account newAccount = new Account(); SaveAccount(newAccount, Path.Text); } Account account = OpenAccount(Path.Text); Category selectedCategory = (Category)Enum.Parse(typeof(Category), categoryBox.SelectedItem.ToString()); MoneyCategory selectedMoneyCategory = (MoneyCategory)Enum.Parse(typeof(MoneyCategory), moneyCategoryBox.SelectedItem.ToString()); Money money = new Money(selectedMoneyCategory, Convert.ToDouble(MoneyInput.Text)); AccountItem item = new AccountItem(NameInput.Text, selectedCategory, money, dateTimePicker1.Value, ContentInput.Text, NoteInput.Text); account.Add(item); SaveAccount(account, Path.Text); }
public void Remove(AccountItem item) { this.accountList.Remove(item); }
public void Add(AccountItem item) { this.accountList.Add(item); }