Beispiel #1
0
        private void btnRemoveCost_Click(object sender, EventArgs e)
        {
            if (lstCosts.SelectedIndex > -1) //something is selected
            {
                ClsCost      _Cost   = (ClsCost)lstCosts.SelectedItem;
                string       message = "Are you sure you would like to delete cost " + _Cost.Type;
                string       caption = "Deleting cost";
                DialogResult result  = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                // if the yes button is pressed
                if (result == DialogResult.Yes)
                {
                    _Tour.CostList.Remove(_Cost);
                    // ClsTour.CostList.Remove(_Cost);
                    updateCostDisplay();
                    UpdatelblShowTotalCosts();
                }
                else
                {
                }
            }
            else
            {
                MessageBox.Show("You have no tours to delete");
            }
        }
Beispiel #2
0
        private void editCost()
        {
            ClsCost _Cost = (ClsCost)lstCosts.SelectedItem;

            _Cost.ViewEdit();
            updateDisplay();
        }
Beispiel #3
0
        private void btnAddCost_Click(object sender, EventArgs e)
        {
            ClsCost _Cost = ClsCost.NewCost(cboTypeOfCost.SelectedIndex, _Tour);

            if (_Cost.ViewEdit())
            {
                pushData();
                _Tour.CostList.Add(_Cost);
                updateCostDisplay();
                UpdatelblShowTotalCosts();
            }
        }
Beispiel #4
0
        private void btnEditCost_Click(object sender, EventArgs e)
        {
            ClsCost _Cost = (ClsCost)lstCosts.SelectedItem;

            if (_Cost == null)
            {
                MessageBox.Show("You must create a cost before you can modify a cost");
            }
            else
            {
                editCost();
            }
            updateCostDisplay();
            UpdatelblShowTotalCosts();
        }
Beispiel #5
0
 public bool ShowDialog(ClsCost prCost)
 {
     _Cost = prCost;
     updateDisplay();
     return(ShowDialog() == DialogResult.OK);
 }