public DialogResult ShowDialog(ClsCost prCost) { _Cost = prCost; updateDisplay(); return(ShowDialog()); }
private void EditTourCostDetails() { ClsCost lcCost = (ClsCost)listViewTourCost.FocusedItem.Tag; if (lcCost != null && lcCost.ViewEdit()) { UpdateCostListDisplayAndCostTotal(); CalculatePricePerPassenger(); } }
private void btnAddTourCost_Click(object sender, EventArgs e) { var TourData = getTourDataForCostAmountCalculation(); ClsCost lcTourCost = ClsCost.NewCost(comboBoxCostType.SelectedIndex, TourData); if (lcTourCost != null && lcTourCost.ViewEdit()) { _Tour.TourCostList.Add(lcTourCost.ID, lcTourCost); UpdateCostListDisplayAndCostTotal(); CalculatePricePerPassenger(); } }
private void btnDeleteTourCost_Click(object sender, EventArgs e) { ClsCost lcCost = (ClsCost)listViewTourCost.FocusedItem.Tag; if (lcCost != null) { DialogResult result = MessageBox.Show("Are you sure to Delete ?", "Alert", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { _Tour.TourCostList.Remove(lcCost.ID); UpdateCostListDisplayAndCostTotal(); CalculatePricePerPassenger(); } } }
private void UpdateCostListDisplayAndCostTotal() { decimal TotalCost = 0; listViewTourCost.Items.Clear(); List <ClsCost> tourCostDetails = _Tour.TourCostList.Values.ToList <ClsCost>(); foreach (var ClsCost in tourCostDetails) { ListViewItem cost = new ListViewItem(); cost.Text = ClsCost.Name; cost.SubItems.Add(ClsCost.typeOfCost()); cost.SubItems.Add("$" + ClsCost.Cost.ToString()); cost.Tag = ClsCost; listViewTourCost.Items.Add(cost); TotalCost += ClsCost.Cost; } lblTotalCost.Text = Convert.ToString(TotalCost); }