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 Delete_Click(object sender, EventArgs e) { int index = All.SelectedIndex; account.Remove(index); All.Items.RemoveAt(index); DataInputAccess.WriteAccountItems(account); }
public Form1() { InitializeComponent(); account = DataInputAccess.ReadAccountItems(); foreach (AccountItem item in account) { All.Items.Add(item); } }