Exemplo n.º 1
0
        private void btnAddAirportRoute_Click(object sender, EventArgs e)//__________________________________Add____________________________________
        {
            if (isValid.isAirportRouteValid(cbAirportRoute.SelectedIndex))
            {
                string s = cbAirportRoute.Text;
                if (airportRoutesDataLink.Exists(s.Substring(0, s.IndexOf("-") - 1), s.Substring(s.IndexOf("-") + 2)))
                {
                    MessageBox.Show("Данный маршрут уже выбран");
                }
                else
                {
                    AirportRoute airportRoute = new AirportRoute()
                    {
                        Start  = s.Substring(0, s.IndexOf("-") - 1),
                        Finish = s.Substring(s.IndexOf("-") + 2)
                    };

                    airportRoutesDataLink.Add(airportRoute);

                    fillAirportRouteTable();
                }
                cbAirportRoute.SelectedIndex = -1;
            }
        }