예제 #1
0
 private void NewAnnualHardBill_Added(object sender, NewHardBillAddedEventArgs e)
 {
     if (e.NewHardBill != null)
     {
         _year.AddHardBill(e.NewHardBill);
     }
     RefreshPage();
 }
예제 #2
0
        private void saveBtn_Click(object sender, EventArgs e)
        {
            NewHardBillAddedEventArgs args = new NewHardBillAddedEventArgs();

            string   name         = nameTb.Text;
            DateTime firstBillDue = firstBillDueDtp.Value.Date;

            decimal amount;

            if (!decimal.TryParse(amountTb.Text, out amount))
            {
                amountTb.Text = _hardBill.Amount.ToString();
                MessageBox.Show("Invalid amount!");
                return;
            }

            HardBillFrequencyEnum frequency;

            Enum.TryParse(frequencyCb.SelectedItem.ToString(), out frequency);

            string accountName = accountCb.Text;
            bool   autoPay     = autoPayCb.Checked;

            if (_hardBill == null)
            {
                args.NewHardBill = new HardBill(name, amount, firstBillDue, frequency, _year.GetAccount(accountName), autoPay);
            }
            else
            {
                _hardBill.Amount         = amount;
                _hardBill.Frequency      = frequency;
                _hardBill.PaymentAccount = _year.GetAccount(accountName);
                _hardBill.AutoPay        = autoPay;
                args.NewHardBill         = null;
            }
            OnNewHardBillAdded(args);

            this.Close();
        }
예제 #3
0
 protected virtual void OnNewHardBillAdded(NewHardBillAddedEventArgs e)
 {
     NewHardBillAdded?.Invoke(this, e);
 }