Esempio n. 1
0
        private void del_submit_button_Click(object sender, EventArgs e)
        {
            int id = int.Parse(del_flightidvalue_label.Text);

            FormDatabaseHelper.removeFlightFromRoutes(id);

            string        origin      = del_destination_combobox.Text;
            string        destination = del_destination_combobox.Text;
            DataTable     newEditTable;
            BindingSource SBind = new BindingSource();

            if ((del_origin_combobox.SelectedItem != null) && (del_destination_combobox.SelectedItem != null))
            {
                newEditTable = FormDatabaseHelper.updateEditGridViewTable(origin, destination);
            }
            else if ((del_origin_combobox.SelectedItem != null) && (del_destination_combobox.SelectedItem == null))
            {
                newEditTable = FormDatabaseHelper.updateEditGridViewTable(origin, null);
            }
            else if ((del_origin_combobox.SelectedItem == null) && (del_destination_combobox.SelectedItem != null))
            {
                newEditTable = FormDatabaseHelper.updateEditGridViewTable(null, destination);
            }
            else
            {
                newEditTable = FormDatabaseHelper.updateEditGridViewTable(null, null);
            }

            SBind.DataSource = newEditTable;
            del_flights_datagridview.Columns.Clear();
            deleteTableColumnSetup();
            del_flights_datagridview.DataSource = SBind;
            del_flights_datagridview.Refresh();
        }