//========== Usecase Delete a Tour================// private void btnDelete_Click(object sender, EventArgs e) { { clsTour lcTour = (clsTour)lstTour.SelectedItem; ClsTourCompany.TourList.Remove(lcTour.ID.ToString()); if (lcTour != null && MessageBox.Show("This Tour will be permanantly deleted, would you like to continue?", "Delete Tour", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { updateDisplay(); } } }
//========================Edit a tour===========================// private void EditTour() { clsTour lcTour = (clsTour)lstTour.SelectedItem; if (lcTour != null && lcTour.ViewEdit()) { updateDisplay(); } }
//============ Add a Tour - Tutorial 2 ==================// private void btnAdd_Click(object sender, EventArgs e) { clsTour lcTour = new clsTour(); if (lcTour != null && lcTour.ViewEdit()) { ClsTourCompany.TourList.Add(lcTour.ID, lcTour); updateDisplay(); } }
public bool ShowDialog(clsTour prTour) { _Tour = prTour; _TempTour.CostList.Clear();//make sure empty foreach (clsCost cost in _Tour.CostList) { _TempTour.CostList.Add(cost); } updateDisplay(); return(ShowDialog() == DialogResult.OK); }
//Cost Per kilometre from overriden Inputammount X Distance in ClsTour public override decimal amount(clsTour prTour) { return(InputAmmount * prTour.Distance); }