Exemplo n.º 1
0
        private void updatePlane_btn_Click(object sender, EventArgs e)
        {
            String planeModel  = "";
            String capacityStr = newCapacityValue_textBox.Text;

            if (!String.IsNullOrEmpty(capacityStr))
            {
                planeModel = planesModels_comboBox.SelectedItem.ToString();
                int flightId    = Int32.Parse(selFlightId_textbox.Text);
                int newCapacity = Int32.Parse(capacityStr);
                int filledSeats = Int32.Parse(filledSeatsValue_textBox.Text);

                //updates in database/flights table
                if (newCapacity > filledSeats)
                {
                    FormDatabaseHelper.updatePlaneInFlightsTable(flightId, planeModel, newCapacity);

                    DataTable     newEditTable = FormDatabaseHelper.updateAccountGridViewTable();
                    BindingSource SBind        = new BindingSource();
                    SBind.DataSource = newEditTable;
                    flightsTableColumnSetup();
                    marketing_datagrid.DataSource = SBind;
                    marketing_datagrid.Refresh();

                    //update in the data grid view
                    //marketing_datagrid.SelectedRows[0].Cells[6].Value = planeModel;
                    //marketing_datagrid.SelectedRows[0].Cells[5].Value = newCapacity;
                }
                else
                {
                    Console.WriteLine("Select a plane with higher capacity than current");
                }
            }
        }
Exemplo n.º 2
0
        private void updateTable()
        {
            DataTable     newEditTable = new DataTable();
            BindingSource SBind        = new BindingSource();

            bool location = false, date = false;

            location = origin_dest_checkbox.Checked;
            date     = date_checkbox.Checked;

            bool multiPassTableSort = false;

            if (location && date)
            {
                multiPassTableSort = true;
            }

            if (location && !multiPassTableSort)
            {
                string origin      = origin_combobox.Text;
                string destination = dest_combobox.Text;

                if (origin_combobox.SelectedItem != null && dest_combobox.SelectedItem != null)
                {
                    newEditTable = FormDatabaseHelper.updateAccountGridViewTable(origin, destination);
                }
                else if (origin_combobox.SelectedItem != null && dest_combobox.SelectedItem == null)
                {
                    newEditTable = FormDatabaseHelper.updateAccountGridViewTable(origin, null);
                }
                else if (origin_combobox.SelectedItem == null && dest_combobox.SelectedItem != null)
                {
                    newEditTable = FormDatabaseHelper.updateAccountGridViewTable(null, destination);
                }
                else
                {
                    newEditTable = FormDatabaseHelper.updateAccountGridViewTable(null, null);
                }
            }
            else if (date && !multiPassTableSort)
            {
                DateTime before = beforeDate_DTP.Value.Date;
                DateTime after  = afterDate_DTP.Value.Date;

                if (date_after_checkbox.Checked && date_before_checkbox.Checked)
                {
                    newEditTable = FormDatabaseHelper.updateGridViewTableWithDate(true, true, before, after);
                }
                else if (!date_after_checkbox.Checked && date_before_checkbox.Checked)
                {
                    newEditTable = FormDatabaseHelper.updateGridViewTableWithDate(true, false, before);
                }
                else if (date_after_checkbox.Checked && !date_before_checkbox.Checked)
                {
                    newEditTable = FormDatabaseHelper.updateGridViewTableWithDate(false, true, default, after);
Exemplo n.º 3
0
        public MarketingLandingPage()
        {
            InitializeComponent();

            DataTable     newEditTable = FormDatabaseHelper.updateAccountGridViewTable();
            BindingSource SBind        = new BindingSource();

            SBind.DataSource = newEditTable;
            flightsTableColumnSetup();
            marketing_datagrid.DataSource = SBind;
            marketing_datagrid.Refresh();

            FormDatabaseHelper.FillPlaneModelsBox(planesModels_comboBox);
            FormDatabaseHelper.fillAirportsAbv(origin_combobox);
            FormDatabaseHelper.fillAirportsAbv(dest_combobox);
        }
Exemplo n.º 4
0
        public FlightManLandingPage()
        {
            InitializeComponent();

            DataTable     newEditTable = FormDatabaseHelper.updateAccountGridViewTable();
            BindingSource SBind        = new BindingSource();

            SBind.DataSource = newEditTable;
            flightsTableColumnSetup();
            flights_dataview.DataSource = SBind;
            flights_dataview.Refresh();

            FormDatabaseHelper.fillAirportsAbv(origin_combobox);
            FormDatabaseHelper.fillAirportsAbv(dest_combobox);

            flight_search_groupbox.Show();
            manifest_groupbox.Hide();
        }