Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        private void Delete_Click(object sender, EventArgs e)
        {
            int index = All.SelectedIndex;

            account.Remove(index);
            All.Items.RemoveAt(index);
            DataInputAccess.WriteAccountItems(account);
        }
Ejemplo n.º 3
0
 public Form1()
 {
     InitializeComponent();
     account = DataInputAccess.ReadAccountItems();
     foreach (AccountItem item in account)
     {
         All.Items.Add(item);
     }
 }