public Flight GetFlight(int id) { Flight flight = null; OracleParameter result_par = new OracleParameter("result_out", OracleDbType.RefCursor); OpenConnection(); using (OracleCommand oracleCommand = new OracleCommand("programmer.GetFlightByID", Connection)) { oracleCommand.CommandType = System.Data.CommandType.StoredProcedure; oracleCommand.Parameters.Add("id_in", id); oracleCommand.Parameters.Add(result_par).Direction = System.Data.ParameterDirection.Output; OracleDataReader dt = oracleCommand.ExecuteReader(); while (dt.Read()) { flight = new Flight { FlightID = int.Parse(dt[0].ToString()), Schedule = scheduleDAL.GetSchedule(int.Parse(dt[1].ToString())), Route = routeDAL.GetRoute(int.Parse(dt[2].ToString())), SeatClass = seatClassDAL.GetClass(int.Parse(dt[3].ToString()), dt[4].ToString()), Fare = int.Parse(dt[5].ToString()) }; } dt.Close(); } return(flight); }
public Seat GetSeat(string class_in, int airplane_in) { Seat seat = null; OracleParameter result_par = new OracleParameter("result_out", OracleDbType.RefCursor); OpenConnection(); using (OracleCommand oracleCommand = new OracleCommand("programmer.GetSeatByClassAndAirplane", Connection)) { oracleCommand.CommandType = System.Data.CommandType.StoredProcedure; oracleCommand.Parameters.Add("class_in", class_in); oracleCommand.Parameters.Add("airplane_in", airplane_in); oracleCommand.Parameters.Add(result_par).Direction = System.Data.ParameterDirection.Output; OracleDataReader dt = oracleCommand.ExecuteReader(); while (dt.Read()) { seat = new Seat { SeatID = int.Parse(dt[0].ToString()), SeatNo = dt[1].ToString(), Availability = dt[2].ToString(), SeatClass = seatClassDAL.GetClass(int.Parse(dt[3].ToString()), dt[4].ToString()) }; } dt.Close(); } return(seat); }