private void hardBillsLv_MouseUp(object sender, MouseEventArgs e) { int index = -1; IHardBill hardBill = null; if (e.Button == MouseButtons.Right) { if (hardBillsLv.Items.Count > 0) { ListViewItem selectedItem = hardBillsLv.GetItemAt(e.X, e.Y); if (selectedItem != null) { index = selectedItem.Index; hardBill = _year.GetHardBill(selectedItem.SubItems[0].Text); } } if ((hardBill != null) && (!hardBill.AutoPay)) { hbPay.Enabled = true; //purchasesEdit.Enabled = true; } else { hbPay.Enabled = false; //purchasesEdit.Enabled = false; } hbCms.Show(this, new Point(e.X + ((Control)sender).Left + 20, e.Y + ((Control)sender).Top + 20)); //accountCms.Show(this, new Point(e.X, e.Y)); } }
public EditHardBillPay(IHardBill hb) { InitializeComponent(); if (hb == null) { throw new ArgumentException("Must select valid hardbill!"); } _hb = hb; paymentDateDtp.Value = _hb.NextBillDue; amountTb.Text = _hb.Amount.ToString(); }
public EditHardBillForm(IHardBill hardBill, YearTop year) { InitializeComponent(); if (year == null) { throw new ArgumentException("Year has not been initialized yet."); } else { _year = year; } frequencyCb.Items.AddRange(Enum.GetNames(typeof(HardBillFrequencyEnum))); var accountList = _year.GetAccountsNames(); foreach (var account in accountList) { accountCb.Items.Add(account); } if (hardBill != null) { _hardBill = hardBill; nameTb.Text = _hardBill.Name; nameTb.ReadOnly = true; firstBillDueDtp.Value = _hardBill.FirstBillDue; firstBillDueDtp.Enabled = false; //editable amountTb.Text = _hardBill.Amount.ToString(); frequencyCb.SelectedItem = _hardBill.Frequency.ToString(); accountCb.SelectedItem = _hardBill.PaymentAccount.Name; autoPayCb.Checked = _hardBill.AutoPay; } else { _hardBill = null; } }
public void AddHardBill(IHardBill hb) { //error checking _hardBills.Add(hb.Name, hb); }