コード例 #1
0
        private bool OnNewTransactionBillAdded()
        {
            string   description = descriptionTb.Text;
            DateTime date        = dateDtp.Value.Date;

            if (!grabTotalAmount())
            {
                return(false);
            }

            UpdateSbGroupAmounts();

            decimal splitTotal = 0;

            foreach (var item in _split)
            {
                splitTotal += item.Value;
            }
            if (splitTotal != _totalAmount)
            {
                MessageBox.Show("Split total doesn't match total amount!");
                return(false);
            }

            NewSbTransactionEventArgs args = new NewSbTransactionEventArgs();

            args.AccountName    = accountCb.Text;
            args.NewTransaction = new SoftBillTransaction(description, _totalAmount, date, _split);

            NewTransactionAdded?.Invoke(this, args);

            return(true);
        }
コード例 #2
0
 private void NewSbTransaction_Added(object sender, NewSbTransactionEventArgs e)
 {
     if (e.NewTransaction != null)
     {
         _year.GetAccount(e.AccountName).NewDebitTransaction(e.NewTransaction);
     }
     RefreshPage();
 }