public static DataTransferObject.Order.FlightView GetOrderFlightView(DataTransferObject.FlightQuery.FlightView flightView) { return(new DataTransferObject.Order.FlightView { SerialNo = flightView.Serial, Airline = flightView.AirlineCode, FlightNo = flightView.FlightNo, Departure = flightView.Departure.Code, Arrival = flightView.Arrival.Code, AirCraft = flightView.Aircraft, TakeoffTime = flightView.Departure.Time, LandingTime = flightView.Arrival.Time, YBPrice = flightView.YBPrice, Bunk = flightView.BunkCode, Fare = flightView.Fare, Type = flightView.BunkType == null ? BunkType.Economic : flightView.BunkType.Value, IsShare = flightView.IsShare, ArrivalTerminal = flightView.Arrival.Terminal, DepartureTerminal = flightView.Departure.Terminal }); }
private static DataTransferObject.FlightQuery.FlightView GetFlightView(Segment flightView, PassengerType passengerType) { var airline = Service.FoundationService.QueryAirline(flightView.AirlineCode); if (airline == null) { throw new CustomException("暂不支持航空公司 " + flightView.AirlineCode); } var basicPrice = Service.FoundationService.QueryBasicPrice(airline.Code.Value, flightView.AirportPair.Departure, flightView.AirportPair.Arrival, flightView.Date); if (basicPrice == null) { throw new CustomException("系统中无运价信息"); } var bafView = Service.FoundationService.QueryBAF(airline.Code.Value, basicPrice.Mileage); var result = new DataTransferObject.FlightQuery.FlightView { AirlineCode = airline.Code.Value, AirlineName = airline.ShortName, FlightNo = flightView.InternalNo, Aircraft = flightView.AircraftType, Departure = getAirportView(flightView.AirportPair.Departure, flightView.TerminalOfDeparture, flightView.Date, flightView.DepartureTime), Arrival = getAirportView(flightView.AirportPair.Arrival, flightView.TerminalOfArrival, flightView.Date, flightView.ArrivalTime), YBPrice = basicPrice.Price, AirportFee = Service.FoundationService.QueryAirportFee(flightView.AircraftType, passengerType), BAF = passengerType == PassengerType.Adult ? bafView.Adult : bafView.Child, AdultBAF = bafView.Adult, ChildBAF = bafView.Child, BunkCode = flightView.CabinSeat, SeatCount = flightView.SeatCount, IsShare = flightView.IsShared }; result.Arrival.Time = result.Arrival.Time.AddDays(flightView.AddDays); return(result); }