//enter new cost private void btnEnterNewCosts_Click(object sender, EventArgs e) { ClsCosts lcCost = ClsCosts.NewCost(cbCostType.SelectedIndex); if (lcCost != null && lcCost.ViewEdit()) { _Costs = lcCost; _Tour.CostList.Add(_Costs); updateDisplay(); } }
//edit an existing cost private void btnEditCosts_Click(object sender, EventArgs e) { ClsCosts lcCost = (ClsCosts)lbCosts.SelectedItem; if (lcCost == null) { MessageBox.Show("There are no Costs to modify. Create one first", "Confirm", MessageBoxButtons.OK); } if (lcCost != null && lcCost.ViewEdit()) { updateDisplay(); } }
//delete a cost private void btnDeleteCosts_Click(object sender, EventArgs e) { ClsCosts _Cost = (ClsCosts)lbCosts.SelectedItem; if (_Cost == null) { MessageBox.Show("There are no Tours to delete. Create one first", "Confirm", MessageBoxButtons.OK); } if (MessageBox.Show("Are you sure?", "confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { _Tour.CostList.Remove(_Cost); } updateDisplay(); }
//update display when form opens public bool ShowDialog(ClsCosts prCost) { _Costs = prCost; updateDisplay(); return(ShowDialog() == DialogResult.OK); }