Пример #1
0
        private void cbFrom_SelectedIndexChanged(object sender, EventArgs e)
        {
            cbTo.Items.Clear();
            cbTo.Text = "";
            Branch        SelectedBranch = branchDAL.GetBranchByName(cbFrom.SelectedItem.ToString());
            List <Branch> destinations   = new List <Branch>();

            foreach (var trip in tripsDAL.GetAvailableTrips().Where(t => t.SourceId == SelectedBranch.Id))
            {
                destinations.Add(trip.Destination);
            }
            foreach (var item in destinations)
            {
                if (!cbTo.Items.Contains(item.BranchName))
                {
                    cbTo.Items.Add(item.BranchName);
                }
            }
            cbTo.SelectedItem = cbTo.Items[0];
            getTripsTime(new object(), new EventArgs());
        }