/// <summary> /// This method calls when user click on button btnAddIncome and user adds a new Income. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddIncome_Click(object sender, EventArgs e) { IncomeForm frmIncome = new IncomeForm(); if (frmIncome.ShowDialog() == DialogResult.OK) { Income newIncome = frmIncome.IncomeData; System.Diagnostics.Debug.WriteLine(newIncome.Description); incomeManager.Add(newIncome); UpdateGui(); } }
/// <summary> /// This method calls when user click on button btnEditIncome and user edits the selected income object. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnEditIncome_Click(object sender, EventArgs e) { int index = lbIncome.SelectedIndex; if (index != -1) { Income newIncome = incomeManager.GetIncomeAt(index); System.Diagnostics.Debug.WriteLine(newIncome.Description); IncomeForm frmIncome = new IncomeForm(); frmIncome.IncomeData = newIncome; if (frmIncome.ShowDialog() == DialogResult.OK) { newIncome = frmIncome.IncomeData; incomeManager.Edit(index, newIncome); UpdateGui(); } } }