Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ...
- public ArrayList GetFly(int tip, string country)
- {
- ...
- var list = new ArrayList();
- var reader = command.ExecuteReader();
- if (reader.HasRows)
- {
- ...
- while (reader.Read())
- {
- decimal nr_zbor = reader.GetDecimal(cod_zbor);
- string aeroport = reader.GetString(nume_aeroport);
- string companie = reader.GetString(nume_companie);
- list.Add(nr_zbor);
- list.Add(companie);
- list.Add(aeroport);
- }
- }
- ...
- private SearchFlyClass searchFly = new SearchFlyClass();
- private ArrayList fly = new ArrayList();
- ...
- private void ShowResultFlySearch(int direction, string country)
- {
- fly = searchFly.GetFly(direction, country);
- for (int count = 0; count < fly.Count; count++)
- {
- string zbor = fly[0].ToString();
- string companie = fly[1].ToString();
- string aeroport = fly[2].ToString();
- ListViewItem searchlist = new ListViewItem();
- searchlist.Items.Add(new ListViewItem(elem));
- }
- }
- ListView listView = new ListView();
- listView.View = View.Details;
- listView.Columns.Add("zbor");
- listView.Columns.Add("airport");
- listView.Columns.Add("company");
- private void ShowResultFlySearch(int direction, string country)
- {
- fly = searchFly.GetFly(direction, country);
- for (int count = 0; count < fly.Count; count++)
- {
- string zbor = fly[0].ToString();
- string companie = fly[1].ToString();
- string aeroport = fly[2].ToString();
- ListViewItem listViewItem = new ListViewItem(zbor);
- listViewItem.SubItems.Add(airport);
- listViewItem.SubItems.Add(companie);
- listView.Items.Add (listViewItem);
- }
- }
- public class Flight
- {
- public decimal Code { get; set; }
- public string Company { get; set; }
- public string Airport { get; set; }
- }
- public Flight GetFlight(int tip, string country)
- var flight = new Flight();
- flight.Code = reader.GetDecimal(cod_zbor);
- flight.Airport = reader.GetString(nume_aeroport);
- flight.Company = reader.GetString(nume_companie);
- return flight;
- var flight = searchFly.GetFlight(...);
- // access flight properties here
Add Comment
Please, Sign In to add comment