Exemple #1
0
        /// <summary>get all segments for flight</summary>
        public static List <CrudeFlightSegmentData> GetFlightSegments(System.Guid flightId)
        {
            var dataList = new List <CrudeFlightSegmentData>();

            string sql = @" 
                select 
	                flight_segment_id, flight_id, departure_airport_id, arrival_airport_id, logical_segment_number, physical_segment_number, from_date_time, until_date_time, departure_gate, arrival_gate, user_id, date_time
                from flight_segment	as fs	
                where fs.flight_id = @flight_id
                order by fs.physical_segment_number
            ";

            using (var conn = new SqlConnection(Conn.ConnectionString)) {
                conn.Open();

                using (var command = new SqlCommand(sql, conn)) {
                    command.Parameters.Add("@flight_id", SqlDbType.UniqueIdentifier).Value = flightId;

                    Logging     log    = Logging.PerformanceTimeStart("SolutionNorSolutionPort.DataAccessLayer.Flight.GetFlightSegments");
                    IDataReader reader = command.ExecuteReader(CommandBehavior.SingleResult);
                    log.PerformanceTimeStop(sql, command);

                    while (reader.Read())
                    {
                        var data = new CrudeFlightSegmentData();
                        data.Populate(reader);
                        dataList.Add(data);
                    }
                }

                return(dataList);
            }
        }