Esempio n. 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string       fromCity    = txtBoxAddFromCity.Text;
            string       toCity      = txtBoxAddToCity.Text;
            string       date        = dateTimePickerManage.Text;
            string       time        = textBoxTimeManage.Text;
            string       price       = textBoxPrice.Text;
            var          Ntypeplanes = lbJourneyPlane.SelectedItems;
            List <Plane> planes      = new List <Plane>();

            foreach (Plane plane in Ntypeplanes)
            {
                planes.Add((Plane)plane);
            }
            JourneysManager.AddJourney(fromCity, toCity, date, time, price, planes);
            txtBoxAddFromCity.Text    = "";
            txtBoxAddToCity.Text      = "";
            dateTimePickerManage.Text = "";
            textBoxTimeManage.Text    = "";
            textBoxPrice.Text         = "";

            comboBoxFromCity.Items.Add(fromCity);
            comboBoxToCity.Items.Add(toCity);
            comboBoxDateTime.Items.Add(date);
            lbJourneyPlane.DataSource = null;
        }