Ejemplo n.º 1
0
        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cmbAirlineActions.SelectedIndex == 1)//select
            {
                dgvAirline.Enabled = false;
            }
            else if (cmbAirlineActions.SelectedIndex == 2)//delete
            {
                dgvAirline.Enabled = true;
            }
            else if (cmbAirlineActions.SelectedIndex == 3)//update
            {
                dgvAirline.Enabled = true;
            }
            else if (cmbAirlineActions.SelectedIndex == 0)//nothing
            {
                dgvAirline.Enabled = false;
            }
            else if (cmbAirlineActions.SelectedIndex == 4)//insert
            {
                dgvAirline.Enabled = false;

                Controller.Country cCountry  = new Controller.Country();
                DataTable          dtCountry = cCountry.select();

                cmbTo.DisplayMember = "Name";
                cmbTo.ValueMember   = "id";
                cmbTo.DataSource    = dtCountry;
            }
        }
Ejemplo n.º 2
0
        //loads all the countries
        private void refreshCountry()
        {
            try
            {
                dgvCountry.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

                Controller.Country cCountry  = new Controller.Country();
                DataTable          dtCountry = cCountry.select();
                dgvCountry.Rows.Clear();

                foreach (DataRow row in dtCountry.Rows)
                {
                    dgvCountry.Rows.Add(row["id"], row["name"], row["flag"]);
                }

                cmbCountries.DisplayMember = "Name";
                cmbCountries.ValueMember   = "id";
                cmbCountries.DataSource    = dtCountry;

                cmbPlaceByPCountry.DisplayMember = "Name";
                cmbPlaceByPCountry.ValueMember   = "id";
                cmbPlaceByPCountry.DataSource    = dtCountry;

                cmbFrom.DisplayMember = "Name";
                cmbFrom.ValueMember   = "id";
                cmbFrom.DataSource    = dtCountry;
            }
            catch
            {
            }
        }
Ejemplo n.º 3
0
 //does an action of the country tab
 private void doCountry()
 {
     Model.Country      mCountry = new Model.Country();
     Controller.Country cCountry = new Controller.Country();
     if (cmbCountryAction.SelectedIndex == 0)
     {
         MessageBox.Show("Please, choose an action!");
     }
     else if (cmbCountryAction.SelectedIndex == 1) //select
     {
         refreshCountry();
     }
     else if (cmbCountryAction.SelectedIndex == 2) //delete
     {
         mCountry.Id = Convert.ToInt32(cmbCountries.SelectedValue.ToString());
         cCountry    = new Controller.Country(mCountry);
         cCountry.delete();
         refreshCountry();
     }
     else if (cmbCountryAction.SelectedIndex == 3)
     {
         cmbCountries.Enabled = true;
         gbNewCountry.Visible = true;
         txtCountryId.Text    = cmbCountries.SelectedValue.ToString();
         gbNewCountry.Visible = true;
     }
     else if (cmbCountryAction.SelectedIndex == 4)
     {
         cmbCountries.Enabled = false;
         gbNewCountry.Visible = true;
         txtCountryId.Text    = "0";
         gbNewCountry.Visible = true;
     }
 }
Ejemplo n.º 4
0
 //saves a country
 private void saveCountry()
 {
     try
     {
         Model.Country      mCountry = new Model.Country();
         Controller.Country cCountry = new Controller.Country();
         mCountry.Id   = Convert.ToInt32(txtCountryId.Text.ToString());
         mCountry.Name = txtCountryName.Text;
         mCountry.Flag = this.flag;
         cCountry      = new Controller.Country(mCountry);
         cCountry.insert();
         refreshCountry();
     }
     catch
     {
         MessageBox.Show("Please, try again!");
     }
 }