Esempio n. 1
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     if (ValidInput())
     {
         if(Entry == null)
             Entry = new FinanceEntry(cmbCategory.SelectedIndex, Convert.ToDouble(txtAmount.Text), txtPlace.Text, txtDescription.Text);
         else
             Entry.Set(cmbCategory.SelectedIndex, Convert.ToDouble(txtAmount.Text), txtPlace.Text, txtDescription.Text);
         DialogResult = DialogResult.OK;
         Dispose();
     }
 }
Esempio n. 2
0
 public static void LoadItem(ListView list, FinanceEntry item)
 {
     var row = new ListViewItem(new[] { "" + item.ID, Categories.Get(item.Category), item.Amount.ToString(Formats.MoneyFormat), item.Place, item.Description });
     list.Items.Add(row);
     list.Items[list.Items.Count - 1].EnsureVisible();
 }
Esempio n. 3
0
 private void tlspCopy_Click(object sender, EventArgs e)
 {
     if (lstItems.SelectedItems.Count > 1)
         MessageBox.Show("You can only copy one item at a time", "Too Many Selected");
     else if (lstItems.SelectedItems.Count < 1)
         MessageBox.Show("You must select and item to copy", "Select Item");
     else
     {
         var row = _listFinances.Find(item => item.ID == Convert.ToInt32(lstItems.SelectedItems[0].SubItems[0].Text));
         var entry = new FinanceEntry(row.Category, row.Amount, row.Place, row.Description);
         _listFinances.Add(entry);
         UIHelper.LoadItem(lstItems, entry);
         _currData[entry.Category] += entry.Amount;
         Recalculate();
     }
 }