Beispiel #1
0
        /// <summary>
        /// This method calls when user click on button btnAddExp and user adds a new Expenditure.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddExp_Click(object sender, EventArgs e)
        {
            ExpenditureForm expenditureForm = new ExpenditureForm();

            if (expenditureForm.ShowDialog() == DialogResult.OK)
            {
                Expenditure expenditure = expenditureForm.ExpenditureData;
                expenditureManager.Add(expenditure);
                UpdateGui();
            }
        }
Beispiel #2
0
        /// <summary>
        /// This method calls when user click on button btnEditExp and user edits the selected Expenditure object.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEditExp_Click(object sender, EventArgs e)
        {
            int index = lbExp.SelectedIndex;

            if (index != -1)
            {
                Expenditure     expenditure     = expenditureManager.GetExpenditureAt(index);
                ExpenditureForm expenditureForm = new ExpenditureForm();

                expenditureForm.ExpenditureData = expenditure;
                if (expenditureForm.ShowDialog() == DialogResult.OK)
                {
                    expenditure = expenditureForm.ExpenditureData;
                    expenditureManager.Edit(index, expenditure);
                    UpdateGui();
                }
            }
        }