public IList <FullFlightData> GetAllFlightsFullData() //maybe i can delete this because of SearchFlightsFullData { List <FullFlightData> fullFlightsData = new List <FullFlightData>(); using (SqlConnection con = new SqlConnection(connection_string)) { con.Open(); using (SqlCommand cmd = new SqlCommand("GET_ALL_FLIGHTS_FULL_DATA", con)) { cmd.CommandType = CommandType.StoredProcedure; using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { FullFlightData fullFlightData = new FullFlightData() { ID = (long)reader["ID"], AirlineCompanyName = (string)reader["AIRLINE_NAME"], OriginCountryName = (string)reader["ORIGIN_COUNTRY"], DestinationCountryName = (string)reader["DESTINATION_COUNTRY"], DepartureTime = (DateTime)reader["DEPARTURE_TIME"], LandingTime = (DateTime)reader["LANDING_TIME"], RemainingTickets = (int)reader["REMAINING_TICKETS"], }; fullFlightsData.Add(fullFlightData); } } } } return(fullFlightsData); }
public IList <FullFlightData> SearchFlightsFullData(string sqlQuery) { List <FullFlightData> fullFlightsData = new List <FullFlightData>(); using (SqlConnection con = new SqlConnection(connection_string)) { con.Open(); using (SqlCommand cmd = new SqlCommand(sqlQuery, con)) //sqlQuery is search all flights full data by default { //cmd.CommandType = CommandType.StoredProcedure; using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { FullFlightData fullFlightData = new FullFlightData() { ID = (long)reader["ID"], AirlineCompanyName = (string)reader["AIRLINE_NAME"], OriginCountryName = (string)reader["ORIGIN_COUNTRY"], DestinationCountryName = (string)reader["DESTINATION_COUNTRY"], DepartureTime = (DateTime)reader["DEPARTURE_TIME"], LandingTime = (DateTime)reader["LANDING_TIME"], RemainingTickets = (int)reader["REMAINING_TICKETS"], }; fullFlightsData.Add(fullFlightData); } } } } return(fullFlightsData); }
public override bool Equals(object obj) { FullFlightData other = (FullFlightData)obj; return(this == other); }