private void addAirportsToComboBox(int CityID) { AirPortList apl = AirPortList.GetRefAirportListByCity(CityID); AirPort apinfo = new AirPort(); apinfo.AirPortID = 0; apinfo.AirPortName = "Виберіть аеропорт..."; apl.Insert(0, apinfo); airportComboBox.DataSource = null; airportComboBox.DataSource = apl; airportComboBox.DisplayMember = "AirPortName"; airportComboBox.ValueMember = "AirPortID"; }
private void citycomboBox_SelectedValueChanged(object sender, EventArgs e) { if (_loaded == true) { int _selectedCity = (int)citycomboBox.SelectedValue; AirPortList _airportList = AirPortList.GetRefAirportListByCity(_selectedCity); //airportcomboBox.DataSource = null; airportcomboBox.DisplayMember = "AirportName"; airportcomboBox.ValueMember = "AirportID"; airportcomboBox.DataSource = _airportList; } }
private void RefreshItems() { myAirPortList = AirPortList.GetDefaultAirPortList(); airPortListDataGridView.DataSource = null; airPortListDataGridView.DataSource = myAirPortList; if (myAirPortList.Count == 0) { EditButton.Visible = false; deleteButton.Visible = false; } else if (myAirPortList.Count > 0) { EditButton.Visible = true; deleteButton.Visible = true; if (Config.HasUserAccess("GetAirport")) { EditButton.Visible = true; } else { EditButton.Visible = false; } if (Config.HasUserAccess("DeleteAirport")) { deleteButton.Visible = true; } else { deleteButton.Visible = false; } } if (Config.HasUserAccess("InsertAirport")) { addButton.Visible = true; } else { addButton.Visible = false; } }
private void EditFlightForm_Load(object sender, EventArgs e) { //для всіх PlaneList _PlaneList = PlaneList.GetRefPlanesList(); planecomboBox.DataSource = _PlaneList; planecomboBox.DisplayMember = "PlaneNumber"; planecomboBox.ValueMember = "PlaneID"; AircompaniesList _AircompaniesList = AircompaniesList.GetRefAircompaniesList(); aircompanycomboBox.DataSource = _AircompaniesList; aircompanycomboBox.DisplayMember = "AirCompanyName"; aircompanycomboBox.ValueMember = "AirCompanyID"; if (act == Action.Insert) { //для вставки CountriesList _countriesList = CountriesList.GetRefCountriesList(); countrycomboBox.DataSource = _countriesList; countrycomboBox.DisplayMember = "CountryName"; countrycomboBox.ValueMember = "CountryID"; int _selectedCountry = (int)countrycomboBox.SelectedValue; CitiesList _citiesList = CitiesList.GetCitiesListByCountry(_selectedCountry); citycomboBox.DataSource = _citiesList; citycomboBox.DisplayMember = "CityName"; citycomboBox.ValueMember = "CityID"; int _selectedCity = (int)citycomboBox.SelectedValue; AirPortList _airportList = AirPortList.GetRefAirportListByCity(_selectedCity); airportcomboBox.DataSource = _airportList; airportcomboBox.DisplayMember = "AirportName"; airportcomboBox.ValueMember = "AirportID"; flightTypecomboBox.SelectedIndex = 0; _loaded = true; } if (act == Action.Update) { //для оновлення try { aircompanycomboBox.SelectedValue = Flight.FlightAircompanyID; planecomboBox.SelectedValue = Flight.FlightPlaneID; AirPort _apinfo = new AirPort(); _apinfo.GetAirport(Flight.FlightAirPortID); City _City = new City(); _City.GetCity(_apinfo.AirPortCityID); CountriesList _countriesList = CountriesList.GetRefCountriesList(); countrycomboBox.DataSource = _countriesList; countrycomboBox.DisplayMember = "CountryName"; countrycomboBox.ValueMember = "CountryID"; countrycomboBox.SelectedValue = _City.CountryID; CitiesList _citiesList = CitiesList.GetCitiesListByCountry(_City.CountryID); citycomboBox.DataSource = _citiesList; citycomboBox.DisplayMember = "CityName"; citycomboBox.ValueMember = "CityID"; citycomboBox.SelectedValue = _apinfo.AirPortCityID; AirPortList _airportList = AirPortList.GetRefAirportListByCity(_apinfo.AirPortCityID); airportcomboBox.DataSource = _airportList; airportcomboBox.DisplayMember = "AirportName"; airportcomboBox.ValueMember = "AirportID"; airportcomboBox.SelectedValue = _apinfo.AirPortID; if (Flight.FlightType == "Вхідний") { flightTypecomboBox.SelectedIndex = 0; } else if (Flight.FlightType == "Вихідний") { flightTypecomboBox.SelectedIndex = 1; } startdateTimePicker.Value = Flight.FlightDateTimeStart; DateTime _tempDuration = Convert.ToDateTime("1900-01-01 " + Flight.FlightDuration); economnumericUpDown.Value = Flight.FlightPriceEconom; businessnumericUpDown.Value = Flight.FlightPriceBusiness; firstnumericUpDown.Value = Flight.FlightPriceFirst; numOfFlishgslabel.Visible = false; periodicitylabel.Visible = false; numOfFlightsnumericUpDown.Visible = false; periodicitydateTimePicker.Visible = false; if (Config.HasUserAccess("UpdateFlight")) { okButton.Visible = true; } else { okButton.Visible = false; } _loaded = true; } catch (Exception) { _error = true; } } }